Examples of HistoryToken


Examples of org.zanata.webtrans.client.history.HistoryToken

    @Test
    public void processHistoryTokenForUninitializedContext() {
        // Given: history token contains everything but editor context is not
        // initialized
        HistoryToken token = new HistoryToken();
        token.setDocFilterText("doc filter test");
        token.setProjectSearchText("project search text");
        token.setDocumentPath("doc/path");
        token.setProjectSearchReplacement("replacement");
        token.setTextFlowId("1");
        when(historyChangeEvent.getValue()).thenReturn(token.toTokenString());
        DocumentInfo documentInfo = TestFixture.documentInfo(1, "doc/path");
        DocumentId documentId = documentInfo.getId();
        when(documentListPresenter.getDocumentId("doc/path")).thenReturn(
                documentId);
        when(documentListPresenter.getDocumentInfo(documentId)).thenReturn(
                documentInfo);
        when(appPresenter.getSelectedDocIdOrNull()).thenReturn(
                new DocumentId(new Long(99), ""));
        contextHolder.updateContext(null);

        // When:
        service.onValueChange(historyChangeEvent);

        // Then:
        InOrder inOrder =
                Mockito.inOrder(documentListPresenter, appPresenter, eventBus,
                        searchResultsPresenter);
        inOrder.verify(documentListPresenter).updateFilterAndRun(
                token.getDocFilterText(), token.getDocFilterExact(),
                token.isDocFilterCaseSensitive());
        inOrder.verify(searchResultsPresenter).updateViewAndRun(
                token.getProjectSearchText(),
                token.getProjectSearchCaseSensitive(),
                token.isProjectSearchInSource(),
                token.isProjectSearchInTarget());
        inOrder.verify(searchResultsPresenter).updateReplacementText(
                token.getProjectSearchReplacement());

        inOrder.verify(documentListPresenter).getDocumentId(
                token.getDocumentPath());
        inOrder.verify(documentListPresenter).getDocumentInfo(documentId);
        inOrder.verify(eventBus).fireEvent(Mockito.isA(InitEditorEvent.class));
        inOrder.verify(appPresenter).getSelectedDocIdOrNull();
        inOrder.verify(appPresenter).selectDocument(documentId);
        inOrder.verify(documentListPresenter).getDocumentInfo(documentId);
        inOrder.verify(eventBus).fireEvent(
                Mockito.isA(DocumentSelectionEvent.class));
        inOrder.verify(appPresenter).showView(token.getView());

        verifyNoMoreInteractions(documentListPresenter, appPresenter, eventBus,
                searchResultsPresenter);
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void processBookmarkedTextFlowWhenEditorIsNotInitialized() {
        // Given: editor is not initialized yet
        HistoryToken token = new HistoryToken();
        token.setTextFlowId("1");

        // When:
        service.processForBookmarkedTextFlow(token);

        // Then:
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void processBookmarkedTextFlowWhenThereIsNoTextFlowInHistoryUrl() {
        // Given: no text flow
        HistoryToken token = new HistoryToken();

        // When:
        service.processForBookmarkedTextFlow(token);

        // Then:
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void processBookmarkedTextFlowWithInvalidTextFlowId() {
        // Given: text flow not in current document
        HistoryToken token = new HistoryToken();
        token.setTextFlowId("111");
        when(stateHolder.getPageCount()).thenReturn(10);
        when(stateHolder.getTargetPage(new TransUnitId(111))).thenReturn(
                NavigationService.UNDEFINED);

        // When:
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    @Test
    public void processBookmarkedTextFlow() {
        // Given: everything works
        contextHolder.updateContext(new GetTransUnitActionContext(TestFixture
                .documentInfo(99, "")));
        HistoryToken token = new HistoryToken();
        token.setTextFlowId("111");
        when(stateHolder.getPageCount()).thenReturn(10);
        when(stateHolder.getTargetPage(new TransUnitId(111))).thenReturn(2);

        // When:
        service.processForBookmarkedTextFlow(token);
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        verify(eventBus).fireEvent(Mockito.isA(BookmarkedTextFlowEvent.class));
    }

    @Test
    public void processMessageFilterOptions() {
        HistoryToken token = new HistoryToken();
        token.setFilterUntranslated(true);

        service.processMessageFilterOptions(token);

        verify(eventBus).fireEvent(
                UserConfigChangeEvent.EDITOR_CONFIG_CHANGE_EVENT);
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void
            onProcessForDocumentListPresenterWillDoNothingIfHistoryNotChanged() {
        HistoryToken token = new HistoryToken();

        service.processForDocumentListPresenter(token);

        verifyZeroInteractions(documentListPresenter);
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        verifyZeroInteractions(documentListPresenter);
    }

    @Test
    public void onProcessForDocumentListPresenter() {
        HistoryToken token = new HistoryToken();
        token.setDocFilterCaseSensitive(false);
        token.setDocFilterExact(true);
        token.setDocFilterText("something");

        service.processForDocumentListPresenter(token);

        verify(documentListPresenter).updateFilterAndRun(
                token.getDocFilterText(), token.getDocFilterExact(),
                token.isDocFilterCaseSensitive());
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        verifyZeroInteractions(appPresenter);
    }

    @Test
    public void onProcessForAppPresenter() {
        HistoryToken token = new HistoryToken();
        token.setDocumentPath("doc/a.po");
        DocumentInfo document = TestFixture.documentInfo(99, "doc/a.po");
        when(documentListPresenter.getDocumentId("doc/a.po")).thenReturn(
                document.getId());
        when(documentListPresenter.getDocumentInfo(document.getId()))
                .thenReturn(document);
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void onProcessForProjectWideSearchWillDoNothingIfHistoryNotChanged() {
        HistoryToken token = new HistoryToken();

        service.processForProjectWideSearch(token);

        verifyZeroInteractions(searchResultsPresenter);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.