Package org.libreplan.business.planner.entities

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


    }

    @Test
    @Transactional
    public void taskStatusCalculationTakesIntoAccountDifferentDepType() {
        Dependency dependency1 = mockDependency(Type.END_START);
        dependency1.getOrigin().setAdvancePercentage(BigDecimal.ONE);
        Dependency dependency2 = mockDependency(Type.START_START);
        dependency2.getOrigin().setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
        assertFalse(task.isFinished());
        assertFalse(task.isInProgress());
        assertTrue(task.getTaskStatus() == TaskStatusEnum.READY_TO_START);
        dependency2.getOrigin().setAdvancePercentage(BigDecimal.ZERO);
        assertTrue(task.getTaskStatus() == TaskStatusEnum.BLOCKED);
    }
View Full Code Here


    }

    @Test
    @Transactional
    public void taskStatusNotAffectedByEndEndDeps() {
        Dependency dependency = mockDependency(Type.END_END);
        dependency.getOrigin().setAdvancePercentage(BigDecimal.ZERO);
        assertTrue(task.getTaskStatus() == TaskStatusEnum.READY_TO_START);
    }
View Full Code Here

    private Dependency mockDependency(Type type){
        return mockDependency(createValidTask(), this.task, type);
    }

    private Dependency mockDependency(TaskElement origin, TaskElement destination, Type type) {
        Dependency dependency = createNiceMock(Dependency.class);
        expect(dependency.getOrigin()).andReturn(origin).anyTimes();
        expect(dependency.getDestination()).andReturn(destination).anyTimes();
        expect(dependency.getType()).andReturn(type).anyTimes();
        replay(dependency);
        origin.add(dependency);
        destination.add(dependency);
        return dependency;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void taskIsReadyToStartIfAllEndStartDepsAreFinished() {
        Dependency dependency = mockDependency(Type.END_START);
        dependency.getOrigin().setAdvancePercentage(BigDecimal.ONE);
        assertFalse(task.isFinished());
        assertFalse(task.isInProgress());
        assertTrue(task.getTaskStatus() == TaskStatusEnum.READY_TO_START);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void taskIsReadyToStartIfAllStartStartDepsAreInProgressOrFinished() {
        Dependency dependency1 = mockDependency(Type.START_START);
        dependency1.getOrigin().setAdvancePercentage(BigDecimal.ONE);
        Dependency dependency2 = mockDependency(Type.START_START);
        dependency2.getOrigin().setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
        assertFalse(task.isFinished());
        assertFalse(task.isInProgress());
        assertTrue(task.getTaskStatus() == TaskStatusEnum.READY_TO_START);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void taskIsBlockedIfHasAnUnfinishedEndStartDependency() {
        Dependency dependency = mockDependency(Type.END_START);
        dependency.getOrigin().setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
        assertFalse(task.isFinished());
        assertFalse(task.isInProgress());
        assertTrue(task.getTaskStatus() == TaskStatusEnum.BLOCKED);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void taskIsBlockedIfHasANotStartedStartStartDependency() {
        Dependency dependency = mockDependency(Type.START_START);
        dependency.getOrigin().setAdvancePercentage(BigDecimal.ZERO);
        assertFalse(task.isFinished());
        assertFalse(task.isInProgress());
        assertTrue(task.getTaskStatus() == TaskStatusEnum.BLOCKED);
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.Dependency

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.