Package net.sf.pmr.agilePlanning.domain.iteration

Examples of net.sf.pmr.agilePlanning.domain.iteration.IterationImpl


     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
       
        iteration = new IterationImpl()
       
        validator = AgilePlanningObjectFactory.getIterationValidator();
       
    }
View Full Code Here


        project.setName("Super A");
        project.setPersistanceId(2);
        project.setPersistanceVersion(3);
       
        // Build iteration to Add
        iterationToAdd = new IterationImpl();
        iterationToAdd.setProject(project);
       
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, 2000);
        calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
        calendar.set(Calendar.DAY_OF_MONTH, 2);
       
        iterationToAdd.setEndDate(calendar.getTime());
        iterationToAdd.setPersistanceId(0);
        iterationToAdd.setPersistanceVersion(0);
       
        calendar.set(Calendar.DAY_OF_MONTH, 22);
       
        iterationToAdd.setStartDate(calendar.getTime());
       
       

        // Build iteration to Update
        iterationToUpdate = new IterationImpl();
        iterationToUpdate.setProject(project);

        calendar.set(Calendar.YEAR, 2000);
        calendar.set(Calendar.MONTH, Calendar.MARCH);
        calendar.set(Calendar.DAY_OF_MONTH, 12);
       
        iterationToUpdate.setEndDate(calendar.getTime());
        iterationToUpdate.setPersistanceId(1);
        iterationToUpdate.setPersistanceVersion(2);
       
        calendar.set(Calendar.DAY_OF_MONTH, 26);
       
        iterationToUpdate.setStartDate(calendar.getTime());
       
        // Build IterationToDelete
        iterationToDelete = new IterationImpl();
       
        iterationToDelete.setProject(project);

        calendar.set(Calendar.YEAR, 2004);
        calendar.set(Calendar.MONTH, Calendar.APRIL);
View Full Code Here

     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
       
        iteration = new IterationImpl()
       
        validator = AgilePlanningObjectFactory.getIterationValidator();
       
    }
View Full Code Here

     */
    protected void setUp() throws Exception {
        super.setUp();
       
        // iteration to add or update
        iterationToAddOrUpdate = new IterationImpl();
        project = new ProjectImpl();
        iterationToAddOrUpdate.setProject(project);
        iterationToAddOrUpdate.setPersistanceId(1);

        mockIterationValidator = new MockIterationValidator();
View Full Code Here

     */
    public void testUpdateWhenValidationFails() {

        int persistanceId = 2;

        Iteration iterationToUpdate = new IterationImpl();
        Project project = new ProjectImpl();
        iterationToUpdate.setProject(project);

        // recherche de l'iteration
        mockIterationRepository.expectFindByPersistanceId(persistanceId, iterationToUpdate);

        // mock de l'erreur
View Full Code Here

     * </ul>
     */
    public void testFindByPersistanceIdWhenIterationIsFound() {

        int persistanceId = 1;
        Iteration iteration = new IterationImpl();

        mockIterationRepository.expectFindByPersistanceId(persistanceId, iteration);

        Iteration iterationFromService = iterationService.findByPersistanceId(persistanceId);

View Full Code Here

     */
    public void testFindByProjectPersistanceIdWhenIterationsAreFound() {

        int projetPersistanceId = 1;
        Set<Iteration> set = new HashSet<Iteration>();
        Iteration iteration = new IterationImpl();
        set.add(iteration);

        mockIterationRepository.expectFindByProjectPersistanceId(projetPersistanceId, set);

        Set setFromService = iterationService.findByProjectPersistanceId(projetPersistanceId);
View Full Code Here

     * <li>retour d'une structure d'erreur vide<li>
     * </ul>
     */
    public void testAddStories() {

        Iteration iteration = new IterationImpl();
        int iterationPersistanceId = 1;
        long iterationPersistanceVersion = 2;
       
        iteration.setPersistanceVersion(3);
        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);

        Set<Integer> storyIds = new HashSet<Integer>();
        storyIds.add(story1PersistanceId);
        storyIds.add(story2PersistanceId);

        // les appels peuvent être réalisés dans n'importe quel ordre
        MockCore.startBlock();
       
        // recherche de l'itération
        mockIterationRepository.expectFindByPersistanceId(iterationPersistanceId, iteration);
       
        // Recherche des stories
        mockStoryRepository.expectFindByPersistanceId(story1PersistanceId, story1);
        mockStoryRepository.expectFindByPersistanceId(story2PersistanceId, story2);

        MockCore.endBlock();
       
        // vérification que le numéro de version est mis à jour
       
        // validation de l'iteration
        mockIterationValidator.expectValidate(iteration, errors);
       
        // enregistrement
        mockIterationRepository.expectAddOrUpdate(iteration);

        // service
        Errors errors = iterationService.addStories(storyIds, iterationPersistanceId, iterationPersistanceVersion);
       
        // vérification qu'aucune erreur n'est retournée
        assertFalse(errors.hasErrors());
       
        // vérification du bon ajout dans la liste des stories (avant la validation)
        assertTrue(iteration.getStories().contains(story1));
        assertTrue(iteration.getStories().contains(story2));

        // vérification que le numéro de version est mis à jour
        assertEquals(iterationPersistanceVersion, iteration.getPersistanceVersion());

    }
View Full Code Here

     * </ul>
     */
    public void testAddStoriesWhenValidationFails() {

      // construction de l'iteration
        Iteration iteration = new IterationImpl();
        int iterationPersistanceId = 1;
        long iterationPersistanceVersion = 2;
       
        iteration.setPersistanceVersion(3);
        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        // construction des stories
        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);

        Set<Integer> storyIds = new HashSet<Integer>();
        storyIds.add(story1PersistanceId);
        storyIds.add(story2PersistanceId);

        // les appels peuvent être réalisés dans n'importe quel ordre
        MockCore.startBlock();
       
        // recherche de l'itération
        mockIterationRepository.expectFindByPersistanceId(iterationPersistanceId, iteration);
       
        // Recherche des stories
        mockStoryRepository.expectFindByPersistanceId(story1PersistanceId, story1);
        mockStoryRepository.expectFindByPersistanceId(story2PersistanceId, story2);

        MockCore.endBlock();
       
        // vérification que le numéro de version est mis à jour
       
        // validation de l'iteration, avec une erreur
        errors.reject("erreur !!");
        mockIterationValidator.expectValidate(iteration, errors);
       
        // l'enregistrement n'est pas appellé
       
        // service
        Errors errors = iterationService.addStories(storyIds, iterationPersistanceId, iterationPersistanceVersion);
       
        // vérification que les erreurs sont retournées
        assertTrue(errors.hasErrors());
       
        // vérification du bon ajout dans la liste des stories (avant la validation)
        assertTrue(iteration.getStories().contains(story1));
        assertTrue(iteration.getStories().contains(story2));

        // vérification que le numéro de version est mis à jour
        assertEquals(iterationPersistanceVersion, iteration.getPersistanceVersion());

    }
View Full Code Here

     * <li>Retoure de la structure d'erreur sans erreurs<li>
     * </ul>
     */
    public void testRemoveStories() {
     
        Iteration iteration = new IterationImpl();
        int iterationPersistanceId = 1;
        long iterationPersistanceVersion = 2;
       
        iteration.setPersistanceVersion(3);
        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);

        Set<Integer> storyIds = new HashSet<Integer>();
        storyIds.add(story1PersistanceId);
        storyIds.add(story2PersistanceId);

        // les appels peuvent être réalisés dans n'importe quel ordre
        MockCore.startBlock();
       
        // recherche de l'itération
        mockIterationRepository.expectFindByPersistanceId(iterationPersistanceId, iteration);
       
        // Recherche des stories
        mockStoryRepository.expectFindByPersistanceId(story1PersistanceId, story1);
        mockStoryRepository.expectFindByPersistanceId(story2PersistanceId, story2);

        MockCore.endBlock();
       
        // vérification que le numéro de version est mis à jour
       
        // validation de l'iteration
        mockIterationValidator.expectValidate(iteration, errors);
       
        // enregistrement
        mockIterationRepository.expectAddOrUpdate(iteration);

        // service
        Errors errors = iterationService.removeStories(storyIds, iterationPersistanceId, iterationPersistanceVersion);
       
        // vérification qu'aucune erreur n'est retournée
        assertFalse(errors.hasErrors());
       
        // vérification de la bonne suppression dans la liste des stories (avant la validation)
        assertFalse(iteration.getStories().contains(story1));
        assertFalse(iteration.getStories().contains(story2));

        // vérification que le numéro de version est mis à jour
        assertEquals(iterationPersistanceVersion, iteration.getPersistanceVersion());

    }
View Full Code Here

TOP

Related Classes of net.sf.pmr.agilePlanning.domain.iteration.IterationImpl

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.