Search in sources :

Example 46 with Gateway

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);
}
Also used : Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)

Example 47 with Gateway

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());
    }
}
Also used : Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService)

Example 48 with Gateway

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());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Test(org.junit.Test)

Example 49 with Gateway

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());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) GatewayTopologyV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.topology.GatewayTopologyV4Request) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) Test(org.junit.Test)

Example 50 with Gateway

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);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Aggregations

Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)69 Test (org.junit.Test)30 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)20 HashSet (java.util.HashSet)17 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)15 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)15 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)15 GatewayV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)13 ExposedService (com.sequenceiq.cloudbreak.api.service.ExposedService)12 GatewayTopology (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology)12 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)11 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)11 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)10 IOException (java.io.IOException)10 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)8 ArrayList (java.util.ArrayList)8 Json (com.sequenceiq.cloudbreak.common.json.Json)7 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)7 ExposedServices (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices)7