Search in sources :

Example 1 with UpdateClusterJson

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

the class StackAndClusterStartTest method testStackAndClusterStart.

@Test
@Parameters("waitOn")
public void testStackAndClusterStart(@Optional(NOWAIT) Boolean waitOn) {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
    Integer stackIntId = Integer.valueOf(stackId);
    String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
    String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
    String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
    // WHEN
    UpdateStackJson updateStackJson = new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(STARTED));
    CloudbreakUtil.checkResponse("StartStack", getCloudbreakClient().stackV1Endpoint().put(Long.valueOf(stackIntId), updateStackJson));
    if (Boolean.TRUE.equals(waitOn)) {
        CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackId, "AVAILABLE");
    }
    UpdateClusterJson updateClusterJson = new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(STARTED));
    CloudbreakUtil.checkResponse("StartCluster", getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId), updateClusterJson));
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, "AVAILABLE");
    // THEN
    CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackV1Endpoint(), ambariPort, stackId, ambariUser, ambariPassword, true);
}
Also used : UpdateStackJson(com.sequenceiq.cloudbreak.api.model.UpdateStackJson) IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson) Parameters(org.testng.annotations.Parameters) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 2 with UpdateClusterJson

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

the class ClusterAndStackStopTest method testClusterAndStackStop.

@Test
@Parameters("waitOn")
public void testClusterAndStackStop(@Optional(NOWAIT) Boolean waitOn) {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
    Integer stackIntId = Integer.valueOf(stackId);
    String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
    String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
    String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
    // WHEN
    UpdateClusterJson updateClusterJson = new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(STOPPED));
    CloudbreakUtil.checkResponse("StopCluster", getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId), updateClusterJson));
    if (Boolean.TRUE.equals(waitOn)) {
        CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, STOPPED);
    }
    UpdateStackJson updateStackJson = new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.valueOf(STOPPED));
    CloudbreakUtil.checkResponse("StopStack", getCloudbreakClient().stackV1Endpoint().put(Long.valueOf(stackIntId), updateStackJson));
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackId, STOPPED);
    // THEN
    CloudbreakUtil.checkClusterStopped(getCloudbreakClient().stackV1Endpoint(), ambariPort, stackId, ambariUser, ambariPassword);
}
Also used : UpdateStackJson(com.sequenceiq.cloudbreak.api.model.UpdateStackJson) IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson) Parameters(org.testng.annotations.Parameters) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 3 with UpdateClusterJson

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

the class ClusterStartTest method testClusterStart.

@Test
public void testClusterStart() {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
    Integer stackIntId = Integer.valueOf(stackId);
    String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
    String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
    String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
    // WHEN
    UpdateClusterJson updateClusterJson = new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(STARTED));
    CloudbreakUtil.checkResponse("StartCluster", getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId), updateClusterJson));
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, "AVAILABLE");
    // THEN
    CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackV1Endpoint(), ambariPort, stackId, ambariUser, ambariPassword, true);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 4 with UpdateClusterJson

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

the class ClusterStopTest method testClusterStop.

@Test
public void testClusterStop() {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
    Integer stackIntId = Integer.valueOf(stackId);
    // WHEN
    UpdateClusterJson updateClusterJson = new UpdateClusterJson();
    updateClusterJson.setStatus(StatusRequest.valueOf(STOPPED));
    CloudbreakUtil.checkResponse("StopCluster", getCloudbreakClient().clusterEndpoint().put(Long.valueOf(stackIntId), updateClusterJson));
    CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, STOPPED);
// THEN
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 5 with UpdateClusterJson

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

the class StackV2Controller method putPassword.

@Override
public Response putPassword(String name, UserNamePasswordJson userNamePasswordJson) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getPublicStack(name, user);
    UpdateClusterJson updateClusterJson = conversionService.convert(userNamePasswordJson, UpdateClusterJson.class);
    return clusterCommonController.put(stack.getId(), updateClusterJson);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Stack(com.sequenceiq.cloudbreak.domain.Stack) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)

Aggregations

UpdateClusterJson (com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)14 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)7 AbstractCloudbreakIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest)7 Test (org.testng.annotations.Test)7 HostGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson)5 Parameters (org.testng.annotations.Parameters)5 UpdateStackJson (com.sequenceiq.cloudbreak.api.model.UpdateStackJson)4 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)3 Stack (com.sequenceiq.cloudbreak.domain.Stack)3 StackV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint)2 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 AmbariAddressJson (com.sequenceiq.cloudbreak.api.model.AmbariAddressJson)1 ConstraintJson (com.sequenceiq.cloudbreak.api.model.ConstraintJson)1 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)1 InstanceGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.InstanceGroupAdjustmentJson)1 InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)1