Package org.zanata.webtrans.shared.model

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


    }

    @Test(enabled = false)
    public void thisBreaksForSomeReason() {
        // fails regardless of using different documentId, locale or constraints
        DocumentId id = new DocumentId(1L, "");
        HLocale locale = getEm().find(HLocale.class, 3L);
        FilterConstraints constraints = FilterConstraints.builder().build();

        dao.getTextFlowByDocumentIdWithConstraints(id, locale, constraints, 0,
                10);
View Full Code Here


    @Test
    public void testGetTextFlowByDocumentIdWithConstraint() {
        HLocale deLocale = getEm().find(HLocale.class, 3L);

        List<HTextFlow> result =
                dao.getTextFlowByDocumentIdWithConstraints(new DocumentId(
                        new Long(4), ""), deLocale, FilterConstraints.builder()
                        .filterBy("mssg").excludeTranslated().excludeFuzzy()
                        .build(), 0, 10);

        assertThat(result, Matchers.hasSize(1));
View Full Code Here

                        "Dummy Workspace", "Mock Sweedish");
        WorkspaceRestrictions workspaceRestrictions =
                new WorkspaceRestrictions(true, true, true, true, true);
        UserWorkspaceContext userWorkspaceContext =
                new UserWorkspaceContext(context, workspaceRestrictions);
        userWorkspaceContext.setSelectedDoc(new DocumentInfo(new DocumentId(
                new Long(1), "Dummy path/Dummy doc"), "Dummy doc",
                "Dummy path", LocaleId.EN_US, null, new AuditInfo(new Date(),
                        "Translator"), new HashMap<String, String>(),
                new AuditInfo(new Date(), "last translator")));
View Full Code Here

    }

    @Test
    public void testOnDocumentSelected() throws Exception {
        DocumentInfo documentInfo = TestFixture.documentInfo(2, "");
        DocumentId documentId = documentInfo.getId();
        service.onDocumentSelected(new DocumentSelectionEvent(documentInfo));

        verify(dispatcher).execute(actionCaptor.capture(),
                resultCaptor.capture());
        GetTransUnitList getTransUnitList = actionCaptor.getValue();
View Full Code Here

    private static UpdateTransUnitResult
            result(boolean success, TransUnit transUnit,
                    ContentState previousState, String errorMessage) {
        return new UpdateTransUnitResult(new TransUnitUpdateInfo(success, true,
                new DocumentId(new Long(1), ""), transUnit, 9, VER_NUM,
                previousState, errorMessage));
    }
View Full Code Here

    @Test
    public void canSelectDocumentInEditorView() {
        // Given:
        presenter.setStatesForTest(projectStats, selectedDocumentStats, null,
                null);
        DocumentId docId = new DocumentId(1L, "");
        // newly selected document has new stats

        ContainerTranslationStatistics newSelectedStats =
                new ContainerTranslationStatistics();
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
View Full Code Here

    @Test
    public void canSelectDocumentNotInEditorView() {
        // Given:
        presenter.setStatesForTest(projectStats, selectedDocumentStats,
                MainView.Documents, null);
        DocumentId docId = new DocumentId(1L, "");
        // newly selected document has new stats

        ContainerTranslationStatistics newSelectedStats =
                new ContainerTranslationStatistics();
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
View Full Code Here

    public void onDocumentStatsUpdateWillDoNothingIfNoSelectedDocument() {
        assertThat(presenter.getSelectedDocumentInfoOrNull(),
                Matchers.is(Matchers.nullValue()));

        presenter.onDocumentStatsUpdated(new DocumentStatsUpdatedEvent(
                new DocumentId(1L, ""), new ContainerTranslationStatistics()));

        verifyZeroInteractions(display);
    }
View Full Code Here

    @Test
    public void onDocumentStatsUpdateWillDoNothingIsDifferentDocument() {
        // Given: current view is null and selected doc id 2
        presenter.setStatesForTest(projectStats, selectedDocumentStats, null,
                null);
        presenter.selectDocument(new DocumentId(2L, ""));

        // When:
        presenter.onDocumentStatsUpdated(new DocumentStatsUpdatedEvent(
                new DocumentId(1L, ""), new ContainerTranslationStatistics()));

        // Then:
        verifyZeroInteractions(display);
    }
View Full Code Here

    public void onDocumentStatsUpdateWillSetStatsIfSameDocument() {
        // Given: current view is Editor and selected doc id 1
        presenter.setStatesForTest(projectStats, selectedDocumentStats, null,
                null);
        presenter.showView(MainView.Editor);
        DocumentId docId = new DocumentId(1L, "");
        DocumentInfo documentInfo =
                new DocumentInfo(docId, "a.po", "pot/", new LocaleId("en-US"),
                        selectedDocumentStats, new AuditInfo(new Date(),
                                "Translator"), new HashMap<String, String>(),
                        new AuditInfo(new Date(), "last translator"));
View Full Code Here

TOP

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

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.