Search in sources :

Example 6 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices in project cloudbreak by hortonworks.

the class GatewayTopologyJsonToExposedServicesConverterTest method testWithSingleExposedService.

@Test
public void testWithSingleExposedService() {
    GatewayTopologyV4Request gatewayTopologyJson = new GatewayTopologyV4Request();
    gatewayTopologyJson.setTopologyName(TOPOLOGY_NAME);
    gatewayTopologyJson.setExposedServices(Collections.singletonList(CLOUDERA_MANAGER_UI));
    when(exposedServiceListValidator.validate(anyList())).thenReturn(new ValidationResultBuilder().build());
    ExposedServices exposedServices = underTest.convert(gatewayTopologyJson);
    assertEquals(1L, exposedServices.getServices().size());
    assertEquals(CLOUDERA_MANAGER_UI, exposedServices.getServices().get(0));
}
Also used : ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) Test(org.junit.Test)

Example 7 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices in project cloudbreak by hortonworks.

the class OpdbServiceEndpointCollectorTest method gatewayTopology.

private GatewayTopology gatewayTopology(String name) {
    GatewayTopologyV4Request gatewayTopologyJson = new GatewayTopologyV4Request();
    gatewayTopologyJson.setTopologyName(name);
    gatewayTopologyJson.setExposedServices(Arrays.asList("HBASEUI", "HBASEJARS", "AVATICA", "CM-UI", "CM-API", "WEBHBASE"));
    ExposedServices exposedServices = exposedServicesConverter.convert(gatewayTopologyJson);
    GatewayTopology gatewayTopology = new GatewayTopology();
    gatewayTopology.setTopologyName(name);
    gatewayTopology.setExposedServices(new Json(exposedServices));
    return gatewayTopology;
}
Also used : GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Json(com.sequenceiq.cloudbreak.common.json.Json)

Example 8 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices in project cloudbreak by hortonworks.

the class ServiceEndpointCollectorTest method gatewayTopology.

private GatewayTopology gatewayTopology(String name, ExposedService... services) {
    GatewayTopologyV4Request gatewayTopologyJson = new GatewayTopologyV4Request();
    gatewayTopologyJson.setTopologyName(name);
    gatewayTopologyJson.setExposedServices(Arrays.stream(services).map(ExposedService::getKnoxService).collect(Collectors.toList()));
    ExposedServices exposedServices = exposedServicesConverter.convert(gatewayTopologyJson);
    GatewayTopology gatewayTopology = new GatewayTopology();
    gatewayTopology.setTopologyName(name);
    gatewayTopology.setExposedServices(new Json(exposedServices));
    return gatewayTopology;
}
Also used : ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Json(com.sequenceiq.cloudbreak.common.json.Json)

Example 9 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices in project cloudbreak by hortonworks.

the class GatewayTopologyToGatewayTopologyJsonConverterTest method testConvert.

@Test
public void testConvert() {
    String topologyName = "topology1";
    GatewayTopology gatewayTopology = new GatewayTopology();
    gatewayTopology.setTopologyName(topologyName);
    ExposedServices exposedServices = new ExposedServices();
    exposedServices.setServices(List.of("SERVICE1", "SERVICE2"));
    gatewayTopology.setExposedServices(new Json(exposedServices));
    GatewayTopologyV4Request result = underTest.convert(gatewayTopology);
    assertEquals(topologyName, result.getTopologyName());
    assertEquals(2, result.getExposedServices().size());
    assertTrue(result.getExposedServices().containsAll(List.of("SERVICE1", "SERVICE2")));
}
Also used : GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Json(com.sequenceiq.cloudbreak.common.json.Json) Test(org.junit.Test)

Example 10 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices in project cloudbreak by hortonworks.

the class GatewayTopologyToGatewayTopologyV4ResponseConverterTest method testConvertWithNoServicesAndEmptyList.

@Test
public void testConvertWithNoServicesAndEmptyList() throws IOException {
    GatewayTopology source = mock(GatewayTopology.class);
    when(source.getTopologyName()).thenReturn(TOPOLOGY);
    ExposedServices exposedServices = mock(ExposedServices.class);
    List<String> services = Collections.emptyList();
    when(exposedServices.getServices()).thenReturn(services);
    Json json = mock(Json.class);
    when(json.get(ExposedServices.class)).thenReturn(exposedServices);
    when(json.getValue()).thenReturn("{}");
    when(source.getExposedServices()).thenReturn(json);
    GatewayTopologyV4Response result = underTest.convert(source);
    assertNotNull(result);
    assertEquals(TOPOLOGY, result.getTopologyName());
    assertEquals(services, result.getExposedServices());
}
Also used : ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Json(com.sequenceiq.cloudbreak.common.json.Json) GatewayTopologyV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.topology.GatewayTopologyV4Response) Test(org.junit.Test)

Aggregations

ExposedServices (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices)14 GatewayTopology (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology)9 Json (com.sequenceiq.cloudbreak.common.json.Json)7 Test (org.junit.Test)7 GatewayTopologyV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request)5 GatewayTopologyV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.topology.GatewayTopologyV4Response)3 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)2 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)2 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)2 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)2 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)2 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)2 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)2 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)2 ValidationResultBuilder (com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder)2 ExposedService (com.sequenceiq.cloudbreak.api.service.ExposedService)1 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)1 HashMap (java.util.HashMap)1