Search in sources :

Example 6 with NoSqlTableDeleteRequest

use of com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest in project cloudbreak by hortonworks.

the class AwsNoSqlConnectorTest method getNoSqlTableAwsError.

@Test
public void getNoSqlTableAwsError() {
    when(dynamoDb.deleteTable(argThat((ArgumentMatcher<String>) argument -> true))).thenThrow(new AmazonDynamoDBException("provider error"));
    thrown.expect(CloudConnectorException.class);
    thrown.expectMessage("provider error");
    underTest.deleteNoSqlTable(new NoSqlTableDeleteRequest());
}
Also used : AmazonDynamoDBException(com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException) ArgumentMatcher(org.mockito.ArgumentMatcher) NoSqlTableDeleteRequest(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest) Test(org.junit.Test)

Example 7 with NoSqlTableDeleteRequest

use of com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest 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());
}
Also used : ArgumentMatcher(org.mockito.ArgumentMatcher) ResourceNotFoundException(com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException) NoSqlTableDeleteResponse(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse) NoSqlTableDeleteRequest(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest) Test(org.junit.Test)

Aggregations

NoSqlTableDeleteRequest (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest)7 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)4 NoSqlTableMetadataRequest (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataRequest)4 NoSqlTableDeleteResponse (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse)3 AwsParameters (com.sequenceiq.environment.parameters.dao.domain.AwsParameters)3 Test (org.junit.Test)3 Test (org.junit.jupiter.api.Test)3 ArgumentMatcher (org.mockito.ArgumentMatcher)3 AmazonDynamoDBException (com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException)1 DeleteTableResult (com.amazonaws.services.dynamodbv2.model.DeleteTableResult)1 ResourceNotFoundException (com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException)1 TableDescription (com.amazonaws.services.dynamodbv2.model.TableDescription)1 NoSqlConnector (com.sequenceiq.cloudbreak.cloud.NoSqlConnector)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1 NoSqlTableMetadataResponse (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse)1 Credential (com.sequenceiq.environment.credential.domain.Credential)1 LocationAwareCredential (com.sequenceiq.environment.environment.domain.LocationAwareCredential)1 Logger (org.slf4j.Logger)1