public void testService( String serviceFolderPath, String overrideServiceName, final int timeoutMins) throws IOException, InterruptedException, RestException, PackagingException, DSLException { LogUtils.log("Reading Service from file : " + serviceFolderPath); Service service = ServiceReader.readService(new File(serviceFolderPath)); LogUtils.log("Succesfully read Service : " + service); serviceName = service.getName(); if (overrideServiceName != null) { LogUtils.log("Overriding service name with " + overrideServiceName); serviceName = overrideServiceName; } installServiceAndWait(serviceFolderPath, serviceName, timeoutMins); String restUrl = getRestUrl(); GSRestClient client = new GSRestClient("", "", new URL(restUrl), PlatformVersion.getVersionNumber()); Map<String, Object> entriesJsonMap = client.getAdminData("ProcessingUnits/Names/default." + serviceName + "/Status"); String serviceStatus = (String) entriesJsonMap.get(STATUS_PROPERTY); AssertUtils.assertTrue("service is not intact", serviceStatus.equalsIgnoreCase("INTACT")); uninstallServiceAndWait(serviceName); }
@Test(timeOut = AbstractTestSupport.DEFAULT_TEST_TIMEOUT * 2, enabled = true) public void testTeardownWithoutUnInstallApplication() throws Exception { ApplicationInstaller travelInstaller = new ApplicationInstaller(getRestUrl(), "travel"); travelInstaller.recipePath(TRAVEL_PATH); ApplicationInstaller petclinicInstaller = new ApplicationInstaller(getRestUrl(), "petclinic"); petclinicInstaller.recipePath(PETCLINIC_SIMPLE_PATH); travelInstaller.install(); petclinicInstaller.install(); super.teardown(); AssertUtils.assertTrue( "Application 'travel' should not have been discovered since a teardown was executed", admin.getApplications().getApplication("travel") == null); AssertUtils.assertTrue( "Application 'petclinic' should not have been discovered since a teardown was executed", admin.getApplications().getApplication("petclinic") == null); super.scanForLeakedAgentNodes(); }
@Test(timeOut = DEFAULT_TEST_TIMEOUT, enabled = true) public void tomcatRecipeTest() throws InterruptedException, IOException { // get new login page LoginPage loginPage = getLoginPage(); MainNavigation mainNav = loginPage.login(); DashboardTab dashboardTab = mainNav.switchToDashboard(); final InfrastructureServicesGrid infrastructureServicesGrid = dashboardTab.getServicesGrid().getInfrastructureGrid(); RepetitiveConditionProvider condition = new RepetitiveConditionProvider() { @Override public boolean getCondition() { return ((infrastructureServicesGrid.getESMInst().getCount() == 1) && (infrastructureServicesGrid.getESMInst().getIcon().equals(Icon.OK))); } }; AssertUtils.repetitiveAssertTrue("No esm in showing in the dashboard", condition, waitingTime); ServicesGrid servicesGrid = dashboardTab.getServicesGrid(); ApplicationsMenuPanel appMenu = servicesGrid.getApplicationsMenuPanel(); appMenu.selectApplication(MANAGEMENT_APPLICATION_NAME); final ApplicationServicesGrid applicationServicesGrid = servicesGrid.getApplicationServicesGrid(); condition = new RepetitiveConditionProvider() { @Override public boolean getCondition() { return applicationServicesGrid.getWebModule().getCount() == 2; } }; AssertUtils.repetitiveAssertTrue(null, condition, waitingTime); appMenu.selectApplication(DEFAULT_APPLICATION_NAME); condition = new RepetitiveConditionProvider() { @Override public boolean getCondition() { return applicationServicesGrid.getAppServerModule().getCount() == 1; } }; AssertUtils.repetitiveAssertTrue( "web server module - expected: 1, actual: " + applicationServicesGrid.getAppServerModule().getCount(), condition, waitingTime); TopologyTab topologyTab = mainNav.switchToTopology(); final ApplicationMap appMap = topologyTab.getApplicationMap(); topologyTab.selectApplication(MANAGEMENT_APPLICATION_NAME); ApplicationNode restful = appMap.getApplicationNode("rest"); assertTrue(restful != null); assertTrue(restful.getStatus().equals(DeploymentStatus.INTACT)); ApplicationNode webui = appMap.getApplicationNode("webui"); assertTrue(webui != null); assertTrue(webui.getStatus().equals(DeploymentStatus.INTACT)); topologyTab.selectApplication(DEFAULT_APPLICATION_NAME); condition = new RepetitiveConditionProvider() { @Override public boolean getCondition() { ApplicationNode simple = appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME); return simple != null; } }; AssertUtils.repetitiveAssertTrue( "could not find tomcat application node after 10 seconds", condition, 10 * 1000); final ApplicationNode tomcatNode = appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME); takeScreenShot(this.getClass(), "tomcatRecipeTest", "topology"); condition = new RepetitiveConditionProvider() { @Override public boolean getCondition() { return tomcatNode.getStatus().equals(DeploymentStatus.INTACT); } }; repetitiveAssertTrueWithScreenshot( "tomcat service is displayed as " + appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME).getStatus() + "even though it is installed", condition, this.getClass(), "tomcatRecipeTest", "tomcat-service"); HealthPanel healthPanel = topologyTab.getTopologySubPanel().switchToHealthPanel(); takeScreenShot(this.getClass(), "tomcatRecipeTest", "topology-healthpanel"); assertTrue( "Process Cpu Usage " + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(PROCESS_CPU_USAGE) != null); assertTrue( "Total Process Virtual Memory" + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(TOTAL_PROCESS_VIRTUAL_MEMORY) != null); assertTrue( "Num Of Active Threads" + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(NUM_OF_ACTIVE_THREADS) != null); assertTrue( "Current Http Threads Busy" + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(CURRENT_HTTP_THREADS_BUSY) != null); assertTrue( "Request Backlog" + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(REQUEST_BACKLOG) != null); assertTrue( "Active Sessions" + METRICS_ASSERTION_SUFFIX, healthPanel.getMetric(ACTIVE_SESSIONS) != null); ServicesTab servicesTab = mainNav.switchToServices(); uninstallService("tomcat", true); }