private static ApplicationServer CreateAppServer(string rootName, Application app, CustomVariableGroup group) { ApplicationServer server = new ApplicationServer(); server.Name = rootName + " server"; server.InstallationEnvironment = _defaultEnv; server.Description = rootName + " server description"; server.EnableDebugLogging = false; server.ApplicationsWithOverrideGroup.Add(new ApplicationWithOverrideVariableGroup() { Enabled = true, Application = app }); // Add the generic apps to the server, so we have more than just the one above. _genericApps.ForEach(x => server.ApplicationsWithOverrideGroup.Add( new ApplicationWithOverrideVariableGroup() { Enabled = true, Application = x })); server.CustomVariableGroups.Add(group); ApplicationServerLogic.Save(server); return(server); }
public void ApplicationShouldBeInstalledTest_UseCase6() { // Use Case #6 -- app does not exist in the server's ApplicationWithGroupToForceInstallList, // but the custom variable does. string rootName = "UseCase06"; TestHelper.CreateAndPersistEntitiesForAUseCase(rootName, 0); ApplicationServer appServer = ApplicationServerLogic.GetByName(TestHelper.GetServerName(rootName)); appServer.ApplicationsWithOverrideGroup[0].CustomVariableGroups[0] = TestHelper.CreateCustomVariableGroup(rootName); ApplicationServerLogic.Save(appServer); // To save with a valid group. // Create a new app group with a new app, but an existing group var appWithValidGroup = new ApplicationWithOverrideVariableGroup(); appWithValidGroup.Application = TestHelper.CreateApp(rootName + " " + Guid.NewGuid().ToString()); appWithValidGroup.CustomVariableGroups[0] = appServer.ApplicationsWithOverrideGroup[0].CustomVariableGroups[0]; // Set the app to something that doesn't already exist within the server... // Leave the group alone because it already exists. ApplicationServerLogic.SaveForceInstallation(new ServerForceInstallation(appServer, appWithValidGroup)); SetGlobalFreeze(false); ApplicationServerLogic.InstallApplications(appServer); _mockAppInstaller.Verify(x => x.InstallApplication(It.IsAny <ApplicationServer>(), It.IsAny <ApplicationWithOverrideVariableGroup>()), Times.Never()); }
private static void AddAppServers() { IEnumerable <InstallationEnvironment> environments = InstallationEnvironmentLogic.GetAll(); for (int i = 1; i <= TotalNumberOfEachEntityToCreate; i++) { ApplicationServer server = new ApplicationServer(); server.Name = "server" + i; server.InstallationEnvironment = environments.Where(x => x.LogicalOrder == 1).First(); // 1st env is dev server.Description = "Description " + i; server.EnableDebugLogging = false; Application app = ApplicationLogic.GetByName("app" + i); server.ApplicationsWithOverrideGroup.Add(new ApplicationWithOverrideVariableGroup() { Enabled = true, Application = app }); CustomVariableGroup group = CustomVariableGroupLogic.GetByName("group" + i); server.CustomVariableGroups.Add(group); ApplicationServerLogic.Save(server); } }
public ApplicationServer SaveServer(ApplicationServer applicationServer) { return(Invoke(() => { ApplicationServerLogic.Save(applicationServer); return applicationServer; })); }