@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); for (FakeInstance fakeInstance : FAKE_INSTANCES) { try { LOGGER.info("Trying to shutdown: " + fakeInstance); fakeInstance.stop(); } catch (Exception e) { } } LOGGER.info("Trying to stop controller"); CONTROLLER_STARTER.stop(); LOGGER.info("Trying to stop zk"); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME); ZK_CLIENT.close(); ZkStarter.stopLocalZkServer(); }
@AfterTest(alwaysRun = true) public void unDeployServices() throws Exception { if (axis2Server1 != null && axis2Server1.isStarted()) { axis2Server1.stop(); } else { if (TestConfigurationProvider.isPlatform() && asContext!=null) { int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay(); String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE; String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE; ServiceDeploymentUtil deployer = new ServiceDeploymentUtil(); String sessionCookie = new LoginLogoutClient(asContext).login(); deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie , serviceName, deploymentDelay); deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie , studentServiceName, deploymentDelay); } } }
@AfterTest(alwaysRun = true) public void unDeployServices() throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException { if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) { axis2Server1.stop(); } else { AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN); int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay(); String serviceName = "SecureStockQuoteServiceScenario"; ServiceDeploymentUtil deployer = new ServiceDeploymentUtil(); LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext); for (int i = 1; i < 9; i++) { deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login() , serviceName + i, deploymentDelay); } } }
@BeforeTest @AfterTest protected void cleanLogDir() throws IOException { Path directory = Paths.get("target/test-logs/"); if (Files.exists(directory)) { Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } }); } }
@AfterTest public void cleanUpTestFiles() { /*String testFilesDirPath = System.getProperty("user.dir") + System.getProperty("file.separator") + "MockTestFiles"; File testFilesDir = new File(testFilesDirPath); if (testFilesDir.exists()) { try { FileUtils.deleteDirectory(testFilesDir); } catch (IOException e) { ApexUnitUtils.shutDownWithDebugLog(e, "IO Exception encountered while deleting the test files directory"); } LOG.info("Test files directory deleted"); } else { LOG.info("Test files directory does not exist; hence not deleted"); }*/ }
public static Annotation getValue(Method javaMethod, Class <? extends Annotation > annotationClass) { Annotation annotation = javaMethod.getAnnotation(annotationClass); if (annotation == null) { boolean skip = false; // Filter out the usual Annotations. Annotation[] annots = javaMethod.getAnnotations(); for (Annotation an : annots) { if (an.annotationType().equals(BeforeMethod.class) || an.annotationType().equals(AfterMethod.class) || an.annotationType().equals(BeforeSuite.class) || an.annotationType().equals(AfterSuite.class) || an.annotationType().equals(BeforeTest.class) || an.annotationType().equals(AfterTest.class)) { skip = true; break; } } if (!skip) { annotation = javaMethod.getDeclaringClass().getAnnotation(annotationClass); } } return annotation; }
@AfterTest(alwaysRun = true) private void cleanUp(){ logger.info("cleanUp() -> Launching test experiment......"); Process p; try { String result = null; p = Runtime.getRuntime().exec("base-airavata/apache-airavata-server-0.17-SNAPSHOT/bin/airavata-server-stop.sh -f"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((result = br.readLine()) != null) System.out.println("line: " + result); p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch (Exception e) { logger.error("Error occured while cleanup", e); Assert.fail(); } }
@AfterTest public void cleanup() throws IOException { Files.walkFileTree(rootPath.toAbsolutePath(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult postVisitDirectory(Path directory, IOException exc) throws IOException { Files.delete(directory); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } }); }
@AfterTest public void tearDown() { try { template.destroy(); } catch (Exception e) { want.fail(e.getMessage()); } }
@AfterTest void printIfError() { if (asserted) { System.setOut(originalOut); System.setErr(originalErr); System.out.println(outContent.toString()); System.err.println(errContent.toString()); } }
@AfterTest public void tearDown() { super.tearDown(); if (Config.driver() != null) { Config.driver().quit(); } }
@AfterTest public void setUpAfterMethod() throws RMIException, Exception { final Map<String, String> map = new HashMap<>(); map.put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()); map.put(MonarchUtils.REGION, regionName); MonarchUtils.destroyFTable(regionName, map, false, true); }
@AfterTest /*public void setUpAfterMethod() throws RMIException, Exception { String locatorPort = testBase.getLocatorPort(); testBase.getClientVm().invoke(new SerializableRunnable() { @Override public void run() { try { MonarchUtils.destroyTable(regionName, locatorPort); } catch (Exception e) { e.printStackTrace(); } } }); }*/ public void setUpAfterMethod() throws Exception { //final Map<String, String> map = new HashMap<>(); //map.put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()); //map.put(MonarchUtils.REGION, regionName); final String locatorPort = testBase.getLocatorPort(); try { MonarchUtils.destroyTable(TABLE1.trim(), locatorPort); MonarchUtils.destroyTable(TABLE2.trim(), locatorPort); MonarchUtils.destroyTable(TABLE3.trim(), locatorPort); MonarchUtils.destroyTable(TABLE_ALL_TYPES.trim(), locatorPort); MonarchUtils.destroyTable(TABLE_LOGICAL_TYPES.trim(), locatorPort); MonarchUtils.destroyTable(TRANSACTION_TABLE.trim(), locatorPort); } catch (Exception e) { e.printStackTrace(); } }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); helixMirrorMakerManager.stop(); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
@AfterTest public void shutdown() { LOGGER.info("Trying to shutdown"); kafkaBrokerTopicObserver.stop(); KafkaStarterUtils.stopServer(kafkaStarter); ZkStarter.stopLocalZkServer(); }
@AfterTest public void testDeleteServer() { if (serverId != null) { Response response = api().deleteServer(serverId); assertTrue(response.error().isEmpty()); } }
@AfterTest protected void tearDown() throws Exception { XWorkTestCaseHelper.tearDown(configurationManager); configurationManager = null; configuration = null; container = null; actionProxyFactory = null; }
@AfterTest public void stopClientAndServer() throws ExecutionException, InterruptedException { logger.info("stopClientAndServer()"); stopClient(); stopServer(); }
@AfterTest(alwaysRun = true, description = "Unload packages after test.") public void removeArtifacts() throws PackageManagementException, InterruptedException, RemoteException, LogoutAuthenticationExceptionException, org.wso2.carbon.humantask.stub.mgt.PackageManagementException { bpelPackageManagementClient.undeployBPEL("ClaimsApprovalProcess"); humanTaskPackageManagementClient.unDeployHumanTask("ClaimsApprovalTask", "ApproveClaim"); loginLogoutClient.logout(); }
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE}) @AfterTest(alwaysRun = true) public void unDeployServices() throws MalformedURLException, LoginAuthenticationExceptionException, ExceptionException, RemoteException { if (axis2Server1 != null && axis2Server1.isStarted()) { axis2Server1.stop(); } }
@AfterTest public void finitOrientdb() throws java.io.IOException { main.stopOrientdb(); deleteOrientdbTestDatabases(); }
@AfterTest public void afterTest(){ try{ webDriverDecorator.getDriver().close(); }catch (Exception e){ } }
/** * Tear down. * * @throws Exception the exception */ @AfterTest public void tearDown() throws Exception { String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } logger.debug("Test torn down"); }
@AfterTest public void afterExecution() { FeatureHooks.executeAfterHookMethod(); try { if(CommonMethod.theUserIsLogIn() ){ CommonMethod.signOut(); } BrowserManager.getInstance().quitBrowser(); } catch (Exception e) { log.error("Unable to logout after execution", e); } }
@AfterTest private void closeDriver() { if(driver != null) { driver.close(); driver.quit(); } }
@AfterTest public void exit() throws IOException { if (graphiteServer != null && graphiteServer.isClosed()) { graphiteServer.close(); } graphiteReporter.disconnect(); }
@AfterTest public void exit() throws IOException { if (graphiteServer != null && graphiteServer.isOpen()) { graphiteServer.close(); } graphiteReporter.disconnect(); }
@AfterTest public void shutdown() throws Exception { try { TypeSystem.getInstance().reset(); if (auditRepository instanceof HBaseBasedAuditRepository) { ((HBaseBasedAuditRepository) auditRepository).stop(); HBaseTestUtils.stopCluster(); } } finally { AtlasGraphProvider.cleanup(); } }
@AfterTest public void tearDown() { if (exec != null) { exec.shutdownNow(); } ThreadLocalPropagateContext.removeThreadLocal(tl1); Assert.assertEquals(ThreadLocalPropagateContext.getThreadLocals().length, 0); tl1.remove(); }
@AfterTest public void tearDown() { _retentionManager.stop(); _pinotHelixResourceManager.stop(); if (INDEXES_DIR.exists()) { FileUtils.deleteQuietly(INDEXES_DIR); } _zkClient.close(); ZkStarter.stopLocalZkServer(); }
@AfterTest public static void Shutdown() { _serverInstance.shutDown(); if (INDEXES_DIR.exists()) { FileUtils.deleteQuietly(INDEXES_DIR); } }
/** * Cleanup the file system manager path */ @AfterTest public void tearDown() { if( !fileServer.deleteFileServer() ) { throw new IllegalStateException("File Databases could not be deleted"); } }
@AfterTest public void cleanupTempfile() throws IOException { FileUtils.deleteDir(new File(getTestResourceFile(CARBON_REPO).getAbsolutePath() + File.separator + "file:text-files")); FileUtils.deleteDir(new File(getTestResourceFile(RUNTIME_REPO).getAbsolutePath() + File.separator + "file:text-files")); }