use of com.revolsys.record.io.GeometryRecordReader in project com.revolsys.open by revolsys.
the class RecordIoTestSuite method doRecordReadTest.
private static void doRecordReadTest(final PathResource resource, final ArrayRecord record) {
if (RecordReader.isReadable(resource)) {
final RecordReaderFactory recordReaderFactory = IoFactory.factory(RecordReaderFactory.class, resource);
try (RecordReader recordReader = RecordReader.newRecordReader(resource)) {
final ClockDirection polygonRingDirection = recordReader.getPolygonRingDirection();
final List<Record> records = recordReader.toList();
Assert.assertEquals("Record Count", 1, records.size());
final Record actualRecord = records.get(0);
if (recordReaderFactory.isCustomFieldsSupported() && !(recordReader instanceof GeometryRecordReader)) {
for (final String fieldName : record.getRecordDefinition().getFieldNames()) {
if (!fieldName.equals("GEOMETRY")) {
final Object expectedValue = record.getValue(fieldName);
final Object actualValue = actualRecord.getValue(fieldName);
final boolean equals = DataType.equal(expectedValue, actualValue);
com.revolsys.geometry.util.Assert.equals(fieldName, equals, expectedValue, actualValue);
}
}
}
if (recordReaderFactory.isGeometrySupported()) {
final Geometry expectedGeometry = record.getGeometry();
final Geometry actualGeometry = actualRecord.getGeometry();
assertGeometry(polygonRingDirection, expectedGeometry, actualGeometry);
}
}
} else {
Logs.debug(RecordIoTestSuite.class, "Reading geometry not supported for: " + resource.getFileNameExtension());
}
}
Aggregations