Search in sources :

Example 6 with CompactRegionResponse

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;
}
Also used : CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) CredentialResponse(com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse)

Example 7 with CompactRegionResponse

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;
}
Also used : CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse)

Example 8 with CompactRegionResponse

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;
}
Also used : CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) CredentialResponse(com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse)

Example 9 with CompactRegionResponse

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());
}
Also used : CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with CompactRegionResponse

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());
}
Also used : CompactRegionResponse(com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

CompactRegionResponse (com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse)12 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)5 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)4 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)4 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)4 Test (org.junit.jupiter.api.Test)4 CredentialResponse (com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse)3 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)2 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)2 FreeIpaResponse (com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse)2 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)2 EnumSource (org.junit.jupiter.params.provider.EnumSource)2 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 ExtendedCloudCredential (com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential)1 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1