diff --git a/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java b/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java
index ca8c4f1bc0..c7ded5f5c6 100644
--- a/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java
+++ b/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java
@@ -65,10 +65,12 @@
import static org.zanata.model.HCopyTransOptions.ConditionRuleAction.DOWNGRADE_TO_FUZZY;
import static org.zanata.model.HCopyTransOptions.ConditionRuleAction.IGNORE;
import static org.zanata.model.HCopyTransOptions.ConditionRuleAction.REJECT;
+import static org.zanata.service.impl.ExecutionHelper.cartesianProduct;
/**
* @author Carlos Munoz camunoz@redhat.com
+ * @author Sean Flanigan sflaniga@redhat.com
*/
@Test(groups = { "business-tests" })
public class CopyTransServiceImplTest extends ZanataDbunitJpaTest {
@@ -117,12 +119,9 @@ public void individualTest() {
.expectTransState(NeedReview));
}
- // TODO move most of the cases into TranslationMemoryServiceImplTest
- // FIXME cut down the number of executions, and remove the 'indices' param
- // NB: Reduced because it otherwise takes about 25 minutes
- @DataProvider(name = "CopyTrans", indices = {0,1,2,3,4,5,6,7,8})
+ @DataProvider(name = "CopyTrans")
protected Object[][] createCopyTransTestParams() {
- Set expandedExecutions = generateAllExecutions();
+ Set expandedExecutions = generateExecutions();
Object[][] val = new Object[expandedExecutions.size()][1];
int i = 0;
@@ -170,7 +169,7 @@ public void testCopyTrans(CopyTransExecution execution) {
// Create the document
HDocument doc = new HDocument();
doc.setContentType(ContentType.TextPlain);
- doc.setLocale(localeDAO.findByLocaleId(new LocaleId("en-US")));
+ doc.setLocale(localeDAO.findByLocaleId(LocaleId.EN_US));
doc.setProjectIteration(projectIteration);
if (execution.documentMatches) {
doc.setFullPath("/same/document");
@@ -213,10 +212,8 @@ public void testCopyTrans(CopyTransExecution execution) {
.setParameter("docId", doc.getDocId())
.setParameter("resId", textFlow.getResId())
.getSingleResult();
- HTextFlowTarget target = targetTextFlow.getTargets().get(3L); // Id: 3
- // for
- // Locale
- // de
+ // Id: 3L for Locale de
+ HTextFlowTarget target = targetTextFlow.getTargets().get(3L);
if (execution.isExpectUntranslated()) {
if (target != null && target.getState() != ContentState.New) {
@@ -305,8 +302,7 @@ public void reuseTranslationsFromObsoleteDocuments() throws Exception {
}
}
- // Run the copy trans scenario (very liberal, but nothing should be
- // translated)
+ // Run the copy trans scenario
CopyTransExecution execution =
new CopyTransExecution(IGNORE, IGNORE, IGNORE, true, true,
true, true, Approved).expectTransState(Approved);
@@ -346,15 +342,16 @@ private static ContentState getExpectedContentState(boolean match,
}
}
- private Set generateAllExecutions() {
+ private Set generateExecutions() {
Set allExecutions =
new HashSet();
+ // NB combinations which affect the query parameters
+ // (context match/mismatch, etc) are tested in TranslationFinderTest
Set