Java 类org.testng.annotations.AfterTest 实例源码

项目:uReplicator    文件:ControllerStarterTest.java   
@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();
}
项目:product-ei    文件:Axis2ServerStartupTestCase.java   
@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);

        }
    }
}
项目:product-ei    文件:Axis2ServerStartupWithSecuredServices.java   
@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);
        }

    }
}
项目:chaperone    文件:ControllerStarterTest.java   
@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();
}
项目:copycat    文件:AbstractLogTest.java   
@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;
      }
    });
  }
}
项目:ApexUnit    文件:ApexManifestFileReaderTest.java   
@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");
    }*/
}
项目:wtf-core    文件:AnnotationReader.java   
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;
}
项目:airavata    文件:AiravataIT.java   
@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();
    }

}
项目:Nicobar    文件:ScriptCompilerPluginSpecTest.java   
@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;
        }
    });
}
项目:otter-G    文件:ExecutorTemplateTest.java   
@AfterTest
public void tearDown() {
    try {
        template.destroy();
    } catch (Exception e) {
        want.fail(e.getMessage());
    }
}
项目:Graphene    文件:GrapheneCLITest.java   
@AfterTest
void printIfError() {
    if (asserted) {
        System.setOut(originalOut);
        System.setErr(originalErr);

        System.out.println(outContent.toString());
        System.err.println(errContent.toString());
    }
}
项目:selenium-testng-template    文件:BaseWebTestCase.java   
@AfterTest
public void tearDown() {
    super.tearDown();
    if (Config.driver() != null) {
        Config.driver().quit(); 
    }
}
项目:monarch    文件:MonarchRecordReaderFTableTest.java   
@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);
}
项目:monarch    文件:AmpoolSinkTaskTest.java   
@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();
  }

}
项目:uReplicator    文件:TestValidationManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:uReplicator    文件:TestSourceKafkaClusterValidationManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:uReplicator    文件:TestKafkaBrokerTopicObserver.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:uReplicator    文件:TestAutoTopicWhitelistingManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:amp-dimensiondata    文件:ServerApiLiveTest.java   
@AfterTest
public void testDeleteServer() {
    if (serverId != null) {
        Response response = api().deleteServer(serverId);
        assertTrue(response.error().isEmpty());
    }
}
项目:struts2    文件:TestNGXWorkTestCase.java   
@AfterTest
protected void tearDown() throws Exception {
    XWorkTestCaseHelper.tearDown(configurationManager);
    configurationManager = null;
    configuration = null;
    container = null;
    actionProxyFactory = null;
}
项目:milo    文件:OpcUaClientIT.java   
@AfterTest
public void stopClientAndServer() throws ExecutionException, InterruptedException {
    logger.info("stopClientAndServer()");

    stopClient();
    stopServer();
}
项目:product-ei    文件:HumanTaskCoordinationTest.java   
@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();
}
项目:product-ei    文件:HealthCareScenarioServerStartupTestCase.java   
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
@AfterTest(alwaysRun = true)
public void unDeployServices()
        throws MalformedURLException, LoginAuthenticationExceptionException, ExceptionException,
               RemoteException {
    if (axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    }

}
项目:chaperone    文件:TestValidationManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:chaperone    文件:TestSourceKafkaClusterValidationManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:chaperone    文件:TestKafkaBrokerTopicObserver.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:chaperone    文件:TestAutoTopicWhitelistingManager.java   
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
项目:bjoern    文件:IntegrationTestClass.java   
@AfterTest
public void finitOrientdb() throws java.io.IOException
{
    main.stopOrientdb();

    deleteOrientdbTestDatabases();
}
项目:webUIAuto    文件:BaseElementTest.java   
@AfterTest
public void afterTest(){
    try{
        webDriverDecorator.getDriver().close();
    }catch (Exception e){

    }
}
项目:hugegherkin    文件:AbstractSeleniumTest.java   
/**
 * 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");
}
项目:RoomManagerAutomation    文件:RunnerCukesTest.java   
@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);
    }
}
项目:brixen    文件:PricelineExampleTest.java   
@AfterTest
private void closeDriver() {
    if(driver != null) {
        driver.close();
        driver.quit();
    }
}
项目:storm-graphite    文件:UdpGraphiteReporterTest.java   
@AfterTest
public void exit() throws IOException {
  if (graphiteServer != null && graphiteServer.isClosed()) {
    graphiteServer.close();
  }
  graphiteReporter.disconnect();
}
项目:storm-graphite    文件:GraphiteReporterTest.java   
@AfterTest
public void exit() throws IOException {
  if (graphiteServer != null && graphiteServer.isOpen()) {
    graphiteServer.close();
  }
  graphiteReporter.disconnect();
}
项目:incubator-atlas    文件:DefaultMetadataServiceTest.java   
@AfterTest
public void shutdown() throws Exception {
    try {
        TypeSystem.getInstance().reset();

        if (auditRepository instanceof HBaseBasedAuditRepository) {
            ((HBaseBasedAuditRepository) auditRepository).stop();
            HBaseTestUtils.stopCluster();
        }
    }
    finally {
        AtlasGraphProvider.cleanup();
    }
}
项目:che    文件:ThreadLocalPropagateContextTest.java   
@AfterTest
public void tearDown() {
  if (exec != null) {
    exec.shutdownNow();
  }
  ThreadLocalPropagateContext.removeThreadLocal(tl1);
  Assert.assertEquals(ThreadLocalPropagateContext.getThreadLocals().length, 0);
  tl1.remove();
}
项目:Pinot    文件:RetentionManagerTest.java   
@AfterTest
public void tearDown() {
  _retentionManager.stop();
  _pinotHelixResourceManager.stop();
  if (INDEXES_DIR.exists()) {
    FileUtils.deleteQuietly(INDEXES_DIR);
  }
  _zkClient.close();
  ZkStarter.stopLocalZkServer();
}
项目:Pinot    文件:IntegrationTest.java   
@AfterTest
public static void Shutdown() {
  _serverInstance.shutDown();
  if (INDEXES_DIR.exists()) {
    FileUtils.deleteQuietly(INDEXES_DIR);
  }
}
项目:irplus    文件:FileServerTest.java   
/**
 * Cleanup the file system manager path
 */
@AfterTest
public void tearDown() 
{
    if( !fileServer.deleteFileServer() )
    {
        throw new IllegalStateException("File Databases could not be deleted");
    }
}
项目:carbon-deployment    文件:DeploymentServiceTest.java   
@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"));
}