Search in sources :

Example 1 with GatewayV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.

the class GatewayConvertUtilTest method testGatewayPathConversionWhenNoPathInGatewayJson.

@Test
public void testGatewayPathConversionWhenNoPathInGatewayJson() {
    Gateway gateway = new Gateway();
    GatewayV4Request gatewayJson = new GatewayV4Request();
    underTest.setGatewayPathAndSsoProvider(gatewayJson, gateway);
    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 2 with GatewayV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.

the class GatewayV4RequestValidatorTest method testValidationWithNameDuplicates.

@Test
public void testValidationWithNameDuplicates() {
    GatewayV4Request gatewayJson = new GatewayV4Request();
    GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
    topology1.setTopologyName("Apple");
    GatewayTopologyV4Request topology2 = new GatewayTopologyV4Request();
    topology2.setTopologyName("Apple");
    GatewayTopologyV4Request topology3 = new GatewayTopologyV4Request();
    topology3.setTopologyName("Banana");
    gatewayJson.setTopologies(Arrays.asList(topology1, topology2, topology3));
    ValidationResult result = underTest.validate(gatewayJson);
    assertEquals(State.ERROR, result.getState());
    assertTrue(result.getFormattedErrors().contains("Apple"));
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.Test)

Example 3 with GatewayV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.

the class GatewayV4RequestValidatorTest method testValidationWithoutNameDuplicates.

@Test
public void testValidationWithoutNameDuplicates() {
    GatewayV4Request gatewayJsonV4Request = new GatewayV4Request();
    GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
    topology1.setTopologyName("Apple");
    GatewayTopologyV4Request topology2 = new GatewayTopologyV4Request();
    topology2.setTopologyName("Banana");
    GatewayTopologyV4Request topology3 = new GatewayTopologyV4Request();
    topology3.setTopologyName("Citrone");
    gatewayJsonV4Request.setTopologies(Arrays.asList(topology1, topology2, topology3));
    ValidationResult result = underTest.validate(gatewayJsonV4Request);
    assertEquals(State.VALID, result.getState());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.Test)

Example 4 with GatewayV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.

the class GatewayV1ToGatewayV4Converter method convert.

public GatewayV4Request convert(List<String> exposedServices) {
    GatewayV4Request gatewayV4Request = new GatewayV4Request();
    gatewayV4Request.setTopologies(getIfNotNull(exposedServices, this::topologies));
    gatewayV4Request.setSsoType(ssoType);
    return gatewayV4Request;
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)

Example 5 with GatewayV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request in project cloudbreak by hortonworks.

the class StackV4RequestToGatewayConverterTest method generateStackV4Request.

private StackV4Request generateStackV4Request(GatewayV4Request gateWayJson) {
    ClusterV4Request clusterRequest = new ClusterV4Request();
    clusterRequest.setGateway(gateWayJson);
    StackV4Request source = new StackV4Request();
    source.setName("funnyCluster");
    source.setCluster(clusterRequest);
    return source;
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)

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