当前位置: 首页>>代码示例>>Java>>正文


Java AfterTest类代码示例

本文整理汇总了Java中org.testng.annotations.AfterTest的典型用法代码示例。如果您正苦于以下问题:Java AfterTest类的具体用法?Java AfterTest怎么用?Java AfterTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AfterTest类属于org.testng.annotations包,在下文中一共展示了AfterTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shutdown

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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();
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:22,代码来源:ControllerStarterTest.java

示例2: unDeployServices

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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);

        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:Axis2ServerStartupTestCase.java

示例3: unDeployServices

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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);
        }

    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:Axis2ServerStartupWithSecuredServices.java

示例4: shutdown

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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();
}
 
开发者ID:uber,项目名称:chaperone,代码行数:22,代码来源:ControllerStarterTest.java

示例5: cleanLogDir

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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;
      }
    });
  }
}
 
开发者ID:atomix,项目名称:copycat,代码行数:21,代码来源:AbstractLogTest.java

示例6: cleanUpTestFiles

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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");
	}*/
}
 
开发者ID:forcedotcom,项目名称:ApexUnit,代码行数:17,代码来源:ApexManifestFileReaderTest.java

示例7: getValue

import org.testng.annotations.AfterTest; //导入依赖的package包/类
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;
}
 
开发者ID:web-auto,项目名称:wtf-core,代码行数:25,代码来源:AnnotationReader.java

示例8: cleanUp

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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();
    }

}
 
开发者ID:apache,项目名称:airavata,代码行数:21,代码来源:AiravataIT.java

示例9: cleanup

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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;
        }
    });
}
 
开发者ID:Netflix,项目名称:Nicobar,代码行数:17,代码来源:ScriptCompilerPluginSpecTest.java

示例10: tearDown

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
public void tearDown() {
    try {
        template.destroy();
    } catch (Exception e) {
        want.fail(e.getMessage());
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:9,代码来源:ExecutorTemplateTest.java

示例11: printIfError

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
void printIfError() {
    if (asserted) {
        System.setOut(originalOut);
        System.setErr(originalErr);

        System.out.println(outContent.toString());
        System.err.println(errContent.toString());
    }
}
 
开发者ID:Lambda-3,项目名称:Graphene,代码行数:11,代码来源:GrapheneCLITest.java

示例12: tearDown

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
public void tearDown() {
	super.tearDown();
	if (Config.driver() != null) {
		Config.driver().quit();	
	}
}
 
开发者ID:21ca,项目名称:selenium-testng-template,代码行数:8,代码来源:BaseWebTestCase.java

示例13: setUpAfterMethod

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:MonarchRecordReaderFTableTest.java

示例14: run

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@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();
  }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:33,代码来源:AmpoolSinkTaskTest.java

示例15: shutdown

import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
public void shutdown() {
  LOGGER.info("Trying to shutdown");
  helixMirrorMakerManager.stop();
  kafkaBrokerTopicObserver.stop();
  KafkaStarterUtils.stopServer(kafkaStarter);
  ZkStarter.stopLocalZkServer();
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:9,代码来源:TestValidationManager.java


注:本文中的org.testng.annotations.AfterTest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。