Search in sources :

Example 6 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetup method buildStackInstanceDeleteDBInstanceRequest.

DeleteDBInstanceRequest buildStackInstanceDeleteDBInstanceRequest() {
    DeleteDBInstanceRequest req = new DeleteDBInstanceRequest();
    req.setDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
    if (config.isProductionStack()) {
        req.setSkipFinalSnapshot(Boolean.FALSE);
        // TODO: Come up with better name for final snapshot
        req.setFinalDBSnapshotIdentifier(config.getStack() + config.getStackInstance());
    } else {
        req.setSkipFinalSnapshot(Boolean.TRUE);
    }
    return req;
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest)

Example 7 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testBuildStackInstanceDeleteDBInstanceRequestProduction.

@Test
public void testBuildStackInstanceDeleteDBInstanceRequestProduction() throws IOException {
    setupProductionConfig();
    DeleteDBInstanceRequest expectedReq = new DeleteDBInstanceRequest();
    expectedReq.setDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
    expectedReq.setSkipFinalSnapshot(Boolean.FALSE);
    expectedReq.setFinalDBSnapshotIdentifier(config.getStack() + config.getStackInstance());
    DeleteDBInstanceRequest req = databaseSetup.buildStackInstanceDeleteDBInstanceRequest();
    assertEquals(expectedReq, req);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) Test(org.junit.Test)

Example 8 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testBuildIdGeneratorDeleteDBInstanceRequestProduction.

@Test
public void testBuildIdGeneratorDeleteDBInstanceRequestProduction() throws IOException {
    setupProductionConfig();
    DeleteDBInstanceRequest expectedReq = new DeleteDBInstanceRequest();
    expectedReq.setDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier());
    expectedReq.setSkipFinalSnapshot(Boolean.FALSE);
    expectedReq.setFinalDBSnapshotIdentifier(config.getStack() + config.getStackInstance());
    DeleteDBInstanceRequest req = databaseSetup.buildIdGeneratorDeleteDBInstanceRequest();
    assertEquals(expectedReq, req);
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) Test(org.junit.Test)

Example 9 with DeleteDBInstanceRequest

use of com.amazonaws.services.rds.model.DeleteDBInstanceRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class MySqlDatabaseSetupTest method testDeleteDatabaseInstanceDoesExist.

@Test
public void testDeleteDatabaseInstanceDoesExist() {
    DeleteDBInstanceRequest req = new DeleteDBInstanceRequest();
    req.setDBInstanceIdentifier("someDB");
    when(mockClient.deleteDBInstance(req)).thenReturn(new DBInstance().withDBInstanceIdentifier("someDB"));
    DBInstance inst = databaseSetup.deleteDatabaseInstance(req);
    assertEquals(inst.getDBInstanceIdentifier(), "someDB");
}
Also used : DeleteDBInstanceRequest(com.amazonaws.services.rds.model.DeleteDBInstanceRequest) DBInstance(com.amazonaws.services.rds.model.DBInstance) Test(org.junit.Test)

Aggregations

DeleteDBInstanceRequest (com.amazonaws.services.rds.model.DeleteDBInstanceRequest)9 Test (org.junit.Test)6 DBInstance (com.amazonaws.services.rds.model.DBInstance)3 DBInstanceNotFoundException (com.amazonaws.services.rds.model.DBInstanceNotFoundException)1