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