@Test public void filterDBInstance () { String dBInstanceArn = randomUUID().toString(); awsRDSPlatform.setFilter(ImmutableMap.of("key", "value")); doReturn(new ListTagsForResourceResult().withTagList(new Tag().withKey("key") .withValue("value"))).when(amazonRDS) .listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dBInstanceArn)); assertTrue(awsRDSPlatform.filterDBInstance(new DBInstance().withDBInstanceArn(dBInstanceArn))); awsRDSPlatform.setFilter(ImmutableMap.of("k", "v")); assertFalse(awsRDSPlatform.filterDBInstance(new DBInstance().withDBInstanceArn(dBInstanceArn))); awsRDSPlatform.setFilter(ImmutableMap.of("key", "value", "k", "v")); assertFalse(awsRDSPlatform.filterDBInstance(new DBInstance().withDBInstanceArn(dBInstanceArn))); doReturn(new ListTagsForResourceResult().withTagList(new Tag().withKey("key") .withValue("value"), new Tag().withKey("k") .withValue("v"))).when(amazonRDS) .listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dBInstanceArn)); awsRDSPlatform.setFilter(ImmutableMap.of("key", "value")); assertTrue(awsRDSPlatform.filterDBInstance(new DBInstance().withDBInstanceArn(dBInstanceArn))); }
boolean filterDBInstance (DBInstance dbInstance) { Collection<Tag> tags = generateTagsFromFilters(); if (tags.isEmpty()) return true; ListTagsForResourceResult listTagsForResourceResult = amazonRDS.listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dbInstance.getDBInstanceArn())); List<Tag> tagList = listTagsForResourceResult.getTagList(); return tagList.containsAll(tags); }
AwsRDSPlatform extends Platform { boolean filterDBInstance (DBInstance dbInstance) { Collection<Tag> tags = generateTagsFromFilters(); if (tags.isEmpty()) return true; ListTagsForResourceResult listTagsForResourceResult = amazonRDS.listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dbInstance.getDBInstanceArn())); List<Tag> tagList = listTagsForResourceResult.getTagList(); return tagList.containsAll(tags); } }
AwsRDSPlatform extends Platform { boolean filterDBInstance (DBInstance dbInstance) { Collection<Tag> tags = generateTagsFromFilters(); if (tags.isEmpty()) return true; ListTagsForResourceResult listTagsForResourceResult = amazonRDS.listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dbInstance.getDBInstanceArn())); List<Tag> tagList = listTagsForResourceResult.getTagList(); return tagList.containsAll(tags); } @Autowired  AwsRDSPlatform();   AwsRDSPlatform(AmazonRDS amazonRDS, AmazonEC2 amazonEC2); }
AwsRDSPlatform extends Platform { boolean filterDBInstance (DBInstance dbInstance) { Collection<Tag> tags = generateTagsFromFilters(); if (tags.isEmpty()) return true; ListTagsForResourceResult listTagsForResourceResult = amazonRDS.listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dbInstance.getDBInstanceArn())); List<Tag> tagList = listTagsForResourceResult.getTagList(); return tagList.containsAll(tags); } @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 { boolean filterDBInstance (DBInstance dbInstance) { Collection<Tag> tags = generateTagsFromFilters(); if (tags.isEmpty()) return true; ListTagsForResourceResult listTagsForResourceResult = amazonRDS.listTagsForResource(new ListTagsForResourceRequest() .withResourceName(dbInstance.getDBInstanceArn())); List<Tag> tagList = listTagsForResourceResult.getTagList(); return tagList.containsAll(tags); } @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);  }