use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyViewResponse in project cloudbreak by hortonworks.
the class EnvironmentResponseConverterTest method testDtoToSimpleResponse.
@ParameterizedTest
@EnumSource(value = CloudPlatform.class, names = { "AWS", "AZURE" })
void testDtoToSimpleResponse(CloudPlatform cloudPlatform) {
EnvironmentDto environmentDto = createEnvironmentDto(cloudPlatform);
CredentialViewResponse credentialResponse = mock(CredentialViewResponse.class);
FreeIpaResponse freeIpaResponse = mock(FreeIpaResponse.class);
CompactRegionResponse compactRegionResponse = mock(CompactRegionResponse.class);
TelemetryResponse telemetryResponse = mock(TelemetryResponse.class);
ProxyViewResponse proxyResponse = mock(ProxyViewResponse.class);
EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
when(credentialViewConverter.convertResponse(environmentDto.getCredential())).thenReturn(credentialResponse);
when(freeIpaConverter.convert(environmentDto.getFreeIpaCreation())).thenReturn(freeIpaResponse);
when(regionConverter.convertRegions(environmentDto.getRegions())).thenReturn(compactRegionResponse);
when(telemetryApiConverter.convert(environmentDto.getTelemetry())).thenReturn(telemetryResponse);
when(proxyConfigToProxyResponseConverter.convertToView(environmentDto.getProxyConfig())).thenReturn(proxyResponse);
when(networkDtoToResponseConverter.convert(environmentDto.getNetwork(), environmentDto.getExperimentalFeatures().getTunnel(), false)).thenReturn(environmentNetworkResponse);
SimpleEnvironmentResponse actual = underTest.dtoToSimpleResponse(environmentDto, true, true);
assertEquals(environmentDto.getResourceCrn(), actual.getCrn());
assertEquals(environmentDto.getName(), actual.getName());
assertEquals(environmentDto.getOriginalName(), actual.getOriginalName());
assertEquals(environmentDto.getDescription(), actual.getDescription());
assertEquals(environmentDto.getCloudPlatform(), actual.getCloudPlatform());
assertEquals(credentialResponse, actual.getCredential());
assertEquals(environmentDto.getStatus().getResponseStatus(), actual.getEnvironmentStatus());
assertEquals(environmentDto.getCreator(), actual.getCreator());
assertLocation(environmentDto.getLocation(), actual.getLocation());
assertTrue(actual.getCreateFreeIpa());
assertEquals(freeIpaResponse, actual.getFreeIpa());
assertEquals(environmentDto.getStatusReason(), actual.getStatusReason());
assertEquals(environmentDto.getCreated(), actual.getCreated());
assertEquals(environmentDto.getExperimentalFeatures().getTunnel(), actual.getTunnel());
assertEquals(environmentDto.getExperimentalFeatures().getCcmV2TlsType(), actual.getCcmV2TlsType());
assertEquals(environmentDto.getAdminGroupName(), actual.getAdminGroupName());
assertEquals(environmentDto.getTags().getUserDefinedTags(), actual.getTags().getUserDefined());
assertEquals(environmentDto.getTags().getDefaultTags(), actual.getTags().getDefaults());
assertEquals(telemetryResponse, actual.getTelemetry());
assertEquals(compactRegionResponse, actual.getRegions());
assertParameters(environmentDto, actual, cloudPlatform);
assertEquals(environmentDto.getParentEnvironmentName(), actual.getParentEnvironmentName());
assertEquals(proxyResponse, actual.getProxyConfig());
assertEquals(environmentNetworkResponse, actual.getNetwork());
verify(credentialViewConverter).convertResponse(environmentDto.getCredential());
verify(freeIpaConverter).convert(environmentDto.getFreeIpaCreation());
verify(regionConverter).convertRegions(environmentDto.getRegions());
verify(telemetryApiConverter).convert(environmentDto.getTelemetry());
verify(proxyConfigToProxyResponseConverter).convertToView(environmentDto.getProxyConfig());
verify(networkDtoToResponseConverter).convert(environmentDto.getNetwork(), environmentDto.getExperimentalFeatures().getTunnel(), false);
}
use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyViewResponse in project cloudbreak by hortonworks.
the class ProxyConfigToProxyResponseConverter method convertToView.
public ProxyViewResponse convertToView(ProxyConfigBase source) {
ProxyViewResponse response = new ProxyViewResponse();
response.setCrn(source.getResourceCrn());
response.setName(source.getName());
response.setDescription(source.getDescription());
response.setProtocol(source.getProtocol());
response.setCreator(source.getCreator());
response.setHost(source.getServerHost());
response.setPort(source.getServerPort());
response.setNoProxyHosts(source.getNoProxyHosts());
return response;
}
Aggregations