Package org.springframework.web.bind.support

Examples of org.springframework.web.bind.support.SessionStatus


        String categoryText = "Social";
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        expect(categoryService.get(id)).andReturn(category).anyTimes();
        categoryService.delete(category);
        expectLastCall();
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, categoryService,sessionStatus);
        String view = controller.deleteCategory(category, validToken, validToken, "true",REFERRER_ID, model,sessionStatus);
        assertEquals("ViewName match", "redirect:/app/admin/categories?action=delete&referringPageId=" + REFERRER_ID, view);
        assertTrue("empty model", model.asMap().isEmpty());
View Full Code Here


        String invalidToken = AdminControllerUtil.generateSessionToken();
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        expect(categoryService.get(id)).andReturn(category);
        categoryService.delete(category);
        expectLastCall();
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, categoryService,sessionStatus);
        String view = controller.deleteCategory(category, validToken, invalidToken, "true",REFERRER_ID, model, sessionStatus);assertTrue("Test should catch exception and never hit this test", false);
        assertTrue("Test should catch exception and never hit this test", false);
    }
View Full Code Here

        String categoryText = "";
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        replay(userService);
        String view = controller.deleteCategory(category, validToken, validToken, "true",REFERRER_ID, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view);
        assertFalse("empty model", model.asMap().isEmpty());
View Full Code Here

        String categoryText = "Social";
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        replay(userService);
        String view = controller.deleteCategory(category, validToken, validToken, "true",REFERRER_ID, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view);
        assertFalse("empty model", model.asMap().isEmpty());
View Full Code Here

        String categoryText = "Social";
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        expect(categoryService.get(id)).andReturn(null).once();
        replay(userService, categoryService);
        String view = controller.deleteCategory(category, validToken, validToken,"true",REFERRER_ID, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view);
View Full Code Here

        String categoryText = "Social";
        CategoryImpl category = new CategoryImpl();
        category.setCreatedUserId(user.getId());
        category.setText(categoryText);
        category.setId(id);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        replay(userService);
        String view = controller.deleteCategory(category, validToken, validToken,"false",REFERRER_ID, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORY_DETAIL, view);
        assertEquals("missing confirmation", true, model.asMap().get("missingConfirm"));
View Full Code Here

        user.setPassword("secrect");
        user.setConfirmPassword(user.getConfirmPassword());
        user.setEmail(email);
        final BindingResult errors = new BeanPropertyBindingResult(user, "user");

        SessionStatus sessionStatus = createMock(SessionStatus.class);

        expect(userService.getUserByEmail(email)).andReturn(user);
        userService.updateUserProfile(user);
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, sessionStatus);

        final String view = controller.updateUserDetail(user, errors, validToken, validToken, modelMap, sessionStatus);
        verify(userService, sessionStatus);
View Full Code Here

        ModelMap modelMap = new ExtendedModelMap();
        Long userid = 123L;
        User user = new User(userid, "john.doe.sr");
        final BindingResult errors = new BeanPropertyBindingResult(user, "user");

        SessionStatus sessionStatus = createMock(SessionStatus.class);
        replay(sessionStatus);
        final String view = controller.updateUserDetail(user, errors, validToken, validToken, modelMap, sessionStatus);
        verify(sessionStatus);

        assertTrue(errors.hasErrors());
View Full Code Here

    @Test(expected = SecurityException.class)
    public void updateUserDetail_wrongToken() {
        ModelMap modelMap = new ExtendedModelMap();
        User user = new User(123L, "john.doe.sr");
        final BindingResult errors = new BeanPropertyBindingResult(user, "user");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        sessionStatus.setComplete();

        expectLastCall();
        replay(sessionStatus);

        String otherToken = AdminControllerUtil.generateSessionToken();
View Full Code Here

        User user = new User(userid, "john.doe.sr");
        user.setPassword("secrect");
        user.setConfirmPassword(user.getConfirmPassword());
        user.setEmail(email);

        SessionStatus sessionStatus = createMock(SessionStatus.class);

        userService.deleteUser(user.getEntityId());
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, sessionStatus);

        final String view = controller.deleteUserDetail(user, validToken, validToken, "true", modelMap, sessionStatus);
        verify(userService, sessionStatus);
View Full Code Here

TOP

Related Classes of org.springframework.web.bind.support.SessionStatus

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.