use of org.testng.annotations.AfterSuite in project OpenAM by OpenRock.
the class AMIdentityTestBase method suiteTearDown.
/**
* Removes realm after suite test is done.
*
* @throws SMSException if realm cannot be deleted.
* @throws SSOException if the super administrator Single Sign On is
* invalid.
*/
@Parameters({ "parent-realms" })
@AfterSuite(groups = { "api" })
public void suiteTearDown(String realms) throws SSOException, SMSException {
Object[] params = { realms };
entering("suiteTearDown", params);
StringTokenizer st = new StringTokenizer(realms, ",");
while (st.hasMoreElements()) {
String realm = st.nextToken().trim();
deleteRealm(getAdminSSOToken(), realm);
}
exiting("suiteTearDown");
}
use of org.testng.annotations.AfterSuite in project oap by oaplatform.
the class AbstractTest method afterSuite.
@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);
}
}
use of org.testng.annotations.AfterSuite in project cloudbreak by hortonworks.
the class AwsDeleteVpcTest method deleteNetwork.
@AfterSuite
@Parameters({ "regionName", "vpcStackName" })
public void deleteNetwork(String regionName, @Optional("it-vpc-stack") String vpcStackName) {
AmazonCloudFormationClient client = new AmazonCloudFormationClient();
client.setRegion(RegionUtils.getRegion(regionName));
client.deleteStack(new DeleteStackRequest().withStackName(vpcStackName));
}
use of org.testng.annotations.AfterSuite in project cloudbreak by hortonworks.
the class AzureDeleteVpcTest method deleteNetwork.
@AfterSuite
@Parameters({ "resourceGroupName", "vpcName" })
public void deleteNetwork(@Optional("it-vpc-resource-group") String resourceGroupName, @Optional("it-vpc") String vpcName) throws Exception {
springTestContextPrepareTestInstance();
ApplicationTokenCredentials serviceClientCredentials = new ApplicationTokenCredentials(defaultAccesKey, defaultTenantId, defaultSecretKey, null);
Azure azure = Azure.authenticate(serviceClientCredentials).withSubscription(defaultSubscriptionId);
azure.networks().deleteByResourceGroup(resourceGroupName, vpcName);
}
use of org.testng.annotations.AfterSuite in project oap by oaplatform.
the class TestDirectoryCleanupTest method tryGeneralCleanup.
@AfterSuite
public void tryGeneralCleanup() {
final long now = System.currentTimeMillis();
boolean empty = true;
if (!java.nio.file.Files.exists(globalTestDirectory()))
return;
try (var stream = java.nio.file.Files.newDirectoryStream(globalTestDirectory())) {
for (Path build : stream) {
boolean self = TestDirectoryFixture.testDirectory().equals(build);
long lastModified = java.nio.file.Files.getLastModifiedTime(build).toMillis();
long diff = now - lastModified;
if (self || diff > TEN_HOURS) {
log.info("delete {}", build);
deleteDirectory(build);
} else {
log.info("skip {}, diff = {}", build, diff);
log.trace("build={}", build);
log.trace("now={}, lastModified={}", now, lastModified);
empty = false;
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
if (empty)
deleteDirectory(globalTestDirectory());
}
Aggregations