use of com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables in project cloudbreak by hortonworks.
the class CloudParameterServiceTest method getNoSqlTables.
@Test
void getNoSqlTables() {
CloudNoSqlTables expected = new CloudNoSqlTables(List.of(new CloudNoSqlTable("a"), new CloudNoSqlTable("b")));
GetPlatformNoSqlTablesResult response = new GetPlatformNoSqlTablesResult(1L, expected);
doAnswer(invocation -> {
Event<GetPlatformNoSqlTablesRequest> ev = invocation.getArgument(1);
ev.getData().getResult().onNext(response);
return null;
}).when(eventBus).notify(anyString(), any(Event.class));
CloudNoSqlTables noSqlTables = underTest.getNoSqlTables(new ExtendedCloudCredential(new CloudCredential("id", "name", "acc"), "aws", "desc", "crn", "account", new ArrayList<>()), "region", "aws", null);
assertEquals(expected, noSqlTables);
}
use of com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables in project cloudbreak by hortonworks.
the class CredentialPlatformResourceControllerTest method getNoSqlTables.
@Test
void getNoSqlTables() {
CloudNoSqlTables noSqlTables = new CloudNoSqlTables();
PlatformResourceRequest platformResourceRequest = new PlatformResourceRequest();
PlatformNoSqlTablesResponse response = new PlatformNoSqlTablesResponse();
when(platformParameterService.getPlatformResourceRequest(any(), any(), any(), any(), any(), any())).thenReturn(platformResourceRequest);
when(platformParameterService.getNoSqlTables(any(PlatformResourceRequest.class))).thenReturn(noSqlTables);
when(cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter.convert(noSqlTables)).thenReturn(response);
doNothing().when(commonPermissionCheckingUtils).checkPermissionForUserOnResource(any(), any(), any());
PlatformNoSqlTablesResponse result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.getNoSqlTables(null, CREDENTIAL_CRN, "region", "aws", "az"));
verify(platformParameterService).getNoSqlTables(platformResourceRequest);
verify(cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter).convert(noSqlTables);
assertEquals(response, result);
}
use of com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method noSqlTables.
@Test
public void noSqlTables() {
when(awsClient.createDynamoDbClient(any(AwsCredentialView.class), anyString())).thenReturn(amazonDynamoDB);
when(amazonDynamoDB.listTables(any(ListTablesRequest.class))).thenReturn(new ListTablesResult().withTableNames("a", "b").withLastEvaluatedTableName("b"), new ListTablesResult().withTableNames("c", "d"));
CloudNoSqlTables cloudNoSqlTables = underTest.noSqlTables(cloudCredential, region("region"), null);
assertThat(cloudNoSqlTables.getCloudNoSqlTables()).hasSameElementsAs(List.of(new CloudNoSqlTable("a"), new CloudNoSqlTable("b"), new CloudNoSqlTable("c"), new CloudNoSqlTable("d")));
}
Aggregations