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

Commit

Permalink
Remove redundant test
Browse files Browse the repository at this point in the history
Requirement is covered by TranslationMemoryServiceImplTest.searchBestMatchTargetTest.
  • Loading branch information
seanf committed Apr 15, 2014
1 parent 05197b4 commit 1db4c3e
Showing 1 changed file with 2 additions and 60 deletions.
Expand Up @@ -91,7 +91,7 @@ protected void prepareDBUnitOperations() {
}

@BeforeMethod
public void beforeMethod() throws Exception {
protected void beforeMethod() throws Exception {
seam.reset()
.use("entityManager", Search.getFullTextEntityManager(getEm()))
.use("entityManagerFactory", getEmf())
Expand Down Expand Up @@ -119,7 +119,7 @@ public void individualTest() {

// TODO most of these combinations should be tested in unit tests instead
@DataProvider(name = "CopyTrans")
public Object[][] createCopyTransTestParams() {
protected Object[][] createCopyTransTestParams() {
Set<CopyTransExecution> expandedExecutions = generateAllExecutions();

Object[][] val = new Object[expandedExecutions.size()][1];
Expand Down Expand Up @@ -311,64 +311,6 @@ public void reuseTranslationsFromObsoleteDocuments() throws Exception {
testCopyTrans(execution);
}

/**
* Makes sure that given two equal results, it will reuse the most recent
* translation.
*/
@Test
public void preferLatestTranslation() throws Exception {
ProjectIterationDAO projectIterationDAO =
seam.autowire(ProjectIterationDAO.class);
DocumentDAO documentDAO = seam.autowire(DocumentDAO.class);

HProjectIteration version =
projectIterationDAO.getBySlug("same-project", "same-version");
assert version != null;

// Create another version with translations in the same project
HProjectIteration newerVersion = new HProjectIteration();
newerVersion.setSlug("newer-version");
newerVersion.setProject(version.getProject());
projectIterationDAO.makePersistent(newerVersion);

// Duplicate the documents (with text flows and translations) on the
// newer version
for (HDocument doc : version.getDocuments().values()) {
HDocument newDoc =
new HDocument(doc.getDocId(), doc.getContentType(),
doc.getLocale());
newDoc.setProjectIteration(newerVersion);
newerVersion.getDocuments().put(newDoc.getPath(), newDoc);

for (HTextFlow tf : doc.getTextFlows()) {
HTextFlow newTf =
new HTextFlow(newDoc, tf.getResId(), tf.getContents()
.get(0));

for (HTextFlowTarget tft : tf.getTargets().values()) {
HTextFlowTarget newTft =
new HTextFlowTarget(newTf, tft.getLocale());
newTft.setContent0(tft.getContents().get(0) + " recent");
newTft.setState(Translated);
newTf.getTargets().put(newTft.getLocale().getId(), newTft);
}
newDoc.getTextFlows().add(newTf);
}
documentDAO.makePersistent(newDoc);
}

getEm().flush();
// force flushing of index in h2
Search.getFullTextEntityManager(getEm()).flushToIndexes();

// run copy trans and make sure the latest translation is copied
CopyTransExecution execution =
new CopyTransExecution(IGNORE, IGNORE, IGNORE, true, true,
true, true, Approved).expectTransState(Translated)
.withContents("target-content-de recent");
testCopyTrans(execution);
}

private ContentState getExpectedContentState(CopyTransExecution execution) {
ContentState expectedContentState =
execution.getRequireTranslationReview() ? Approved : Translated;
Expand Down

0 comments on commit 1db4c3e

Please sign in to comment.