diff --git a/DEVELOPING.md b/DEVELOPING.md index d619196405..bde79fd6e9 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -7,7 +7,7 @@ The JTS build chain uses Maven. Build commands are executed at the project root * Build JTS, with tests: mvn clean install - + * Build JTS, no tests: mvn clean install -DskipTests @@ -15,11 +15,11 @@ The JTS build chain uses Maven. Build commands are executed at the project root * Build `jts-io-ora`: mvn install -Poracle - + * Build `jts-io-sde`: mvn install -Parcsde - + * Build everything: mvn install -Pall @@ -47,7 +47,7 @@ Field | Value Type | Java Application Project | `jts-tests` Main class | `org.locationtech.jtstest.testrunner.JTSTestRunnerCmd` -Program arguments | `-files validate general` +Program arguments | `validate general` Working directory | `${workspace_loc:jts-tests/src/test/resources/testxml}` * **JTS TestBuilder** - for viewing and processing geometry with JTS @@ -59,19 +59,19 @@ Project | `jts-app` Main class | `org.locationtech.jtstest.testbuilder.JTSTestBuilder` Program arguments (optional) | `-geomfunc ...` VM args | `-Xmx1000M` -VM args (optional, for Mac) | `-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel` +VM args (optional, for Mac) | `-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel` Working directory | Default ## Testing -JTS aims for 100% code coverage for unit tests. +JTS aims for 100% code coverage for unit tests. There are two kinds of unit tests: ### JUnit tests Used for verifying API code, internal data structures, and ancillary algorithms. -These tests are written in Java. +These tests are written in Java. This allows testing all parts of the codebase, and can provide richer error detection and reporting. However, the tests are not as readable or portable @@ -83,15 +83,17 @@ as the XML tests. ### XML Tests -JTS provides a code-independent, declarative XML-based format for expressing geometric functional tests. +JTS provides a code-independent, declarative XML-based format for expressing geometric functional tests. This format has the following advantages: * allows encoding large geometries * provides geometric test cases in a reusable way -* easily consumed by external tools such as the JTS TestBuilder or other geometry libraries (e.g. GEOS) +* easily consumed by tools such as the JTS TestBuilder or by other geometry libraries (e.g. GEOS) * allows geometric tests to be used with other operation implementations, for testing or comparison purposes -This format should be used for tests which involve large geometries, or which +This format should be used for tests which involve large geometries, or which express fundamental geometric semantics of the JTS library. +The XML test format can be executed using the JTS TestRunner, or imported into the JTS TestBuilder. + diff --git a/doc/JTS_Version_History.md b/doc/JTS_Version_History.md index 6d8b5254cd..ce70daef6e 100644 --- a/doc/JTS_Version_History.md +++ b/doc/JTS_Version_History.md @@ -25,7 +25,6 @@ Distributions for older JTS versions can be obtained at the * Change `Polygon` `getExteriorRing` and `getInteriorRingN` accessors to return `LinearRing`. *This is a binary incompatible change to the method signature. Recompilation is necessary. No source code changes are required.* - ### Functionality Improvements * Added `IndexedFacetDistance.isWithinDistance` @@ -37,6 +36,13 @@ Distributions for older JTS versions can be obtained at the * Fix bug in `Quadtree.ensureExtent` (#416) * Fix bugs in `LinearLocation` endpoint handling (#421) +## JTS TestRunner + +### Functionality Improvements + +* Allow test files/dirs to be specified as free args + + # Version 1.16.1 diff --git a/modules/tests/src/main/java/org/locationtech/jtstest/testrunner/JTSTestRunnerCmd.java b/modules/tests/src/main/java/org/locationtech/jtstest/testrunner/JTSTestRunnerCmd.java index 3dbaaebcd2..12db81e2e0 100644 --- a/modules/tests/src/main/java/org/locationtech/jtstest/testrunner/JTSTestRunnerCmd.java +++ b/modules/tests/src/main/java/org/locationtech/jtstest/testrunner/JTSTestRunnerCmd.java @@ -177,9 +177,15 @@ private static TestRunnerOptions readOptions(String[] args) throws ParseExceptio private static List extractTestFilenames(CommandLine commandLine) throws FileNotFoundException, IOException { List testFiles = new ArrayList(); + + if (commandLine.hasOption(OptionSpec.OPTION_FREE_ARGS)) { + testFiles.addAll(FilesUtil.expand(cmdOptionArgList(commandLine, OptionSpec.OPTION_FREE_ARGS))); + } + if (commandLine.hasOption(OPT_FILES)) { testFiles.addAll(FilesUtil.expand(cmdOptionArgList(commandLine, OPT_FILES))); } + if (commandLine.hasOption(OPT_PROPERTIES)) { Properties properties = new Properties(); File file = new File(commandLine.getOption(OPT_PROPERTIES).getArg(0)); @@ -196,6 +202,9 @@ private static CommandLine createCommandLine() throws ParseException { CommandLine commandLine = new CommandLine('-'); OptionSpec os; + os = new OptionSpec(OptionSpec.OPTION_FREE_ARGS, OptionSpec.NARGS_ONE_OR_MORE); + commandLine.addOptionSpec(os); + os = new OptionSpec(OPT_FILES, OptionSpec.NARGS_ONE_OR_MORE); commandLine.addOptionSpec(os); @@ -211,23 +220,28 @@ private static CommandLine createCommandLine() throws ParseException { return commandLine; } + static final String[] help = new String[] { + "", + "Usage: java org.locationtech.jtstest.testrunner.JTSTestRunnerCmd", + " [ -geomfunc ]", + " [ -geomop ]", + " [ -testIndex ]", + " [ -verbose]", + " [ -properties ]", + " [ -files <.xml file or dir> ...]", + " [ <.xml file or dir> ... ]", + " -files run a list of .xml files or directories containing .xml files", + " -properties load .xml filenames from a .properties file", + " -geomfunc specifies the class providing the geometry operations", + " -geomop specifies the class providing the geometry operations", + " -testIndex specfies the index of a single test to run", + " -verbose display the results of successful tests" + }; + private static void printHelp() { - System.out.println(""); - System.out.println("Usage: java com.vividsolutions.jtstest.testrunner.TopologyTestApp "); - System.out.println(" [-files <.xml files>] [-gui] "); - System.out.println(" [-geomfunc ]"); - System.out.println(" [-geomop ]"); - System.out.println(" [-testIndex ]"); - System.out.println(" [-verbose]"); - System.out.println(" [-properties ]"); - System.out.println(""); - System.out.println(" -files run a list of .xml files or directories"); - System.out.println(" containing .xml files"); - System.out.println(" -properties load .xml filenames from a .properties file"); - System.out.println(" -geomfunc specifies the class providing the geometry operations"); - System.out.println(" -geomop specifies the class providing the geometry operations"); - System.out.println(" -testIndex specfies the index of a single test to run"); - System.out.println(" -verbose display the results of successful tests"); + for (String s : help) { + System.out.println(s); + } } public static List cmdOptionArgList(CommandLine commandLine, String optionName) {