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