本文整理汇总了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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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;
}
});
}
}
示例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");
}*/
}
示例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;
}
示例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();
}
}
示例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;
}
});
}
示例10: tearDown
import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
public void tearDown() {
try {
template.destroy();
} catch (Exception e) {
want.fail(e.getMessage());
}
}
示例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());
}
}
示例12: tearDown
import org.testng.annotations.AfterTest; //导入依赖的package包/类
@AfterTest
public void tearDown() {
super.tearDown();
if (Config.driver() != null) {
Config.driver().quit();
}
}
示例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);
}
示例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();
}
}
示例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();
}