Examples of AddReviewCommentAction


Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

        display.enableComment(transUnitId != null);
    }

    @Override
    public void addComment(String commentContent) {
        dispatcher.execute(new AddReviewCommentAction(transUnitId,
                commentContent, contextHolder.getContext().getDocument()
                        .getId()),
                new AbstractAsyncCallback<AddReviewCommentResult>() {
                    @Override
                    public void onSuccess(AddReviewCommentResult result) {
View Full Code Here

Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

    }

    @Override
    public void addComment(String content) {
        dispatcher.execute(
                new AddReviewCommentAction(saveEvent.getTransUnitId(), content,
                        contextHolder.getContext().getDocument().getId()),
                new AbstractAsyncCallback<AddReviewCommentResult>() {
                    @Override
                    public void onSuccess(AddReviewCommentResult result) {
                        display.clearInput();
View Full Code Here

Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

    }

    @Test(expectedExceptions = ActionException.class)
    public void testExecuteWithBlankComment() throws ActionException {
        String blankComment = "   \t \n";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), blankComment,
                        documentId);

        handler.execute(action, null);
    }
View Full Code Here

Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

    public void testExecute() throws Exception {
        // Given: we want to add comment to trans unit id 2 and locale id DE
        String commentContent = "new comment";
        TransUnitId transUnitId = new TransUnitId(2L);
        HLocale hLocale = new HLocale(LocaleId.DE);
        AddReviewCommentAction action =
                new AddReviewCommentAction(transUnitId, commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(securityServiceImpl.checkWorkspaceStatus(action.getWorkspaceId()))
                .thenReturn(hProject);
        when(
                translationWorkspaceManager.getOrRegisterWorkspace(action
                        .getWorkspaceId())).thenReturn(workspace);
        when(localeService.getByLocaleId(action.getWorkspaceId().getLocaleId()))
                .thenReturn(hLocale);
        when(
                textFlowTargetDAO.getTextFlowTarget(transUnitId.getValue(),
                        hLocale.getLocaleId())).thenReturn(hTextFlowTarget);
        when(hTextFlowTarget.getState()).thenReturn(ContentState.Rejected);
        when(hTextFlowTarget.getTextFlow()).thenReturn(hTextFlow);
        when(hTextFlowTarget.addReviewComment(commentContent, hPerson))
                .thenReturn(hReviewComment);
        when(hReviewComment.getId()).thenReturn(1L);

        // When:
        AddReviewCommentResult result = handler.execute(action, null);

        // Then:
        InOrder inOrder =
                Mockito.inOrder(textFlowTargetDAO,
                        textFlowTargetReviewCommentsDAO,
                        hTextFlowTarget, workspace,
                        securityServiceImpl, identity);
        inOrder.verify(securityServiceImpl).checkWorkspaceStatus(
                action.getWorkspaceId());
        inOrder.verify(textFlowTargetDAO).getTextFlowTarget(
                transUnitId.getValue(), hLocale.getLocaleId());
        inOrder.verify(identity).checkPermission("review-comment", hLocale,
                hProject);
        inOrder.verify(hTextFlowTarget).addReviewComment(commentContent,
View Full Code Here

Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

    @Test(expectedExceptions = ActionException.class)
    public void testExecuteWhenTargetIsNull() throws Exception {
        // Given: we want to add comment to trans unit id 1 and locale id DE but
        // target is null
        String commentContent = "new comment";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(hPerson.getName()).thenReturn("John Smith");
        when(textFlowTargetDAO.getTextFlowTarget(1L, LocaleId.DE)).thenReturn(
                null);
View Full Code Here

Examples of org.zanata.webtrans.shared.rpc.AddReviewCommentAction

    @Test(expectedExceptions = ActionException.class)
    public void testExecuteWhenTargetIsUntranslated() throws Exception {
        // Given: we want to add comment to trans unit id 1 and locale id DE but
        // target is new
        String commentContent = "new comment";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(hPerson.getName()).thenReturn("John Smith");
        when(textFlowTargetDAO.getTextFlowTarget(1L, LocaleId.DE)).thenReturn(
                hTextFlowTarget);
        when(hTextFlowTarget.getState()).thenReturn(ContentState.New);
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.