Commit 1b95f5d8 authored by jhargrave's avatar jhargrave

simplifier test now to full comparison with a non-simplified merge

parent 15c02a58
......@@ -8,7 +8,6 @@ import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
......@@ -138,7 +137,6 @@ public class PostSegmentationSimplifierIT {
}
@SuppressWarnings("resource")
@Ignore("Only Fails becuase of wassegmented property difference")
public void testDoubleExtraction4() {
ArrayList<InputDocument> list = new ArrayList<InputDocument>();
......
package net.sf.okapi.simplifier.integration;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
......@@ -19,7 +16,6 @@ import org.junit.rules.ErrorCollector;
import net.sf.okapi.common.Event;
import net.sf.okapi.common.LocaleId;
import net.sf.okapi.common.Util;
import net.sf.okapi.common.filters.IFilter;
import net.sf.okapi.common.filters.InputDocument;
import net.sf.okapi.common.filters.RoundTripComparison;
import net.sf.okapi.filters.html.HtmlFilter;
......@@ -155,7 +151,6 @@ public class PostSegmentationSimplifierWithConfigIT {
}
@SuppressWarnings("resource")
@Ignore("Only Fails becuase of wassegmented property difference")
public void testDoubleExtraction4() {
ArrayList<InputDocument> list = new ArrayList<InputDocument>();
......
......@@ -75,12 +75,15 @@ public class RoundTripSimplifierHtmlItsTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -83,12 +83,15 @@ public class RoundTripSimplifyDitaTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -78,12 +78,15 @@ public class RoundTripSimplifyHtmlTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,12 +74,15 @@ public class RoundTripSimplifyIcmlTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,12 +74,15 @@ public class RoundTripSimplifyIdmlTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
ZipXMLFileCompare compare = new ZipXMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFiles(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFiles(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -75,11 +75,15 @@ public class RoundTripSimplifyJsonTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,12 +74,15 @@ public class RoundTripSimplifyOpenOfficeTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
ZipXMLFileCompare compare = new ZipXMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFiles(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFiles(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,11 +74,15 @@ public class RoundTripSimplifyOpenXmlTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
ZipXMLFileCompare compare = new ZipXMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFiles(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFiles(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -75,12 +75,15 @@ public class RoundTripSimplifyPoTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -75,12 +75,15 @@ public class RoundTripSimplifyPropertyTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -75,12 +75,15 @@ public class RoundTripSimplifyRegexTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -75,12 +75,15 @@ public class RoundTripSimplifySrtTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,12 +74,15 @@ public class RoundTripSimplifyTableTkitsIT {
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -111,11 +111,15 @@ public class RoundTripSimplifyXliffTkitsIT
target = LocaleId.fromString(locales.get(1));
}
RoundTripUtils.extract(source, target, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(source, target, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(source, target, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(source, target, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare XML: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare XML: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,11 +74,15 @@ public class RoundTripSimplifyXmlStreamTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -41,6 +41,13 @@ public class RoundTripSimplifyXmlTkitsIT
public void tearDown() throws Exception {
xmlFilter.close();
}
@Test
public void xmlSingleFileTranslate1() throws FileNotFoundException, URISyntaxException {
for (File file : IntegrationtestUtils.getTestFiles("/xml/test01.xml", Arrays.asList(".xml.single"))) {
runTest(true, file, "okf_xml", null);
}
}
@Test
public void xmlFiles() throws FileNotFoundException, URISyntaxException {
......@@ -74,12 +81,15 @@ public class RoundTripSimplifyXmlTkitsIT
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged));
} catch(Throwable e) {
errCol.addError(e);
}
......
......@@ -74,12 +74,16 @@ public class RoundTripSimplifyYamlTkitsIT
String original = root + f;
String tkitMerged = root + f + ".tkitMerged";
String merged = root + f + ".merged";
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, false);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, merged, configName, customConfigPath);
RoundTripUtils.extract(LocaleId.ENGLISH, LocaleId.FRENCH, original, xliff, configName, customConfigPath, segment, true);
RoundTripUtils.merge(LocaleId.ENGLISH, LocaleId.FRENCH, false, original, xliff, tkitMerged, configName, customConfigPath);
FileCompare compare = new FileCompare();
try {
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(tkitMerged, tkitMerged, StandardCharsets.UTF_8.name()));
assertTrue("Compare Lines: " + f, compare.compareFilesPerLines(merged, tkitMerged, StandardCharsets.UTF_8.name()));
} catch(Throwable e) {
errCol.addError(e);
}
......
<?xml version="1.0"?>
<myMetaDoc
xmlns:cml="myChineseMakupLanguage">
<head>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule selector="//img/@alt" translate="yes"/>
<its:translateRule selector="//*/@title" translate="yes"/>
<its:translateRule selector="//verbatim" translate="no"/>
<its:translateRule selector="//verbatim/@*" translate="no"/>
<its:translateRule selector="//verbatim//*/@*" translate="no"/>
<its:withinTextRule selector="//img|//verbatim" withinText="yes"/>
</its:rules>
</head>
<body>
<par>Text with an image: <img alt="Image description" src="img.png"/>.</par>
<par id="100" title="Text">This is the first paragraph. It has some <verbatim>un-translatable
code with an image: <img src="test.png" alt="Image description"/></verbatim>.</par>
<insert xmlns:z="myChineseMakupLanguage" xmlns:i="http://www.w3.org/2005/11/its">
<z:书籍>
<z:封面>
<z:汇集>The Lord of the Rings</z:汇集>
<z:标题>The Return of the King</z:标题>
<z:作者>J.R.R. Tolkein</z:作者>
</z:封面>
<z:章节 数="1">
<z:头注>Minas Tirith</z:头注>
<z:段落识别 id="A34B"><z:姓名>Pippin</z:姓名> looked out from the shelter of <z:姓名>Gandalf</z:姓名>'s cloak.</z:段落识别>
</z:章节>
<z:>
<i:rules version="1.0" xmlns:cml="myChineseMakupLanguage">
<i:translateRule selector="//cml:作者" translate="no"/>
<i:translateRule selector="//cml:姓名" translate="no"/>
<i:withinTextRule selector="//cml:姓名" withinText="yes"/>
</i:rules>
</z:躯>
</z:书籍>
</insert>
</body>
</myMetaDoc>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment