Package org.zanata.webtrans.shared.model

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


    }

    @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"));
View Full Code Here


            .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

                        .setLastModifiedBy("lastModifiedBy")
                        .setLastModifiedTime(new Date())
                        .setMsgContext("msgContext").setRowIndex(1)
                        .setVerNum(1).build();
        TransUnitUpdateInfo updateInfo =
                new TransUnitUpdateInfo(true, true, new DocumentId(2222L,
                        "match/exact/filter"), newTransUnit, 3, 0,
                        ContentState.NeedReview);
        TransUnitUpdatedEvent mockEvent = mock(TransUnitUpdatedEvent.class);

        when(mockEvent.getUpdateInfo()).thenReturn(updateInfo);

        documentListPresenter.bind();
        documentListPresenter.setDocuments(buildSampleDocumentArray());
        documentListPresenter.onTransUnitUpdated(mockEvent);

        verify(mockEventBus, times(2)).fireEvent(
                capturedEventBusEvent.capture());

        DocumentStatsUpdatedEvent docStatsEvent = null;
        for (GwtEvent event : capturedEventBusEvent.getAllValues()) {
            if (event.getAssociatedType().equals(
                    DocumentStatsUpdatedEvent.getType())) {
                docStatsEvent = (DocumentStatsUpdatedEvent) event;
            }
        }

        assertThat(
                "a document stats event should be fired when a TU update event occurs, not found",
                docStatsEvent, notNullValue());

        // document stats
        assertThat(
                "document id in document stats event shoudl match updated TU document id",
                docStatsEvent.getDocId(), equalTo(new DocumentId(2222L, "")));

        // check actual counts (approved/fuzzy/untranslated)
        // default TUs: 1/2/3
        // approving 1 fuzzy, expect 2/1/3
        assertThat(
View Full Code Here

        documentListPresenter.bind();

        // simulate document click on second document
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(2222L, ""), "doc122",
                        "second/path/", LocaleId.EN_US,
                        new ContainerTranslationStatistics(), new AuditInfo(
                                new Date(), "Translator"),
                        new HashMap<String, String>(), new AuditInfo(
                                new Date(), "last translator"));
View Full Code Here

    public void getDocumentId() {
        documentListPresenter.bind();
        documentListPresenter.setDocuments(buildSampleDocumentArray());

        // third document from buildSampleDocumentArray()
        DocumentId docId =
                documentListPresenter
                        .getDocumentId("does/not/match/exact/filter");
        assertThat(docId.getId(), is(3333L));

        // second document from buildSampleDocumentArray()
        docId = documentListPresenter.getDocumentId("match/exact/filter");
        assertThat(docId.getId(), is(2222L));
    }
View Full Code Here

    @Test
    public void getDocumentInfo() {
        documentListPresenter.bind();
        documentListPresenter.setDocuments(buildSampleDocumentArray());

        DocumentId doc1 = new DocumentId(1111L, "no/filter/matches");
        DocumentInfo docInfo = documentListPresenter.getDocumentInfo(doc1);

        assertThat(docInfo, is(equalTo(new DocumentInfo(doc1, "doc111",
                "first/path/", LocaleId.EN_US,
                new ContainerTranslationStatistics(), new AuditInfo(new Date(),
                        "Translator"), new HashMap<String, String>(),
                new AuditInfo(new Date(), "last translator")))));

        DocumentId doc2 = new DocumentId(3333L, "does/not/match/exact/filter");
        docInfo = documentListPresenter.getDocumentInfo(doc2);
        assertThat(docInfo, is(equalTo(new DocumentInfo(doc2, "doc123",
                "third/path/", LocaleId.EN_US,
                new ContainerTranslationStatistics(), new AuditInfo(new Date(),
                        "Translator"), new HashMap<String, String>(),
View Full Code Here

                .toString()));
        stats.addStats(new TranslationStatistics(wordCount, LocaleId.ES
                .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(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(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

    public void testAddComment() throws Exception {
        when(commentBeforeSaveEvent.getSaveEvent()).thenReturn(saveEvent);
        presenter.onCommentBeforeSave(commentBeforeSaveEvent);

        when(contextHolder.getContext().getDocument().getId()).thenReturn(
                new DocumentId(1L, "doc"));
        ArgumentCaptor<AddReviewCommentAction> actionCaptor =
                ArgumentCaptor.forClass(AddReviewCommentAction.class);
        ArgumentCaptor<AsyncCallback> resultCaptor =
                ArgumentCaptor.forClass(AsyncCallback.class);
View Full Code Here

    public static DocumentInfo documentInfo(long id, String docId) {
        return documentInfo(id, "", docId);
    }

    public static DocumentInfo documentInfo(long id, String path, String name) {
        return new DocumentInfo(new DocumentId(id, path + name), name, path,
                LocaleId.EN_US, null, new AuditInfo(new Date(), "Translator"),
                null, new AuditInfo(new Date(), "last translator"));
    }
View Full Code Here

    public void setUp() throws Exception {
        filter = new PathDocumentFilter();
    }

    private static DocumentInfo docInfo(String name, String path) {
        return new DocumentInfo(new DocumentId(1L, ""), name, path,
                LocaleId.EN_US, new ContainerTranslationStatistics(),
                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.