use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.FreeIpaRecommendationResponse in project cloudbreak by hortonworks.
the class FreeIpaRecommendationServiceTest method testGetRecommendation.
@Test
public void testGetRecommendation() {
when(credentialService.getCredentialByCredCrn(anyString())).thenReturn(new Credential("AWS", "", "", "", ""));
when(cloudParameterService.getVmTypesV2(any(), eq("eu-central-1"), eq("AWS"), eq(CdpResourceType.DEFAULT), any())).thenReturn(initCloudVmTypes());
when(defaultInstanceTypeProvider.getForPlatform(eq("AWS"))).thenReturn("medium");
FreeIpaRecommendationResponse recommendation = underTest.getRecommendation("cred", "eu-central-1", null);
assertEquals("medium", recommendation.getDefaultInstanceType());
Set<VmTypeResponse> vmTypes = recommendation.getVmTypes();
assertEquals(2, vmTypes.size());
assertThat(vmTypes.stream().map(VmTypeResponse::getValue).collect(Collectors.toSet())).containsExactly("large", "medium");
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.FreeIpaRecommendationResponse in project cloudbreak by hortonworks.
the class FreeIpaRecommendationService method getRecommendation.
public FreeIpaRecommendationResponse getRecommendation(String credentialCrn, String region, String availabilityZone) {
Credential credential = credentialService.getCredentialByCredCrn(credentialCrn);
String defaultInstanceType = defaultInstanceTypeProvider.getForPlatform(credential.getCloudPlatform());
Set<VmTypeResponse> availableVmTypes = getAvailableVmTypes(region, availabilityZone, credential, defaultInstanceType);
return new FreeIpaRecommendationResponse(availableVmTypes, defaultInstanceType);
}
Aggregations