Package org.zanata.webtrans.shared.model

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


        UpdateTransUnit updateTransUnit = actionCaptor.getValue();
        assertThat(updateTransUnit.getUpdateRequests(), hasSize(1));
        assertThat(updateTransUnit.getUpdateType(),
                equalTo(TransUnitUpdated.UpdateType.WebEditorSave));

        TransUnitUpdateRequest request =
                updateTransUnit.getUpdateRequests().get(0);
        assertThat(request.getTransUnitId(), equalTo(TRANS_UNIT_ID));
        assertThat(request.getNewContents(), Matchers.contains("new content"));
        assertThat(request.getBaseTranslationVersion(), equalTo(VER_NUM));
        assertThat(request.getNewContentState(), equalTo(ContentState.Approved));
    }
View Full Code Here


        UpdateTransUnit updateTransUnit = actionCaptor.getValue();
        assertThat(updateTransUnit.getUpdateRequests(), hasSize(1));
        assertThat(updateTransUnit.getUpdateType(),
                equalTo(TransUnitUpdated.UpdateType.WebEditorSave));

        TransUnitUpdateRequest request =
                updateTransUnit.getUpdateRequests().get(0);
        assertThat(request.getTransUnitId(), equalTo(TRANS_UNIT_ID));
        assertThat(request.getNewContents(), Matchers.contains("new content"));
        assertThat(request.getBaseTranslationVersion(), equalTo(VER_NUM));
        assertThat(request.getNewContentState(), equalTo(ContentState.Approved));

        assertThat(queue.hasPending(), Matchers.is(true));
    }
View Full Code Here

        int versionNum = 0; // no previous translation

        // Translate using webtrans
        UpdateType updateType = UpdateType.WebEditorSave;
        UpdateTransUnit action =
                new UpdateTransUnit(new TransUnitUpdateRequest(new TransUnitId(
                        textFlowId), Lists.newArrayList(translation),
                        translationState, versionNum), updateType);
        action.setWorkspaceId(workspaceId);

        UpdateTransUnitResult result = transUnitHandler.execute(action, null);
View Full Code Here

    private TransMemoryMerge prepareAction(int threshold,
            boolean acceptImportedTMResults, long... tranUnitIds)
            throws NoSuchWorkspaceException {
        List<TransUnitUpdateRequest> requests = newArrayList();
        for (long tranUnitId : tranUnitIds) {
            requests.add(new TransUnitUpdateRequest(
                    new TransUnitId(tranUnitId), null, null, 0));
        }
        // we have TransMemoryMergeStatusResolverTest to cover various different
        // merge options so here we don't test that
        MergeRule importedTMOption =
View Full Code Here

                updateRequestCaptor.capture());

        List<TransUnitUpdateRequest> updateRequest =
                updateRequestCaptor.getValue();
        assertThat(updateRequest, Matchers.hasSize(1));
        TransUnitUpdateRequest transUnitUpdateRequest = updateRequest.get(0);
        assertThat(transUnitUpdateRequest.getNewContents(),
                Matchers.equalTo(mostSimilarTM.getTargetContents()));
        assertThat(
                transUnitUpdateRequest.getTargetComment(),
                Matchers.equalTo("auto translated by TM merge from project: project a, version: master, DocId: pot/msg.pot"));
    }
View Full Code Here

                updateRequestCaptor.capture());

        List<TransUnitUpdateRequest> updateRequest =
                updateRequestCaptor.getValue();
        assertThat(updateRequest, Matchers.hasSize(1));
        TransUnitUpdateRequest transUnitUpdateRequest = updateRequest.get(0);
        assertThat(transUnitUpdateRequest.getNewContents(),
                Matchers.equalTo(mostSimilarTM.getTargetContents()));
        assertThat(
                transUnitUpdateRequest.getTargetComment(),
                Matchers.equalTo("auto translated by TM merge from translation memory: test-tm, unique id: uid10"));
    }
View Full Code Here

        return new TransMemoryDetails(null, null, projectName, null, docId,
                resId, msgContext, null, null, null);
    }

    private static TransMemoryMerge mergeTMAction(MergeOptions mergeOptions) {
        TransUnitUpdateRequest updateRequest =
                new TransUnitUpdateRequest(new TransUnitId(1), null, null, 0);
        return new TransMemoryMerge(80, Lists.newArrayList(updateRequest),
                mergeOptions);
    }
View Full Code Here

                                    .getDocument().getLocale().getLocaleId(),
                            checkContext, checkDocument, checkProject,
                            action.getThresholdPercent());

            if (tmResult.isPresent()) {
                TransUnitUpdateRequest request =
                        createRequest(action, targetLocale, requestMap,
                                hTextFlow, tmResult.get(), hTextFlowTarget);
                updateRequests.add(request);
            }
        }
View Full Code Here

                            oldTarget);
            comment = buildTargetComment(tmDetail);
        }

        if (statusToSet != null) {
            TransUnitUpdateRequest unfilledRequest =
                    requestMap.get(hTextFlowToBeFilled.getId());
            TransUnitUpdateRequest request =
                    new TransUnitUpdateRequest(
                            unfilledRequest.getTransUnitId(),
                            tmResult.getTargetContents(), statusToSet,
                            unfilledRequest.getBaseTranslationVersion());
            request.addTargetComment(comment);
            log.debug("auto translate from translation memory {}", request);
            return request;
        }
        return null;
    }
View Full Code Here

TOP

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

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.