use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request 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"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class ClusterRequestToClusterConverterTest method testNoGateway.
@Test
public void testNoGateway() {
// GIVEN
Blueprint blueprint = new Blueprint();
blueprint.setStackType(StackType.HDP.name());
given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
// WHEN
ClusterV4Request clusterRequest = getRequest("cluster-no-gateway.json");
Cluster result = underTest.convert(clusterRequest);
// THEN
assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "fileSystem", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "configStrategy", "extendedBlueprintText", "gateway", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "customConfigurations"));
assertNull(result.getGateway());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request 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"));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class SdxServiceTest method testCreateInternalSdxClusterWithCustomInstanceGroupShouldFail.
@Test
void testCreateInternalSdxClusterWithCustomInstanceGroupShouldFail() {
when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
StackV4Request stackV4Request = new StackV4Request();
ClusterV4Request clusterV4Request = new ClusterV4Request();
stackV4Request.setCluster(clusterV4Request);
SdxClusterRequest sdxClusterRequest = createSdxClusterRequest("7.2.12", CUSTOM);
withCustomInstanceGroups(sdxClusterRequest);
mockEnvironmentCall(sdxClusterRequest, CloudPlatform.AWS, null);
BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, stackV4Request));
assertEquals("Custom instance group is not accepted on SDX Internal API.", badRequestException.getMessage());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class GatewayManifesterTest method prepareGatewayWhenRequestedHasValueForGatewayShouldReturnWithoutModifications.
@Test
void prepareGatewayWhenRequestedHasValueForGatewayShouldReturnWithoutModifications() {
GatewayV4Request gatewayV4Request = getGatewayV4Request();
StackV4Request stackV4Request = new StackV4Request();
stackV4Request.setCluster(new ClusterV4Request());
stackV4Request.getCluster().setGateway(gatewayV4Request);
underTest.configureGatewayForSdxCluster(stackV4Request);
isTrue(stackV4Request.getCluster().getGateway().equals(gatewayV4Request));
}
Aggregations