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);
}
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());
}
Aggregations