Examples of DerivedAllocation


Examples of org.libreplan.business.planner.entities.DerivedAllocation

    public void forOneResourceTheHoursGeneratedAreGotFromAlpha() {
        givenDerivedFrom();
        givenFinder();
        givenConfigurationUnit(new BigDecimal(1.5), new Worker());
        givenDayAssignments(new LocalDate(2009, 10, 20), 8, 8, 8, 4);
        DerivedAllocation derivedAllocation = DerivedAllocationGenerator
                .generate(derivedFrom, finder, configurationUnit,
                        dayAssignments);
        List<DerivedDayAssignment> assignments = derivedAllocation
                .getAssignments();
        assertThat(assignments, haveHours(12, 12, 12, 6));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

        Machine otherMachine = Machine.create();
        dayAssignments
                .add(createAssignment(start.plusDays(5), otherMachine, 8));

        DerivedAllocation derivedAllocation = DerivedAllocationGenerator
                .generate(derivedFrom, finder, configurationUnit,
                        dayAssignments);
        List<DerivedDayAssignment> assignments = derivedAllocation
                .getAssignments();
        assertThat(assignments.size(), equalTo(4));
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

        Worker worker1 = workerWithAlwaysAssignedHours(4);
        Worker worker2 = workerWithAlwaysAssignedHours(6);
        givenFinder(worker1, worker2);
        givenConfigurationUnit(new BigDecimal(1.5));
        givenDayAssignments(new LocalDate(2009, 10, 20), 8, 8, 8, 4);
        DerivedAllocation derivedAllocation = DerivedAllocationGenerator
                .generate(derivedFrom, finder, configurationUnit,
                        dayAssignments);
        List<DerivedDayAssignment> assignments = derivedAllocation
                .getAssignments();
        Map<Resource, List<DerivedDayAssignment>> byResource = DayAssignment
                .byResourceAndOrdered(assignments);
        assertThat(byResource.get(worker1), haveHours(7, 7, 7, 4));
        assertThat(byResource.get(worker2), haveHours(5, 5, 5, 2));
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

    @Test
    public void aDerivedAllocationHasAMachineWorkerConfigurationUnitAndAResourceAllocation() {
        givenConfigurationUnit();
        givenDerivedFrom();
        DerivedAllocation result = DerivedAllocation.create(derivedFrom,
                configurationUnit);
        assertNotNull(result);
        assertThat(result.getConfigurationUnit(), equalTo(configurationUnit));
        assertEquals(result.getDerivedFrom(), derivedFrom);
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

    @Test
    public void aJustCreatedDerivedAllocationIsANewObject() {
        givenDerivedFrom();
        givenConfigurationUnit();
        DerivedAllocation result = DerivedAllocation.create(derivedFrom,
                configurationUnit);
        assertTrue(result.isNewObject());
    }
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

    }

    @Test
    public void whenResettingAssignmentsTheParentIsChanged() {
        givenADerivedAllocation();
        DerivedAllocation another = DerivedAllocation.create(derivedFrom,
                configurationUnit);
        givenDayAssignments(another, new LocalDate(2008, 12, 1), worker, 8, 8,
                8);
        derivedAllocation.resetAssignmentsTo(dayAssignments);
        for (DerivedDayAssignment each : derivedAllocation.getAssignments()) {
View Full Code Here

Examples of org.libreplan.business.planner.entities.DerivedAllocation

    @Test
    public void asDerivedFromChangesTheDerivedFromProperty() {
        givenADerivedAllocation();
        ResourceAllocation<?> newDerivedFrom = GenericResourceAllocation
                .create();
        DerivedAllocation modified = derivedAllocation
                .asDerivedFrom(newDerivedFrom);
        assertEquals(newDerivedFrom, modified.getDerivedFrom());
    }
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.