Package org.zanata.webtrans.shared.model

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


    @Override
    public void execute() {
        Log.info("ENTER DummyUpdateTransUnitCommand.execute()");

        TransUnitUpdateRequest firstTu = action.getUpdateRequests().get(0);
        TransUnit tu =
                TransUnit.Builder.newTransUnitBuilder()
                        .setId(firstTu.getTransUnitId().getId())
                        .setVerNum(firstTu.getBaseTranslationVersion() + 1)
                        .setResId("dummyRestId").setLocaleId(LocaleId.EN_US)
                        .setSources(firstTu.getNewContents()).build();
View Full Code Here


    @Test
    public void canGetByIdOrNull() {
        model.setData(data);

        TransUnit found = model.getByIdOrNull(new TransUnitId(2));
        assertThat(found, Matchers.equalTo(data.get(1)));

        TransUnit notFound = model.getByIdOrNull(new TransUnitId(99));
        assertThat(notFound, Matchers.is(Matchers.nullValue()));
    }
View Full Code Here

    public void selectedIsNullIfIndexIsOutOfRange() {
        model.setData(data);

        model.setSelected(-1);

        TransUnit result = model.getSelectedOrNull();
        assertThat(result, Matchers.is(Matchers.nullValue()));
    }
View Full Code Here

    }

    @Test
    public void willUpdateModelIfInCurrentPage() {
        TransUnitId updatedTUId = new TransUnitId(3);
        TransUnit updatedTransUnit =
                TestFixture.makeTransUnit(3, ContentState.Approved);
        List<TransUnit> oldData = ImmutableList.copyOf(data);

        model.setData(data);
        assertThat(model.getByIdOrNull(updatedTUId),
View Full Code Here

    }

    @Test
    public void willNotUpdateModelIfNotInCurrentPage() {
        TransUnitId updatedTUId = new TransUnitId(9);
        TransUnit updatedTransUnit =
                TestFixture.makeTransUnit(9, ContentState.Approved);
        List<TransUnit> oldData = ImmutableList.copyOf(data);

        model.setData(data);
        assertThat(model.getByIdOrNull(updatedTUId),
View Full Code Here

    @Test
    public void canUpdateRowIfInCurrentDisplays() {
        selectedTU = currentPageRows.get(2);
        when(display.getId()).thenReturn(selectedTU.getId());
        TransUnit updatedTransUnit =
                TestFixture.makeTransUnit(selectedTU.getId().getId());

        presenter.updateRow(updatedTransUnit);

        InOrder inOrder = Mockito.inOrder(display);
View Full Code Here

    @Test
    public void canUpdateRowIfInCurrentDisplaysAndIsCurrentRow() {
        selectedTU = currentPageRows.get(2);
        presenter.setStatesForTesting(selectedTU.getId(), 0, display);
        when(display.getId()).thenReturn(selectedTU.getId());
        TransUnit updatedTransUnit =
                TestFixture.makeTransUnit(selectedTU.getId().getId());

        presenter.updateRow(updatedTransUnit);

        verify(display).setValueAndCreateNewEditors(updatedTransUnit);
View Full Code Here

    @Test
    public void willIgnoreIfUpdateRowWithValueNotInCurrentPage() {
        selectedTU = currentPageRows.get(2);
        when(display.getId()).thenReturn(selectedTU.getId());
        TransUnit updatedTransUnit = TestFixture.makeTransUnit(99);

        presenter.updateRow(updatedTransUnit);

        verify(display, never()).setValueAndCreateNewEditors(updatedTransUnit);
    }
View Full Code Here

                Matchers.equalTo(identity.getEditorClientId()));
    }

    @Test
    public void canCallServerOnSelection() {
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);
        service.transUnitSelected(selectedTransUnit);

        verify(dispatcher).execute(actionCaptor.capture(),
                Mockito.isA(NoOpAsyncCallback.class));
        TransUnitEditAction action = actionCaptor.getValue();
        assertThat(action.getPerson(),
                Matchers.sameInstance(identity.getPerson()));
        assertThat(action.getSelectedTransUnitId(),
                Matchers.sameInstance(selectedTransUnit.getId()));
    }
View Full Code Here

                Matchers.sameInstance(selectedTransUnit.getId()));
    }

    @Test
    public void onPersonExit() {
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);
        Person person = TestFixture.person();

        service.personExit(person, selectedTransUnit.getId());

        verify(dispatcher).execute(actionCaptor.capture(),
                Mockito.isA(NoOpAsyncCallback.class));
        TransUnitEditAction action = actionCaptor.getValue();
        assertThat(action.getPerson(), Matchers.sameInstance(person));
        assertThat(action.getSelectedTransUnitId(),
                Matchers.sameInstance(selectedTransUnit.getId()));
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.TransUnit

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.