Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.TransUnitId


    @Test
    public void onBookmarkedTextFlowOnDifferentPage() {
        // current offset is 1
        contextHolder.changeOffset(1);
        TransUnitId targetId = new TransUnitId(1);
        // target offset is 2
        BookmarkedTextFlowEvent bookmarkedTextFlowEvent =
                new BookmarkedTextFlowEvent(2, targetId);
        NavigationService serviceSpy = spy(service);
        doNothing().when(serviceSpy).execute(bookmarkedTextFlowEvent);
View Full Code Here


        verify(serviceSpy).execute(bookmarkedTextFlowEvent);
    }

    @Test
    public void onRequestSelectTableRowSamePage() {
        TransUnitId selectingId = new TransUnitId(1);

        DocumentInfo docInfo = TestFixture.documentInfo();

        HistoryToken mockHistoryToken = mock(HistoryToken.class);
        when(history.getHistoryToken()).thenReturn(mockHistoryToken);

        // When:
        service.onRequestSelectTableRow(new RequestSelectTableRowEvent(docInfo,
                selectingId));

        // Then:
        verify(mockHistoryToken).setView(MainView.Editor);
        verify(mockHistoryToken).setDocumentPath(
                docInfo.getPath() + docInfo.getName());
        verify(mockHistoryToken).clearEditorFilterAndSearch();
        verify(mockHistoryToken).setTextFlowId(selectingId.toString());
    }
View Full Code Here

        int versionNum = 0; // no previous translation

        // Translate using webtrans
        UpdateType updateType = UpdateType.WebEditorSave;
        UpdateTransUnit action =
                new UpdateTransUnit(new TransUnitUpdateRequest(new TransUnitId(
                        textFlowId), Lists.newArrayList(translation),
                        translationState, versionNum), updateType);
        action.setWorkspaceId(workspaceId);

        UpdateTransUnitResult result = transUnitHandler.execute(action, null);
View Full Code Here

    }

    @Test
    public void testQuery() {
        List<HTextFlowTargetReviewComment> reviewComments =
                reviewCommentsDAO.getReviewComments(new TransUnitId(5L),
                        LocaleId.EN_US);

        assertThat(reviewComments, Matchers.hasSize(1));
        assertThat(reviewComments.get(0).getCommenter().getName(),
                Matchers.equalTo("Sample User"));
View Full Code Here

        target.addReviewComment("bad translation", person);
        getEm().persist(target);

        List<HTextFlowTargetReviewComment> result =
                reviewCommentsDAO.getReviewComments(new TransUnitId(target
                        .getTextFlow().getId()), target.getLocaleId());

        assertThat(result, Matchers.hasSize(1));
        assertThat(result.get(0).getCommenterName(),
                Matchers.equalTo(person.getName()));
View Full Code Here

        // change target after making comment
        target.setContent0("new translation");
        getEm().persist(target);

        List<HTextFlowTargetReviewComment> result =
                reviewCommentsDAO.getReviewComments(new TransUnitId(target
                        .getTextFlow().getId()), target.getLocaleId());

        assertThat(result.get(0).getTargetVersion(),
                Matchers.equalTo(oldVersion));
    }
View Full Code Here

            boolean acceptImportedTMResults, long... tranUnitIds)
            throws NoSuchWorkspaceException {
        List<TransUnitUpdateRequest> requests = newArrayList();
        for (long tranUnitId : tranUnitIds) {
            requests.add(new TransUnitUpdateRequest(
                    new TransUnitId(tranUnitId), null, null, 0));
        }
        // we have TransMemoryMergeStatusResolverTest to cover various different
        // merge options so here we don't test that
        MergeRule importedTMOption =
                acceptImportedTMResults ? MergeRule.IGNORE_CHECK
View Full Code Here

        List<TransUnit> transUnits =
                Lists.newArrayList(TestFixture.makeTransUnit(1),
                        TestFixture.makeTransUnit(2));
        when(displayProvider.get()).thenReturn(display1, display2);
        presenter.showData(transUnits);
        when(display1.getId()).thenReturn(new TransUnitId(1));
        TransUnitId selectedId = new TransUnitId(2);
        when(display2.getId()).thenReturn(selectedId);
        when(display2.getSourcePanelList()).thenReturn(
                Lists.newArrayList(hasSelectableSource1));

        // When: select source with id 2
View Full Code Here

        List<TransUnit> transUnits =
                Lists.newArrayList(TestFixture.makeTransUnit(1),
                        TestFixture.makeTransUnit(2));
        when(displayProvider.get()).thenReturn(display1, display2);
        presenter.showData(transUnits);
        TransUnitId previousSelectedId = transUnits.get(0).getId();
        when(display1.getId()).thenReturn(previousSelectedId);
        when(display1.getSourcePanelList()).thenReturn(
                Lists.newArrayList(hasSelectableSource1));
        TransUnitId selectedId = transUnits.get(1).getId();
        when(display2.getId()).thenReturn(selectedId);
        when(display2.getSourcePanelList()).thenReturn(
                Lists.newArrayList(hasSelectableSource1, hasSelectableSource2));

        // When: select source with id 1
View Full Code Here

    }

    @Test
    public void withNoPriorSelectionGetCurrentTransUnitIdIsNull()
            throws Exception {
        TransUnitId transUnitId = presenter.getCurrentTransUnitIdOrNull();
        assertThat(transUnitId, Matchers.nullValue());
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.TransUnitId

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.