Package org.zanata.webtrans.client.events

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


        presenter.saveAsApprovedAndMoveNext(selectedTU.getId());

        // Then:
        verify(eventBus, atLeastOnce()).fireEvent(eventCaptor.capture());

        TransUnitSaveEvent saveEvent =
                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        TransUnitSaveEvent.class);
        assertThat(saveEvent.getTransUnitId(), equalTo(selectedTU.getId()));
        assertThat(saveEvent.getTargets(), Matchers.equalTo(NEW_TARGETS));
        assertThat(saveEvent.getStatus(), equalTo(ContentState.Translated));

        NavTransUnitEvent navEvent =
                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        NavTransUnitEvent.class);
        assertThat(navEvent.getRowType(),
View Full Code Here


        // When:
        presenter.savePendingChangesIfApplicable();

        // Then:
        verify(eventBus).fireEvent(
                new TransUnitSaveEvent(NEW_TARGETS, ContentState.Approved,
                        selectedTU.getId(), 99, CACHED_TARGETS));
    }
View Full Code Here

    }

    private static TransUnitSaveEvent event(String newContent,
            ContentState status, TransUnitId transUnitId, int verNum,
            String oldContent) {
        return new TransUnitSaveEvent(Lists.newArrayList(newContent), status,
                transUnitId, verNum, Lists.newArrayList(oldContent));
    }
View Full Code Here

                TestFixture.makeTransUnit(TRANS_UNIT_ID.getId(),
                        ContentState.NeedReview, "old content");
        when(navigationService.getByIdOrNull(TRANS_UNIT_ID)).thenReturn(old);

        // When: save as fuzzy
        TransUnitSaveEvent saveEvent =
                event("new content", ContentState.NeedReview, TRANS_UNIT_ID,
                        VER_NUM, "old content");
        service.onTransUnitSave(saveEvent);
        verify(dispatcher).execute(actionCaptor.capture(),
                resultCaptor.capture());
        // on rpc failure:

        // Then: will reset value back
        AsyncCallback<UpdateTransUnitResult> callback = resultCaptor.getValue();
        when(messages.notifyUpdateFailed("id " + TRANS_UNIT_ID, errorMessage))
                .thenReturn("update failed");
        callback.onFailure(new RuntimeException(errorMessage));
        verify(targetContentsPresenter).setEditingState(
                saveEvent.getTransUnitId(),
                TargetContentsDisplay.EditingState.UNSAVED);
        ArgumentCaptor<NotificationEvent> notificationEventCaptor =
                ArgumentCaptor.forClass(NotificationEvent.class);
        verify(targetContentsPresenter).setEditingState(TRANS_UNIT_ID,
                TargetContentsDisplay.EditingState.UNSAVED);
View Full Code Here

TOP

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

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.