Package org.nxplanner.domain

Examples of org.nxplanner.domain.UserStory


        iteration.setName(ITERATION_PREFIX + iteration.getId());
        return iteration;
    }

    public UserStory newUserStory(Iteration iteration) {
        UserStory story = new UserStory();
        story.setId(nextId++);
        story.setName(STORY_PREFIX + iteration.getId());
        iteration.getUserStories().add(story);
        return story;
    }
View Full Code Here


                mockAuthorizer.hasPermissionPersonId);
    }

    public void testUserAuthorizedWithObjectAttributeString() throws Exception {
        mockAuthorizer.hasPermission2Return = Boolean.TRUE;
        Object mockObject = new UserStory();
        support.pageContext.setAttribute("x", mockObject);
        tag.setObject("x");
        tag.setProjectId(11);
        tag.setPermission("set");
View Full Code Here

        assertEquals("wrong param to authorizer", mockObject, mockAuthorizer.hasPermission2DomainObject);
    }

    public void testUserAuthorizedWhenObjectIsFromDefaultAttribute() throws Exception {
        mockAuthorizer.hasPermission2Return = Boolean.TRUE;
        Object mockObject = new UserStory();
        support.pageContext.setAttribute("project", mockObject);
        tag.setProjectId(11);
        tag.setPermission("set");

        int result = tag.doStartTag();
View Full Code Here

    }

    public void testUserAuthorizedWhenProjectIdFromRequestParam() throws Exception {
        support.request.setParameterValue("projectId", new String[]{"33"});
        mockAuthorizer.hasPermission2Return = Boolean.TRUE;
        UserStory mockStory = new UserStory();
        tag.setObject(mockStory);
        tag.setPermission("set");

        int result = tag.doStartTag();
View Full Code Here

public class TestStoryModel extends TestCase {
    StoryModel model;

    public void testGetName() throws Exception {
        UserStory story = new UserStory();
        story.setName("story");
        Iteration iteration = new Iteration();
        iteration.setName("iteration");
        IterationModel model = new IterationModel(iteration){
            protected Project getProject() {
                Project project = new Project();
View Full Code Here

    }

    public void testPopulateTask() throws Exception {
        Project project = newProject();
        Iteration iteration = newIteration(project);
        UserStory story = newUserStory(iteration);
        Task task = newTask(story);
        commitCloseAndOpenSession();
        DomainContext context = new DomainContext();
        context.populate(task);
        assertEquals(project.getId(), context.getProjectId());
        assertEquals(project.getName(), context.getProjectName());
        assertEquals(iteration.getId(), context.getIterationId());
        assertEquals(iteration.getName(), context.getIterationName());
        assertEquals(story.getId(), context.getStoryId());
        assertEquals(story.getName(), context.getStoryName());
        assertSame(task, context.getTargetObject());
    }
View Full Code Here

    }

    public void testPopulateStory() throws Exception {
        Project project = newProject();
        Iteration iteration = newIteration(project);
        UserStory story = newUserStory(iteration);
        commitCloseAndOpenSession();
        DomainContext context = new DomainContext();
        context.populate(story);
        assertEquals(project.getId(), context.getProjectId());
        assertEquals(project.getName(), context.getProjectName());
        assertEquals(iteration.getId(), context.getIterationId());
        assertEquals(iteration.getName(), context.getIterationName());
        assertEquals(story.getId(), context.getStoryId());
        assertEquals(story.getName(), context.getStoryName());
        assertSame(story, context.getTargetObject());
    }
View Full Code Here

    public static final String OPERATION_PARAM_KEY = "operation";

    public void beforeObjectCommit(Object object, Session session, ActionMapping actionMapping, ActionForm actionForm,
            HttpServletRequest request, HttpServletResponse reply) throws Exception {
        UserStoryEditorForm storyForm = (UserStoryEditorForm)actionForm;
        UserStory story = (UserStory)object;
        String operation = request.getParameter(OPERATION_PARAM_KEY);
        try {
            if (StringUtils.equals(operation, "continue")) {
                continueStory(request, session, story, storyForm.getTargetIterationId());
                HistorySupport.saveEvent(session, story, CONTINUED, null,
                        SecurityHelper.getRemoteUserId(request), new Date());
            } else if (StringUtils.equals(operation, "move")) {
                story.setIterationId(storyForm.getTargetIterationId());
                HistorySupport.saveEvent(session, story, MOVED, null,
                        SecurityHelper.getRemoteUserId(request), new Date());
            }
        } catch (Exception e) {
            throw new ServletException(e);
View Full Code Here

    }


    public UserStory continueStory(HttpServletRequest request, Session session, UserStory story,
            int targetIterationId) throws Exception {
        UserStory continuedStory = new UserStory();
        BeanUtils.copyProperties(continuedStory, story);
        session.save(continuedStory);
        HistorySupport.saveEvent(session, continuedStory, HistoricalEvent.CREATED, "continuation",
                SecurityHelper.getRemoteUserId(request), new Date());
        continuedStory.setTasks(null);
        continuedStory.setIterationId(targetIterationId);
        story.setDescription(getResources(request).getMessage("story.continued.to",
                Integer.toString(continuedStory.getId())) + "\n\n" + story.getDescription());
        continuedStory.setDescription(getResources(request).getMessage("story.continued.from",
                Integer.toString(story.getId()) + "\n\n" + continuedStory.getDescription()));
        Iterator taskIterator = story.getTasks().iterator();
        while (taskIterator.hasNext()) {
            Task task = (Task)taskIterator.next();
            if (!task.isCompleted()) {
                Task continuedTask = new Task();
View Full Code Here

TOP

Related Classes of org.nxplanner.domain.UserStory

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.