Search in sources :

Example 21 with Gateway

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

the class ClusterRequestToClusterConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    ClusterV4Request request = getRequest("cluster.json");
    Blueprint blueprint = new Blueprint();
    blueprint.setStackType(StackType.HDP.name());
    given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
    given(gatewayV4RequestToGatewayConverter.convert(request.getGateway())).willReturn(new Gateway());
    // WHEN
    Cluster result = underTest.convert(request);
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "fileSystem", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "configStrategy", "extendedBlueprintText", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "customConfigurations"));
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AbstractJsonConverterTest(com.sequenceiq.cloudbreak.converter.AbstractJsonConverterTest) Test(org.junit.jupiter.api.Test)

Example 22 with Gateway

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

the class ClusterRequestToClusterConverterTest method testConvertWithCloudStorageDetails.

@Test
public void testConvertWithCloudStorageDetails() {
    // GIVEN
    ClusterV4Request request = getRequest("cluster-with-cloud-storage.json");
    given(gatewayV4RequestToGatewayConverter.convert(request.getGateway())).willReturn(new Gateway());
    given(cloudStorageConverter.requestToFileSystem(request.getCloudStorage())).willReturn(new FileSystem());
    given(cloudStorageValidationUtil.isCloudStorageConfigured(request.getCloudStorage())).willReturn(true);
    Blueprint blueprint = new Blueprint();
    blueprint.setStackType(StackType.HDP.name());
    given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
    // WHEN
    Cluster result = ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.convert(request));
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "extendedBlueprintText", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "configStrategy", "customConfigurations"));
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AbstractJsonConverterTest(com.sequenceiq.cloudbreak.converter.AbstractJsonConverterTest) Test(org.junit.jupiter.api.Test)

Example 23 with Gateway

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

the class ClusterToClusterV4ResponseConverterTest method createSource.

@Override
public Cluster createSource() {
    Stack stack = TestUtil.stack();
    Blueprint blueprint = TestUtil.blueprint();
    Cluster cluster = TestUtil.cluster(blueprint, stack, 1L);
    cluster.setProxyConfigCrn("test-CRN");
    stack.setCluster(cluster);
    Gateway gateway = new Gateway();
    cluster.setGateway(gateway);
    return cluster;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 24 with Gateway

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

the class ClusterRequestToGatewayConverterTest method testConvertNewTopologies.

@Test
public void testConvertNewTopologies() {
    GatewayV4Request source = new GatewayV4Request();
    GatewayTopologyV4Request topology1 = new GatewayTopologyV4Request();
    topology1.setTopologyName("topology1");
    source.setTopologies(Collections.singletonList(topology1));
    Gateway result = underTest.convert(source);
    assertFalse(result.getTopologies().isEmpty());
}
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) Test(org.junit.Test)

Example 25 with Gateway

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

the class ClusterRequestToGatewayConverterTest method testConvertSsoType.

@Test
public void testConvertSsoType() {
    GatewayV4Request source = new GatewayV4Request();
    source.setTopologies(getTopologies());
    Gateway result = underTest.convert(source);
    assertEquals(SSOType.NONE, result.getSsoType());
}
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)

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