use of com.cloudera.api.swagger.client.ApiResponse in project cloudbreak by hortonworks.
the class SyncApiCommandRetrieverTest method createApiCommandListResponse.
private ApiResponse<ApiCommandList> createApiCommandListResponse(int statusCode) {
ApiCommandList commandList = new ApiCommandList();
ApiCommand command1 = new ApiCommand();
command1.setId(new BigDecimal(4L));
command1.setName("DeployClusterClientConfig");
command1.setSuccess(true);
command1.setStartTime(new DateTime(2000, 1, 1, 1, 1, 1).toString());
ApiCommand command2 = new ApiCommand();
command2.setId(new BigDecimal(5L));
command2.setName("DeployClusterClientConfig");
command2.setSuccess(true);
command2.setStartTime(new DateTime(2000, 1, 1, 1, 1, 2).toString());
ApiCommand command3 = new ApiCommand();
command3.setId(new BigDecimal(6L));
command3.setName("RestartServices");
command3.setSuccess(true);
command3.setStartTime(new DateTime(2000, 1, 1, 1, 1, 3).toString());
commandList.addItemsItem(command1);
commandList.addItemsItem(command2);
commandList.addItemsItem(command3);
return new ApiResponse<>(statusCode, emptyHeaders, commandList);
}
use of com.cloudera.api.swagger.client.ApiResponse in project cloudbreak by hortonworks.
the class ClouderaManagerMgmtTelemetryServiceTest method testSetupTelemetry.
@Test
public void testSetupTelemetry() throws ApiException {
// GIVEN
Stack stack = new Stack();
stack.setType(StackType.WORKLOAD);
User user = new User();
user.setUserCrn("crn:cdp:iam:us-west-1:accountId:user:name");
stack.setCreator(user);
stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
WorkloadAnalytics wa = new WorkloadAnalytics();
Telemetry telemetry = new Telemetry();
telemetry.setWorkloadAnalytics(wa);
ApiConfigList apiConfigList = new ApiConfigList();
ApiResponse response = new ApiResponse<>(0, null, apiConfigList);
AltusCredential credential = new AltusCredential("accessKey", "secretKey".toCharArray());
when(entitlementService.useDataBusCNameEndpointEnabled(anyString())).thenReturn(false);
when(dataBusEndpointProvider.getDataBusEndpoint(anyString(), anyBoolean())).thenReturn("https://dbusapi.us-west-1.sigma.altus.cloudera.com");
when(apiClient.execute(any(), any())).thenReturn(response);
when(clouderaManagerDatabusService.getAltusCredential(stack, SDX_STACK_CRN)).thenReturn(credential);
when(clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient)).thenReturn(cmResourceApi);
when(cmResourceApi.updateConfig(anyString(), any())).thenReturn(apiConfigList);
// WHEN
underTest.setupTelemetryRole(stack, apiClient, null, new ApiRoleList(), telemetry, SDX_STACK_CRN);
// THEN
verify(externalAccountService, times(1)).createExternalAccount(anyString(), anyString(), anyString(), anyMap(), any(ApiClient.class));
verify(clouderaManagerDatabusService, times(1)).getAltusCredential(stack, SDX_STACK_CRN);
}
Aggregations