Search in sources :

Example 1 with PlacementSettings

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

the class StackToStackV2RequestConverter method getPlacementSettings.

private PlacementSettings getPlacementSettings(String region, String availabilityZone) {
    PlacementSettings ps = new PlacementSettings();
    ps.setRegion(region);
    ps.setAvailabilityZone(availabilityZone);
    return ps;
}
Also used : PlacementSettings(com.sequenceiq.cloudbreak.api.model.v2.PlacementSettings)

Example 2 with PlacementSettings

use of com.sequenceiq.cloudbreak.api.model.v2.PlacementSettings 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)

Aggregations

PlacementSettings (com.sequenceiq.cloudbreak.api.model.v2.PlacementSettings)2 GeneralSettings (com.sequenceiq.cloudbreak.api.model.v2.GeneralSettings)1 ImageSettings (com.sequenceiq.cloudbreak.api.model.v2.ImageSettings)1 InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)1 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Parameters (org.testng.annotations.Parameters)1