Examples of WidgetComment


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

        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
        expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
        replay(mockAuthentication);

        WidgetComment localWidgetComment = new WidgetCommentImpl();
        UserImpl localUser = new UserImpl();
        localUser.setId(VALID_USER_ID);
        localWidgetComment.setUser(localUser);
        expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(localWidgetComment).anyTimes();
        replay(mockWidgetCommentRepository);

        assertThat(defaultWidgetCommentPermissionEvaluator.hasPermission(mockAuthentication, localWidgetComment, Permission.CREATE), is(true));
View Full Code Here

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

    public void deleteAll(){
        String userId = "1234L";
        List<Widget> widgets = Lists.newArrayList();
        Widget w = new WidgetImpl();
        List<WidgetComment> comments = Lists.newArrayList();
        WidgetComment wc1 = new WidgetCommentImpl();
        WidgetComment wc2 = new WidgetCommentImpl();
        wc1.setUserId(userId);
        wc2.setUserId(userId);
        comments.add(wc1);
        comments.add(wc2);
        w.setComments(comments);
        widgets.add(w);
View Full Code Here

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

        String userId = "1234L";
        String userId_2 = "1111L";
        List<Widget> widgets = Lists.newArrayList();
        Widget w = new WidgetImpl();
        List<WidgetComment> comments = Lists.newArrayList();
        WidgetComment wc1 = new WidgetCommentImpl();
        WidgetComment wc2 = new WidgetCommentImpl();
        wc1.setUserId(userId_2);
        wc2.setUserId(userId_2);
        comments.add(wc1);
        comments.add(wc2);
        w.setComments(comments);
        widgets.add(w);
View Full Code Here

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

    public void get(){
        String id = "1234L";
        String widgetId = "321L";
        List<WidgetComment> comments = Lists.newArrayList();
        Widget widget = new WidgetImpl(widgetId);
        WidgetComment wc = new WidgetCommentImpl(id);
        comments.add(wc);
        widget.setComments(comments);

        expect(template.get(widgetId)).andReturn(widget);
        replay(template);

        WidgetComment result = repo.getCommentById(widgetId, id);
        assertThat(result.getId(), is(equalTo(id)));
    }
View Full Code Here

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

    public void get_null(){
        String id = "1234L";
        String widgetId = "321L";
        List<WidgetComment> comments = Lists.newArrayList();
        Widget widget = new WidgetImpl(widgetId);
        WidgetComment wc = new WidgetCommentImpl("1111L");
        comments.add(wc);
        widget.setComments(comments);

        expect(template.get(widgetId)).andReturn(widget);
        replay(template);

        WidgetComment result = repo.getCommentById(widgetId, id);
        assertNull(result);

    }
View Full Code Here

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

        wc.setUserId(VALID_USER_ID.toString());
        assertThat(wc.getId(), is(nullValue()));
        repository.createWidgetComment(VALID_WIDGET_ID.toString(), wc);
        String newId = wc.getId();
        assertThat(Long.parseLong(newId) > 0, is(true));
        WidgetComment newComment = repository.getCommentById(VALID_WIDGET_ID.toString(), newId);
        assertThat(newComment.getUserId(), is(VALID_USER_ID.toString()));
        assertThat(newComment.getText(), is(text));
        assertThat(newComment.getCreatedDate(), is(createdDate));
        assertThat(newComment.getLastModifiedDate(), is(lastModDate));
    }
View Full Code Here

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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void save_existing() {
        final String UPDATED_TEXT = "updated comment";
        WidgetComment widgetComment = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(widgetComment.getText(), is(not(UPDATED_TEXT)));
        widgetComment.setText(UPDATED_TEXT);
        repository.createWidgetComment(VALID_WIDGET_ID.toString(), widgetComment);
        WidgetComment updatedComment = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(updatedComment.getText(), is(UPDATED_TEXT));
    }
View Full Code Here

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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_jpaObject() {
        WidgetComment wc = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(wc, is(notNullValue()));
        repository.deleteWidgetComment(VALID_WIDGET_ID.toString(), wc);
        wc = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(wc, is(nullValue()));
    }
View Full Code Here

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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_implObject() {
        WidgetComment wc = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(wc, is(notNullValue()));
        WidgetComment impl = new WidgetCommentImpl(wc.getId());
        repository.deleteWidgetComment(VALID_WIDGET_ID.toString(), impl);
        wc = repository.getCommentById(VALID_WIDGET_ID.toString(), VALID_WIDGET_COMMENT_ID.toString());
        assertThat(wc, is(nullValue()));
    }
View Full Code Here

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

        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
        expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
        replay(mockAuthentication);

        WidgetComment localWidgetComment = new WidgetCommentImpl();
        UserImpl localUser = new UserImpl();
        localUser.setId(VALID_USER_ID);
        localWidgetComment.setUserId(VALID_USER_ID);
        expect(widgetRepository.getCommentById(null, VALID_COMMENT_ID)).andReturn(localWidgetComment).anyTimes();
        replay(widgetRepository);

        assertThat(defaultWidgetCommentPermissionEvaluator.hasPermission(mockAuthentication, localWidgetComment, Permission.CREATE), is(true));
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.