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); }
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); }
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); }