Class TestReader
- java.lang.Object
-
- org.locationtech.jtstest.testrunner.TestReader
-
public class TestReader extends java.lang.Object- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private GeometryFactorygeometryFactoryprivate GeometryOperationgeomOp(package private) java.util.VectorparsingProblemsprivate ResultMatcherresultMatcherprivate static java.lang.StringTAG_geometryOperationprivate static java.lang.StringTAG_resultMatcherprivate doubletoleranceprivate WKTOrWKBReaderwktorbReader
-
Constructor Summary
Constructors Constructor Description TestReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.io.FileabsoluteWktFile(java.io.File wktFile, TestRun testRun)voidclearParsingProblems()private PrecisionModelcreatePrecisionModel(org.jdom2.Element precisionModelElement)TestRuncreateTestRun(java.io.File testFile, int runIndex)static java.util.ListgetContents(java.lang.String textFileName)Returns a List of the String's in the text file, one per line.GeometryOperationgetGeometryOperation()private java.lang.ObjectgetInstance(java.lang.String classname, java.lang.Class baseClass)Gets an instance of a class with the given name, and ensures that the class is assignable to a specified baseClass.java.util.ListgetParsingProblems()booleanisBooleanFunction(java.lang.String name)booleanisDoubleFunction(java.lang.String name)booleanisGeometryFunction(java.lang.String name)booleanisIntegerFunction(java.lang.String name)private GeometryOperationparseGeometryOperation(org.jdom2.Element runElement)Parses an optional geometryOperation element.private PrecisionModelparsePrecisionModel(org.jdom2.Element runElement)Parses an optional precisionModel element.private ResultMatcherparseResultMatcher(org.jdom2.Element runElement)Parses an optional resultMatcher element.private java.util.ListparseTestCases(java.util.List caseElements, java.io.File testFile, TestRun testRun, double tolerance)Creates a List of TestCase's from the givenElement's. private TestRunparseTestRun(org.jdom2.Element runElement, java.io.File testFile, int runIndex)Creates a TestRun from theElement. private java.util.ListparseTests(java.util.List testElements, int caseIndex, java.io.File testFile, TestCase testCase, double tolerance)Creates a List of Test's from the givenElement's. private doubleparseTolerance(org.jdom2.Element runElement)private GeometryreadGeometry(org.jdom2.Element geometryElement, java.io.File wktFile)private BooleanResulttoBooleanResult(java.lang.String value)private DoubleResulttoDoubleResult(java.lang.String value)private GeometryResulttoGeometryResult(java.lang.String value, TestRun testRun)private IntegerResulttoIntegerResult(java.lang.String value)private ResulttoResult(java.lang.String value, java.lang.String name, TestRun testRun)private java.lang.StringtoString(java.util.List stringList)private java.io.FilewktFile(org.jdom2.Element geometryElement, TestRun testRun)
-
-
-
Field Detail
-
TAG_geometryOperation
private static final java.lang.String TAG_geometryOperation
- See Also:
- Constant Field Values
-
TAG_resultMatcher
private static final java.lang.String TAG_resultMatcher
- See Also:
- Constant Field Values
-
parsingProblems
java.util.Vector parsingProblems
-
geometryFactory
private GeometryFactory geometryFactory
-
wktorbReader
private WKTOrWKBReader wktorbReader
-
tolerance
private double tolerance
-
geomOp
private GeometryOperation geomOp
-
resultMatcher
private ResultMatcher resultMatcher
-
-
Method Detail
-
getGeometryOperation
public GeometryOperation getGeometryOperation()
-
isBooleanFunction
public boolean isBooleanFunction(java.lang.String name)
-
isIntegerFunction
public boolean isIntegerFunction(java.lang.String name)
-
isDoubleFunction
public boolean isDoubleFunction(java.lang.String name)
-
isGeometryFunction
public boolean isGeometryFunction(java.lang.String name)
-
getParsingProblems
public java.util.List getParsingProblems()
-
clearParsingProblems
public void clearParsingProblems()
-
createTestRun
public TestRun createTestRun(java.io.File testFile, int runIndex)
-
parseTests
private java.util.List parseTests(java.util.List testElements, int caseIndex, java.io.File testFile, TestCase testCase, double tolerance) throws TestParseExceptionCreates a List of Test's from the givenElement's. - Throws:
TestParseException
-
toResult
private Result toResult(java.lang.String value, java.lang.String name, TestRun testRun) throws TestParseException, ParseException
- Throws:
TestParseExceptionParseException
-
toBooleanResult
private BooleanResult toBooleanResult(java.lang.String value) throws TestParseException
- Throws:
TestParseException
-
toDoubleResult
private DoubleResult toDoubleResult(java.lang.String value) throws TestParseException
- Throws:
TestParseException
-
toIntegerResult
private IntegerResult toIntegerResult(java.lang.String value) throws TestParseException
- Throws:
TestParseException
-
toGeometryResult
private GeometryResult toGeometryResult(java.lang.String value, TestRun testRun) throws ParseException
- Throws:
ParseException
-
parseTestCases
private java.util.List parseTestCases(java.util.List caseElements, java.io.File testFile, TestRun testRun, double tolerance) throws TestParseExceptionCreates a List of TestCase's from the givenElement's. - Throws:
TestParseException
-
parseTestRun
private TestRun parseTestRun(org.jdom2.Element runElement, java.io.File testFile, int runIndex) throws TestParseException
Creates a TestRun from theElement. - Throws:
TestParseException
-
parsePrecisionModel
private PrecisionModel parsePrecisionModel(org.jdom2.Element runElement) throws TestParseException
Parses an optional precisionModel element. The default is to use a FLOATING model.- Parameters:
runElement-- Returns:
- a PrecisionModel instance (default if not specified)
- Throws:
TestParseException
-
createPrecisionModel
private PrecisionModel createPrecisionModel(org.jdom2.Element precisionModelElement) throws TestParseException
- Throws:
TestParseException
-
parseGeometryOperation
private GeometryOperation parseGeometryOperation(org.jdom2.Element runElement) throws TestParseException
Parses an optional geometryOperation element. The default is to leave this unspecified .- Parameters:
runElement-- Returns:
- an instance of the GeometryOperation class, if specified, or null if no geometry operation was specified
- Throws:
TestParseException- if a parsing error was encountered
-
parseResultMatcher
private ResultMatcher parseResultMatcher(org.jdom2.Element runElement) throws TestParseException
Parses an optional resultMatcher element. The default is to leave this unspecified .- Parameters:
runElement-- Returns:
- an instance of the ResultMatcher class, if specified, or null if no result matcher was specified
- Throws:
TestParseException- if a parsing error was encountered
-
parseTolerance
private double parseTolerance(org.jdom2.Element runElement) throws TestParseException- Throws:
TestParseException
-
getInstance
private java.lang.Object getInstance(java.lang.String classname, java.lang.Class baseClass)Gets an instance of a class with the given name, and ensures that the class is assignable to a specified baseClass.- Returns:
- an instance of the class, if it is assignment-compatible, or null if the requested class is not assigment-compatible
-
wktFile
private java.io.File wktFile(org.jdom2.Element geometryElement, TestRun testRun) throws TestParseException- Throws:
TestParseException
-
readGeometry
private Geometry readGeometry(org.jdom2.Element geometryElement, java.io.File wktFile) throws java.io.FileNotFoundException, ParseException, java.io.IOException
- Throws:
java.io.FileNotFoundExceptionParseExceptionjava.io.IOException
-
toString
private java.lang.String toString(java.util.List stringList)
-
absoluteWktFile
private java.io.File absoluteWktFile(java.io.File wktFile, TestRun testRun)
-
getContents
public static java.util.List getContents(java.lang.String textFileName) throws java.io.FileNotFoundException, java.io.IOExceptionReturns a List of the String's in the text file, one per line.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-