Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
update tests to work with multiple-TU update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed May 2, 2012
1 parent a123a33 commit c721351
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Expand Up @@ -1091,14 +1091,15 @@ private void simulateWebEditorTranslation(String projectSlug, String iterationSl
.setString(3, projectSlug)
.uniqueResult();
Long textFlowId = hTextFlow.getId();
int versionNum = 1; //hTextFlow.getTargets().get(hLocale);

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

UpdateTransUnitResult result = transUnitHandler.execute(action, null);

assertThat( result.isSuccess(), is(true) );
assertThat( result.isSingleSuccess(), is(true) );
mockControl.verify();
}

Expand Down
Expand Up @@ -284,6 +284,7 @@ public void generatesDocumentStatsOnTuUpdate()
.setSources(sources).setSourceComment("this is the source comment")
.setTargets(targets).setStatus(ContentState.Approved).setLastModifiedBy("lastModifiedBy")
.setLastModifiedTime("lastModifiedTime").setMsgContext("msgContext").setRowIndex(1)
.setVerNum(1)
.build();
expect(mockEvent.getTransUnit()).andReturn(newTransUnit).anyTimes();
replay(mockEvent);
Expand Down Expand Up @@ -335,6 +336,7 @@ public void generatesProjectStatsOnTuUpdate()
.setSources(sources).setSourceComment("this is the source comment")
.setTargets(targets).setStatus(ContentState.Approved).setLastModifiedBy("lastModifiedBy")
.setLastModifiedTime("lastModifiedTime").setMsgContext("msgContext").setRowIndex(1)
.setVerNum(1)
.build();
expect(mockEvent.getTransUnit()).andReturn(newTransUnit).anyTimes();
replay(mockEvent);
Expand Down
Expand Up @@ -29,7 +29,7 @@ public void execute()
// TransUnitUpdated updated = new TransUnitUpdated(documentId, wordCount,
// previousStatus, tu);

UpdateTransUnitResult result = new UpdateTransUnitResult(true);
UpdateTransUnitResult result = new UpdateTransUnitResult(true, 1);
callback.onSuccess(result);
Log.info("EXIT DummyUpdateTransUnitCommand.execute()");
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ public void beforeMethod()
handler = new ReplaceTextHandler();
handler.updateTransUnitHandler = mockUpdateTransUnitHandler;
transUnitBuilder = TransUnit.Builder.newTransUnitBuilder()
.setId(1).setResId("").setLocaleId("en-US").addSource("abc");
.setId(1).setResId("").setLocaleId("en-US").setVerNum(1).addSource("abc");
}

@Test
Expand Down

0 comments on commit c721351

Please sign in to comment.