Package org.joda.time

Examples of org.joda.time.DateTime.minusDays()


        DateTime now = DateTime.now();
        Date oldTermDate = new Date(now.plusDays(10).getMillis());
        String oldTermReason = "Foo";
        int ageThreshold = 5;
        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()))
                .withExpectedTerminationTime(oldTermDate)
                .withTerminationReason(oldTermReason);
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
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);
        int retentionDays = 4;
View Full Code Here

        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);
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
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);
        resource.setTag(JanitorMonkey.JANITOR_TAG, "donotmark");
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,
                OldDetachedVolumeRule.TERMINATION_DATE_FORMATTER.print(userDate));
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);
        int retentionDays = 4;
View Full Code Here

        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);
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
View Full Code Here

        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);
        int retentionDays = 4;
View Full Code Here

        //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);
        int retentionDays = 4;

        //set the "now" to the fixed execution date for this rule and create a partial mock
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);
        int retentionDays = 4;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.