Examples of CategoryImpl


Examples of org.apache.olingo.odata2.core.servicedocument.CategoryImpl

    return categories;
  }

  private CategoryImpl parseCategory(final XMLStreamReader reader) throws XMLStreamException {
    reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_CATEGORY);
    CategoryImpl category = new CategoryImpl();
    category.setScheme(reader.getAttributeValue(null, FormatXml.ATOM_CATEGORY_SCHEME));
    category.setTerm(reader.getAttributeValue(null, FormatXml.ATOM_CATEGORY_TERM));
    category.setLabel(reader.getAttributeValue(null, FormatXml.ATOM_CATEGORY_LABEL));
    CommonAttributesImpl attributes = parseCommonAttribute(reader);
    return category.setCommonAttributes(attributes);
  }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

        assertThat(categoryConverter.convert(category), is(nullValue()));
    }

    @Test
    public void newCategory() {
        Category category = new CategoryImpl();
        category.setCreatedDate(new Date());
        category.setId("9");
        category.setLastModifiedDate(new Date());
        category.setText("hello");
        category.setCreatedUserId("1");
        category.setLastModifiedUserId("1");
        category.setWidgets(new ArrayList<Widget>());

        JpaCategory converted = categoryConverter.convert(category);
        assertThat(converted, is(not(sameInstance(category))));
        assertThat(converted, is(instanceOf(JpaCategory.class)));
        assertThat(converted.getCreatedDate(), is(equalTo(category.getCreatedDate())));
        assertThat(converted.getCreatedUserId(), is(equalTo(category.getCreatedUserId())));
        assertThat(converted.getEntityId().toString(), is(equalTo(category.getId())));
        assertThat(converted.getId(), is(equalTo(category.getId())));
        assertThat(converted.getLastModifiedDate(), is(equalTo(category.getLastModifiedDate())));
        assertThat(converted.getLastModifiedUserId(), is(equalTo(category.getLastModifiedUserId())));
        assertThat(converted.getText(), is(equalTo(category.getText())));
        assertThat(converted.getWidgets(), is(equalTo(category.getWidgets())));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

    }

    @Override
    @Transactional
    public Category create(String text, User createdUser) {
        Category category = new CategoryImpl();
        Date now = new Date();
        category.setText(text);
        category.setCreatedDate(now);
        category.setCreatedUserId(createdUser.getId());
        category.setLastModifiedDate(now);
        category.setLastModifiedUserId(createdUser.getId());
        return categoryRepository.save(category);
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

        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 CategoryImpl(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
        assertTrue("verify tokencheck", model.asMap().containsKey(ModelKeys.TOKENCHECK));
        assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

        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 CategoryImpl(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
        assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

        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 CategoryImpl(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
        assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

        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 CategoryImpl(), model.asMap().get("category"));
        assertTrue(model.containsAttribute("topnav"));
        assertTrue(model.containsAttribute("tabs"));
        assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.CategoryImpl

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

Examples of org.apache.rave.portal.model.impl.CategoryImpl

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

Examples of org.apache.rave.portal.model.impl.CategoryImpl

    @Test
    public void createCategory_invalidValidRequest_emptyText(){
        Model model = new ExtendedModelMap();
        User user = new UserImpl();
        String categoryText = "";
        CategoryImpl category = new CategoryImpl();
        category.setText(categoryText);
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        expect(userService.getAuthenticatedUser()).andReturn(user).once();
        replay(userService);
        String view = controller.createCategory(category, validToken, validToken,REFERRER_ID, model, sessionStatus);
        assertEquals("ViewName match", ViewNames.ADMIN_CATEGORIES, view);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.