use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStopV2Test method testStackStop.
@Test
public void testStackStop() {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
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
Response response = getCloudbreakClient().stackV2Endpoint().putStop(stackName);
// THEN
CloudbreakUtil.checkResponse("StackStopV2", response);
Map<String, String> desiredStatuses = new HashMap<>();
desiredStatuses.put("status", "STOPPED");
desiredStatuses.put("clusterStatus", "STOPPED");
CloudbreakUtil.waitAndCheckStatuses(getCloudbreakClient(), stackId, desiredStatuses);
CloudbreakUtil.checkClusterStopped(getCloudbreakClient().stackV2Endpoint(), ambariPort, stackId, ambariUser, ambariPassword);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStopV2Test method setContextParameters.
@BeforeMethod
public void setContextParameters() {
IntegrationTestContext itContext = getItContext();
Assert.assertNotNull(itContext.getContextParam(CloudbreakV2Constants.STACK_NAME), "Stack name is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.STACK_ID), "Stack id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID), "Ambari port id is mandatory.");
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockScalingTest method configMockServer.
@BeforeClass
@Parameters({ "mockPort", "sshPort", "desiredCount", "hostGroup" })
public void configMockServer(@Optional("9443") int mockPort, @Optional("2020") int sshPort, int desiredCount, String hostGroup) {
IntegrationTestContext itContext = getItContext();
String clusterName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
StackResponse response = getCloudbreakClient().stackV2Endpoint().getPrivate(clusterName, null);
java.util.Optional<InstanceGroupResponse> igg = response.getInstanceGroups().stream().filter(ig -> ig.getGroup().equals(hostGroup)).findFirst();
Map<String, CloudVmInstanceStatus> instanceMap = itContext.getContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, Map.class);
ScalingMock scalingMock = (ScalingMock) applicationContext.getBean(ScalingMock.NAME, mockPort, sshPort, instanceMap);
scalingMock.addSPIEndpoints();
scalingMock.addMockEndpoints();
scalingMock.addAmbariMappings(clusterName);
itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, scalingMock);
igg.ifPresent(ig -> {
int scalingAdjustment = desiredCount - ig.getNodeCount();
if (scalingAdjustment > 0) {
scalingMock.addInstance(scalingAdjustment);
}
});
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStartTest method setContextParameters.
@BeforeMethod
public void setContextParameters() {
IntegrationTestContext itContext = getItContext();
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.STACK_ID), "Stack id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID), "Ambari port id is mandatory.");
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStartTest method testStackStart.
@Test
public void testStackStart() {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
Integer stackIntId = Integer.valueOf(stackId);
// WHEN
UpdateStackJson updateStackJson = new UpdateStackJson();
updateStackJson.setStatus(StatusRequest.valueOf(STARTED));
CloudbreakUtil.checkResponse("StartStack", getCloudbreakClient().stackV1Endpoint().put(Long.valueOf(stackIntId), updateStackJson));
CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackId, "AVAILABLE");
// THEN
}
Aggregations