use of com.netflix.simianarmy.Resource in project SimianArmy by Netflix.
the class TestRDSJanitorResourceTracker method testGetResourceNotFound.
@SuppressWarnings("unchecked")
@Test
public void testGetResourceNotFound() {
ArrayList<AWSResource> resources = new ArrayList<>();
TestRDSJanitorResourceTracker tracker = new TestRDSJanitorResourceTracker();
when(tracker.getJdbcTemplate().query(Matchers.anyString(), Matchers.any(Object[].class), Matchers.any(RowMapper.class))).thenReturn(resources);
Resource resource = tracker.getResource("id-2");
Assert.assertNull(resource);
}
use of com.netflix.simianarmy.Resource in project SimianArmy by Netflix.
the class TestASGJanitorCrawler method testInstancesWithNames.
@Test
public void testInstancesWithNames() {
List<AutoScalingGroup> asgList = createASGList();
String[] asgNames = { "asg1", "asg2" };
AWSClient awsMock = createMockAWSClient(asgList, asgNames);
ASGJanitorCrawler crawler = new ASGJanitorCrawler(awsMock);
List<Resource> resources = crawler.resources(asgNames);
verifyASGList(resources, asgList);
}
use of com.netflix.simianarmy.Resource in project SimianArmy by Netflix.
the class TestASGJanitorCrawler method testInstancesWithResourceType.
@Test
public void testInstancesWithResourceType() {
List<AutoScalingGroup> asgList = createASGList();
AWSClient awsMock = createMockAWSClient(asgList);
ASGJanitorCrawler crawler = new ASGJanitorCrawler(awsMock);
for (AWSResourceType resourceType : AWSResourceType.values()) {
List<Resource> resources = crawler.resources(resourceType);
if (resourceType == AWSResourceType.ASG) {
verifyASGList(resources, asgList);
} else {
Assert.assertTrue(resources.isEmpty());
}
}
}
use of com.netflix.simianarmy.Resource in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesWithNullIds.
@Test
public void testInstancesWithNullIds() {
List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
List<Instance> instanceList = createInstanceList();
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
List<Resource> resources = crawler.resources();
verifyInstanceList(resources, instanceDetailsList);
}
use of com.netflix.simianarmy.Resource in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesWithResourceType.
@Test
public void testInstancesWithResourceType() {
List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
List<Instance> instanceList = createInstanceList();
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
for (AWSResourceType resourceType : AWSResourceType.values()) {
List<Resource> resources = crawler.resources(resourceType);
if (resourceType == AWSResourceType.INSTANCE) {
verifyInstanceList(resources, instanceDetailsList);
} else {
Assert.assertTrue(resources.isEmpty());
}
}
}
Aggregations