use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithEnvCmConversionShouldNotHappenIfInputCmIsNull.
@Test
void testConvertWithEnvCmConversionShouldNotHappenIfInputCmIsNull() {
distroXV1RequestInput.getCluster().setCm(null);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1RequestWithEnvironment();
assertNotNull(result);
assertNull(result.getCm());
verify(cmConverter, never()).convert(any(ClouderaManagerV1Request.class));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithoutEnvTheNameShouldBeSetToNull.
@Test
void testConvertWithoutEnvTheNameShouldBeSetToNull() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1Request();
assertNotNull(result);
assertNull(result.getName());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithoutEnvCmConversionShouldHappenIfInputCmIsNotNull.
@Test
void testConvertWithoutEnvCmConversionShouldHappenIfInputCmIsNotNull() {
ClouderaManagerV4Request cmConversionResult = new ClouderaManagerV4Request();
when(cmConverter.convert(distroXV1RequestInput.getCluster().getCm())).thenReturn(cmConversionResult);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1Request();
assertNotNull(result);
assertEquals(cmConversionResult, result.getCm());
verify(cmConverter, times(1)).convert(any(ClouderaManagerV1Request.class));
verify(cmConverter, times(1)).convert(distroXV1RequestInput.getCluster().getCm());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithEnvTheCustomContainerShouldBeSetToNull.
@Test
void testConvertWithEnvTheCustomContainerShouldBeSetToNull() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1RequestWithEnvironment();
assertNotNull(result);
assertNull(result.getCustomContainer());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithoutEnvWhenExposedServiceIsEmptyThenAllShouldBeConverted.
@Test
void testConvertWithoutEnvWhenExposedServiceIsEmptyThenAllShouldBeConverted() {
distroXV1RequestInput.getCluster().setExposedServices(new ArrayList<>(0));
GatewayV4Request gr = new GatewayV4Request();
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
when(gatewayConverter.convert(List.of("ALL"))).thenReturn(gr);
ClusterV4Request result = testConvertDistroXV1Request();
assertNotNull(result);
assertEquals(gr, result.getGateway());
verify(gatewayConverter, times(1)).convert(anyList());
verify(gatewayConverter, times(1)).convert(List.of("ALL"));
}
Aggregations