public void GetByServerAppAndGroupTest() { string serverName = "server4"; ApplicationServer server = ApplicationServerLogic.GetByName(serverName); string appName = "app8"; Application app = ApplicationLogic.GetByName(appName); ApplicationWithOverrideVariableGroup appWithGroup = new ApplicationWithOverrideVariableGroup(); appWithGroup.Application = app; InstallationSummary mostRecentInstallationSummary = InstallationSummaryLogic.GetMostRecentByServerAppAndGroup(server, appWithGroup); InstallationSummary mostRecentSummaryInMemory = TestUtility.AllInstallationSummaries .Where(summary => summary.ApplicationServer.Id == server.Id && summary.ApplicationWithOverrideVariableGroup.ApplicationId == appWithGroup.Application.Id && summary.ApplicationWithOverrideVariableGroup.CustomVariableGroupId == null) .OrderByDescending(x => x.InstallationStart) .First(); Assert.AreEqual(mostRecentSummaryInMemory.InstallationStart, mostRecentInstallationSummary.InstallationStart); Assert.AreEqual(serverName, mostRecentInstallationSummary.ApplicationServer.Name); Assert.AreEqual(appName, mostRecentInstallationSummary.ApplicationWithOverrideVariableGroup.Application.Name); }
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 ApplicationServer GetAppServerWithNoInstallationSummariesFromDb() { var appServer = ApplicationServerLogic.GetByName("server10"); appServer.EnableDebugLogging = _enableAppServerDebugLogging; return(appServer); }
public void ApplicationShouldBeInstalledTest_UseCase5() { // Use Case #5 -- app exists in the server's ApplicationWithGroupToForceInstallList, // but the custom variable is different string rootName = "UseCase05"; TestHelper.CreateAndPersistEntitiesForAUseCase(rootName, 0); ApplicationServer appServer = ApplicationServerLogic.GetByName(TestHelper.GetServerName(rootName)); ApplicationWithOverrideVariableGroup appWithDifferentGroup = new ApplicationWithOverrideVariableGroup(); appWithDifferentGroup.Application = appServer.ApplicationsWithOverrideGroup[0].Application; // Set the group to something that doesn't already exist within the server... appWithDifferentGroup.CustomVariableGroups[0] = TestHelper.CreateCustomVariableGroup(rootName + " " + Guid.NewGuid().ToString()); ApplicationServerLogic.SaveForceInstallation(new ServerForceInstallation(appServer, appWithDifferentGroup)); SetGlobalFreeze(false); ApplicationServerLogic.InstallApplications(appServer); _mockAppInstaller.Verify(x => x.InstallApplication(It.IsAny <ApplicationServer>(), It.IsAny <ApplicationWithOverrideVariableGroup>()), Times.Never()); }
private static void AddManyInstallationSummariesForOneServerAndApp() { string serverName = "server4"; ApplicationServer server = ApplicationServerLogic.GetByName(serverName); string appName = "app8"; Application app = ApplicationLogic.GetByName(appName); ApplicationWithOverrideVariableGroup appWithGroup = new ApplicationWithOverrideVariableGroup(); appWithGroup.Application = app; // Save many installation summaries, for one server, to test Raven's 128 or 1024 limit. DateTime originalStartTime = DateTime.Now.AddDays(-1); for (int i = 1; i <= NumberOfExtraInstallationSummariesForServer4AndApp8; i++) { DateTime startTime = originalStartTime.AddMinutes(i); InstallationSummary summary = new InstallationSummary(appWithGroup, server, startTime); summary.InstallationEnd = startTime.AddSeconds(4); summary.InstallationResult = InstallationResult.Success; AllInstallationSummaries.Add(summary); InstallationSummaryLogic.Save(summary); } }
private static void TestHighNumberOfSessionRequests() { PrestoServerUtility.RegisterRavenDataClasses(); var appServer = ApplicationServerLogic.GetByName("PBG1MES22S105"); Debug.WriteLine(appServer.Name); }
public void GetByNameTest() { string name = "server2"; ApplicationServer server = ApplicationServerLogic.GetByName(name); Assert.AreEqual(name, server.Name); }
private TestEntityContainer CreateTestEntityContainer(string rootName, Func <InstallationSummary, DateTime> forceInstallationTimeFunc, bool forceInstallEnvironmentShouldMatch, bool freezeAllInstallations, int numberOfInstallationSummariesToCreate) { // Creates all of the entities for a particular use case and stores them in a container. This is done // because many of the methods in this class do this same thing. SetGlobalFreeze(freezeAllInstallations); TestHelper.CreateAndPersistEntitiesForAUseCase(rootName, numberOfInstallationSummariesToCreate); ApplicationServer appServer = ApplicationServerLogic.GetByName(TestHelper.GetServerName(rootName)); // So we can check the event log and see that this test passed/failed for the right reason. appServer.EnableDebugLogging = _enableAppServerDebugLogging; // Use this app and group string appName = TestHelper.GetAppName(rootName); ApplicationWithOverrideVariableGroup appWithGroup = appServer.ApplicationsWithOverrideGroup.Where(x => x.Application.Name == appName).First(); // Get the most recent InstallationSummary for this server. InstallationSummary mostRecentInstallationSummary = InstallationSummaryLogic.GetMostRecentByServerAppAndGroup(appServer, appWithGroup); ForceInstallation forceInstallation = new ForceInstallation(); forceInstallation.ForceInstallationTime = forceInstallationTimeFunc.Invoke(mostRecentInstallationSummary); if (forceInstallEnvironmentShouldMatch) { forceInstallation.ForceInstallEnvironment = appServer.InstallationEnvironment; } else { forceInstallation.ForceInstallEnvironment = InstallationEnvironmentLogic.GetAll().Where(x => x.LogicalOrder != appServer.InstallationEnvironment.LogicalOrder).First(); } appWithGroup.Application.ForceInstallation = forceInstallation; TestEntityContainer container = new TestEntityContainer(); container.ApplicationServer = appServer; container.AppWithGroup = appWithGroup; container.ForceInstallation = forceInstallation; container.MostRecentInstallationSummary = mostRecentInstallationSummary; return(container); }
private static ApplicationServer GetApplicationServerForThisMachine(string serverName) { // Get the app server, on which this process is running. ApplicationServer appServer = ApplicationServerLogic.GetByName(serverName); if (appServer == null) { Logger.LogWarning(string.Format(CultureInfo.CurrentCulture, PrestoTaskRunnerResources.AppServerNotFound, serverName), PrestoTaskRunnerName); } return(appServer); }
public void GetByServerAppAndGroupWithManyInstallationSummariesTest() { string serverName = "server4"; ApplicationServer server = ApplicationServerLogic.GetByName(serverName); string appName = "app8"; Application app = ApplicationLogic.GetByName(appName); ApplicationWithOverrideVariableGroup appWithGroup = new ApplicationWithOverrideVariableGroup(); appWithGroup.Application = app; InstallationSummary mostRecentInstallationSummary = InstallationSummaryLogic.GetMostRecentByServerAppAndGroup(server, appWithGroup); Assert.AreEqual(serverName, mostRecentInstallationSummary.ApplicationServer.Name); Assert.AreEqual(appName, mostRecentInstallationSummary.ApplicationWithOverrideVariableGroup.Application.Name); }