Search in sources :

Example 6 with StackV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.StackV2Request in project cloudbreak by hortonworks.

the class StackV2RequestToStackRequestConverter method convertClusterRequest.

private void convertClusterRequest(StackV2Request source, StackRequest stackRequest) {
    if (source.getCluster() != null) {
        stackRequest.setClusterRequest(conversionService.convert(source.getCluster(), ClusterRequest.class));
        for (InstanceGroupV2Request instanceGroupV2Request : source.getInstanceGroups()) {
            HostGroupRequest convert = conversionService.convert(instanceGroupV2Request, HostGroupRequest.class);
            stackRequest.getClusterRequest().getHostGroups().add(convert);
        }
        stackRequest.getClusterRequest().setName(source.getGeneral().getName());
    }
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest) HostGroupRequest(com.sequenceiq.cloudbreak.api.model.HostGroupRequest)

Example 7 with StackV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.StackV2Request in project cloudbreak by hortonworks.

the class GeneralClusterConfigsProvider method generalClusterConfigs.

public GeneralClusterConfigs generalClusterConfigs(StackV2Request stack, IdentityUser identityUser) {
    boolean gatewayInstanceMetadataPresented = false;
    boolean instanceMetadataPresented = false;
    int nodeCount = 0;
    for (InstanceGroupV2Request instanceGroupV2Request : stack.getInstanceGroups()) {
        nodeCount += instanceGroupV2Request.getNodeCount();
    }
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setIdentityUserEmail(identityUser.getUsername());
    generalClusterConfigs.setAmbariIp("pendign...");
    generalClusterConfigs.setInstanceGroupsPresented(instanceMetadataPresented);
    generalClusterConfigs.setPassword(stack.getCluster().getAmbari().getPassword());
    generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented);
    generalClusterConfigs.setClusterName(stack.getGeneral().getName());
    generalClusterConfigs.setExecutorType(stack.getCluster().getExecutorType());
    generalClusterConfigs.setStackName(stack.getGeneral().getName());
    generalClusterConfigs.setUuid("pending...");
    generalClusterConfigs.setUserName(stack.getCluster().getAmbari().getUserName());
    generalClusterConfigs.setNodeCount(nodeCount);
    generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.ofNullable("pending..."));
    return generalClusterConfigs;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)

Example 8 with StackV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.StackV2Request in project cloudbreak by hortonworks.

the class MockScalingTest method testStackScaling.

@Test
@Parameters({ "hostGroup", "desiredCount", "checkAmbari" })
public void testStackScaling(String hostGroup, int desiredCount, @Optional("false") boolean checkAmbari) throws Exception {
    // GIVEN
    // WHEN
    super.testStackScaling(hostGroup, desiredCount, checkAmbari);
    // THEN
    ScalingMock scalingMock = getItContext().getContextParam(CloudbreakV2Constants.MOCK_SERVER, ScalingMock.class);
    String clusterName = getItContext().getContextParam(CloudbreakV2Constants.STACK_NAME);
    String stackId = getItContext().getContextParam(CloudbreakITContextConstants.STACK_ID);
    StackV2Request stackV2Request = getItContext().getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    boolean securityEnabled = stackV2Request.getCluster().getAmbari().getEnableSecurity();
    scalingMock.verifyV2Calls(clusterName, ScalingUtil.getNodeCountStack(getCloudbreakClient().stackV2Endpoint(), stackId), securityEnabled);
}
Also used : StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) StackScalingV2Test(com.sequenceiq.it.cloudbreak.v2.StackScalingV2Test)

Example 9 with StackV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.StackV2Request in project cloudbreak by hortonworks.

the class AbstractStackCreationV2Test method createStackRequest.

@BeforeMethod(groups = "V2StackCreationInit")
@Parameters({ "stackName", "credentialName", "region", "availabilityZone", "imageCatalog", "imageId" })
public void createStackRequest(String stackName, @Optional("") String credentialName, @Optional("") String region, @Optional("") String availabilityZone, @Optional("") String imageCatalog, @Optional("") String imageId) {
    IntegrationTestContext itContext = getItContext();
    credentialName = StringUtils.hasText(credentialName) ? credentialName : itContext.getContextParam(CloudbreakV2Constants.CREDENTIAL_NAME);
    region = StringUtils.hasText(region) ? region : itContext.getContextParam(CloudbreakV2Constants.REGION);
    availabilityZone = StringUtils.hasText(availabilityZone) ? availabilityZone : itContext.getContextParam(CloudbreakV2Constants.AVAILABILTYZONE);
    imageCatalog = StringUtils.hasText(imageCatalog) ? imageCatalog : itContext.getContextParam(CloudbreakV2Constants.IMAGECATALOG);
    imageId = StringUtils.hasText(imageId) ? imageId : itContext.getContextParam(CloudbreakV2Constants.IMAGEID);
    Map<String, InstanceGroupV2Request> instanceGroupV2RequestMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
    Assert.assertTrue(StringUtils.hasText(credentialName), "Credential name is mandatory.");
    Assert.assertTrue(StringUtils.hasText(region), "Region is mandatory.");
    Assert.assertTrue(StringUtils.hasText(availabilityZone), "AvailabilityZone is mandatory.");
    Assert.assertNotNull(instanceGroupV2RequestMap, "InstanceGroup map is mandatory");
    StackV2Request stackV2Request = new StackV2Request();
    GeneralSettings gs = new GeneralSettings();
    stackV2Request.setGeneral(gs);
    gs.setName(stackName);
    gs.setCredentialName(credentialName);
    PlacementSettings ps = new PlacementSettings();
    stackV2Request.setPlacement(ps);
    ps.setRegion(region);
    ps.setAvailabilityZone(availabilityZone);
    if (StringUtils.hasText(imageCatalog) || StringUtils.hasText(imageId)) {
        ImageSettings is = new ImageSettings();
        is.setImageCatalog(imageCatalog);
        is.setImageId(imageId);
        stackV2Request.setImageSettings(is);
    }
    stackV2Request.setInstanceGroups(Lists.newArrayList(instanceGroupV2RequestMap.values()));
    itContext.putContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, stackV2Request);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) PlacementSettings(com.sequenceiq.cloudbreak.api.model.v2.PlacementSettings) GeneralSettings(com.sequenceiq.cloudbreak.api.model.v2.GeneralSettings) ImageSettings(com.sequenceiq.cloudbreak.api.model.v2.ImageSettings) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 10 with StackV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.StackV2Request in project cloudbreak by hortonworks.

the class AbstractStackCreationV2Test method authenticationParams.

@BeforeMethod(dependsOnGroups = "V2StackCreationInit")
@Parameters("publicKeyId")
public void authenticationParams(@Optional("") String publicKeyId) {
    IntegrationTestContext itContext = getItContext();
    publicKeyId = StringUtils.hasText(publicKeyId) ? publicKeyId : itContext.getContextParam(CloudbreakV2Constants.SSH_PUBLICKEY_ID);
    Assert.assertNotNull(publicKeyId, "Publickey id is mandatory.");
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    StackAuthenticationRequest stackAuthenticationRequest = new StackAuthenticationRequest();
    stackAuthenticationRequest.setPublicKeyId(publicKeyId);
    stackV2Request.setStackAuthentication(stackAuthenticationRequest);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)8 InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)5 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)4 Parameters (org.testng.annotations.Parameters)4 BeforeMethod (org.testng.annotations.BeforeMethod)3 Test (org.testng.annotations.Test)3 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)2 StackAuthenticationRequest (com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)2 AmbariV2Request (com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request)2 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)2 ImageSettings (com.sequenceiq.cloudbreak.api.model.v2.ImageSettings)2 NetworkV2Request (com.sequenceiq.cloudbreak.api.model.v2.NetworkV2Request)2 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)1 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)1 NetworkRequest (com.sequenceiq.cloudbreak.api.model.NetworkRequest)1 OrchestratorRequest (com.sequenceiq.cloudbreak.api.model.OrchestratorRequest)1 StackRequest (com.sequenceiq.cloudbreak.api.model.StackRequest)1 GeneralSettings (com.sequenceiq.cloudbreak.api.model.v2.GeneralSettings)1