@Test public void testAvailabilitySetParameterCollection() { Map<String, InstanceGroupParameterResponse> instanceGroupParameterResponseMap = underTest.collectInstanceGroupParameters(Sets.newHashSet(getRequestWithAs(WORKER_GROUP_NAME), getRequestWithoutAs(COMPUTE_GROUP_NAME))); assertTrue(instanceGroupParameterResponseMap.get(WORKER_GROUP_NAME).getParameters().containsKey(AS_KEY)); assertTrue(instanceGroupParameterResponseMap.get(WORKER_GROUP_NAME).getParameters().get(AS_KEY) instanceof Map); Map<Object, Object> workerAsMap = (Map<Object, Object>) instanceGroupParameterResponseMap.get(WORKER_GROUP_NAME).getParameters().get(AS_KEY); assertEquals(workerAsMap.get(AS_NAME_KEY), STACK_NAME + "-" + WORKER_GROUP_NAME + "-customPostFix"); assertEquals(workerAsMap.get(AS_FAULT_DOMAIN_COUNTER_KEY), 5); assertEquals(workerAsMap.get(AS_UPDATE_DOMAIN_COUNTER_KEY), 50); assertTrue(instanceGroupParameterResponseMap.get(COMPUTE_GROUP_NAME).getParameters().containsKey(AS_KEY)); assertTrue(instanceGroupParameterResponseMap.get(COMPUTE_GROUP_NAME).getParameters().get(AS_KEY) instanceof Map); Map<Object, Object> computeAsMap = (Map<Object, Object>) instanceGroupParameterResponseMap.get(COMPUTE_GROUP_NAME).getParameters().get(AS_KEY); assertEquals(computeAsMap.get(AS_NAME_KEY), STACK_NAME + "-" + COMPUTE_GROUP_NAME + "-as"); assertEquals(computeAsMap.get(AS_FAULT_DOMAIN_COUNTER_KEY), 2); assertEquals(computeAsMap.get(AS_UPDATE_DOMAIN_COUNTER_KEY), 20); }
@Override public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) { Map<String, InstanceGroupParameterResponse> result = new HashMap<>(); for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) { InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse(); if (groupParameterRequest.getParameters().containsKey("availabilitySet")) { instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters()); } else { Map<String, Object> parameters = groupParameterRequest.getParameters(); Map<String, Object> availabilitySet = new HashMap<>(); availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getStackName(), groupParameterRequest.getGroupName())); availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER); availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER); parameters.put("availabilitySet", availabilitySet); instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(parameters); } result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse); } return result; }
AzurePlatformParameters implements PlatformParameters { @Override public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) { Map<String, InstanceGroupParameterResponse> result = new HashMap<>(); for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) { InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse(); if (groupParameterRequest.getParameters().containsKey("availabilitySet")) { instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters()); } else { Map<String, Object> parameters = groupParameterRequest.getParameters(); Map<String, Object> availabilitySet = new HashMap<>(); availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getStackName(), groupParameterRequest.getGroupName())); availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER); availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER); parameters.put("availabilitySet", availabilitySet); instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(parameters); } result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse); } return result; } }
AzurePlatformParameters implements PlatformParameters { @Override public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) { Map<String, InstanceGroupParameterResponse> result = new HashMap<>(); for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) { InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse(); if (groupParameterRequest.getParameters().containsKey("availabilitySet")) { instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters()); } else { Map<String, Object> parameters = groupParameterRequest.getParameters(); Map<String, Object> availabilitySet = new HashMap<>(); availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getStackName(), groupParameterRequest.getGroupName())); availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER); availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER); parameters.put("availabilitySet", availabilitySet); instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(parameters); } result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse); } return result; }  }
AzurePlatformParameters implements PlatformParameters { @Override public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) { Map<String, InstanceGroupParameterResponse> result = new HashMap<>(); for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) { InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse(); if (groupParameterRequest.getParameters().containsKey("availabilitySet")) { instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters()); } else { Map<String, Object> parameters = groupParameterRequest.getParameters(); Map<String, Object> availabilitySet = new HashMap<>(); availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getStackName(), groupParameterRequest.getGroupName())); availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER); availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER); parameters.put("availabilitySet", availabilitySet); instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(parameters); } result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse); } return result; }  @PostConstruct void init(); @Override ScriptParams scriptParams(); @Override DiskTypes diskTypes(); static DiskType defaultDiskType(); @Override String resourceDefinition(String resource); @Override List<StackParamValidation> additionalStackParameters(); @Override PlatformOrchestrator orchestratorParams(); @Override TagSpecification tagSpecification(); @Override String platforName(); @Override boolean isAutoTlsSupported(); @Override Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests); @Override VmRecommendations recommendedVms(); String getRoleDefJson(); String getAuditRoleDefJson(); }
AzurePlatformParameters implements PlatformParameters { @Override public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) { Map<String, InstanceGroupParameterResponse> result = new HashMap<>(); for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) { InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse(); if (groupParameterRequest.getParameters().containsKey("availabilitySet")) { instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters()); } else { Map<String, Object> parameters = groupParameterRequest.getParameters(); Map<String, Object> availabilitySet = new HashMap<>(); availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getStackName(), groupParameterRequest.getGroupName())); availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER); availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER); parameters.put("availabilitySet", availabilitySet); instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName()); instanceGroupParameterResponse.setParameters(parameters); } result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse); } return result; }  @PostConstruct void init(); @Override ScriptParams scriptParams(); @Override DiskTypes diskTypes(); static DiskType defaultDiskType(); @Override String resourceDefinition(String resource); @Override List<StackParamValidation> additionalStackParameters(); @Override PlatformOrchestrator orchestratorParams(); @Override TagSpecification tagSpecification(); @Override String platforName(); @Override boolean isAutoTlsSupported(); @Override Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests); @Override VmRecommendations recommendedVms(); String getRoleDefJson(); String getAuditRoleDefJson();  }