@Test public void testAddParametersWhenAws() { Map<String, Object> parameters = new HashMap<>(); DetailedEnvironmentResponse environment = DetailedEnvironmentResponse.Builder.builder() .withCloudPlatform(CloudPlatform.AWS.name()) .withNetwork(EnvironmentNetworkResponseBuilder.anEnvironmentNetworkResponse() .withAws(EnvironmentNetworkAwsParamsBuilder.anEnvironmentNetworkAwsParams().withVpcId(TEST_VPC_ID).build()) .withNetworkCidr(TEST_VPC_CIDR) .build()) .build(); parameters = underTest.addParameters(parameters, environment, CloudPlatform.AWS); assertThat(parameters, IsMapContaining.hasEntry(NetworkParameterAdder.VPC_ID, TEST_VPC_ID)); assertThat(parameters, IsMapContaining.hasEntry(NetworkParameterAdder.VPC_CIDR, TEST_VPC_CIDR)); }
public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { switch (cloudPlatform) { case AWS: parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr()); parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs()); parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId()); break; case AZURE: break; case GCP: break; case MOCK: parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId()); break; default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } return parameters; }
NetworkParameterAdder { public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { switch (cloudPlatform) { case AWS: parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr()); parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs()); parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId()); break; case AZURE: break; case GCP: break; case MOCK: parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId()); break; default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } return parameters; } }
NetworkParameterAdder { public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { switch (cloudPlatform) { case AWS: parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr()); parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs()); parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId()); break; case AZURE: break; case GCP: break; case MOCK: parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId()); break; default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } return parameters; }  }
NetworkParameterAdder { public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { switch (cloudPlatform) { case AWS: parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr()); parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs()); parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId()); break; case AZURE: break; case GCP: break; case MOCK: parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId()); break; default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } return parameters; }  Map<String, Object> addSubnetIds(Map<String, Object> parameters, List<String> subnetIds, List<String> azs, CloudPlatform cloudPlatform); Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform); }
NetworkParameterAdder { public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { switch (cloudPlatform) { case AWS: parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr()); parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs()); parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId()); break; case AZURE: break; case GCP: break; case MOCK: parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId()); break; default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } return parameters; }  Map<String, Object> addSubnetIds(Map<String, Object> parameters, List<String> subnetIds, List<String> azs, CloudPlatform cloudPlatform); Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform);  }