use of org.testng.annotations.AfterSuite in project cloudbreak by hortonworks.
the class MockSuiteInitializer method cleanUp.
@AfterSuite(alwaysRun = true)
@Parameters("cleanUp")
public void cleanUp(@Optional("true") boolean cleanUp) {
if (isCleanUpNeeded(cleanUp)) {
CloudbreakClient cloudbreakClient = itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class);
cleanUpService.deleteImageCatalog(cloudbreakClient, MOCK_IMAGE_CATALOG_NAME);
}
}
use of org.testng.annotations.AfterSuite in project cloudbreak by hortonworks.
the class CloudbreakTestSuiteInitializer method cleanUp.
@AfterSuite(alwaysRun = true)
@Parameters("cleanUp")
public void cleanUp(@Optional("true") boolean cleanUp) {
if (isCleanUpNeeded(cleanUp)) {
CloudbreakClient cloudbreakClient = itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class);
String stackId = itContext.getCleanUpParameter(CloudbreakITContextConstants.STACK_ID);
cleanUpService.deleteStackAndWait(cloudbreakClient, stackId);
List<InstanceGroup> instanceGroups = itContext.getCleanUpParameter(CloudbreakITContextConstants.TEMPLATE_ID, List.class);
if (instanceGroups != null && !instanceGroups.isEmpty()) {
Collection<String> deletedTemplates = new HashSet<>();
for (InstanceGroup ig : instanceGroups) {
if (!deletedTemplates.contains(ig.getTemplateId())) {
cleanUpService.deleteTemplate(cloudbreakClient, ig.getTemplateId());
deletedTemplates.add(ig.getTemplateId());
}
}
}
Set<Long> recipeIds = itContext.getContextParam(CloudbreakITContextConstants.RECIPE_ID, Set.class);
if (recipeIds != null) {
for (Long recipeId : recipeIds) {
cleanUpService.deleteRecipe(cloudbreakClient, recipeId);
}
}
cleanUpService.deleteCredential(cloudbreakClient, itContext.getCleanUpParameter(CloudbreakITContextConstants.CREDENTIAL_ID));
cleanUpService.deleteBlueprint(cloudbreakClient, itContext.getCleanUpParameter(CloudbreakITContextConstants.BLUEPRINT_ID));
cleanUpService.deleteNetwork(cloudbreakClient, itContext.getCleanUpParameter(CloudbreakITContextConstants.NETWORK_ID));
cleanUpService.deleteSecurityGroup(cloudbreakClient, itContext.getCleanUpParameter(CloudbreakITContextConstants.SECURITY_GROUP_ID));
cleanUpService.deleteRdsConfigs(cloudbreakClient, itContext.getCleanUpParameter(CloudbreakITContextConstants.RDS_CONFIG_ID));
}
}
use of org.testng.annotations.AfterSuite in project cloudbreak by hortonworks.
the class GcpDeleteVpcTest method deleteNetwork.
@AfterSuite
@Parameters("vpcName")
public void deleteNetwork(@Optional("it-vpc") String vpcName) throws Exception {
springTestContextPrepareTestInstance();
String serviceAccountPrivateKey = ResourceUtil.readBase64EncodedContentFromResource(applicationContext, defaultP12File);
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
PrivateKey privateKey = SecurityUtils.loadPrivateKeyFromKeyStore(SecurityUtils.getPkcs12KeyStore(), new ByteArrayInputStream(Base64.decodeBase64(serviceAccountPrivateKey)), "notasecret", "privatekey", "notasecret");
JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
GoogleCredential googleCredential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setServiceAccountId(defaultServiceAccountId).setServiceAccountScopes(Collections.singletonList(ComputeScopes.COMPUTE)).setServiceAccountPrivateKey(privateKey).build();
Compute compute = new Builder(httpTransport, jsonFactory, null).setApplicationName(defaultName).setHttpRequestInitializer(googleCredential).build();
Delete delete = compute.networks().delete(defaultProjectId, vpcName);
Operation operation = delete.execute();
if (operation.getHttpErrorStatusCode() != null) {
throw new IllegalStateException("gcp operation failed: " + operation.getHttpErrorMessage());
}
}
use of org.testng.annotations.AfterSuite in project open-ecard by ecsec.
the class AddonPropertiesTest method clear.
/**
* Remove created folders and files
* @throws java.io.IOException
*/
@AfterSuite
public void clear() throws IOException {
if (!addonsExists) {
new File(FileUtils.getAddonsConfDir().getPath() + "/test-addon.conf").delete();
path.delete();
} else {
new File(FileUtils.getAddonsConfDir().getPath() + "/test-addon.conf").delete();
}
}
use of org.testng.annotations.AfterSuite in project carina by qaprosoft.
the class CryptoToolTest method cleanup.
@AfterSuite
public void cleanup() {
File keyFile = new File(cryptoFileName);
Assert.assertTrue(keyFile.exists());
keyFile.delete();
}
Aggregations