Search in sources :

Example 11 with CreateDBInstanceRequest

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

the class MySqlDatabaseSetupTest method testBuildIdGeneratorCreateDBInstanceRequestNonProduction.

/**
 * Test that we setup a non-production database correctly.
 *
 * @throws IOException
 */
@Test
public void testBuildIdGeneratorCreateDBInstanceRequestNonProduction() throws IOException {
    setupDevelopmentConfig();
    // Start with the defaults
    CreateDBInstanceRequest expected = MySqlDatabaseSetup.getDefaultCreateDBInstanceRequest();
    expected.setDBName(config.getIdGeneratorDatabaseSchemaName());
    expected.setDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier());
    expected.setAllocatedStorage(new Integer(5));
    expected.setMasterUsername(config.getIdGeneratorDatabaseMasterUsername());
    expected.setMasterUserPassword(config.getIdGeneratorDatabaseMasterPasswordPlaintext());
    expected.withDBSecurityGroups(config.getIdGeneratorDatabaseSecurityGroupName());
    expected.setDBParameterGroupName(config.getDatabaseParameterGroupName());
    // in non-production Multi-AZ must be turned off.
    expected.setMultiAZ(false);
    // Test against expected
    CreateDBInstanceRequest request = databaseSetup.buildIdGeneratorCreateDBInstanceRequest();
    assertEquals(expected, request);
}
Also used : CreateDBInstanceRequest(com.amazonaws.services.rds.model.CreateDBInstanceRequest) Test(org.junit.Test)

Example 12 with CreateDBInstanceRequest

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

the class MySqlDatabaseSetupTest method testBuildStackTableDBInstanceCreateDBInstanceRequestNonProduction.

@Test
public void testBuildStackTableDBInstanceCreateDBInstanceRequestNonProduction() throws IOException {
    setupDevelopmentConfig();
    CreateDBInstanceRequest expectedReq = MySqlDatabaseSetup.getDefaultCreateDBInstanceRequest();
    expectedReq.setDBName(config.getStackInstanceTablesDBSchema());
    expectedReq.setDBInstanceIdentifier(config.getStackTableDBInstanceDatabaseIdentifier(0));
    expectedReq.setAllocatedStorage(new Integer(10));
    expectedReq.setMasterUsername(config.getStackInstanceDatabaseMasterUser());
    expectedReq.setMasterUserPassword(config.getStackInstanceDatabaseMasterPasswordPlaintext());
    expectedReq.withDBSecurityGroups(config.getStackDatabaseSecurityGroupName());
    expectedReq.setDBParameterGroupName(config.getDatabaseParameterGroupName());
    expectedReq.setBackupRetentionPeriod(0);
    expectedReq.setMultiAZ(Boolean.FALSE);
    expectedReq.setDBInstanceClass(DATABASE_INSTANCE_CLASS_M1_SMALL);
    CreateDBInstanceRequest request = databaseSetup.buildStackTableDBInstanceCreateDBInstanceRequest(0);
    assertEquals(expectedReq, request);
}
Also used : CreateDBInstanceRequest(com.amazonaws.services.rds.model.CreateDBInstanceRequest) Test(org.junit.Test)

Example 13 with CreateDBInstanceRequest

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

the class MySqlDatabaseSetupTest method testBuildStackInstancesCreateDBInstanceRequestProduction.

/**
 * Test that we setup a production database as expected.
 * @throws IOException
 */
@Test
public void testBuildStackInstancesCreateDBInstanceRequestProduction() throws IOException {
    // setup for production.
    setupProductionConfig();
    // Start with the defaults.
    CreateDBInstanceRequest expected = MySqlDatabaseSetup.getDefaultCreateDBInstanceRequest();
    // Production stacks have have different properties
    // Production database need to have a backup replicate ready to go in
    // another zone at all times!
    expected.setMultiAZ(true);
    // The production database should be a large
    expected.setDBInstanceClass(DATABASE_INSTANCE_CLASS_R3_LARGE);
    expected.setDBName(config.getStackInstanceDatabaseSchema());
    expected.setDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier());
    expected.setAllocatedStorage(new Integer(50));
    expected.setMasterUsername(config.getStackInstanceDatabaseMasterUser());
    expected.setMasterUserPassword(config.getStackInstanceDatabaseMasterPasswordPlaintext());
    expected.withDBSecurityGroups(config.getStackDatabaseSecurityGroupName());
    expected.setDBParameterGroupName(config.getDatabaseParameterGroupName());
    // Test against expected
    CreateDBInstanceRequest request = databaseSetup.buildStackInstancesCreateDBInstanceRequest();
    assertEquals(expected, request);
}
Also used : CreateDBInstanceRequest(com.amazonaws.services.rds.model.CreateDBInstanceRequest) Test(org.junit.Test)

Example 14 with CreateDBInstanceRequest

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

the class MySqlDatabaseSetupTest method testBuildStackTableDBInstanceCreateDBInstanceRequestProduction.

@Test
public void testBuildStackTableDBInstanceCreateDBInstanceRequestProduction() throws IOException {
    setupProductionConfig();
    CreateDBInstanceRequest expectedReq = MySqlDatabaseSetup.getDefaultCreateDBInstanceRequest();
    expectedReq.setDBName(config.getStackInstanceTablesDBSchema());
    expectedReq.setDBInstanceIdentifier(config.getStackTableDBInstanceDatabaseIdentifier(0));
    expectedReq.setMasterUsername(config.getStackInstanceDatabaseMasterUser());
    expectedReq.setMasterUserPassword(config.getStackInstanceDatabaseMasterPasswordPlaintext());
    expectedReq.withDBSecurityGroups(config.getStackDatabaseSecurityGroupName());
    expectedReq.setDBParameterGroupName(config.getDatabaseParameterGroupName());
    expectedReq.setBackupRetentionPeriod(0);
    expectedReq.setMultiAZ(Boolean.FALSE);
    expectedReq.setAllocatedStorage(500);
    expectedReq.setDBInstanceClass(DATABASE_INSTANCE_CLASS_R3_LARGE);
    CreateDBInstanceRequest request = databaseSetup.buildStackTableDBInstanceCreateDBInstanceRequest(0);
    assertEquals(expectedReq, request);
}
Also used : CreateDBInstanceRequest(com.amazonaws.services.rds.model.CreateDBInstanceRequest) Test(org.junit.Test)

Aggregations

CreateDBInstanceRequest (com.amazonaws.services.rds.model.CreateDBInstanceRequest)14 Test (org.junit.Test)9 DBInstance (com.amazonaws.services.rds.model.DBInstance)2 DescribeDBInstancesRequest (com.amazonaws.services.rds.model.DescribeDBInstancesRequest)2 DBInstanceNotFoundException (com.amazonaws.services.rds.model.DBInstanceNotFoundException)1 DescribeDBInstancesResult (com.amazonaws.services.rds.model.DescribeDBInstancesResult)1 ArrayList (java.util.ArrayList)1