Package org.zanata.webtrans.shared.rpc

Examples of org.zanata.webtrans.shared.rpc.HasTransUnitUpdatedData


    @Test
    public void testOnTransUnitUpdatedInCurrentPage() throws Exception {
        // Given: updated trans unit is from same document and it's on current
        // page
        service.init(initContext);
        HasTransUnitUpdatedData updatedData =
                mock(HasTransUnitUpdatedData.class, withSettings()
                        .defaultAnswer(RETURNS_DEEP_STUBS));
        when(updatedData.getUpdateInfo().getDocumentId()).thenReturn(
                initContext.getDocument().getId());
        TransUnit updatedTU = data.get(0);
        when(updatedData.getUpdateInfo().getTransUnit()).thenReturn(updatedTU);
        EditorClientId editorClientId = new EditorClientId("sessionId", 1);
        when(updatedData.getEditorClientId()).thenReturn(editorClientId);
        when(updatedData.getUpdateType()).thenReturn(
                TransUnitUpdated.UpdateType.WebEditorSave);

        // When:
        service.onTransUnitUpdated(new TransUnitUpdatedEvent(updatedData));
View Full Code Here


    @Test
    public void testOnTransUnitUpdatedNotInCurrentPage() throws Exception {
        // Given: updated trans unit is from same document but NOT on current
        // page
        service.init(initContext);
        HasTransUnitUpdatedData updatedData =
                mock(HasTransUnitUpdatedData.class, withSettings()
                        .defaultAnswer(RETURNS_DEEP_STUBS));
        when(updatedData.getUpdateInfo().getDocumentId()).thenReturn(
                initContext.getDocument().getId());
        // updated TU has something different so that we can assert it won't
        // update current page data model
        TransUnit updatedTU =
                TransUnit.Builder.from(data.get(data.size() - 1))
                        .setSourceComment("different").build();
        when(updatedData.getUpdateInfo().getTransUnit()).thenReturn(updatedTU);

        // When:
        service.onTransUnitUpdated(new TransUnitUpdatedEvent(updatedData));

        // Then:
View Full Code Here

    @Test
    public void testOnTransUnitUpdatedNotInCurrentDocument() throws Exception {
        // Given: updated trans unit is from another document
        service.init(initContext);
        HasTransUnitUpdatedData updatedData =
                mock(HasTransUnitUpdatedData.class, withSettings()
                        .defaultAnswer(RETURNS_DEEP_STUBS));
        when(updatedData.getUpdateInfo().getDocumentId()).thenReturn(
                initContext.getDocument().getId());

        // When:
        service.onTransUnitUpdated(new TransUnitUpdatedEvent(updatedData));
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.rpc.HasTransUnitUpdatedData

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.