use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockStackCreationV2Test method configMockServer.
@BeforeClass
@Parameters({ "stackName", "mockPort", "sshPort" })
public void configMockServer(String stackName, @Optional("9443") int mockPort, @Optional("2020") int sshPort) {
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> instanceGroupV2RequestMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
int numberOfServers = 0;
for (InstanceGroupV2Request igr : instanceGroupV2RequestMap.values()) {
numberOfServers += igr.getNodeCount();
}
StackCreationMock stackCreationMock = (StackCreationMock) applicationContext.getBean(StackCreationMock.NAME, mockPort, sshPort, numberOfServers);
stackCreationMock.addSPIEndpoints();
stackCreationMock.mockImageCatalogResponse(itContext);
stackCreationMock.addSaltMappings();
stackCreationMock.addAmbariMappings(stackName);
itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, stackCreationMock);
itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, stackCreationMock.getInstanceMap());
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockInstanceTerminationReplicationErrorTest method configMockServer.
@BeforeClass
@Parameters({ "mockPort", "sshPort" })
public void configMockServer(@Optional("9443") int mockPort, @Optional("2020") int sshPort) {
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> instanceGroupV2RequestMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
String stackName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
int numberOfServers = 0;
for (InstanceGroupV2Request igr : instanceGroupV2RequestMap.values()) {
numberOfServers += igr.getNodeCount();
}
InstanceTerminationReplicationErrorMock instanceTerminationMock = (InstanceTerminationReplicationErrorMock) applicationContext.getBean(InstanceTerminationReplicationErrorMock.NAME, mockPort, sshPort, numberOfServers);
instanceTerminationMock.addAmbariMappings(stackName);
instanceTerminationMock.addMockEndpoints();
itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, instanceTerminationMock);
itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, instanceTerminationMock.getInstanceMap());
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockInstanceTerminationTest method configMockServer.
@BeforeClass
@Parameters({ "mockPort", "sshPort" })
public void configMockServer(@Optional("9443") int mockPort, @Optional("2020") int sshPort) {
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> instanceGroupV2RequestMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
String stackName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
int numberOfServers = 0;
for (InstanceGroupV2Request igr : instanceGroupV2RequestMap.values()) {
numberOfServers += igr.getNodeCount();
}
InstanceTerminationMock instanceTerminationMock = (InstanceTerminationMock) applicationContext.getBean(InstanceTerminationMock.NAME, mockPort, sshPort, numberOfServers);
instanceTerminationMock.addAmbariMappings(stackName);
instanceTerminationMock.addMockEndpoints();
itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, instanceTerminationMock);
itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, instanceTerminationMock.getInstanceMap());
}
use of com.sequenceiq.it.IntegrationTestContext 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);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStopTest method testStackStop.
@Test
public void testStackStop() {
// 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(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);
}
Aggregations