Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.Category


    }

    @Test
    public void save_Valid(){
        MongoDbCategory converted = new MongoDbCategory();
        Category item = new MongoDbCategory();

        expect(converter.convert(item, Category.class)).andReturn(converted);
        template.save(converted, CollectionNames.CATEGORY_COLLECTION);
        expectLastCall();
        converter.hydrate(converted, Category.class);
View Full Code Here


        setValue(categoryService.get(text));
    }

    @Override
    public String getAsText() {
        Category category = (Category)getValue();
        return (category == null) ? null : category.getId().toString();
    }
View Full Code Here

        assertThat(converted, is(sameInstance(categoryRepository.save(item))));
    }

    @Test
    public void delete_Valid(){
        Category item = new MongoDbCategory();
        String id = "123";
        item.setId(id);
        MongoDbCategory hydrate = new MongoDbCategory();

        expect(template.findById(id, categoryRepository.CLASS, CollectionNames.CATEGORY_COLLECTION)).andReturn(hydrate);
        template.remove(hydrate, CollectionNames.CATEGORY_COLLECTION);
        expectLastCall();
View Full Code Here

       
        assertEquals(ViewNames.ADMIN_CATEGORIES, viewName);
        assertEquals(categories, model.asMap().get("categories"));
        assertFalse(model.containsAttribute("actionresult"));
        assertTrue(model.containsAttribute("category"));
        assertEquals("Check that the category object available", new Category(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
        assertTrue("verify tokencheck", model.asMap().containsKey(ModelKeys.TOKENCHECK));
    }
View Full Code Here

        assertEquals(ViewNames.ADMIN_CATEGORIES, viewName);
        assertEquals(categories, model.asMap().get("categories"));
        assertTrue(model.containsAttribute("actionresult"));
        assertEquals(UPDATE, model.asMap().get("actionresult"));
        assertTrue(model.containsAttribute("category"));
        assertEquals("Check that the category object available", new Category(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
    }
View Full Code Here

        assertEquals(ViewNames.ADMIN_CATEGORIES, viewName);
        assertEquals(categories, model.asMap().get("categories"));
        assertTrue(model.containsAttribute("actionresult"));
        assertEquals(DELETE, model.asMap().get("actionresult"));
        assertTrue(model.containsAttribute("category"));
        assertEquals("Check that the category object available", new Category(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
    }
View Full Code Here

        assertEquals(ViewNames.ADMIN_CATEGORIES, viewName);
        assertEquals(categories, model.asMap().get("categories"));
        assertTrue(model.containsAttribute("actionresult"));
        assertEquals(CREATE, model.asMap().get("actionresult"));
        assertTrue(model.containsAttribute("category"));
        assertEquals("Check category object available", new Category(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
    }
View Full Code Here

    @Test
    public void createCategory_valid(){
        Model model = new ExtendedModelMap();
        User user = new User();
        String categoryText = "Social";
        Category category = new Category();
        category.setText(categoryText);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        expect(categoryService.create(categoryText, user)).andReturn(new Category());
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, categoryService,sessionStatus);
        String view = controller.createCategory(category, validToken, validToken, model, sessionStatus);
        assertEquals("ViewName match", "redirect:/app/admin/categories?action=create", view);
View Full Code Here

    public void createCategory_invalidToken(){
        Model model = new ExtendedModelMap();
        String invalidToken =  AdminControllerUtil.generateSessionToken();
        User user = new User();
        String categoryText = "Social";
        Category category = new Category();
        category.setText(categoryText);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        expect(categoryService.create(categoryText, user)).andReturn(new Category());
        sessionStatus.setComplete();
        expectLastCall();
        replay(userService, categoryService,sessionStatus);
        String view = controller.createCategory(category, validToken, invalidToken, model, sessionStatus);
        assertTrue("Test should catch exception and never hit this test", false);
View Full Code Here

    @Test
    public void createCategory_invalidValidRequest_emptyText(){
        Model model = new ExtendedModelMap();
        User user = new User();
        String categoryText = "";
        Category category = new Category();
        category.setText(categoryText);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        replay(userService);
        String view = controller.createCategory(category, validToken, validToken, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORIES, view);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Category

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.