Package org.joda.time

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


            } else if (dt.getMinuteOfHour() != 0) {
                return dt.plusMinutes(1);
            } else if (dt.getHourOfDay() != 0) {
                return dt.plusHours(1);
            } else {
                return dt.plusDays(1);
            }
        default:
            return null;
        }
    }
View Full Code Here


            .addRule(new AlwaysInvalidRule(now, perm[1]))
            .addRule(new AlwaysInvalidRule(now, perm[2]));
            Assert.assertFalse(engine.isValid(resource));
            Assert.assertEquals(
                    resource.getExpectedTerminationTime().getTime(),
                    now.plusDays(1).getMillis());
            Assert.assertEquals(resource.getTerminationReason(), "1");
        }
    }

}
View Full Code Here

        Map<String, Resource> trackedResources = new HashMap<String, Resource>();
        int n = 10;
        DateTime now = DateTime.now();
        Date markTime = new Date(now.minusDays(5).getMillis());
        Date notifyTime = new Date(now.minusDays(4).getMillis());
        Date terminationTime = new Date(now.plusDays(10).getMillis());
        for (Resource r : generateTestingResources(n)) {
            trackedResources.put(r.getId(), r);
            r.setState(CleanupState.MARKED);
            r.setNotificationTime(notifyTime);
            r.setMarkTime(markTime);
View Full Code Here

        int ageThreshold = 5;
        DateTime now = DateTime.now();
        Resource resource = new AWSResource().withId("snap123").withResourceType(AWSResourceType.EBS_SNAPSHOT)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("completed");
        Date oldTermDate = new Date(now.plusDays(10).getMillis());
        String oldTermReason = "Foo";
        int retentionDays = 4;
        NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
        resource.setExpectedTerminationTime(oldTermDate);
View Full Code Here

        String description = "This is a test resource.";
        String ownerEmail = "owner@test.com";
        String region = "us-east-1";
        String terminationReason = "This is a test termination reason.";
        DateTime now = DateTime.now();
        Date expectedTerminationTime = new Date(now.plusDays(10).getMillis());
        Date markTime = new Date(now.getMillis());
        String fieldName = "fieldName123";
        String fieldValue = "fieldValue456";
        Resource resource = new AWSResource().withId(id).withResourceType(resourceType)
                .withDescription(description).withOwnerEmail(ownerEmail).withRegion(region)
View Full Code Here

        String description = "This is a test resource.";
        String ownerEmail = "owner@test.com";
        String region = "us-east-1";
        String terminationReason = "This is a test termination reason.";
        DateTime now = DateTime.now();
        Date expectedTerminationTime = new Date(now.plusDays(10).getMillis());
        Date markTime = new Date(now.getMillis());
        String fieldName = "fieldName123";
        String fieldValue = "fieldValue456";

        SelectResult result1 = mkSelectResult(id1, resourceType, state, description, ownerEmail,
View Full Code Here

    }

    @Test
    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("i-12345678").withResourceType(AWSResourceType.INSTANCE)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()))
                .withExpectedTerminationTime(oldTermDate)
View Full Code Here

        MonkeyCalendar calendar = new TestMonkeyCalendar();
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        int retentionDays = 3;
        OldEmptyASGRule rule = new OldEmptyASGRule(calendar, launchConfiguAgeThreshold, retentionDays,
                new DummyASGInstanceValidator());
        Date oldTermDate = new Date(now.plusDays(10).getMillis());
        String oldTermReason = "Foo";
        resource.setExpectedTerminationTime(oldTermDate);
        resource.setTerminationReason(oldTermReason);
        Assert.assertFalse(rule.isValid(resource));
        Assert.assertEquals(oldTermDate, resource.getExpectedTerminationTime());
View Full Code Here


    @Test
    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");
View Full Code Here

            LOGGER.error(String.format("Failed to find creation time for launch configuration %s", lcName));
            return true;
        }

        DateTime createTime = new DateTime(Long.parseLong(lcCreationTime));
        if (now.isBefore(createTime.plusDays(launchConfigAgeThreshold))) {
            LOGGER.info(String.format("The launch configuration %s has not been created for more than %d days",
                    lcName, launchConfigAgeThreshold));
            return true;
        }
        LOGGER.info(String.format("The launch configuration %s has been created for more than %d days",
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.