Пример #1
0
        static void Main(string[] args)
        {
            var data = new SqlServerDataStore("git", "localhost", "1433", "sa", "QWEqwe123")
            {
                //Logger = Console.WriteLine,
                //SingletonSession = true,
            };
            var gitClient = new CommandLineGitClient("D:/src/git/.git")
            {
                //Branch = "development",
                //ExtendedLog = true,
            };
            var vcsData = new VcsDataCached(gitClient, 1000, 1000);
            var mapper  = ConstructDataMapper(data, vcsData, new VcsDataMapper.MappingSettings()
            {
                RevisionLimit = 6000,
                CheckMode     = VcsDataMapper.CheckMode.TOUCHED,
            });

            using (ConsoleTimeLogger.Start("time"))
            {
                mapper.MapRevisions();
                //mapper.Truncate(1000);
                //mapper.Check(2309, DataMapper.CheckMode.ALL);
                //mapper.CheckAndTruncate("/test-delta.c");

                //GetLog(vcsData);
                //BlameDiff(vcsData);
                //FileHistory(data, vcsData, "/Documentation/merge-pull-opts.txt");
                //Select(data);
            }

            Console.ReadKey();
        }
Пример #2
0
        public virtual void Setup()
        {
            // run the testsetupscript...
            this.ConnectionString = ConfigurationManager.ConnectionStrings["WorkmateDatabase"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            {
                connection.Open(); // this will throw an exception if we can't connect
            }

            string path = Path.Combine(this.ApplicationPath, @"DataAccess\SqlProvider\SetupScript.sql");
            string sql  = File.ReadAllText(path);

            using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            {
                connection.Open(); // this will throw an exception if we can't connect

                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandText = sql;
                    command.CommandType = System.Data.CommandType.Text;

                    command.ExecuteNonQuery();
                }
            }

            _SqlServerDataStore   = new SqlServerDataStore(this.ConnectionString);
            this.DummyDataManager = new DummyDataManager(Path.Combine(this.ApplicationPath, @"DataAccess\DummyData.xml"));

            this.DefaultUpdateTestIterations = 10;
            this.Random = new Random();

            ApplicationSettings applicationSettings = new ApplicationSettings(
                ConfigurationManager.AppSettings
                , ConfigurationManager.ConnectionStrings);

            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            MembershipSection configSection           = (MembershipSection)config.GetSection("system.web/membership");

            IMembershipSettings membershipSettings = new MembershipSettings(
                (NameValueCollection)configSection.Providers[configSection.DefaultProvider].Parameters);

            InstanceContainer.Initialize(_SqlServerDataStore, applicationSettings, membershipSettings);

            Workmate.Components.ApplicationManager applicationManger = new Workmate.Components.ApplicationManager(this.DataStore);
            this.Application = applicationManger.GetApplication("debug_test_setup");
            if (this.Application == null)
            {
                this.Application = new Workmate.Components.Entities.Application("debug_test_setup", "Auto generated at " + DateTime.UtcNow.ToString() + " (UTC)");

                var report = applicationManger.Create(this.Application);
                if (report.Status != DataRepositoryActionStatus.Success)
                {
                    throw new ApplicationException("Unable to create debug test setup");
                }
            }
        }
Пример #3
0
        private SqlServerDataStore GetTestStore()
        {
            var store = new SqlServerDataStore(GetInfo());

            if (!store.StoreExists)
            {
                store.CreateStore();
            }
            else
            {
                store.EnsureCompatibility();
            }

            return(store);
        }
Пример #4
0
        public void TransactionTest()
        {
            var connection = new SqlConnectionInfo();

            connection.DatabaseName = "TEST";
            connection.ServerName   = "test.opennetcf.com";
            connection.ServerPort   = 1433;
            connection.UserName     = "******";
            connection.Password     = "******";

            var store = new SqlServerDataStore(connection);

            try
            {
                store.AddType <PublishedTenantBuildingState>();
                store.AddType <PublishedTenantApartmentState>();

                var b = new PublishedTenantBuildingState()
                {
                    PublishID     = Guid.NewGuid(),
                    RecordDateUtc = DateTime.Now.ToUniversalTime()
                };
                var a1 = new PublishedTenantApartmentState()
                {
                    PublishID = Guid.NewGuid(),
                    PublishedBuildingStateID = b.PublishID,
                    SpaceTemperature         = 1
                };
                var a2 = new PublishedTenantApartmentState()
                {
                    PublishID = Guid.NewGuid(),
                    PublishedBuildingStateID = b.PublishID,
                    SpaceTemperature         = 2
                };


                store.BeginTransaction();
                store.Insert(b);
                store.Insert(a1);
                store.Insert(a2);
                store.Commit();
            }
            catch (Exception ex)
            {
            }
        }
Пример #5
0
        public void GuidPKTest()
        {
            var store = new SqlServerDataStore(GetInfo());

            store.AddType <GuidItem>();

            var item = new GuidItem();

            store.Insert(item);


            var results = store.Select <GuidItem>().ToArray();

            results[0].FieldA = 42;
            store.Update(results[0]);
            results = store.Select <GuidItem>().ToArray();
        }
Пример #6
0
        public void BaseClassTest()
        {
            var connection = new SqlConnectionInfo();

            connection.DatabaseName = "TEST";
            connection.ServerName   = "test.opennetcf.com";
            connection.ServerPort   = 1433;
            connection.UserName     = "******";
            connection.Password     = "******";

            var store = new SqlServerDataStore(connection);

            try
            {
                store.AddType <PublishedTenantBuildingState>();
                store.AddType <PublishedTenantApartmentState>();
            }
            catch (Exception ex)
            {
            }
        }
Пример #7
0
        public void TestCreateStore()
        {
            var store = new SqlServerDataStore(GetInfo());

            store.CreateStore();
        }