Package com.netflix.simianarmy.aws

Examples of com.netflix.simianarmy.aws.AWSResource


        Assert.assertNull(resource.getExpectedTerminationTime());
    }

    @Test
    public void testUnavailableVolume() {
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME);
        ((AWSResource) resource).setAWSResourceState("stopped");
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(), 0, 0);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here


    @Test
    public void testTaggedAsNotMark() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold + 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
View Full Code Here

    @Test
    public void testNoMetaTag() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
View Full Code Here

    @Test
    public void testUserSpecifiedTerminationDate() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        int retentionDays = 4;
        DateTime userDate = new DateTime(now.plusDays(3).withTimeAtStartOfDay());
        resource.setTag(JanitorMonkey.JANITOR_TAG,
View Full Code Here

    @Test
    public void testOldDetachedVolume() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold + 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
View Full Code Here

    public void testOldDetachedVolumeBeforeDaylightSavingsCutover() {
        int ageThreshold = 5;
        //here we set the create date to a few days before a known DST cutover, where
        //we observed DST failures
        DateTime closeToSpringAheadDst = new DateTime(2014, 3, 7, 0, 0, DateTimeZone.forID("America/Los_Angeles"));
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
            .withLaunchTime(new Date(closeToSpringAheadDst.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(closeToSpringAheadDst.minusDays(ageThreshold + 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
View Full Code Here

    @Test
    public void testDetachedVolumeNotOld() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold - 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
View Full Code Here

    @Test
    public void testAttachedVolume() {
        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        String metaTag = VolumeTaggingMonkey.makeMetaTag("i-123", "owner", null);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
        int retentionDays = 4;
View Full Code Here

    public void testResourceWithExpectedTerminationTimeSet() {
        DateTime now = DateTime.now();
        Date oldTermDate = new Date(now.plusDays(10).getMillis());
        String oldTermReason = "Foo";
        int ageThreshold = 5;
        Resource resource = new AWSResource().withId("vol-123").withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold + 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
View Full Code Here

    private Resource parseJsonElementToVolumeResource(String region, JsonNode jsonNode) {
        Validate.notNull(jsonNode);
        long createTime = jsonNode.get("createTime").asLong();

        Resource resource = new AWSResource().withId(jsonNode.get("volumeId").getTextValue()).withRegion(region)
                .withResourceType(AWSResourceType.EBS_VOLUME)
                .withLaunchTime(new Date(createTime));

        JsonNode tags = jsonNode.get("tags");
        StringBuilder description = new StringBuilder();
View Full Code Here

TOP

Related Classes of com.netflix.simianarmy.aws.AWSResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.