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

项目:teasy    文件:OurBeforeAfterAnnotationsOrderBase.java   
@AfterSuite
public void after_suite() {
    Assert.assertEquals(orderMethods.size(), 8, "Incorrect size of called methods");

    Assert.assertEquals(orderMethods.get(0), BEFORE_CLASS_BASE, "Incorrect called method by index 0");
    Assert.assertEquals(orderMethods.get(1), BEFORE_CLASS_TEST_PUBLIC, "Incorrect called method by index 1");
    Assert.assertEquals(orderMethods.get(2), BEFORE_METHOD_BASE, "Incorrect called method by index 2");
    Assert.assertEquals(orderMethods.get(3), BEFORE_METHOD_TEST_PUBLIC, "Incorrect called method by index 3");
    Assert.assertEquals(orderMethods.get(4), AFTER_METHOD_TEST_PUBLIC, "Incorrect called method by index 4");
    Assert.assertEquals(orderMethods.get(5), AFTER_METHOD_BASE_PUBLIC, "Incorrect called method by index 5");
    Assert.assertEquals(orderMethods.get(6), AFTER_CLASS_TEST_PUBLIC, "Incorrect called method by index 6");
    Assert.assertEquals(orderMethods.get(7), AFTER_CLASS_BASE_PUBLIC, "Incorrect called method by index 7");

    Assert.assertFalse(orderMethods.contains(BEFORE_CLASS_BASE_PRIVATE), "Private method with @OurBeforeClass from super class was called");
    Assert.assertFalse(orderMethods.contains(BEFORE_METHOD_BASE_PRIVATE), "Private method with @OurBeforeMethod from super class was called");

    Assert.assertFalse(orderMethods.contains(AFTER_METHOD_BASE_PRIVATE), "Private method with @OurAfterMethod from super class was called");
    Assert.assertFalse(orderMethods.contains(AFTER_CLASS_BASE_PRIVATE), "Private method with @OurAfterClass from super class was called");
}
项目:Equella    文件:AbstractRestAssuredTest.java   
@AfterSuite
public void cleanupAfterSuite(ITestContext context)
{
    if( suite != null )
    {
        @SuppressWarnings("unchecked")
        List<CleanupAfter> cleanups = (List<CleanupAfter>) suite.getAttribute("cleanups");
        if( cleanups != null )
        {
            ListIterator<CleanupAfter> listIterator = cleanups.listIterator(cleanups.size());
            while( listIterator.hasPrevious() )
            {
                CleanupAfter cleanup = listIterator.previous();
                if( cleanup != null )
                {
                    cleanup.cleanUp();
                }
            }
        }
    }
}
项目:cassandra-jdbc-wrapper    文件:BuildCluster.java   
@AfterSuite(groups={"init"})
public static void tearDownAfterSuite() throws Exception {      
    System.out.println("CLOSING CASSANDRA CONNECTION");     
    if(dynamicCluster){
        System.out.println("Stopping nodes");
        clusterHasBuilt = false;
        try{
            ccmBridge.forceStop();          
            System.out.println("Discarding cluster");
            ccmBridge.remove();
            HOST = System.getProperty("host", ConnectionDetails.getHost());
        }catch(Exception e){
            System.out.println("Silent error discarding cluster");
        }
    }
}
项目: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;
}
项目:helix    文件:AbstractTestClass.java   
@AfterSuite
public void afterSuite() throws Exception {
  ZKClientPool.reset();
  if (_gZkClient != null) {
    _gZkClient.close();
    _gZkClient = null;
  }

  if (_zkServer != null) {
    TestHelper.stopZkServer(_zkServer);
    _zkServer = null;
  }

  if (_gZkClientTestNS != null) {
    _gZkClientTestNS.close();
    _gZkClientTestNS = null;
  }
  if (_zkServerTestNS != null) {
    TestHelper.stopZkServer(_zkServerTestNS);
    _zkServerTestNS = null;
  }
}
项目:stevia    文件:SteviaTestBase.java   
/**
 * Stop RC server if it's running.
 */
@AfterSuite(alwaysRun = true)
private void stopRCServer() {       
    if (isRCStarted) {

        Object server = seleniumServer[0];
        Method stopMethod = (Method) seleniumServer[1];
        try {
            stopMethod.invoke(server);
        } catch (Exception e) {

            STEVIA_TEST_BASE_LOG.warn("Failed to shutdown the Selenium Server",e);
        }

    }
}
项目:dropbox-sdk-java    文件:ITUtil.java   
@BeforeSuite
@AfterSuite(alwaysRun=true)
public static void deleteRoot() throws Exception {
    // always use standard HTTP requestor for delete root
    DbxClientV2 client = newClientV2(
        newRequestConfig()
            .withHttpRequestor(newStandardHttpRequestor())
    );
    try {
        client.files().delete(RootContainer.ROOT);
    } catch (DeleteErrorException ex) {
        if (ex.errorValue.isPathLookup() &&
            ex.errorValue.getPathLookupValue().isNotFound()) {
            // ignore
        } else {
            throw ex;
        }
    }
}
项目:coteafs-appium    文件:DefaultTest.java   
/**
 * @author wasiq.bhamla
 * @since 17-Apr-2017 3:47:41 PM
 */
@AfterSuite (alwaysRun = true)
public void tearDownTestSuite () {
    if (this.androidServer != null && this.androidDevice != null) {
        this.androidDevice.stop ();
        this.androidServer.stop ();
    }
}
项目:Log4Reports    文件:BaseCase.java   
@AfterSuite
public void afterSuite(){
    System.out.println("BaseCase: afterSuite");
    Log.close();
    TestReport.endTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss");
    TestReport.endMsTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss.SSS");
    System.out.println("case����--->" + TestReport.caseCount);
    System.out.println("fail����--->"+TestReport.failureCount);
    System.out.println("success����--->"+TestReport.successCount);
    System.out.println("skip����--->"+TestReport.skipedCount);
    if(! LogConfig.receivers.equals("")){
        new TestReport(LogConfig.receivers, LogConfig.subject).sendReport();
    }

}
项目:monarch    文件:TestBase.java   
@AfterSuite
  public void setUpAfterClass() throws Exception {
//    System.out.println("@AfterSuite -> TestBase.setUpAfterClass");
    MonarchUtils.getConnection(new HashMap<String, String>(1){{
      put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort());
    }}).close();
    testBase.tearDown2();
  }
项目:monarch    文件:TestBase.java   
@AfterSuite
  public void setUpAfterClass() throws Exception {
//    System.out.println("@AfterSuite -> TestBase.setUpAfterClass");
    /*MonarchUtils.getConnection(new HashMap<String, String>(1){{
      put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort());
    }}).close();*/
    MonarchUtils.getConnection(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()).close();
    testBase.tearDown2();
  }
项目:cloudkeeper    文件:ITS3StagingArea.java   
@AfterSuite
public void tearDown() {
    if (!skipTest) {
        if (s3Connection != null) {
            assert s3Bucket != null && executorService != null : "must have been initialized in setup()";
            cleanS3(s3Connection, s3Bucket);
            executorService.shutdownNow();
        }
    }
}
项目:FinanceAnalytics    文件:AbstractDbTest.java   
/**
 * Code run after entire suite.
 * @throws Exception if an error occurs
 */
@AfterSuite(groups = {TestGroup.UNIT_DB, TestGroup.INTEGRATION })
public static final void tearDownSuite() throws Exception {
  for (DbConnector connector : s_connectors.values()) {
    ReflectionUtils.close(connector);
  }
}
项目:carbon-metrics    文件:BaseReporterTest.java   
@AfterSuite
protected static void destroy() throws Exception {
    if (logger.isInfoEnabled()) {
        logger.info("Unbinding jdbc/WSO2MetricsDB");
    }
    InitialContext ic = new InitialContext();
    ic.unbind("jdbc/WSO2MetricsDB");
    ic.unbind("jdbc");

    if (logger.isInfoEnabled()) {
        logger.info("Stopping reporters");
    }
    metrics.deactivate();
}
项目:carbon-metrics    文件:BaseReporterTest.java   
@AfterSuite
protected static void destroy() throws Exception {
    if (logger.isInfoEnabled()) {
        logger.info("Deactivating Metrics");
    }
    metrics.deactivate();
}
项目:brooklyn-tosca    文件:Alien4CloudIntegrationTest.java   
@AfterSuite(alwaysRun = true)
public void tearDown() throws Exception {
    try {
        if (this.mgmt != null) {
            Entities.destroyAll(this.mgmt);
        }
    } catch (Throwable e) {
        LOG.error("Caught exception in tearDown method", e);
    } finally {
        this.mgmt = null;
        if (origFeatureEnablement != null) {
            BrooklynFeatureEnablement.setDefault(ToscaTypePlanTransformer.FEATURE_TOSCA_ENABLED, origFeatureEnablement);
        }
    }
}
项目:restassured_cli    文件:SampleTestBase.java   
/**
 * Stops WireMock when all tests are executed.
 */
@AfterSuite
public void afterClass() {
    logger.debug("========== Stopping WireMock ==========");
    if (wireMockServer != null) {
        wireMockServer.stop();
        wireMockServer = null;
    }
}
项目:elide    文件:AbstractApiResourceInitializer.java   
@AfterSuite
public final void tearDownServer() {
    log.debug("...Stopping Server...");
    try {
        server.stop();
    } catch (Exception e) {
        log.debug(e.getMessage());
    }
}
项目:presto    文件:TestExpressionCompiler.java   
@AfterSuite
public void tearDownClass()
{
    if (executor != null) {
        executor.shutdownNow();
        executor = null;
    }
}
项目:JDI    文件:TestNGBase.java   
@AfterSuite(alwaysRun = true)
public static void jdiTearDown() throws IOException {
    LocalDateTime date = Instant.ofEpochMilli(21 * 3600000 + getTestRunTime())
            .atZone(ZoneId.systemDefault())
            .toLocalDateTime();
    String formattedTime = DateTimeFormatter.ofPattern("HH:mm:ss.S").format(date);

    logger.info("Test run finished. " + LINE_BREAK + "Total test run time: " + formattedTime);

    if (WebSettings.killBrowser.toLowerCase().contains("after"))
        killAllRunWebBrowsers();
}
项目:JDI    文件:TestNGBase.java   
@AfterSuite
    public static void jdiTearDown() {
        if (WinSettings.driverFactory instanceof WiniumDriverFactory) {
            WiniumDriverFactory winiumDriverFactory = (WiniumDriverFactory) WinSettings.driverFactory;

            winiumDriverFactory.getDriver("winniumdesctop").close(); //Can be useful only for *.exe applications
            Process process = winiumDriverFactory.getStartedProcess();
            if (process != null)
                process.destroy();

//            killAllRunDrivers();
        }
    }
项目:edx-app-android    文件:BaseTest.java   
/**
 * 1) This will uninstall the app. 2) This will create an index.html file in
 * output folder to list down the test runs.
 * 
 * @throws IOException
 * @throws MessagingException
 * @throws AddressException
 */
@AfterSuite(alwaysRun = true, groups = { "Android", "iOS" })
public void createIndexFile(ITestContext testContext) throws IOException{

    String root = PropertyLoader.loadProperty("output.path").get();
    testLogger.info("report path " + root);
    int pathLevel = root.split("/").length;
    String reportFolder = root.split("/")[pathLevel - 1];
    int numberOfPassedTests = testContext.getPassedTests().size();
    int numberOfFailedTests = testContext.getFailedTests().size();
    int numberOfSkippedTests = testContext.getSkippedTests().size();
    String summaryFileName = "runSummary.csv";
    String summaryFilePath = root + "/..";
    String summaryReport = reportFolder + "," + numberOfPassedTests + ","
            + numberOfFailedTests + "," + numberOfSkippedTests;
    FileGenerator.appendTextToBeginingOfFile(summaryFilePath,
            summaryFileName, summaryReport);
    testLogger.info(reportFolder);
    testLogger.info("Passed: " + numberOfPassedTests);
    testLogger.info("Failed: " + numberOfFailedTests);
    testLogger.info("Skipped: " + numberOfSkippedTests);
    FileGenerator.generateBarGraphIndexHTML(summaryFilePath);
    String parentFolder = root + "/../..";
    for (int i = 1; i < pathLevel; i++) {
        FileGenerator.generateIndexHTML(parentFolder.toString());
        parentFolder = parentFolder + "/..";
    }
}
项目:clc-java-sdk    文件:SingleServerFixture.java   
@AfterSuite(groups = LONG_RUNNING)
public void deleteServer() {
    ServerMetadata serverStateBeforeDelete = loadMetadataOf(server);

    serverService.delete(server);

    assertThatServerProperlyStarted(serverStateBeforeDelete);
}
项目:oap    文件:AbstractTest.java   
@AfterSuite
public void afterSuite() throws Exception {
    if( cleanupTemp ) {
        final long now = System.currentTimeMillis();
        boolean empty = true;
        if( !java.nio.file.Files.exists( Env.tmp ) ) return;

        try( val stream = java.nio.file.Files.newDirectoryStream( Env.tmp ) ) {
            for( Path build : stream ) {
                final boolean self = Env.tmpRoot.equals( build );
                final long lastModified = java.nio.file.Files.getLastModifiedTime( build ).toMillis();
                final long diff = now - lastModified;
                if( self || diff > TEN_HOURS ) {
                    log.info( "delete {}", build );
                    deleteDirectory( build );
                } else {
                    log.info( "skip {}, self = {}, diff = {}", build, self, diff );
                    log.trace( "build={}, env={}", build );
                    log.trace( "now={}, lastModified={}", now, lastModified );
                    empty = false;
                }
            }
        }

        if( empty ) deleteDirectory( Env.tmp );
    }
}
项目:community-edition-old    文件:Word2010Test.java   
@AfterSuite
public void tearDown()
{
    File propFile = new File(location, "hello world.docx");
    propFile.setWritable(true);
    propFile.delete();
    Assert.assertFalse(propFile.exists());
}
项目:community-edition-old    文件:Word2013Test.java   
@AfterSuite
public void tearDown() throws SecurityException
{
    File propFile = new File(location, "hello world.docx");
    propFile.setWritable(true);
    propFile.delete();
    Assert.assertFalse(propFile.exists());
}
项目:community-edition-old    文件:PowerPoint2013Test.java   
@AfterSuite
public void tearDown() throws IOException
{

 //   Files.delete(Paths.get(location, "hello world.pptx"));
    File propFile = new File(location, "hello world.pptx");
    propFile.setWritable(true);
    propFile.delete();
    Assert.assertFalse(propFile.exists());
}
项目:community-edition-old    文件:PowerPoint2010Test.java   
@AfterSuite
public void tearDown()
{
    File propFile = new File(location, "hello world.pptx");
    propFile.setWritable(true);
    propFile.delete();
    Assert.assertFalse(propFile.exists());
}
项目:netarchivesuite-svngit-migration    文件:SeleniumTest.java   
@AfterSuite(alwaysRun=true)
public void shutdown() {
    try {
        SelectiveHarvestPageHelper.deactivateAllHarvests();
        driver.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:incubator-gobblin    文件:Kafka08DataWriterTest.java   
@AfterSuite
public void afterSuite()
    throws IOException {
  try {
    _kafkaTestHelper.stopClients();
  }
  finally {
    _kafkaTestHelper.stopServers();
  }
}
项目:incubator-gobblin    文件:Kafka09DataWriterTest.java   
@AfterSuite
public void afterSuite()
    throws IOException {
  try {
    _kafkaTestHelper.stopClients();
  }
  finally {
    _kafkaTestHelper.stopServers();
  }
}
项目:incubator-gobblin    文件:KafkaSimpleStreamingTest.java   
@AfterSuite
public void afterSuite()
    throws IOException {
  try {
    _kafkaTestHelper.stopClients();
  }
  finally {
    _kafkaTestHelper.stopServers();
  }
}
项目:incubator-gobblin    文件:Kafka09JsonIntegrationTest.java   
@AfterSuite
public void afterSuite()
    throws IOException {
  try {
    kafkaTestHelper.stopClients();
  } finally {
    kafkaTestHelper.stopServers();
  }
}
项目:deep-spark    文件:AerospikeJavaRDDFT.java   
@AfterSuite
public static void cleanup() {
    try {
        aerospike.close();
    } catch (Exception e) {
        LOG.error("Error while closing Aerospike client connection", e);
    }

}
项目:deep-spark    文件:MongoJavaRDDFT.java   
@AfterSuite
public static void cleanup() {
    try {
        if (mongodExecutable != null) {
            mongodExecutable.stop();
        }
    } finally {
        Files.forceDelete(new File(DB_FOLDER_NAME));
    }

}
项目:deep-spark    文件:ESJavaRDDFT.java   
@AfterSuite
public static void cleanup() throws IOException {

    deleteDataSet();
    if (node != null) {

        node.stop();
        client.close();
    }

    File file = new File(DB_FOLDER_NAME);
    FileUtils.deleteDirectory(file);

}
项目:deep-spark    文件:CassandraJavaRDDFT.java   
@AfterSuite
protected void disposeServerAndRdd() throws IOException {
    if (cassandraServer != null) {
        cassandraServer.shutdown();
    }

}
项目:cats    文件:CatsTestWithMonitoring.java   
@AfterSuite
public void afterSuite()
{
    try
    {
        if(scheduler!= null){   
            scheduler.shutdown();
        }
    }
    catch ( SchedulerException e )
    {
        e.printStackTrace();
    }
}
项目:helix    文件:ZkUnitTestBase.java   
@AfterSuite(alwaysRun = true)
public void afterSuite() {
  _gZkClient.close();
  TestHelper.stopZkServer(_zkServer);
  _zkServer = null;

  // System.out.println("Number of open zkClient after ZkUnitTests: "
  // + ZkClient.getNumberOfConnections());

}
项目:helix    文件:AdminTestBase.java   
@AfterSuite
public void afterSuite() {
  // System.out.println("START AdminTestBase.afterSuite() at " + new
  // Date(System.currentTimeMillis()));
  // stop admin
  _adminThread.stop();

  // stop zk
  ZKClientPool.reset();
  _gZkClient.close();

  TestHelper.stopZkServer(_zkServer);
  // System.out.println("END AdminTestBase.afterSuite() at " + new
  // Date(System.currentTimeMillis()));
}