Package org.zanata.webtrans.shared.model

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


        when(mockHistory.getHistoryToken()).thenReturn(documentPathToken);

        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 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>(),
                new AuditInfo(new Date(), "last translator")))));
    }
View Full Code Here

        stats.addStats(new TranslationStatistics(unitCount, LocaleId.ES
                .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 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

        verify(eventBus).fireEvent(eventCaptor.capture());
    }

    @Test
    public void fireSearchEvent() {
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(new Long(1), ""), "test",
                        "test/path", LocaleId.EN_US,
                        new ContainerTranslationStatistics(), new AuditInfo(
                                new Date(), "Translator"),
                        new HashMap<String, String>(), new AuditInfo(
                                new Date(), "last translator"));
        userWorkspaceContext.setSelectedDoc(docInfo);

        when(messages.searchGlossary()).thenReturn("Search glossary");
        when(display.getGlossaryTextBox()).thenReturn(mockGlossaryTextBox);
        when(mockGlossaryTextBox.getText()).thenReturn("query");
        when(display.getSearchType()).thenReturn(mockSearchType);
        when(mockSearchType.getValue()).thenReturn(SearchType.FUZZY);

        presenter.fireSearchEvent();

        verify(display).startProcessing();
        verify(dispatcher).execute(getGlossaryCaptor.capture(),
                callbackCaptor.capture());
        GetGlossary action = getGlossaryCaptor.getValue();
        assertThat(action.getQuery(), Matchers.equalTo("query"));
        assertThat(action.getSearchType(), Matchers.equalTo(SearchType.FUZZY));
        assertThat(action.getSrcLocaleId(),
                Matchers.equalTo(docInfo.getSourceLocale()));
    }
View Full Code Here

    @Test
    public void
            fireSearchEventInSequentialWillBlockSecondRequestUntilFirstReturn() {
        // Given:
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(new Long(1), ""), "test",
                        "test/path", LocaleId.EN_US,
                        new ContainerTranslationStatistics(), new AuditInfo(
                                new Date(), "Translator"),
                        new HashMap<String, String>(), new AuditInfo(
                                new Date(), "last translator"));
        userWorkspaceContext.setSelectedDoc(docInfo);
        when(messages.searchGlossary()).thenReturn("Search glossary");
        when(display.getGlossaryTextBox()).thenReturn(mockGlossaryTextBox);
        when(mockGlossaryTextBox.getText()).thenReturn("query1", "query2");
        when(display.getSearchType()).thenReturn(mockSearchType);
        when(mockSearchType.getValue()).thenReturn(SearchType.FUZZY,
                SearchType.FUZZY_PLURAL);

        // When: calling search glossary twice while the first one hasn't return
        // any result
        presenter.fireSearchEvent();
        presenter.fireSearchEvent();

        // Then: there is only one RPC call to the server and the second request
        // get ignored
        verify(display).startProcessing();
        verify(dispatcher).execute(getGlossaryCaptor.capture(),
                callbackCaptor.capture());
        GetGlossary action = getGlossaryCaptor.getValue();
        assertThat(action.getQuery(), Matchers.equalTo("query1"));
        assertThat(action.getSearchType(), Matchers.equalTo(SearchType.FUZZY));
        assertThat(action.getSrcLocaleId(),
                Matchers.equalTo(docInfo.getSourceLocale()));
    }
View Full Code Here

                Matchers.equalTo(docInfo.getSourceLocale()));
    }

    @Test
    public void fireSearchEventOnSuccessCallbackWithGlossaryResults() {
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(new Long(1), ""), "test",
                        "test/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

        verify(display).stopProcessing(true);
    }

    @Test
    public void fireSearchEventOnSuccessCallbackButNoGlossaryFound() {
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(new Long(1), ""), "test",
                        "test/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

        verify(display).stopProcessing(false);
    }

    @Test
    public void fireSearchEventOnFailureCallback() {
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(new Long(1), ""), "test",
                        "test/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.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.