Search in sources :

Example 26 with GatewayV4Request

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

the class GatewayToGatewayV4RequestConverter method convert.

public GatewayV4Request convert(Gateway gateway) {
    GatewayV4Request gatewayJson = new GatewayV4Request();
    gatewayJson.setPath(gateway.getPath());
    gatewayJson.setTokenCert(gateway.getTokenCert());
    gatewayJson.setSsoProvider(gateway.getSsoProvider());
    gatewayJson.setSsoType(gateway.getSsoType());
    gatewayJson.setGatewayType(gateway.getGatewayType());
    gatewayJson.setTopologies(convertTopologies(gateway, gatewayJson));
    return gatewayJson;
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)

Example 27 with GatewayV4Request

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

the class StackV4RequestToGatewayConverter method convert.

public Gateway convert(StackV4Request source) {
    Gateway gateway = new Gateway();
    GatewayV4Request gatewayJson = source.getCluster().getGateway();
    ValidationResult validationResult = gatewayJsonValidator.validate(gatewayJson);
    if (validationResult.hasError()) {
        throw new BadRequestException(validationResult.getFormattedErrors());
    }
    convertUtil.setBasicProperties(gatewayJson, gateway);
    convertUtil.setTopologies(gatewayJson, gateway);
    convertUtil.setGatewayPathAndSsoProvider(gatewayJson, gateway);
    return gateway;
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult)

Example 28 with GatewayV4Request

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

the class GatewayV4RequestValidatorTest method testValidationWithMissingTopology.

@Test
public void testValidationWithMissingTopology() {
    GatewayV4Request gatewayJson = new GatewayV4Request();
    ValidationResult result = underTest.validate(gatewayJson);
    assertEquals(State.ERROR, result.getState());
    assertTrue(result.getFormattedErrors().contains("No topology is defined in gateway request."));
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.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