Search in sources :

Example 31 with IntegrationTestContext

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

the class RDSConfigTest method testRDSConfig.

@Test
@Parameters({ "rdsName", "rdsUser", "rdsPassword", "rdsConnectionUrl", "rdsDbType", "hdpVersion" })
public void testRDSConfig(String rdsName, @Optional("") String rdsUser, @Optional("") String rdsPassword, @Optional("") String rdsConnectionUrl, @Optional("POSTGRES") String rdsDbType, @Optional("2.5") String hdpVersion) {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    rdsUser = StringUtils.hasLength(rdsUser) ? rdsUser : defaultRdsUser;
    rdsPassword = StringUtils.hasLength(rdsPassword) ? rdsPassword : defaultRdsPassword;
    rdsConnectionUrl = StringUtils.hasLength(rdsConnectionUrl) ? rdsConnectionUrl : defaultRdsConnectionUrl;
    RDSConfigRequest rdsCreateRequest = new RDSConfigRequest();
    rdsCreateRequest.setName(rdsName);
    rdsCreateRequest.setConnectionUserName(rdsUser);
    rdsCreateRequest.setConnectionPassword(rdsPassword);
    rdsCreateRequest.setConnectionURL(rdsConnectionUrl);
    RDSTestRequest testRequest = new RDSTestRequest();
    testRequest.setRdsConfig(rdsCreateRequest);
    // WHEN
    String rdsConnectionResult = getCloudbreakClient().rdsConfigEndpoint().testRdsConnection(testRequest).getConnectionResult();
    Assert.assertEquals(rdsConnectionResult, "connected", "RDS connection test failed. Set the RDS configuration parameters properly.");
    String rdsConfigId = getCloudbreakClient().rdsConfigEndpoint().postPrivate(rdsCreateRequest).getId().toString();
    itContext.putContextParam(CloudbreakITContextConstants.RDS_CONFIG_ID, rdsConfigId);
    itContext.putCleanUpParam(CloudbreakITContextConstants.RDS_CONFIG_ID, rdsConfigId);
    // THEN
    String listedRDSByName = getCloudbreakClient().rdsConfigEndpoint().getPrivate(rdsName).getName();
    Assert.assertEquals(listedRDSByName, rdsName);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) RDSConfigRequest(com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest) RDSTestRequest(com.sequenceiq.cloudbreak.api.model.rds.RDSTestRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 32 with IntegrationTestContext

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

the class IpPoolTests method setup.

@BeforeTest
public void setup() throws Exception {
    given(CloudbreakClient.isCreated());
    given(cloudProvider.aValidCredential());
    IntegrationTestContext it = getItContext();
    credentialId = Credential.getTestContextCredential().apply(it).getResponse().getId();
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) BeforeTest(org.testng.annotations.BeforeTest)

Example 33 with IntegrationTestContext

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

the class NetworksTest method setup.

@BeforeTest
public void setup() throws Exception {
    given(CloudbreakClient.isCreated());
    given(cloudProvider.aValidCredential());
    IntegrationTestContext it = getItContext();
    credentialId = Credential.getTestContextCredential().apply(it).getResponse().getId();
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) BeforeTest(org.testng.annotations.BeforeTest)

Example 34 with IntegrationTestContext

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

the class MockClusterCreationWithSaltFailTest method setContextParameters.

@BeforeMethod
public void setContextParameters() {
    IntegrationTestContext itContext = getItContext();
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.BLUEPRINT_ID), "Blueprint id is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.STACK_ID), "Stack id is mandatory.");
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 35 with IntegrationTestContext

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

the class MockClusterCreationWithSaltSuccessTest method setContextParameters.

@BeforeMethod
public void setContextParameters() {
    IntegrationTestContext itContext = getItContext();
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.BLUEPRINT_ID), "Blueprint id is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.STACK_ID), "Stack 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