use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method createEditEnvironmentRequest.
private EnvironmentEditRequest createEditEnvironmentRequest() {
EnvironmentEditRequest request = new EnvironmentEditRequest();
request.setDescription("Test description.");
request.setNetwork(new EnvironmentNetworkRequest());
request.setAuthentication(createAuthenticationRequest());
request.setTelemetry(new TelemetryRequest());
request.setSecurityAccess(createSecurityAccessRequest());
request.setIdBrokerMappingSource(IdBrokerMappingSource.IDBMMS);
request.setCloudStorageValidation(CloudStorageValidation.DISABLED);
request.setAdminGroupName("cb-admin");
request.setAws(createAwsRequest());
return request;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest in project cloudbreak by hortonworks.
the class EnvironmentChangeAuthenticationAction method action.
@Override
public EnvironmentTestDto action(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient environmentClient) throws Exception {
EnvironmentEditRequest request = new EnvironmentEditRequest();
EnvironmentAuthenticationRequest environmentAuthenticationRequest = new EnvironmentAuthenticationRequest();
environmentAuthenticationRequest.setPublicKey(testDto.getRequest().getAuthentication().getPublicKey());
environmentAuthenticationRequest.setPublicKeyId(testDto.getRequest().getAuthentication().getPublicKeyId());
request.setAuthentication(environmentAuthenticationRequest);
testDto.setResponse(environmentClient.getDefaultClient().environmentV1Endpoint().editByCrn(testDto.getResponse().getCrn(), request));
Log.when(LOGGER, "Environment edit authentication action posted");
return testDto;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method testInitEditDto.
@Test
void testInitEditDto() {
EnvironmentEditRequest request = createEditEnvironmentRequest();
EnvironmentTelemetry environmentTelemetry = mock(EnvironmentTelemetry.class);
AccountTelemetry accountTelemetry = mock(AccountTelemetry.class);
Features features = mock(Features.class);
NetworkDto networkDto = mock(NetworkDto.class);
when(accountTelemetry.getFeatures()).thenReturn(features);
when(accountTelemetryService.getOrDefault(any())).thenReturn(accountTelemetry);
when(telemetryApiConverter.convert(eq(request.getTelemetry()), any(), anyString())).thenReturn(environmentTelemetry);
when(networkRequestToDtoConverter.convert(request.getNetwork())).thenReturn(networkDto);
EnvironmentEditDto actual = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initEditDto(request));
assertEquals("test-aws", actual.getAccountId());
assertEquals(request.getDescription(), actual.getDescription());
assertEquals(environmentTelemetry, actual.getTelemetry());
assertAuthentication(request.getAuthentication(), actual.getAuthentication());
assertEquals(request.getAdminGroupName(), actual.getAdminGroupName());
assertSecurityAccess(request.getSecurityAccess(), actual.getSecurityAccess());
verify(accountTelemetry).getFeatures();
verify(accountTelemetryService).getOrDefault(any());
verify(telemetryApiConverter).convert(eq(request.getTelemetry()), any(), anyString());
verify(networkRequestToDtoConverter).convert(request.getNetwork());
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest in project cloudbreak by hortonworks.
the class EnvironmentChangeSecurityAccessAction method action.
@Override
public EnvironmentTestDto action(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient environmentClient) throws Exception {
EnvironmentEditRequest request = new EnvironmentEditRequest();
SecurityAccessRequest securityAccess = testDto.getRequest().getSecurityAccess();
SecurityAccessRequest clone = cloneSecurityAccessRequest(securityAccess);
request.setSecurityAccess(clone);
testDto.setResponse(environmentClient.getDefaultClient().environmentV1Endpoint().editByCrn(testDto.getResponse().getCrn(), request));
Log.when(LOGGER, "Environment edit authentication action posted");
return testDto;
}
Aggregations