Search in sources :

Example 21 with StackV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.

the class DatalakeServiceTest method testGetDatalakeCrnHasResult.

@Test
public void testGetDatalakeCrnHasResult() {
    StackV4Request source = new StackV4Request();
    Workspace workspace = new Workspace();
    source.setSharedService(new SharedServiceV4Request());
    source.getSharedService().setDatalakeName("name");
    Stack output = new Stack();
    output.setResourceCrn("resultCrn");
    when(stackService.findStackByNameOrCrnAndWorkspaceId(any(), any())).thenReturn(Optional.of(output));
    String res = underTest.getDatalakeCrn(source, workspace);
    Assertions.assertTrue("resultCrn".equals(res));
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) SharedServiceV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.sharedservice.SharedServiceV4Request) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 22 with StackV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.

the class DatalakeServiceTest method testPrepareDatalakeRequestWhenDatalakeCrnIsNotNull.

@Test
public void testPrepareDatalakeRequestWhenDatalakeCrnIsNotNull() {
    Stack source = new Stack();
    source.setDatalakeCrn("crn");
    StackV4Request x = new StackV4Request();
    lenient().when(stackService.getResourceBasicViewByResourceCrn(anyString())).thenReturn(Optional.empty());
    underTest.prepareDatalakeRequest(source, x);
    verify(stackService, times(1)).getResourceBasicViewByResourceCrn("crn");
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 23 with StackV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.

the class YcloudHybridCloudTest method validateRequestParameters.

private SdxInternalTestDto validateRequestParameters(TestContext tc, SdxInternalTestDto dto, SdxClient client) {
    assertNotNull(dto);
    SdxInternalClusterRequest sdxRequest = dto.getRequest();
    assertNotNull(sdxRequest);
    StackV4Request stackRequest = sdxRequest.getStackV4Request();
    assertNotNull(stackRequest);
    ClusterV4Request clusterRequest = stackRequest.getCluster();
    assertNotNull(clusterRequest);
    ClouderaManagerV4Request cmRequest = clusterRequest.getCm();
    assertNotNull(cmRequest);
    validateInstanceGroups(stackRequest.getInstanceGroups());
    validateRepository(cmRequest.getRepository());
    validateProducts(cmRequest.getProducts());
    return dto;
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) SdxInternalClusterRequest(com.sequenceiq.sdx.api.model.SdxInternalClusterRequest) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)

Example 24 with StackV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.

the class LoadBalancerConfigServiceTest method testCreateLoadBalancersForEndpointGatewayDatalakePublicSubnetsOnly.

@Test
public void testCreateLoadBalancersForEndpointGatewayDatalakePublicSubnetsOnly() {
    Stack stack = createAwsStack(StackType.DATALAKE, PUBLIC_ID_1);
    CloudSubnet subnet = getPublicCloudSubnet(PUBLIC_ID_1, AZ_1);
    DetailedEnvironmentResponse environment = createEnvironment(subnet, true, "AWS");
    StackV4Request request = new StackV4Request();
    request.setEnableLoadBalancer(false);
    when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
    when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(subnet));
    ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
        Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
        assertEquals(1, loadBalancers.size());
        assertEquals(LoadBalancerType.PUBLIC, loadBalancers.iterator().next().getType());
    });
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) LoadBalancer(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) SubnetTest(com.sequenceiq.cloudbreak.core.network.SubnetTest) Test(org.junit.Test)

Example 25 with StackV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.

the class LoadBalancerConfigServiceTest method testCreateLoadBalancerForYarn.

@Test
public void testCreateLoadBalancerForYarn() {
    Stack stack = createYarnStack();
    CloudSubnet subnet = getPublicCloudSubnet(PUBLIC_ID_1, AZ_1);
    DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AWS");
    StackV4Request request = new StackV4Request();
    request.setEnableLoadBalancer(false);
    when(entitlementService.datalakeLoadBalancerEnabled(anyString())).thenReturn(true);
    when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
    ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
        Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
        assertEquals(1, loadBalancers.size());
        assertEquals(LoadBalancerType.PUBLIC, loadBalancers.iterator().next().getType());
    });
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) LoadBalancer(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) SubnetTest(com.sequenceiq.cloudbreak.core.network.SubnetTest) Test(org.junit.Test)

Aggregations

StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)105 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)66 Test (org.junit.jupiter.api.Test)58 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)52 InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)36 Test (org.junit.Test)36 LoadBalancer (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer)34 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)33 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)33 SubnetTest (com.sequenceiq.cloudbreak.core.network.SubnetTest)32 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)31 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)17 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)14 Map (java.util.Map)13 Set (java.util.Set)13 Optional (java.util.Optional)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)12 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)11 HashMap (java.util.HashMap)11 List (java.util.List)11