use of com.amazonaws.services.rds.model.DescribeDBInstancesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetup method describeResources.
public void describeResources() {
DescribeDBInstancesRequest req;
DescribeDBInstancesResult res;
req = buildIdGeneratorDescribeDBInstanceRequest();
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
resources.setIdGeneratorDatabase(res.getDBInstances().get(0));
}
req = buildStackInstanceDescribeDBInstanceRequest();
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
resources.setStackInstancesDatabase(res.getDBInstances().get(0));
}
// TODO: Describe table DB instances
List<DBInstance> descDbInstResults = new ArrayList<DBInstance>();
int numTableInstances = Integer.parseInt(this.config.getNumberTableInstances());
for (int i = 0; i < numTableInstances; i++) {
req = buildStackTableDBInstanceDescribeDBInstanceRequest(i);
res = client.describeDBInstances(req);
if ((res.getDBInstances() != null) && (res.getDBInstances().size() == 1)) {
descDbInstResults.add(res.getDBInstances().get(0));
}
}
resources.setStackInstanceTablesDatabases(descDbInstResults);
}
use of com.amazonaws.services.rds.model.DescribeDBInstancesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetup method buildStackTableDBInstanceDescribeDBInstanceRequest.
DescribeDBInstancesRequest buildStackTableDBInstanceDescribeDBInstanceRequest(int inst) {
DescribeDBInstancesRequest req = new DescribeDBInstancesRequest();
req.setDBInstanceIdentifier(config.getStackTableDBInstanceDatabaseIdentifier(inst));
return req;
}
use of com.amazonaws.services.rds.model.DescribeDBInstancesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetup method buildStackInstanceDescribeDBInstanceRequest.
DescribeDBInstancesRequest buildStackInstanceDescribeDBInstanceRequest() {
DescribeDBInstancesRequest req = new DescribeDBInstancesRequest();
req.setDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
return req;
}
use of com.amazonaws.services.rds.model.DescribeDBInstancesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetupTest method testbuildStackInstanceDescribeDBInstanceRequest.
@Test
public void testbuildStackInstanceDescribeDBInstanceRequest() {
DescribeDBInstancesRequest expectedReq = new DescribeDBInstancesRequest().withDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
DescribeDBInstancesRequest req = databaseSetup.buildStackInstanceDescribeDBInstanceRequest();
assertEquals(expectedReq, req);
}
use of com.amazonaws.services.rds.model.DescribeDBInstancesRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class MySqlDatabaseSetupTest method testWaitForDatabaseNotAvailable.
@Test
public void testWaitForDatabaseNotAvailable() throws Exception {
when(mockDbInstance.getDBInstanceStatus()).thenReturn("busy");
when(mockDbInstance.getDBInstanceIdentifier()).thenReturn("dbInstanceId");
List<DBInstance> expectedDBInstances = Arrays.asList(mockDbInstance);
when(mockDBInstancesResult.getDBInstances()).thenReturn(expectedDBInstances);
ArgumentCaptor<DescribeDBInstancesRequest> captor = new ArgumentCaptor<>();
when(mockClient.describeDBInstances(captor.capture())).thenReturn(mockDBInstancesResult);
DBInstance instance = databaseSetup.waitForDatabase(mockDbInstance);
List<DescribeDBInstancesRequest> actualRequests = captor.getAllValues();
assertEquals(10, actualRequests.size());
assertNull(instance);
}
Aggregations