Package org.zanata.webtrans.shared.model

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


        verify(history).newItem("view:doc");
    }

    @Test
    public void onEditorClickAndHasSelectedDocumentButAlreadyInEditorView() {
        DocumentInfo selectedDocument = mock(DocumentInfo.class);
        presenter.setStatesForTest(null, null, null, selectedDocument);
        when(history.getToken()).thenReturn("view:doc");

        presenter.onEditorClicked();
        verify(history).getToken();
View Full Code Here


        stats.addStats(new TranslationStatistics(unitCount, LocaleId.EN_US
            .toString()));
        stats.addStats(new TranslationStatistics(wordCount, LocaleId.EN_US
            .toString()));

        DocumentInfo docInfo =
            new DocumentInfo(new DocumentId(1111L, "no/filter/matches"),
                "matches", "no/filter", LocaleId.EN_US, stats,
                new AuditInfo(new Date(), "Translator"),
                new HashMap<String, String>(), new AuditInfo(
                new Date(), "last translator"));
        docList.add(new DocumentNode(docInfo));

        docInfo =
            new DocumentInfo(new DocumentId(2222L, "match/exact/filter"),
                "filter", "match/exact/", LocaleId.EN_US, stats,
                new AuditInfo(new Date(), "Translator"),
                new HashMap<String, String>(), new AuditInfo(
                new Date(), "last translator"));
        docList.add(new DocumentNode(docInfo));

        docInfo =
            new DocumentInfo(new DocumentId(3333L,
                "does/not/match/exact/filter"), "filter",
                "does/not/match/exact/", LocaleId.EN_US, stats,
                new AuditInfo(new Date(), "Translator"),
                new HashMap<String, String>(), new AuditInfo(
                new Date(), "last translator"));
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

                Matchers.equalTo(ContentState.NeedReview));
    }

    @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

    @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

        verify(eventBus).fireEvent(isA(NotificationEvent.class));

        // editor key handler on selected doc is NOT null
        HistoryToken editorToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(editorToken);
        DocumentInfo selectedDocument = mock(DocumentInfo.class);
        presenter.setStatesForTest(null, null, MainView.Documents,
                selectedDocument);
        editorKey.getHandler().onKeyShortcut(null);
        assertThat(editorToken.getView(), Matchers.is(MainView.Editor));
        verify(history).newItem(editorToken.toTokenString());
View Full Code Here

                new ContainerTranslationStatistics();
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
                1, 2, 3), LocaleId.EN_US.toString()));
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitWords(
                4, 5, 6), LocaleId.EN_US.toString()));
        DocumentInfo documentInfo =
                new DocumentInfo(docId, "a.po", "pot/", new LocaleId("en-US"),
                        newSelectedStats, new AuditInfo(new Date(),
                                "Translator"), new HashMap<String, String>(),
                        new AuditInfo(new Date(), "last translator"));
        when(documentListPresenter.getDocumentInfo(docId)).thenReturn(
                documentInfo);
View Full Code Here

        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
                1, 2, 3), LocaleId.EN_US.toString()));
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitWords(
                4, 5, 6), LocaleId.EN_US.toString()));

        DocumentInfo documentInfo =
                new DocumentInfo(docId, "a.po", "pot/", new LocaleId("en-US"),
                        newSelectedStats, new AuditInfo(new Date(),
                                "Translator"), new HashMap<String, String>(),
                        new AuditInfo(new Date(), "last translator"));
        when(documentListPresenter.getDocumentInfo(docId)).thenReturn(
                documentInfo);
View Full Code Here

        // 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"));
        when(documentListPresenter.getDocumentInfo(docId)).thenReturn(
                documentInfo);
View Full Code Here

    @Test
    public void onDocumentsClickWillFireNewHistoryItemAndSwitchToDocumentView() {
        // Given: current token is search view and has selected doc
        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"));
        when(documentListPresenter.getDocumentInfo(docId)).thenReturn(
                documentInfo);
View Full Code Here

TOP

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

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.