@Test
@Ignore("see https://github.com/zanata/zanata-server/pull/571#issuecomment-55547577 this test can be used to reproduce that issue.")
// see org.zanata.rest.service.ResourceUtils.transferFromTextFlows()
public void testPushTranslationAndCopyTrans() {
ZanataRestCaller restCaller =
new ZanataRestCaller();
String projectSlug = "push-test";
String iterationSlug = "master";
String projectType = "gettext";
restCaller.createProjectAndVersion(projectSlug, iterationSlug,
projectType);
String docId = "messages";
Resource sourceResource = buildSourceResource(docId);
TranslationsResource transResource = buildTranslationResource();
int numOfMessages = 520;
for (int i = 0; i < numOfMessages; i++) {
String resId = "res" + i;
String content = "content" + i;
sourceResource.getTextFlows().add(buildTextFlow(resId, content));
transResource.getTextFlowTargets().add(
buildTextFlowTarget(resId, content));
}
restCaller.asyncPushSource(projectSlug, iterationSlug, sourceResource, false);
restCaller.asyncPushTarget(projectSlug, iterationSlug, docId,
new LocaleId("pl"), transResource, "import");
assertThat(true, Matchers.is(true));
// create another version
restCaller.createProjectAndVersion(projectSlug, "2", projectType);
restCaller.asyncPushSource(projectSlug, "2", sourceResource, false);
restCaller.asyncPushTarget(projectSlug, "2", docId, new LocaleId("pl"),
transResource, "import");
// push to old version again
restCaller.asyncPushSource(projectSlug, iterationSlug, sourceResource,
COPYTRANS);
}