Package org.apache.rave.portal.model.impl

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


    }//end convert_valid

    @Test
    public void convert_Null(){
        Category source = new CategoryImpl();

        MongoDbCategory converted = converter.convert(source);

        assertNull(converted.getLastModifiedUserId());
        assertNull(converted.getCreatedUserId());
View Full Code Here


    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_implObject() {
        Category category = repository.get(VALID_ENTITY_ID.toString());
        assertThat(category, is(notNullValue()));
        CategoryImpl impl = new CategoryImpl(category.getId());
        repository.delete(impl);
        category = repository.get(VALID_ENTITY_ID.toString());
        assertThat(category, is(nullValue()));
    }
View Full Code Here

    }

    @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());
        categoryRepository.save(category);
        return category;
    }
View Full Code Here

    @Test
    public void getCategories_Valid(){
        List<String> categoryIds = Arrays.asList(ID_1, ID_2);
        expect(categoryRepository.get(ID_1)).andReturn(null);
        Category category = new CategoryImpl();
        expect(categoryRepository.get(ID_2)).andReturn(category);
        replay(categoryRepository);
        widget.setCategoryIds(categoryIds);
        List<Category> result = widget.getCategories();
        assertNotNull(result);
View Full Code Here

    }

    @Test
    public void getCategories_Null_Categories_Full(){
        List<Category> categoryList = new ArrayList<Category>();
        categoryList.add(new CategoryImpl());
        widget.setCategories(categoryList);
        assertThat(categoryList, is(sameInstance(widget.getCategories())));
    }
View Full Code Here

        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

        user.setUsername(VALID_USERNAME);
        user.setId(VALID_USER_ID);
        user2 = new UserImpl();
        user2.setUsername(VALID_USERNAME2);

        category = new CategoryImpl();
        category.setId(VALID_WIDGET_CATEGORY_ID);
        category.setCreatedUserId(VALID_USER_ID);

        grantedAuthorities = new ArrayList<GrantedAuthority>();
        grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_USER"));
View Full Code Here

        List<Category> categories = categoryService.getAll();

        model.addAttribute("categories", categories);
        // put category object in the model to allow creating categories from view
        model.addAttribute(ModelKeys.CATEGORY, new CategoryImpl());
        // add tokencheck attribute for creating new category
        model.addAttribute(ModelKeys.TOKENCHECK, AdminControllerUtil.generateSessionToken());

        if (isCreateDeleteOrUpdate(action)) {
            model.addAttribute("actionresult", action);
View Full Code Here

        controller.setPreferenceService(preferenceService);
        categoryService = createMock(CategoryService.class);
        controller.setCategoryService(categoryService);

        categories = new ArrayList<Category>();
        categories.add(new CategoryImpl());
        categories.add(new CategoryImpl());

        webDataBinder = createMock(WebDataBinder.class);
        categoryEditor = new CategoryEditor(categoryService);
        controller.setCategoryEditor(categoryEditor);
    }
View Full Code Here

    @Before
    public void setUp() {
        categoryService = createMock(CategoryService.class);
        categoryEditor = new CategoryEditor(categoryService);

        validCategory = new CategoryImpl();
        validCategory.setId(CATEGORY_ID);
        validCategory.setText(CATEGORY_TEXT);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.CategoryImpl

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.