Commit 0745bd4f authored by jhargrave's avatar jhargrave

add xliff compare tests...

fix a few errors in other integration tests
parent 0837c979

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -4,3 +4,4 @@
.settings/*
/target
*/target/*
/target/
......@@ -73,11 +73,33 @@ public final class IntegrationtestUtils {
return FileUtil.getFilteredFiles(dir, filter, true);
}
public static Collection<File> getTestFilesNoRecurse(String resourcePath, final List<String> extensions)
throws URISyntaxException {
File dir;
URL url = IntegrationtestUtils.class.getResource(resourcePath);
dir = new File(url.toURI()).getParentFile();
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
for (String e : extensions) {
if (name.endsWith(e)) {
return true;
}
}
return false;
}
};
return FileUtil.getFilteredFiles(dir, filter, false);
}
public static Collection<File> getTestFiles(String resourcePath,
final List<String> extensions) throws URISyntaxException {
return getTestFiles(resourcePath, extensions, false);
}
public static String[] getTestFilesNames(String resourcePath, final List<String> extensions) throws URISyntaxException {
Collection<File> files = getTestFiles(resourcePath, extensions);
String[] paths = new String[files.size()];
......
......@@ -62,6 +62,7 @@
<module>roundtrip-integration-tests</module>
<module>tkit-integration-tests</module>
<module>pipeline-integration-tests</module>
<module>xliffcompare-integration-tests</module>
<!-- Testing memory leaks etc.. <module>memory-integration-tests</module> -->
</modules>
<build>
......
......@@ -46,8 +46,8 @@ public class RoundTripDoxygenIT
public void doxygenFiles() throws FileNotFoundException, URISyntaxException {
// run top level files (without config)
for (File file : IntegrationtestUtils.getTestFiles("/doxygen/lists.h", Arrays.asList(".h", ".py"))) {
runTest(false, file, "okf_xmlstream-dita", null);
runTest(true, file, "okf_xmlstream-dita", null);
runTest(false, file, "okf_doxygen", null);
runTest(true, file, "okf_doxygen", null);
}
// run each subdirectory where we assume there is a custom config)
......
......@@ -47,8 +47,8 @@ public class RoundTripDtdIT
public void dtdFiles() throws FileNotFoundException, URISyntaxException {
// run top level files (without config)
for (File file : IntegrationtestUtils.getTestFiles("/dtd/Test01.dtd", Arrays.asList(".dtd"))) {
runTest(false, file, "okf_xmlstream-dita", null);
runTest(true, file, "okf_xmlstream-dita", null);
runTest(false, file, "okf_dtd", null);
runTest(true, file, "okf_dtd", null);
}
// run each subdirectory where we assume there is a custom config)
......
......@@ -90,6 +90,8 @@ public class RoundTripXliffIT
RoundTripUtils.extract(source, target, tkitMerged, xliff, configName, customConfigPath, segment);
RoundTripUtils.merge(source, target, false, tkitMerged, xliff, mergedRoundTrip, configName, customConfigPath);
// some tests fail, but the legacy merger may not work well for bilingual merge
// and some of the differences are its annotations
XMLFileCompare compare = new XMLFileCompare();
try {
assertTrue("Compare XML: " + f, compare.compareFilesPerLines(mergedRoundTrip, tkitMerged));
......
......@@ -46,8 +46,8 @@ public class RoundTripDoxygenTkitsIT
public void doxygenFiles() throws FileNotFoundException, URISyntaxException {
// run top level files (without config)
for (File file : IntegrationtestUtils.getTestFiles("/doxygen/lists.h", Arrays.asList(".h", ".py"))) {
runTest(false, file, "okf_xmlstream-dita", null);
runTest(true, file, "okf_xmlstream-dita", null);
runTest(false, file, "okf_doxygen", null);
runTest(true, file, "okf_doxygen", null);
}
// run each subdirectory where we assume there is a custom config)
......
......@@ -47,8 +47,8 @@ public class RoundTripDtdTkitsIT
public void dtdFiles() throws FileNotFoundException, URISyntaxException {
// run top level files (without config)
for (File file : IntegrationtestUtils.getTestFiles("/dtd/Test01.dtd", Arrays.asList(".dtd"))) {
runTest(false, file, "okf_xmlstream-dita", null);
runTest(true, file, "okf_xmlstream-dita", null);
runTest(false, file, "okf_dtd", null);