@SlowTest
public void testCopyTrans(CopyTransExecution execution) {
// Prepare Execution
ProjectIterationDAO iterationDAO =
seam.autowire(ProjectIterationDAO.class);
LocaleDAO localeDAO = seam.autowire(LocaleDAO.class);
// Get the project iteration
HProjectIteration projectIteration;
if (execution.projectMatches) {
projectIteration =
iterationDAO.getBySlug("same-project", "different-version");
} else {
projectIteration =
iterationDAO.getBySlug("different-project",
"different-version");
}
assert projectIteration != null;
// Set require translation review
projectIteration
.setRequireTranslationReview(execution.requireTranslationReview);
// Change all targets to have the execution's match state
for (HDocument doc : projectIteration.getDocuments().values()) {
for (HTextFlow tf : doc.getAllTextFlows().values()) {
for (HTextFlowTarget tft : tf.getTargets().values()) {
tft.setState(execution.matchState);
}
}
}
// Create the document
HDocument doc = new HDocument();
doc.setContentType(ContentType.TextPlain);
doc.setLocale(localeDAO.findByLocaleId(LocaleId.EN_US));
doc.setProjectIteration(projectIteration);
if (execution.documentMatches) {
doc.setFullPath("/same/document");
} else {
doc.setFullPath("/different/document");