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); } }
private async void Initialize(string address) { try { this.BeginProgress(Resources.Message_ReceivingInformation); var dataBaseInfos = await Task.Run(() => CremaBootstrapper.GetDataBases(address)); var query = from connectionItem in this.cremaAppHost.ConnectionItems where connectionItem.Address == this.cremaAppHost.ConnectionItem.Address && connectionItem.ID == this.cremaAppHost.ConnectionItem.ID && connectionItem.PasswordID == this.cremaAppHost.ConnectionItem.PasswordID join dataBase in dataBaseInfos on connectionItem.DataBaseName equals dataBase.Name select connectionItem; foreach (var item in dataBaseInfos) { var viewModel = new DataBaseItemViewModel(this.authentication, item, this); if (this.ConnectableOnly == true) { viewModel.ConnectionItem = query.FirstOrDefault(i => i.DataBaseName == item.Name); } this.compositionService?.SatisfyImportsOnce(viewModel); this.itemsSource.Add(viewModel); } this.selectedItem = this.itemsSource.FirstOrDefault(item => item.Name == this.selectedValue); this.EndProgress(); this.Refresh(); } catch (Exception e) { this.EndProgress(); AppMessageBox.ShowError(Resources.Message_ConnectionFailed, e); this.TryClose(); } }
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()); }
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 }
public CremaClientTestFixture() { this.ServerHost = new CremaServerTestFixture(); var bootstrap = new CremaBootstrapper(); this.CremaHost = (ICremaHost)bootstrap.GetService(typeof(ICremaHost)); }
public async void Login(string address, string userID, SecureString password, string dataBaseName) { this.HasError = false; this.BeginProgress(); try { this.ProgressMessage = Resources.Message_ConnectingToServer; if (await this.cremaHost.Dispatcher.InvokeAsync(() => CremaBootstrapper.IsOnline(address, userID, password)) == true) { if (AppMessageBox.ShowQuestion(Resources.Message_SameIDConnected) == false) { this.ProgressMessage = string.Empty; this.EndProgress(); this.HasError = false; return; } } await this.OpenAsync(address, userID, password); if (dataBaseName != string.Empty) { await this.LoadAsync(dataBaseName); } else { this.EndProgress(); this.dataBase = null; this.dataBaseName = null; this.address = null; this.Refresh(); this.ProgressMessage = string.Empty; } } catch (TimeoutException e) { CremaLog.Error(e); this.ErrorMessage = Resources.Message_ConnectionFailed; } catch (EndpointNotFoundException e) { CremaLog.Error(e); this.ErrorMessage = Resources.Message_ConnectionFailed; } catch (Exception e) { CremaLog.Error(e); this.ErrorMessage = e.Message; if (this.IsOpened == true) { AppMessageBox.ShowError(e.Message); } } finally { this.EndProgress(this.ProgressMessage); } }
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(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(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()); }
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(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; }); }
protected virtual IEnumerable <string> SelectPath() { var items = CremaBootstrapper.SelectPath(AppDomain.CurrentDomain.BaseDirectory); foreach (var item in items) { yield return(item); } if (this.Settings.PluginsPath != null) { foreach (var item in this.Settings.PluginsPath) { yield return(item); } } }
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); }); }
private void CreateRepository() { var userInfos = UserInfoGenerator.Generate(0, 0); var dataSet = new CremaDataSet(); try { CremaBootstrapper.CreateRepositoryInternal(this.application, this.Path, this.RepositoryModule, this.FileType, this.DataBaseUrl, userInfos, dataSet); } catch { if (this.Force == true) { DirectoryUtility.Delete(this.Path); } CremaBootstrapper.CreateRepositoryInternal(this.application, this.Path, this.RepositoryModule, this.FileType, this.DataBaseUrl, userInfos, dataSet); } }
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; }); }
private void InitCremaService() { var repoPath = DirectoryUtility.Prepare(CremaDbPath, "_repo"); using (var bootstrap = new CremaBootstrapper()) { bootstrap.CreateRepository(repoPath, "crema", false); } Service = new CremaService(); Service.BasePath = repoPath; Service.MultiThreading = true; Service.Port = 4004; Service.HttpPort = AddressUtility.GetDefaultHttpPort(Service.Port); Service.Open(); CremaHost = Service.GetService <ICremaHost>(); }
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 async Task CreateRepositoryAsync() { var dialog = new CommonOpenFileDialog() { IsFolderPicker = true, }; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { var basePath = dialog.FileName; var isEmpty = DirectoryUtility.IsEmpty(basePath); if (isEmpty == false) { await AppMessageBox.ShowAsync("대상 경로는 비어있지 않습니다."); return; } CremaBootstrapper.CreateRepository(this.service, basePath, "git", "xml"); await AppMessageBox.ShowAsync("저장소를 생성했습니다."); this.BasePath = basePath; } }
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); }); }
public async Task InitializeAsync(TestContext context) { var basePath = Path.Combine(context.TestRunDirectory, "repo"); var repositoryPath = GenerateRepositoryPath(); var userInfos = UserInfoGenerator.Generate(0, 0); var dataSet = new CremaDataSet(); await Task.Run(() => CremaBootstrapper.CreateRepositoryInternal(this, repositoryPath, "git", "xml", string.Empty, userInfos, dataSet)); this.BasePath = repositoryPath; this.LongPaths = Environment.OSVersion.Platform == PlatformID.Win32NT; this.cremaHost = this.GetService(typeof(ICremaHost)) as ICremaHost; this.context = context; string GenerateRepositoryPath() { var repositoryPath = Path.Combine(basePath, context.FullyQualifiedTestClassName); if (Environment.OSVersion.Platform == PlatformID.Win32NT && repositoryPath.Length > 168) { repositoryPath = Path.Combine(basePath, $"{Guid.NewGuid()}"); } return(repositoryPath); } }
protected override void OnExecute() { CremaBootstrapper.UpgradeRepository(this.boot, this.Path, this.DataBases); }
protected override void OnExecute() { CremaBootstrapper.CleanRepository(this.boot, this.Path); }
public CleanCommand(CremaBootstrapper boot) : base("clean") { this.boot = boot; }
public UpgradeCommand(CremaBootstrapper boot) : base("upgrade") { this.boot = boot; }
public InitializeCommand(CremaBootstrapper boot) : base("init") { this.boot = boot; }
public ValidateCommand(CremaBootstrapper boot) : base("validate") { this.RepositoryModule = CremaBootstrapper.DefaultRepositoryModule; this.boot = boot; }
public RunCommand(CremaBootstrapper application, ICremaHost cremaHost) : base("run") { this.application = application; this.cremaHost = cremaHost; }
protected override void OnExecute() { CremaBootstrapper.CreateRepository(this.boot, this.Path, this.RepositoryModule, this.FileType, this.DataBaseUrl); }