use of com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse in project cloudbreak by hortonworks.
the class AwsNoSqlConnectorTest method deleteNoSqlTable.
@Test
public void deleteNoSqlTable() {
TableDescription tableDescription = new TableDescription().withTableArn(ARN).withTableStatus(DELETING_STATUS);
DeleteTableResult deleteResult = new DeleteTableResult().withTableDescription(tableDescription);
when(dynamoDb.deleteTable(argThat((ArgumentMatcher<String>) argument -> true))).thenReturn(deleteResult);
NoSqlTableDeleteResponse result = underTest.deleteNoSqlTable(new NoSqlTableDeleteRequest());
assertEquals(ARN, result.getId());
assertEquals(DELETING_STATUS, result.getTableStatus());
assertEquals(ResponseStatus.OK, result.getStatus());
}
use of com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse in project cloudbreak by hortonworks.
the class S3GuardTableDeleteHandler method deleteNoSqlTable.
private ResponseStatus deleteNoSqlTable(LocationAwareCredential locationAwareCredential, String dynamoDbTablename) {
Credential credential = locationAwareCredential.getCredential();
String cloudPlatform = credential.getCloudPlatform();
String location = locationAwareCredential.getLocation();
NoSqlConnector noSqlConnector = getNoSqlConnector(cloudPlatform);
CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);
NoSqlTableMetadataRequest noSqlTableMetadataRequest = NoSqlTableMetadataRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
NoSqlTableMetadataResponse noSqlTableMetaData = noSqlConnector.getNoSqlTableMetaData(noSqlTableMetadataRequest);
if (ResponseStatus.OK.equals(noSqlTableMetaData.getStatus())) {
NoSqlTableDeleteRequest request = NoSqlTableDeleteRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
NoSqlTableDeleteResponse response = noSqlConnector.deleteNoSqlTable(request);
return response.getStatus();
} else {
return ResponseStatus.OK;
}
}
use of com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse in project cloudbreak by hortonworks.
the class AwsNoSqlConnectorTest method getNoSqlTableResourceNotFound.
@Test
public void getNoSqlTableResourceNotFound() {
when(dynamoDb.deleteTable(argThat((ArgumentMatcher<String>) argument -> true))).thenThrow(new ResourceNotFoundException("not found"));
NoSqlTableDeleteResponse result = underTest.deleteNoSqlTable(new NoSqlTableDeleteRequest());
assertNull(result.getId());
assertNull(result.getTableStatus());
assertEquals(ResponseStatus.RESOURCE_NOT_FOUND, result.getStatus());
}
Aggregations