示例#1
0
文件: Program.cs 项目: teize001/Crema
        static void Main(string[] args)
        {
            try
            {
                using (var application = new CremaBootstrapper())
                {
                    var configs        = application.GetService(typeof(ConsoleConfiguration)) as ConsoleConfiguration;
                    var commandContext = application.GetService(typeof(CommandContext)) as CommandContext;
#if DEBUG
                    commandContext.VerifyName = false;
#endif
                    commandContext.Execute(Environment.CommandLine);
                    configs.Commit();
                }
            }
            catch (TargetInvocationException e)
            {
                Console.Error.WriteLine(e.InnerException.ToString());
                Environment.Exit(1);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
示例#2
0
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(CremaHost_AssemblyInitializer));
     cremaHost      = app.GetService(typeof(ICremaHost)) as ICremaHost;
     authentication = cremaHost.Dispatcher.Invoke(() => cremaHost.Start());
 }
示例#3
0
        public static void Initialize(this CremaBootstrapper app, TestContext context, string name)
        {
#if SERVER
            var repositoryPath = DirectoryUtility.Prepare(context.TestRunDirectory + "_repo", name);
            app.CreateRepository(repositoryPath, app.RepositoryName, false);
            app.BasePath       = repositoryPath;
            app.MultiThreading = true;
#endif
#if CLIENT
            var cremaHost      = app.GetService(typeof(ICremaHost)) as ICremaHost;
            var repositoryPath = DirectoryUtility.Prepare(context.TestRunDirectory + "_repo", name);
            CremaServeHost.Run("init", repositoryPath.WrapQuot());
            var process  = CremaServeHost.RunAsync("run", repositoryPath.WrapQuot(), "--port", port);
            var eventSet = new ManualResetEvent(false);
            cremaHostToPort[cremaHost] = port;
            port += 2;
            process.OutputDataReceived += (s, e) =>
            {
                if (e.Data == "종료하시려면 <Q> 키를 누르세요.")
                {
                    eventSet.Set();
                }
            };
            eventSet.WaitOne();
            app.Disposed += (s, e) =>
            {
                process.StandardInput.WriteLine("exit");
                process.WaitForExit(100);
                cremaHostToPort.Remove(cremaHost);
            };
#endif
        }
示例#4
0
        public CremaClientTestFixture()
        {
            this.ServerHost = new CremaServerTestFixture();

            var bootstrap = new CremaBootstrapper();

            this.CremaHost = (ICremaHost)bootstrap.GetService(typeof(ICremaHost));
        }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IDataBase_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IDomainCollection_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         domains        = cremaHost.GetService(typeof(IDomainCollection)) as IDomainCollection;
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IUserItem_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         userContext    = cremaHost.GetService(typeof(IUserContext)) as IUserContext;
     });
     userItem = userContext.Dispatcher.Invoke(() => userContext.Random());
 }
示例#8
0
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IDataBase_Deleted_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.AddNewDataBase(authentication, RandomUtility.NextIdentifier(), RandomUtility.NextString());
         dataBase.Delete(authentication);
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITableCategoryCollection_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.Initialize(authentication);
         categories = dataBase.TableContext.Categories;
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITableContent_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.Initialize(authentication);
         content = dataBase.TableContext.Tables.Random(item => item.Parent == null).Content;
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITypeCollection_Deleted_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.TypeContext.AddRandomItems(authentication);
         types = dataBase.TypeContext.Types;
         dataBase.Leave(authentication);
         dataBase.Unload(authentication);
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITypeTemplate_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.TypeContext.AddRandomItems(authentication);
         template = dataBase.TypeContext.Types.Random().Template;
         template.BeginEdit(authentication);
         member = template.AddNew(authentication);
     });
 }
示例#13
0
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IDomain_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.TypeContext.AddRandomItems(authentication);
         dataBase.TableContext.AddRandomItems(authentication);
         table = dataBase.TableContext.Tables.Random(item => item.TemplatedParent == null);
         table.Template.BeginEdit(authentication);
         domain = table.Template.Domain;
     });
 }
示例#14
0
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITableColumn_Deleted_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.Initialize(authentication);
         template = dataBase.TableContext.Tables.Random(item => item.TemplatedParent == null).Template;
         template.BeginEdit(authentication);
         column = template.Random();
         dataBase.Leave(authentication);
         dataBase.Unload(authentication);
     });
 }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITableRow_Deleted_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.Initialize(authentication);
         content = dataBase.TableContext.Tables.Random(item => item.Parent == null).Content;
         content.BeginEdit(authentication);
         content.EnterEdit(authentication);
         if (content.Count == 0)
         {
             content.AddRandomRows(authentication);
         }
         row = content.Random();
         dataBase.Leave(authentication);
         dataBase.Unload(authentication);
     });
 }