Package org.zanata.webtrans.client.events

Examples of org.zanata.webtrans.client.events.DocumentStatsUpdatedEvent


                        new AuditInfo(event.getUpdateInfo().getTransUnit()
                                .getLastModifiedTime(), event.getUpdateInfo()
                                .getTransUnit().getLastModifiedBy());
                display.updateLastTranslated(row, lastTranslated);
            }
            eventBus.fireEvent(new DocumentStatsUpdatedEvent(
                    updatedDoc.getId(), currentStats));
        }

        eventBus.fireEvent(new RefreshProjectStatsEvent(Lists
                .newArrayList(nodes.values())));
View Full Code Here


    @Test
    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

        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

        newStats.addStats(new TranslationStatistics(
                new TransUnitCount(9, 9, 9), LocaleId.EN_US.toString()));
        newStats.addStats(new TranslationStatistics(
                new TransUnitWords(8, 8, 8), LocaleId.EN_US.toString()));

        presenter.onDocumentStatsUpdated(new DocumentStatsUpdatedEvent(docId,
                newStats));

        // Then:
        assertThat(selectedDocumentStats.getStats(),
                Matchers.equalTo(newStats.getStats()));
View Full Code Here

        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(
                "document Approved TU count should increase by 1 when a TU is updated from NeedsReview to Approved",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.MESSAGE)
                        .getApproved(), is(new Long(2)));
        assertThat(
                "document NeedsReview TU count should decrease by 1 when a TU is updated from NeedsReview to Approved",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.MESSAGE)
                        .getDraft(), is(new Long(1)));
        assertThat(
                "document Untranslated TU count should remain the same when a TU is updated from NeedsReview to Approved",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.MESSAGE)
                        .getUntranslated(), is(new Long(3)));

        // default words: 4/5/6
        // approving 3 fuzzy so expect 7/2/6
        assertThat(
                "document Approved words should increase when TU changes to Approved",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.WORD)
                        .getApproved(), is(new Long(7)));
        assertThat(
                "document NeedsReview words should decrease when a TU changes from NeedsReview",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.WORD)
                        .getDraft(), is(new Long(2)));
        assertThat(
                "document Untranslated words should not change when TU changes between NeedsReview and Approved",
                docStatsEvent.getNewStats()
                        .getStats(LocaleId.ES.toString(), StatUnit.WORD)
                        .getDraft(), is(new Long(2)));
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.events.DocumentStatsUpdatedEvent

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.