@Test public void getDBClusterHealth () { String memberId1 = randomUUID().toString(); String memberId2 = randomUUID().toString(); AwsRDSClusterContainer awsRDSClusterContainer = mock(AwsRDSClusterContainer.class); doReturn(new DescribeDBClustersResult().withDBClusters()).when(amazonRDS).describeDBClusters(any(DescribeDBClustersRequest.class)); assertEquals(ContainerHealth.DOES_NOT_EXIST, awsRDSPlatform.getDBClusterHealth(awsRDSClusterContainer)); doReturn(new DescribeDBClustersResult().withDBClusters(new DBCluster().withStatus(AwsRDSConstants.AWS_RDS_FAILING_OVER))) .when(amazonRDS) .describeDBClusters(any(DescribeDBClustersRequest.class)); assertEquals(ContainerHealth.RUNNING_EXPERIMENT, awsRDSPlatform.getDBClusterHealth(awsRDSClusterContainer)); doReturn(new DescribeDBClustersResult().withDBClusters(new DBCluster().withStatus(AwsRDSConstants.AWS_RDS_AVAILABLE))) .when(amazonRDS) .describeDBClusters(any(DescribeDBClustersRequest.class)); assertEquals(ContainerHealth.NORMAL, awsRDSPlatform.getDBClusterHealth(awsRDSClusterContainer)); doReturn(new DescribeDBClustersResult().withDBClusters(new DBCluster().withStatus(AwsRDSConstants.AWS_RDS_AVAILABLE) .withDBClusterMembers(new DBClusterMember() .withDBInstanceIdentifier(memberId1), new DBClusterMember() .withDBInstanceIdentifier(memberId2)))) .when(amazonRDS) .describeDBClusters(any(DescribeDBClustersRequest.class)); doReturn(new DescribeDBInstancesResult().withDBInstances(new DBInstance().withDBInstanceStatus(AwsRDSConstants.AWS_RDS_AVAILABLE))) .when(amazonRDS) .describeDBInstances(any(DescribeDBInstancesRequest.class)); assertEquals(ContainerHealth.NORMAL, awsRDSPlatform.getDBClusterHealth(awsRDSClusterContainer)); }
ContainerHealth getDBClusterHealth (AwsRDSClusterContainer awsRDSClusterContainer) { String clusterInstanceId = awsRDSClusterContainer.getDbClusterIdentifier(); return getContainerHealth(clusterInstanceId); }
AwsRDSPlatform extends Platform { ContainerHealth getDBClusterHealth (AwsRDSClusterContainer awsRDSClusterContainer) { String clusterInstanceId = awsRDSClusterContainer.getDbClusterIdentifier(); return getContainerHealth(clusterInstanceId); } }
AwsRDSPlatform extends Platform { ContainerHealth getDBClusterHealth (AwsRDSClusterContainer awsRDSClusterContainer) { String clusterInstanceId = awsRDSClusterContainer.getDbClusterIdentifier(); return getContainerHealth(clusterInstanceId); } @Autowired  AwsRDSPlatform();   AwsRDSPlatform(AmazonRDS amazonRDS, AmazonEC2 amazonEC2); }
AwsRDSPlatform extends Platform { ContainerHealth getDBClusterHealth (AwsRDSClusterContainer awsRDSClusterContainer) { String clusterInstanceId = awsRDSClusterContainer.getDbClusterIdentifier(); return getContainerHealth(clusterInstanceId); } @Autowired  AwsRDSPlatform();   AwsRDSPlatform(AmazonRDS amazonRDS, AmazonEC2 amazonEC2); Map<String, String> getVpcToSecurityGroupMap(); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override List<Container> generateExperimentRoster(); @Override boolean isContainerRecycled(Container container); Map<String, String> getFilter(); void setFilter(Map<String, String> filter); void failoverCluster(String dbClusterIdentifier); void restartInstance(String... dbInstanceIdentifiers); Set<String> getClusterInstances(String dbClusterIdentifier); ContainerHealth getInstanceStatus(String... dbInstanceIdentifiers); void setVpcSecurityGroupIds(String dbInstanceIdentifier, String vpcSecurityGroupId); void setVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); ContainerHealth checkVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); Collection<String> getVpcSecurityGroupIds(String dbInstanceIdentifier); String getChaosSecurityGroup(String dbInstanceIdentifier); DBSnapshot snapshotDBInstance(String dbInstanceIdentifier); DBClusterSnapshot snapshotDBCluster(String dbClusterIdentifier); void deleteInstanceSnapshot(DBSnapshot dbSnapshot); void deleteClusterSnapshot(DBClusterSnapshot dbClusterSnapshot); boolean isInstanceSnapshotRunning(String dbInstanceIdentifier); boolean isClusterSnapshotRunning(String dbClusterIdentifier); }
AwsRDSPlatform extends Platform { ContainerHealth getDBClusterHealth (AwsRDSClusterContainer awsRDSClusterContainer) { String clusterInstanceId = awsRDSClusterContainer.getDbClusterIdentifier(); return getContainerHealth(clusterInstanceId); } @Autowired  AwsRDSPlatform();   AwsRDSPlatform(AmazonRDS amazonRDS, AmazonEC2 amazonEC2); Map<String, String> getVpcToSecurityGroupMap(); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override List<Container> generateExperimentRoster(); @Override boolean isContainerRecycled(Container container); Map<String, String> getFilter(); void setFilter(Map<String, String> filter); void failoverCluster(String dbClusterIdentifier); void restartInstance(String... dbInstanceIdentifiers); Set<String> getClusterInstances(String dbClusterIdentifier); ContainerHealth getInstanceStatus(String... dbInstanceIdentifiers); void setVpcSecurityGroupIds(String dbInstanceIdentifier, String vpcSecurityGroupId); void setVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); ContainerHealth checkVpcSecurityGroupIds(String dbInstanceIdentifier, Collection<String> vpcSecurityGroupIds); Collection<String> getVpcSecurityGroupIds(String dbInstanceIdentifier); String getChaosSecurityGroup(String dbInstanceIdentifier); DBSnapshot snapshotDBInstance(String dbInstanceIdentifier); DBClusterSnapshot snapshotDBCluster(String dbClusterIdentifier); void deleteInstanceSnapshot(DBSnapshot dbSnapshot); void deleteClusterSnapshot(DBClusterSnapshot dbClusterSnapshot); boolean isInstanceSnapshotRunning(String dbInstanceIdentifier); boolean isClusterSnapshotRunning(String dbClusterIdentifier);  }