Search in sources :

Example 1 with RDSTestRequest

use of com.sequenceiq.cloudbreak.api.model.rds.RDSTestRequest 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 2 with RDSTestRequest

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

the class RdsConfigAction method testConnect.

static void testConnect(IntegrationTestContext integrationTestContext, Entity entity) throws Exception {
    RdsTestEntity rdsTestEntity = (RdsTestEntity) entity;
    RDSTestRequest rdsTestRequest = new RDSTestRequest();
    rdsTestRequest.setRdsConfig(rdsTestEntity.getRequest());
    CloudbreakClient client;
    client = integrationTestContext.getContextParam(CloudbreakClient.CLOUDBREAK_CLIENT, CloudbreakClient.class);
    rdsTestEntity.setResponse(client.getCloudbreakClient().rdsConfigEndpoint().testRdsConnection(rdsTestRequest));
    logJSON("Rds test post request: ", rdsTestEntity.getRequest());
}
Also used : RDSTestRequest(com.sequenceiq.cloudbreak.api.model.rds.RDSTestRequest)

Aggregations

RDSTestRequest (com.sequenceiq.cloudbreak.api.model.rds.RDSTestRequest)2 RDSConfigRequest (com.sequenceiq.cloudbreak.api.model.rds.RDSConfigRequest)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1