Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.IntraDayDate


                8));
    }

    @Test
    public void initiallyTheIntendedResourcesPerDayAreNull() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        assertThat(specificResourceAllocation.getIntendedResourcesPerDay(),
                nullValue());
    }
View Full Code Here


                nullValue());
    }

    @Test
    public void afterAllocatingSomeResourcesPerDayTheIntendedResourcesPerDayAreNotNull() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        ResourcesPerDay specified = ResourcesPerDay.amount(1);
        specificResourceAllocation.resourcesPerDayUntil(plusDays(start, 3))
                .allocate(specified);
        assertThat(specificResourceAllocation.getIntendedResourcesPerDay(),
View Full Code Here

    public void theIntendedAndTheRealResourcesPerDayCanBeDifferent() {
        givenResourceCalendar(
                Capacity.create(hours(8)).withAllowedExtraEffort(hours(2)),
                Collections.<LocalDate, Capacity> emptyMap());

        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);

        specificResourceAllocation.resourcesPerDayUntil(plusDays(start, 3))
                .allocate(ResourcesPerDay.amount(2));
View Full Code Here

        assertTrue(intentededAmount.compareTo(realAmount) > 0);
    }

    @Test
    public void canAllocateFromEndUntilSomeStartDate() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        specificResourceAllocation.resourcesPerDayFromEndUntil(start).allocate(
                ResourcesPerDay.amount(1));
        assertThat(specificResourceAllocation.getAssignments(),
                haveHours(8, 8, 8, 8));
View Full Code Here

                haveHours(8, 8, 8, 8));
    }

    @Test
    public void canAllocateFromEndInTheMiddleOfTheDayToStartDate() {
        IntraDayDate start = date(2000, 2, 4);
        IntraDayDate end = plusDaysAndEffort(start, 3, hours(3));
        givenSpecificResourceAllocation(start, end);
        specificResourceAllocation.resourcesPerDayFromEndUntil(start).allocate(
                ResourcesPerDay.amount(1));
        assertThat(specificResourceAllocation.getAssignments(),
                haveHours(8, 8, 8, 3));
View Full Code Here

    }

    @Test
    public void theResourcesPerDayAreConvertedTakingIntoAccountTheWorkerCalendar() {
        givenResourceCalendarAlwaysReturning(4);
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 2);
        specificResourceAllocation.allocate(ResourcesPerDay.amount(1));
        assertThat(specificResourceAllocation.getAssignments(), haveHours(4, 4));
    }
View Full Code Here

        assertThat(specificResourceAllocation.getAssignments(), haveHours(4, 4));
    }

    @Test(expected = IllegalArgumentException.class)
    public void cantAllocateOnAnWrongInterval() {
        IntraDayDate start = date(2000, 2, 4);
        givenSpecificResourceAllocation(start, 4);
        IntraDayDate dayBefore = minusDays(start, 1);
        specificResourceAllocation.onIntervalWithinTask(start, dayBefore).allocateHours(
                10);
    }
View Full Code Here

    }

    @Test
    public void theEndDateIsTheSameDayIfItIsNotCompletelyFilled() {
        givenSpecificAllocations(ResourcesPerDay.amount(1));
        IntraDayDate endDate = ResourceAllocation.allocating(allocations)
                .untilAllocating(hours(31));
        assertThat(endDate.getDate(), equalTo(startDate.getDate().plusDays(3)));
        assertThat(endDate.getEffortDuration(), equalTo(hours(7)));
    }
View Full Code Here

    }

    @Test
    public void theResourcesPerDayUsedInfluenceTheEndHourWhenLastDayNotCompletelyFilled() {
        givenSpecificAllocations(ResourcesPerDay.amount(2));
        IntraDayDate endDate = ResourceAllocation.allocating(allocations)
                .untilAllocating(hours(20));
        assertThat(endDate.getDate(), equalTo(startDate.getDate().plusDays(1)));
        assertThat(endDate.getEffortDuration(), equalTo(hours(2)));
    }
View Full Code Here

    @Test
    public void theEndDateIsTheDayAfterIfItIsCompletelyFilled() {
        LocalDate start = new LocalDate();
        givenStartDate(IntraDayDate.create(start, hours(1)));
        givenSpecificAllocations(ResourcesPerDay.amount(1));
        IntraDayDate endDate = ResourceAllocation.allocating(allocations)
                .untilAllocating(hours(7));
        assertThat(endDate, equalTo(startDate.nextDayAtStart()));
        assertThat(endDate.getEffortDuration(), equalTo(hours(0)));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.workingday.IntraDayDate

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.