use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class GatewayManifester method configureGatewayForSdxCluster.
public StackV4Request configureGatewayForSdxCluster(StackV4Request stackV4Request) {
if (stackV4Request.getCluster().getGateway() == null) {
GatewayV4Request gatewayV4Request = new GatewayV4Request();
gatewayV4Request.setTopologies(List.of(getGatewayTopologyV4Request()));
gatewayV4Request.setSsoType(defaultSsoType);
stackV4Request.getCluster().setGateway(gatewayV4Request);
LOGGER.info("Configured gateway for SDX {}", stackV4Request.getName());
}
return stackV4Request;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToGatewayConverterTest method testWithInvalidGatewayRequest.
@Test(expected = BadRequestException.class)
public void testWithInvalidGatewayRequest() {
GatewayV4Request gatewayJson = new GatewayV4Request();
StackV4Request source = generateStackV4Request(gatewayJson);
when(gatewayJsonValidator.validate(gatewayJson)).thenReturn(ValidationResult.builder().error("invalid").build());
underTest.convert(source);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class GatewayConvertUtilTest method testGatewayPathConversionWhenPathIsInGatewayJson.
@Test
public void testGatewayPathConversionWhenPathIsInGatewayJson() {
Gateway gateway = new Gateway();
String gatewayPath = "gatewayPath";
GatewayV4Request gatewayJson = new GatewayV4Request();
gatewayJson.setPath(gatewayPath);
underTest.setGatewayPathAndSsoProvider(gatewayJson, gateway);
assertEquals('/' + gateway.getPath() + "/sso/api/v1/websso", gateway.getSsoProvider());
assertEquals(gatewayPath, gateway.getPath());
assertEquals('/' + gateway.getPath() + "/sso/api/v1/websso", gateway.getSsoProvider());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class GatewayConvertUtilTest method testSetMultipleTopologies.
@Test
public void testSetMultipleTopologies() {
GatewayV4Request source = new GatewayV4Request();
GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
topology1.setTopologyName("topology1");
topology1.setExposedServices(Collections.singletonList("AMBARI"));
GatewayTopologyV4Request topology2 = new GatewayTopologyV4Request();
topology2.setTopologyName("topology2");
topology2.setExposedServices(Collections.singletonList("ALL"));
source.setTopologies(Arrays.asList(topology1, topology2));
Gateway result = new Gateway();
when(gatewayTopologyV4RequestToGatewayTopologyConverter.convert(any())).thenReturn(new GatewayTopology());
underTest.setTopologies(source, result);
verify(gatewayTopologyV4RequestToGatewayTopologyConverter, times(2)).convert(any());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverterTest method testConvertWhenGatewayExists.
@Test
public void testConvertWhenGatewayExists() {
String clusterName = "cluster-name";
ClusterV4Request source = new ClusterV4Request();
GatewayV4Request gatewayJson = new GatewayV4Request();
source.setGateway(gatewayJson);
source.setBlueprintName(BLUEPRINT);
when(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq(BLUEPRINT), any())).thenReturn(blueprint);
Gateway gateway = new Gateway();
when(gatewayV4RequestToGatewayConverter.convert(gatewayJson)).thenReturn(gateway);
Cluster actual = underTest.convert(source);
assertThat(actual.getGateway(), is(gateway));
verify(gatewayV4RequestToGatewayConverter, times(1)).convert(gatewayJson);
}
Aggregations