use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway in project cloudbreak by hortonworks.
the class ServiceEndpointCollector method getHiveJdbcUrlFromGatewayTopology.
private String getHiveJdbcUrlFromGatewayTopology(String managerIp, GatewayTopology gt, SecurityConfig securityConfig) {
Gateway gateway = gt.getGateway();
String jdbcAddressPart = "jdbc:hive2://%s/;";
if (!gatewayListeningOnHttpsPort(gateway)) {
jdbcAddressPart = "jdbc:hive2://%s:" + gateway.getGatewayPort() + "/;";
}
if (securityConfig != null && securityConfig.getUserFacingCert() != null) {
return String.format(jdbcAddressPart + "ssl=true;transportMode=http;httpPath=%s/%s%s/hive", managerIp, gateway.getPath(), gt.getTopologyName(), API_TOPOLOGY_POSTFIX);
}
return String.format(jdbcAddressPart + "ssl=true;sslTrustStore=/cert/gateway.jks;trustStorePassword=${GATEWAY_JKS_PASSWORD};" + "transportMode=http;httpPath=%s/%s%s/hive", managerIp, gateway.getPath(), gt.getTopologyName(), API_TOPOLOGY_POSTFIX);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway in project cloudbreak by hortonworks.
the class ServiceEndpointCollector method getHBaseUIUrlWithHostParameterFromGatewayTopology.
private String getHBaseUIUrlWithHostParameterFromGatewayTopology(String managerIp, GatewayTopology gt, String hbaseMasterPrivateIp) {
Gateway gateway = gt.getGateway();
ExposedService hbaseUi = exposedServiceCollector.getHBaseUIService();
if (gatewayListeningOnHttpsPort(gateway)) {
return String.format("https://%s/%s/%s%s?host=%s&port=%s", managerIp, gateway.getPath(), gt.getTopologyName(), hbaseUi.getKnoxUrl(), hbaseMasterPrivateIp, hbaseUi.getPort());
} else {
return String.format("https://%s:%s/%s/%s%s?host=%s&port=%s", managerIp, gateway.getGatewayPort(), gateway.getPath(), gt.getTopologyName(), hbaseUi.getKnoxUrl(), hbaseMasterPrivateIp, hbaseUi.getPort());
}
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway in project cloudbreak by hortonworks.
the class GatewayConvertUtilTest method testGatewayPathConversionWhenPathIsInGatewayJson.
@Test
public void testGatewayPathConversionWhenPathIsInGatewayJson() {
Gateway gateway = new Gateway();
String gatewayPath = "gatewayPath";
GatewayV4Request gatewayJson = new GatewayV4Request();
gatewayJson.setPath(gatewayPath);
underTest.setGatewayPathAndSsoProvider(gatewayJson, gateway);
assertEquals('/' + gateway.getPath() + "/sso/api/v1/websso", gateway.getSsoProvider());
assertEquals(gatewayPath, gateway.getPath());
assertEquals('/' + gateway.getPath() + "/sso/api/v1/websso", gateway.getSsoProvider());
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway in project cloudbreak by hortonworks.
the class GatewayConvertUtilTest method testSetMultipleTopologies.
@Test
public void testSetMultipleTopologies() {
GatewayV4Request source = new GatewayV4Request();
GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
topology1.setTopologyName("topology1");
topology1.setExposedServices(Collections.singletonList("AMBARI"));
GatewayTopologyV4Request topology2 = new GatewayTopologyV4Request();
topology2.setTopologyName("topology2");
topology2.setExposedServices(Collections.singletonList("ALL"));
source.setTopologies(Arrays.asList(topology1, topology2));
Gateway result = new Gateway();
when(gatewayTopologyV4RequestToGatewayTopologyConverter.convert(any())).thenReturn(new GatewayTopology());
underTest.setTopologies(source, result);
verify(gatewayTopologyV4RequestToGatewayTopologyConverter, times(2)).convert(any());
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverterTest method testConvertWhenGatewayExists.
@Test
public void testConvertWhenGatewayExists() {
String clusterName = "cluster-name";
ClusterV4Request source = new ClusterV4Request();
GatewayV4Request gatewayJson = new GatewayV4Request();
source.setGateway(gatewayJson);
source.setBlueprintName(BLUEPRINT);
when(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq(BLUEPRINT), any())).thenReturn(blueprint);
Gateway gateway = new Gateway();
when(gatewayV4RequestToGatewayConverter.convert(gatewayJson)).thenReturn(gateway);
Cluster actual = underTest.convert(source);
assertThat(actual.getGateway(), is(gateway));
verify(gatewayV4RequestToGatewayConverter, times(1)).convert(gatewayJson);
}
Aggregations