use of com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse in project cloudbreak by hortonworks.
the class SdxRecommendationServiceTest method createEnvironment.
private DetailedEnvironmentResponse createEnvironment(String cloudPlatform) {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
CredentialResponse credential = new CredentialResponse();
credential.setCrn("cred");
environment.setCredential(credential);
CompactRegionResponse regions = new CompactRegionResponse();
regions.setNames(List.of("eu-central-1"));
environment.setRegions(regions);
environment.setCloudPlatform(cloudPlatform);
return environment;
}
use of com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse in project cloudbreak by hortonworks.
the class DistroXV1RequestToStackV4RequestConverterTest method createCompactRegionResponse.
private CompactRegionResponse createCompactRegionResponse() {
CompactRegionResponse regionResponse = new CompactRegionResponse();
regionResponse.setNames(List.of("myregion"));
return regionResponse;
}
use of com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method getEnvironmentResponse.
private DetailedEnvironmentResponse getEnvironmentResponse() {
DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
environmentResponse.setCloudPlatform("AWS");
environmentResponse.setCredential(new CredentialResponse());
CompactRegionResponse compactRegionResponse = new CompactRegionResponse();
compactRegionResponse.setNames(Lists.newArrayList("region1"));
environmentResponse.setRegions(compactRegionResponse);
return environmentResponse;
}
use of com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testValidateShouldBeSuccessWhenStackRegionIsRegionDisplayNameAndEnvironmentsRegionsAreRegionNames.
@Test
void testValidateShouldBeSuccessWhenStackRegionIsRegionDisplayNameAndEnvironmentsRegionsAreRegionNames() {
// GIVEN
String westUs2RegionName = "westus2";
String westUs2RegionDisplayName = "West US 2";
Stack stack = getStack();
stack.setRegion(westUs2RegionDisplayName);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
CompactRegionResponse regions = new CompactRegionResponse();
regions.getNames().add(westUs2RegionName);
regions.getNames().add("westus");
environment.setRegions(regions);
when(connector.displayNameToRegion(any())).thenReturn(westUs2RegionName);
when(connector.regionToDisplayName(any())).thenReturn(westUs2RegionDisplayName);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validate(stack, environment, true, validationBuilder);
// THEN
ValidationResult actualResult = validationBuilder.build();
assertFalse(actualResult.hasError());
}
use of com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testValidateShouldBeSuccessWhenStackRegionIsRegionNameAndEnvironmentsRegionsAreDisplayNames.
@Test
void testValidateShouldBeSuccessWhenStackRegionIsRegionNameAndEnvironmentsRegionsAreDisplayNames() {
// GIVEN
String westUs2RegionName = "westus2";
String westUs2RegionDisplayName = "West US 2";
Stack stack = getStack();
stack.setRegion(westUs2RegionName);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
CompactRegionResponse regions = new CompactRegionResponse();
regions.getNames().add(westUs2RegionDisplayName);
regions.getNames().add("West US");
environment.setRegions(regions);
when(connector.displayNameToRegion(any())).thenReturn(westUs2RegionName);
when(connector.regionToDisplayName(any())).thenReturn(westUs2RegionDisplayName);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validate(stack, environment, true, validationBuilder);
// THEN
ValidationResult actualResult = validationBuilder.build();
assertFalse(actualResult.hasError());
}
Aggregations