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;
}
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;
}
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."));
}
Aggregations