Ejemplo n.º 1
0
 private static void ResetSchema(TransactionContextCreator contextCreator)
 {
     try
     {
         using (var ctx = contextCreator.Create())
         {
             FeatureManager.DropSchema(ctx);
             ctx.Complete();
         }
     }
     catch (Exception _)
     {
     }
     try
     {
         using (var ctx = contextCreator.Create())
         {
             FeatureManager.CreateSchema(ctx);
             ctx.Complete();
         }
     }
     catch (Exception _)
     {
     }
 }
Ejemplo n.º 2
0
        public static void Replicate()
        {
            try
            {
                var contextCreator = new TransactionContextCreator(@"Data Source = C:\Users\PetarPetrov\Desktop\server.sqlite; Version = 3;");

                var clientData = new ClientData();
                clientData.Add(new Dictionary <string, FeatureContextRow>
                {
                    { @"Agenda", new FeatureContextRow(1, @"Agenda") }
                });
                clientData.Add(new[] { new FeatureExceptionRow(1, @"new exception : stack trace => ..."), });
                clientData.Add(new Dictionary <long, List <FeatureRow> >()
                {
                    { 1, new List <FeatureRow>()
                      {
                          new FeatureRow(1, @"Add Activity", 1),
                          new FeatureRow(2, @"Close Activity", 1),
                          new FeatureRow(3, @"Cancel Activity", 1),
                      } },
                });
                clientData.Add(new[]
                {
                    new FeatureEntryRow(2, "N/A", DateTime.Now),
                    new FeatureEntryRow(3, "Sick", DateTime.Now)
                });
                clientData.Add(new[]
                {
                    new FeatureExceptionEntryRow(1, DateTime.Today.AddDays(-1), 1),
                });

                //ResetSchema(contextCreator);

                var s = Stopwatch.StartNew();
                using (var ctx = contextCreator.Create())
                {
                    //FeatureServerManager.CreateSchema(ctx);

                    for (var i = 0; i < 1; i++)
                    {
                        FeatureManager.Replicate(ctx, @"BG900343", @"1.0.0.0", clientData.GetBytes());
                    }

                    ctx.Complete();
                }
                s.Stop();
                Console.WriteLine(s.ElapsedMilliseconds);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
        private static void GenerateData(string path)
        {
            var contextCreator = new TransactionContextCreator(GetSqliteConnectionString(path));

            var featureManager = new Atos.Client.Features.FeatureManager(() => contextCreator.Create());

            if (!File.Exists(path))
            {
                // Create the schema
                Atos.Client.Features.FeatureManager.CreateSchema(contextCreator.Create);
            }

            // TODO : !!!
            // Generate exceptions
            // Generate more scenarios
            var s = Stopwatch.StartNew();
            //var scenarios = new[]
            //{
            //	GetUploadImageFeature(),
            //	GetDownloadImageFeature(),
            //	GetLoadImagesAsync(),
            //	GetDeleteImageAsync(),
            //	GetSetAsDefaultAsync(),
            //	GetCreateActivityData(),
            //};
            //foreach (var data in scenarios)
            //{
            //	featureManager.MarkUsageAsync(data);
            //	//featureManager.Write(data);
            //}

            var f = new Feature(@"Images", @"Upload");

            try
            {
                throw new Exception(@"Unable to display feature");

                featureManager.Save(f);
            }
            catch (Exception ex)
            {
                featureManager.Save(f, ex);
            }

            s.Stop();

            Console.WriteLine(s.ElapsedMilliseconds);
        }