Package org.nxplanner.domain

Examples of org.nxplanner.domain.Task


        assertEquals("wrong adjusted estimated hours", 6.0, adjustedEstimated, 0);
    }

    public void testGetAdjustedEstimatedHoursWithUnestimatedTasks() {
        Task task1 = new Task();
        FieldAccessor.set(task1, "timeEntries", new ArrayList());
        Task task2 = new Task();
        ArrayList tasks = new ArrayList();
        FieldAccessor.set(task2, "timeEntries", new ArrayList());
        tasks.add(task1);
        tasks.add(task2);
        UserStory story = new UserStory();
View Full Code Here


        task = newTask(story);
        task.setName("aaa task");
        UserStory anotherStory = newUserStory(iteration);
        anotherStory.setName("zzzz"); //second in alphabetical order
        anotherStory.setPriority(1); //first in priority order
        Task anotherTask = newTask(anotherStory);
        anotherTask.setName("zzz task");
        source = new IterationDataSource(iteration, session);
        assertFieldValues(anotherStory, anotherTask);
        assertFieldValues(story, task);
        assertFalse("next", source.next());
    }
View Full Code Here

                    entry.setPerson2Id(person2Id);
                    entry.setReportDate(reportDate);
                }
            }

            Task task = (Task)session.load(Task.class, new Integer(form.getOid()));
            //log.info("task estimate: "+task.getEstimatedHours()+", actual = "+hoursWorked);
            if (hoursWorked > task.getEstimatedHours()) {
                request.setAttribute("edit/task", task);
                request.setAttribute("actualHours", new Double(hoursWorked));
                request.setAttribute("estimatedHours", new Double(task.getEstimatedHours()));
                return actionMapping.findForward("edit/task/estimate");
            }

            if (rowDeleted) {
                form.reset(actionMapping, request);
View Full Code Here

    }

    private ActionForward doUpdateEstimateAction(Session session, TimeEditorForm form,
            HttpServletRequest request) throws Exception {
        try {
            Task task = (Task)session.load(Task.class, new Integer(form.getOid()));
            task.setEstimatedHours(new DecimalFormat(request).parse(request.getParameter("estimate")));
            return new ActionForward(request.getParameter("returnto"), true);
        } finally {
            session.flush();
            session.connection().commit();
        }
View Full Code Here

        SimpleDateFormat dateTimeFormat = getDateTimeFormat(request);
        SimpleDateFormat dateFormat = getDateFormat(request);
        List entries = session.find("from timeEntry in class org.nxplanner.domain.TimeEntry " +
                "where timeEntry.taskId = ? order by timeEntry.reportDate",
                form.getOid(), Hibernate.STRING);
        Task task = null;
        if (entries.size() == 0) {
            int taskId = Integer.parseInt(form.getOid());
            task = (Task)session.load(Task.class, new Integer(taskId));
        }
        session.connection().rollback();

        int i = 0;
        TimeEntry entry = null;
        Iterator itr = entries.iterator();
        while (itr.hasNext()) {
            entry = (TimeEntry)itr.next();
            form.setEntryId(i, Integer.toString(entry.getId()));
            if (entry.getStartTime() != null) {
                form.setStartTime(i, dateTimeFormat.format(entry.getStartTime()));
            } else {
                form.setStartTime(i, "");
            }
            if (entry.getEndTime() != null) {
                form.setEndTime(i, dateTimeFormat.format(entry.getEndTime()));
            } else {
                form.setEndTime(i, "");
            }
            form.setDuration(i, DecimalFormat.format(request, entry.getDuration()));
            form.setPerson1Id(i, Integer.toString(entry.getPerson1Id()));
            form.setPerson2Id(i, Integer.toString(entry.getPerson2Id()));
            if (entry.getReportDate() != null) {
                form.setReportDate(i, dateFormat.format(entry.getReportDate()));
            } else {
                form.setReportDate(i, "");
            }
            i++;
        }
        if (entry == null || entry.getEndTime() != null || entry.getDuration() > 0) {
            // start new row
            form.setEntryId(i, "0");
            form.setDeleted(i, null);
            form.setStartTime(i, "");
            form.setEndTime(i, "");
            form.setReportDate(i, dateFormat.format(new Date()));
            if (i == 0) {
                int personId = task.getAcceptorId();
                form.setPerson1Id(i, personId == 0 ? null : Integer.toString(personId));
                form.setPerson2Id(i, null);
            } else {
                form.setPerson1Id(i, form.getPerson1Id(i - 1));
                form.setPerson2Id(i, form.getPerson2Id(i - 1));
View Full Code Here

        t2.setEndTime(new Date(now + 7200000));
        ArrayList timeEntries = new ArrayList();
        timeEntries.add(t1);
        timeEntries.add(t2);

        task1 = new Task();
        task1.setAcceptorId(1010);
        task1.setEstimatedHours(4.0);
        task1.setOriginalEstimatedHours(2.0);
        task1.setTimeEntries(timeEntries);
        task1.setCreatedDate(new Date(0));
        task2 = new Task();
        task2.setAcceptorId(1212);
        task2.setEstimatedHours(4.0);
        task2.setOriginalEstimatedHours(3.0);
        task2.setTimeEntries(timeEntries);
        task2.setCreatedDate(new Date(0));
        task3 = new Task();
        task3.setAcceptorId(1313);
        task3.setEstimatedHours(6.0);
        task3.setOriginalEstimatedHours(4.0);
        task3.setTimeEntries(new ArrayList());
        task3.setCreatedDate(new Date(0));
View Full Code Here

        Logger.getRootLogger().setLevel(logLevel);
        GlobalSessionFactory.set(null);
    }

    public void testPopulateFormWithoutTimeEntries() throws Exception {
        Task task = new Task();
        task.setAcceptorId(44);
        mockSession.find2Return = new ArrayList();
        mockSession.loadReturn = task;
        replay();

        support.executeAction(action);
View Full Code Here

        assertEquals("wrong forward", "editor.jsp", forward.getPath());
        assertTrue("txn rollback not called", support.connection.rollbackCalled);
    }

    public void testActionCreateEntry() throws Exception {
        Task task = new Task();
        task.setEstimatedHours(4.0);
        mockSession.loadReturn = task;

        editorForm.setAction(UpdateTimeAction.UPDATE_TIME_ACTION);
        editorForm.setEntryId(0, "0");
        editorForm.setStartTime(0, DATE_1a);
View Full Code Here

        assertTrue("txn commit not called", support.connection.commitCalled);
        assertTrue("reset called", !editorForm.resetCalled);
    }

    public void testActionEditEntryNoEndTime() throws Exception {
        Task task = new Task();
        task.setEstimatedHours(4.0);
        mockSession.loadReturn = task;
        setUpTimeEntries();

        editorForm.setAction(UpdateTimeAction.UPDATE_TIME_ACTION);
        editorForm.setEntryId(0, "1");
View Full Code Here

        assertTrue("not redirected", forward.getRedirect());
        assertTrue("txn commit not called", support.connection.commitCalled);
    }

    public void testActionCreateEntryNoStartTime() throws Exception {
        Task task = new Task();
        task.setEstimatedHours(4.0);
        mockSession.loadReturn = task;
        editorForm.setAction(UpdateTimeAction.UPDATE_TIME_ACTION);
        editorForm.setEntryId(0, "0");
        editorForm.setEndTime(0, DATE_2a);
        editorForm.setReportDate(0, DATE_1c);
View Full Code Here

TOP

Related Classes of org.nxplanner.domain.Task

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.