// and have
// a wrong
// HAccount
// injected
UpdateTransUnitHandler transUnitHandler =
seamAutowire.autowire(UpdateTransUnitHandler.class);
// Translation unit id to update
HTextFlow hTextFlow =
(HTextFlow) getSession()
.createQuery(
"select tf from HTextFlow tf where tf.contentHash = ? and "
+ "tf.document.docId = ? and "
+ "tf.document.projectIteration.slug = ? and "
+ "tf.document.projectIteration.project.slug = ?")
.setString(0, HashUtil.generateHash(textFlowContent))
.setString(1, docId).setString(2, iterationSlug)
.setString(3, projectSlug).uniqueResult();
Long textFlowId = hTextFlow.getId();
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);
assertThat(result.isSingleSuccess(), is(true));
verify(mockIdentity).checkLoggedIn();
verify(mockIdentity, atLeastOnce()).checkPermission(anyString(),
any(HLocale.class), any(HProject.class));