use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToGatewayConverterTest method shouldCreateCorrectSsoUrlWhenClusterNameisProvided.
@Test
public void shouldCreateCorrectSsoUrlWhenClusterNameisProvided() {
GatewayV4Request gatewayJson = new GatewayV4Request();
gatewayJson.setPath("funnyPath");
gatewayJson.setTopologies(Arrays.asList(getGatewayTopologyV4Request()));
StackV4Request source = generateStackV4Request(gatewayJson);
when(gatewayJsonValidator.validate(gatewayJson)).thenReturn(ValidationResult.builder().build());
doAnswer(i -> {
Gateway gw = i.getArgument(1);
gw.setSsoProvider("SSOPROVIDER");
gw.setPath(gatewayJson.getPath());
gw.setTopologies(GATEWAY_TOPOLOGY);
gw.setGatewayType(GatewayType.CENTRAL);
return null;
}).when(convertUtil).setBasicProperties(eq(gatewayJson), any(Gateway.class));
Gateway result = underTest.convert(source);
assertEquals("SSOPROVIDER", result.getSsoProvider());
assertEquals("funnyPath", result.getPath());
assertTrue(EqualsBuilder.reflectionEquals(GATEWAY_TOPOLOGY, result.getTopologies()));
assertEquals(GatewayType.CENTRAL, result.getGatewayType());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenGatewayExistsInStack.
@Test
public void testConvertWhenGatewayExistsInStack() {
when(stackV4RequestToGatewayConverter.convert(source)).thenReturn(new Gateway());
when(cluster.getGateway()).thenReturn(new GatewayV4Request());
TemplatePreparationObject result = underTest.convert(source);
assertNotNull(result.getGatewayView());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request 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"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithoutEnvWhenExposedServiceIsNotEmptyThenItShouldBeConverted.
@Test
void testConvertWithoutEnvWhenExposedServiceIsNotEmptyThenItShouldBeConverted() {
GatewayV4Request gr = new GatewayV4Request();
when(gatewayConverter.convert(distroXV1RequestInput.getCluster().getExposedServices())).thenReturn(gr);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1Request();
assertNotNull(result);
assertEquals(gr, result.getGateway());
verify(gatewayConverter, times(1)).convert(anyList());
verify(gatewayConverter, times(1)).convert(distroXV1RequestInput.getCluster().getExposedServices());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class ClusterRequestToGatewayConverterTest method testConvertNewTopologies.
@Test
public void testConvertNewTopologies() {
GatewayV4Request source = new GatewayV4Request();
GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
topology1.setTopologyName("topology1");
source.setTopologies(Collections.singletonList(topology1));
Gateway result = underTest.convert(source);
assertFalse(result.getTopologies().isEmpty());
}
Aggregations