@Test void convert() { EnvironmentDto environmentDto = getEnvironmentDto(); CreateAWSEnvironmentRequest result = underTest.convert(environmentDto); assertEquals(environmentDto.getAuthentication().getPublicKey(), result.getAuthentication().getPublicKey()); assertEquals(environmentDto.getAuthentication().getPublicKeyId(), result.getAuthentication().getPublicKeyId()); assertEquals(environmentDto.getCredential().getName(), result.getCredentialName()); assertEquals(environmentDto.getDescription(), result.getDescription()); assertEquals(environmentDto.getName(), result.getEnvironmentName()); assertEquals(environmentDto.getTelemetry().getLogging().getStorageLocation(), result.getLogStorage().getStorageLocationBase()); assertEquals(environmentDto.getTelemetry().getLogging().getS3().getInstanceProfile(), result.getLogStorage().getInstanceProfile()); assertEquals(environmentDto.getNetwork().getNetworkCidr(), result.getNetworkCidr()); assertEquals(environmentDto.getLocation().getName(), result.getRegion()); assertEquals(environmentDto.getParameters().getAwsParametersDto().getS3GuardTableName(), result.getS3GuardTableName()); assertEquals(environmentDto.getSecurityAccess().getCidr(), result.getSecurityAccess().getCidr()); assertEquals(environmentDto.getSecurityAccess().getDefaultSecurityGroupId(), result.getSecurityAccess().getDefaultSecurityGroupId()); assertEquals(environmentDto.getSecurityAccess().getSecurityGroupIdForKnox(), result.getSecurityAccess().getSecurityGroupIdForKnox()); assertThat(result.getSubnetIds()).hasSameElementsAs(environmentDto.getNetwork().getSubnetIds()); assertEquals(environmentDto.getNetwork().getAws().getVpcId(), result.getVpcId()); }
public CreateAWSEnvironmentRequest convert(EnvironmentDto source) { CreateAWSEnvironmentRequest environmentRequest = new CreateAWSEnvironmentRequest(); environmentRequest.setAuthentication(environmentAuthenticationRequestToAuthenticationRequest(source.getAuthentication())); environmentRequest.setCredentialName(source.getCredential().getName()); environmentRequest.setDescription(source.getDescription()); environmentRequest.setEnvironmentName(source.getName()); environmentRequest.setLogStorage(environmentTelemetryToLogStorageRequest(source.getTelemetry())); environmentRequest.setNetworkCidr(getIfNotNull(source.getNetwork(), NetworkDto::getNetworkCidr)); environmentRequest.setRegion(source.getLocation().getName()); environmentRequest.setS3GuardTableName(getS3GuardTableName(source)); environmentRequest.setSecurityAccess(environmentSecurityAccessToSecurityAccessRequest(source.getSecurityAccess())); environmentRequest.setSubnetIds(getSubnetIds(source)); environmentRequest.setVpcId(getVpcId(source)); return environmentRequest; }
EnvironmentDtoToCreateAWSEnvironmentRequestConverter implements EnvironmentDtoToCliRequestConverter { public CreateAWSEnvironmentRequest convert(EnvironmentDto source) { CreateAWSEnvironmentRequest environmentRequest = new CreateAWSEnvironmentRequest(); environmentRequest.setAuthentication(environmentAuthenticationRequestToAuthenticationRequest(source.getAuthentication())); environmentRequest.setCredentialName(source.getCredential().getName()); environmentRequest.setDescription(source.getDescription()); environmentRequest.setEnvironmentName(source.getName()); environmentRequest.setLogStorage(environmentTelemetryToLogStorageRequest(source.getTelemetry())); environmentRequest.setNetworkCidr(getIfNotNull(source.getNetwork(), NetworkDto::getNetworkCidr)); environmentRequest.setRegion(source.getLocation().getName()); environmentRequest.setS3GuardTableName(getS3GuardTableName(source)); environmentRequest.setSecurityAccess(environmentSecurityAccessToSecurityAccessRequest(source.getSecurityAccess())); environmentRequest.setSubnetIds(getSubnetIds(source)); environmentRequest.setVpcId(getVpcId(source)); return environmentRequest; } }
EnvironmentDtoToCreateAWSEnvironmentRequestConverter implements EnvironmentDtoToCliRequestConverter { public CreateAWSEnvironmentRequest convert(EnvironmentDto source) { CreateAWSEnvironmentRequest environmentRequest = new CreateAWSEnvironmentRequest(); environmentRequest.setAuthentication(environmentAuthenticationRequestToAuthenticationRequest(source.getAuthentication())); environmentRequest.setCredentialName(source.getCredential().getName()); environmentRequest.setDescription(source.getDescription()); environmentRequest.setEnvironmentName(source.getName()); environmentRequest.setLogStorage(environmentTelemetryToLogStorageRequest(source.getTelemetry())); environmentRequest.setNetworkCidr(getIfNotNull(source.getNetwork(), NetworkDto::getNetworkCidr)); environmentRequest.setRegion(source.getLocation().getName()); environmentRequest.setS3GuardTableName(getS3GuardTableName(source)); environmentRequest.setSecurityAccess(environmentSecurityAccessToSecurityAccessRequest(source.getSecurityAccess())); environmentRequest.setSubnetIds(getSubnetIds(source)); environmentRequest.setVpcId(getVpcId(source)); return environmentRequest; }  }
EnvironmentDtoToCreateAWSEnvironmentRequestConverter implements EnvironmentDtoToCliRequestConverter { public CreateAWSEnvironmentRequest convert(EnvironmentDto source) { CreateAWSEnvironmentRequest environmentRequest = new CreateAWSEnvironmentRequest(); environmentRequest.setAuthentication(environmentAuthenticationRequestToAuthenticationRequest(source.getAuthentication())); environmentRequest.setCredentialName(source.getCredential().getName()); environmentRequest.setDescription(source.getDescription()); environmentRequest.setEnvironmentName(source.getName()); environmentRequest.setLogStorage(environmentTelemetryToLogStorageRequest(source.getTelemetry())); environmentRequest.setNetworkCidr(getIfNotNull(source.getNetwork(), NetworkDto::getNetworkCidr)); environmentRequest.setRegion(source.getLocation().getName()); environmentRequest.setS3GuardTableName(getS3GuardTableName(source)); environmentRequest.setSecurityAccess(environmentSecurityAccessToSecurityAccessRequest(source.getSecurityAccess())); environmentRequest.setSubnetIds(getSubnetIds(source)); environmentRequest.setVpcId(getVpcId(source)); return environmentRequest; }  @Override CloudPlatform supportedPlatform(); CreateAWSEnvironmentRequest convert(EnvironmentDto source); }
EnvironmentDtoToCreateAWSEnvironmentRequestConverter implements EnvironmentDtoToCliRequestConverter { public CreateAWSEnvironmentRequest convert(EnvironmentDto source) { CreateAWSEnvironmentRequest environmentRequest = new CreateAWSEnvironmentRequest(); environmentRequest.setAuthentication(environmentAuthenticationRequestToAuthenticationRequest(source.getAuthentication())); environmentRequest.setCredentialName(source.getCredential().getName()); environmentRequest.setDescription(source.getDescription()); environmentRequest.setEnvironmentName(source.getName()); environmentRequest.setLogStorage(environmentTelemetryToLogStorageRequest(source.getTelemetry())); environmentRequest.setNetworkCidr(getIfNotNull(source.getNetwork(), NetworkDto::getNetworkCidr)); environmentRequest.setRegion(source.getLocation().getName()); environmentRequest.setS3GuardTableName(getS3GuardTableName(source)); environmentRequest.setSecurityAccess(environmentSecurityAccessToSecurityAccessRequest(source.getSecurityAccess())); environmentRequest.setSubnetIds(getSubnetIds(source)); environmentRequest.setVpcId(getVpcId(source)); return environmentRequest; }  @Override CloudPlatform supportedPlatform(); CreateAWSEnvironmentRequest convert(EnvironmentDto source);  }