Search in sources :

Example 46 with IntegrationTestContext

use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.

the class StackCreationTest method setContextParams.

@BeforeMethod
public void setContextParams() {
    IntegrationTestContext itContext = getItContext();
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.TEMPLATE_ID, List.class), "Template id is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.CREDENTIAL_ID), "Credential id is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.NETWORK_ID), "Network id is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.SECURITY_GROUP_ID), "Security group id is mandatory.");
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) ArrayList(java.util.ArrayList) List(java.util.List) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 47 with IntegrationTestContext

use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.

the class MockInstanceTerminationReplicationTest 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();
    }
    InstanceTerminationReplicationMock instanceTerminationMock = (InstanceTerminationReplicationMock) applicationContext.getBean(InstanceTerminationReplicationMock.NAME, mockPort, sshPort, numberOfServers);
    instanceTerminationMock.addAmbariMappings(stackName);
    instanceTerminationMock.addMockEndpoints();
    itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, instanceTerminationMock);
    itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, instanceTerminationMock.getInstanceMap());
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) BeforeClass(org.testng.annotations.BeforeClass) Parameters(org.testng.annotations.Parameters)

Example 48 with IntegrationTestContext

use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.

the class MockInstanceTerminationUnknownTest 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();
    }
    InstanceTerminationUnknownMock instanceTerminationMock = (InstanceTerminationUnknownMock) applicationContext.getBean(InstanceTerminationUnknownMock.NAME, mockPort, sshPort, numberOfServers);
    instanceTerminationMock.addAmbariMappings(stackName);
    instanceTerminationMock.addMockEndpoints();
    itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, instanceTerminationMock);
    itContext.putContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, instanceTerminationMock.getInstanceMap());
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) BeforeClass(org.testng.annotations.BeforeClass) Parameters(org.testng.annotations.Parameters)

Example 49 with IntegrationTestContext

use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.

the class OpenstackStackCreationV2Test method networkParams.

@BeforeMethod(dependsOnGroups = "V2StackCreationInit")
@Parameters({ "subnetCidr", "floatingPool" })
public void networkParams(String subnetCidr, @Optional("") String floatingPool) {
    IntegrationTestContext itContext = getItContext();
    NetworkV2Request networkV2Request = createNetworkRequest(itContext, subnetCidr);
    floatingPool = StringUtils.hasText(floatingPool) ? floatingPool : itContext.getContextParam(CloudbreakV2Constants.OPENSTACK_FLOATING_POOL);
    Map<String, Object> networkParameters = Maps.newHashMap();
    if (StringUtils.hasText(floatingPool)) {
        networkParameters.put("publicNetId", floatingPool);
    }
    networkV2Request.setParameters(networkParameters);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) NetworkV2Request(com.sequenceiq.cloudbreak.api.model.v2.NetworkV2Request) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 50 with IntegrationTestContext

use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.

the class StackScalingV2Test 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.");
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)71 Parameters (org.testng.annotations.Parameters)39 Test (org.testng.annotations.Test)32 AbstractCloudbreakIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest)26 BeforeMethod (org.testng.annotations.BeforeMethod)26 StackV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint)10 InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)9 BeforeClass (org.testng.annotations.BeforeClass)9 HashMap (java.util.HashMap)8 UpdateClusterJson (com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)7 UpdateStackJson (com.sequenceiq.cloudbreak.api.model.UpdateStackJson)7 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)7 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)6 ArrayList (java.util.ArrayList)6 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)5 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)4 ClusterV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.ClusterV1Endpoint)3 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)3 HostGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson)3 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)3