Search in sources :

Example 11 with StackV2Request

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

the class AbstractStackCreationV2Test method testStackCreation.

@Test
public void testStackCreation() throws Exception {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    // WHEN
    String stackId = getCloudbreakClient().stackV2Endpoint().postPrivate(stackV2Request).getId().toString();
    // THEN
    Assert.assertNotNull(stackId);
    itContext.putContextParam(CloudbreakITContextConstants.STACK_ID, stackId, true);
    itContext.putContextParam(CloudbreakV2Constants.STACK_NAME, stackV2Request.getGeneral().getName());
    Map<String, String> desiredStatuses = new HashMap<>();
    desiredStatuses.put("status", "AVAILABLE");
    desiredStatuses.put("clusterStatus", "AVAILABLE");
    CloudbreakUtil.waitAndCheckStatuses(getCloudbreakClient(), stackId, desiredStatuses);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) HashMap(java.util.HashMap) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 12 with StackV2Request

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

the class AbstractStackCreationV2Test method ambariParameters.

@BeforeMethod(dependsOnGroups = "V2StackCreationInit")
@Parameters({ "blueprintName", "enableSecurity", "kerberosMasterKey", "kerberosAdmin", "kerberosPassword" })
public void ambariParameters(@Optional("") String blueprintName, @Optional("false") boolean enableSecurity, @Optional String kerberosMasterKey, @Optional String kerberosAdmin, @Optional String kerberosPassword) {
    IntegrationTestContext itContext = getItContext();
    blueprintName = StringUtils.hasText(blueprintName) ? blueprintName : itContext.getContextParam(CloudbreakV2Constants.SSH_PUBLICKEY_ID);
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password is mandatory.");
    Assert.assertNotNull(blueprintName, "blueprint name is mandatory.");
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    ClusterV2Request clusterV2Request = new ClusterV2Request();
    stackV2Request.setCluster(clusterV2Request);
    AmbariV2Request ambariV2Request = new AmbariV2Request();
    clusterV2Request.setAmbari(ambariV2Request);
    ambariV2Request.setBlueprintName(blueprintName);
    ambariV2Request.setUserName(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID));
    ambariV2Request.setPassword(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
    GatewayJson gatewayJson = new GatewayJson();
    gatewayJson.setEnableGateway(Boolean.FALSE);
    gatewayJson.setExposedServices(ImmutableList.of("ALL"));
    ambariV2Request.setGateway(gatewayJson);
    if (enableSecurity) {
        ambariV2Request.setEnableSecurity(enableSecurity);
        KerberosRequest kerberosRequest = new KerberosRequest();
        kerberosRequest.setMasterKey(kerberosMasterKey);
        kerberosRequest.setAdmin(kerberosAdmin);
        kerberosRequest.setPassword(kerberosPassword);
        ambariV2Request.setKerberos(kerberosRequest);
    }
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) ClusterV2Request(com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request) GatewayJson(com.sequenceiq.cloudbreak.api.model.GatewayJson) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with StackV2Request

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

the class AbstractStackCreationV2Test method createNetworkRequest.

protected NetworkV2Request createNetworkRequest(IntegrationTestContext itContext, String subnetCidr) {
    subnetCidr = StringUtils.hasText(subnetCidr) ? subnetCidr : itContext.getContextParam(CloudbreakV2Constants.SUBNET_CIDR);
    Assert.assertNotNull(subnetCidr, "Subnet cidr is mandatory.");
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    NetworkV2Request networkRequest = new NetworkV2Request();
    networkRequest.setSubnetCIDR(subnetCidr);
    stackV2Request.setNetwork(networkRequest);
    return networkRequest;
}
Also used : StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) NetworkV2Request(com.sequenceiq.cloudbreak.api.model.v2.NetworkV2Request)

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