Search in sources :

Example 16 with GatewayV4Request

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;
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)

Example 17 with GatewayV4Request

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);
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) Test(org.junit.Test)

Example 18 with GatewayV4Request

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());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Test(org.junit.Test)

Example 19 with GatewayV4Request

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());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Test(org.junit.Test)

Example 20 with GatewayV4Request

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);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Aggregations

GatewayV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)27 Test (org.junit.Test)15 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)13 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)7 Test (org.junit.jupiter.api.Test)6 GatewayTopologyV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request)5 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)4 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)4 GatewayTopology (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1