Package org.libreplan.business.planner.entities

Examples of org.libreplan.business.planner.entities.Task$DurationBetweenDates


    @Test
    public void taskGroupHasManyTaskElements() {
        List<TaskElement> tasks = taskGroup.getChildren();
        assertTrue("a task group has no task elements initially", tasks
                .isEmpty());
        TaskElement child1 = new Task();
        LocalDate start = new LocalDate(2000, 10, 20);
        child1.setIntraDayStartDate(IntraDayDate.startOfDay(start));
        child1.setIntraDayEndDate(IntraDayDate.startOfDay(start.plusDays(10)));
        taskGroup.addTaskElement(child1);

        TaskGroup child2 = createValidTaskGroup();
        taskGroup.addTaskElement(child2);
View Full Code Here


                child2)));
    }

    @Test
    public void addingTaskElementToTaskGroupSetsTheParentProperty() {
        Task child = TaskTest.createValidTask();
        taskGroup.addTaskElement(child);
        assertThat(child.getParent(), equalTo(taskGroup));
    }
View Full Code Here

                        UserDashboardUtil.getBoundResourceAsList(user), null,
                        null);

        List<Task> tasks = new ArrayList<Task>();
        for (SpecificResourceAllocation each : resourceAllocations) {
            Task task = each.getTask();
            forceLoad(task);
            tasks.add(task);
        }

        sortTasksDescendingByStartDate(tasks);
View Full Code Here

        taskGroup.getChildren().set(0, null);
    }

    @Test
    public void taskGroupIsFinishedIifAllTasksAreFinished() {
        Task task1 = TaskTest.createValidTaskWithFullProgress();
        Task task2 = TaskTest.createValidTaskWithFullProgress();
        TaskGroup taskGroup = new TaskGroup();
        taskGroup.addTaskElement(task1);
        taskGroup.addTaskElement(task2);
        assertTrue(taskGroup.isFinished());
        task2.setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
        task2.resetStatus();
        taskGroup.resetStatus();
        assertFalse(taskGroup.isFinished());
    }
View Full Code Here

        assertFalse(taskGroup.isFinished());
    }

    @Test
    public void taskGroupIsInProgressIifAnyTaskisInProgress() {
        Task task1 = TaskTest.createValidTaskWithFullProgress();
        Task task2 = TaskTest.createValidTaskWithFullProgress();
        TaskGroup taskGroup = new TaskGroup();
        taskGroup.addTaskElement(task1);
        taskGroup.addTaskElement(task2);
        assertFalse(taskGroup.isInProgress());
        task2.setAdvancePercentage(new BigDecimal("0.0001", new MathContext(4)));
        task2.resetStatus();
        taskGroup.resetStatus();
        assertTrue(taskGroup.isInProgress());
    }
View Full Code Here

    private TaskElement task = new Task();

    private Dependency exampleDependency;

    public TaskElementTest() {
        this.exampleDependency = Dependency.create(new Task(), new Task(),
                Type.END_START);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void aDependencyWithThisOriginCanBeRemoved() {
        Task origin = new Task();
        Task destination = new Task();
        Type type = Type.START_END;
        Dependency.create(origin, destination, type);
        assertThat(origin.getDependenciesWithThisOrigin().size(), equalTo(1));
        assertThat(destination.getDependenciesWithThisDestination().size(),
                equalTo(1));
        origin.removeDependencyWithDestination(destination, type);
        assertThat(origin.getDependenciesWithThisOrigin().size(), equalTo(0));
        assertThat(destination.getDependenciesWithThisDestination().size(),
                equalTo(0));
    }
View Full Code Here

        Dependency.create(taskBeingTransformed, destinationDependencyTask,
                Type.END_START);
    }

    public void detachRemovesDependenciesFromRelatedTasks() {
        Task taskToDetach = (Task) TaskTest.createValidTask();
        Task sourceDependencyTask = (Task) TaskTest.createValidTask();
        Task destinationDependencyTask = (Task) TaskTest.createValidTask();
        taskToDetach.setName("prueba");
        taskToDetach.setNotes("blabla");
        taskToDetach.setStartDate(new Date());
        addDependenciesForChecking(taskToDetach, sourceDependencyTask,
                destinationDependencyTask);
        taskToDetach.detach();
        assertThat(sourceDependencyTask.getDependenciesWithThisOrigin().size(),
                equalTo(0));
        assertThat(destinationDependencyTask
                .getDependenciesWithThisDestination().size(), equalTo(0));
    }
View Full Code Here

    @Test
    @Transactional
    public void detachRemovesTaskFromParent() {
        TaskGroup parent = TaskGroupTest.createValidTaskGroup();
        Task child = (Task) TaskTest.createValidTask();
        Task anotherChild = (Task) TaskTest.createValidTask();
        parent.addTaskElement(child);
        parent.addTaskElement(anotherChild);
        child.detach();
        assertThat(parent.getChildren().size(), equalTo(1));
    }
View Full Code Here

        OrderLine orderLine = OrderLine.create();
        addOrderTo(orderLine);
        LocalDate deadline = new LocalDate(2007, 4, 4);
        orderLine.setDeadline(asDate(deadline));
        TaskSource taskSource = asTaskSource(orderLine);
        Task task = Task.createTask(taskSource);
        assertThat(task.getDeadline(), equalTo(deadline));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.Task$DurationBetweenDates

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.