Author: desruisseaux Date: Fri Jan 8 14:59:44 2016 New Revision: 1723735 URL: http://svn.apache.org/viewvc?rev=1723735&view=rev Log: Add test for EPSGFactory.getAuthorityCodes(Class). Since this is a potentially costly test, add a TestCase.RUN_EXTENSIVE_TESTS flag. Opportunstically renamed two other internal constants.
Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestConfiguration.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties sis/branches/JDK8/pom.xml Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -255,7 +255,7 @@ public final strictfp class DefaultBrows @Override public void warningOccured(final Object source, final LogRecord warning) { assertFalse("No other warning were expected.", receivedWarning); - if (verbose) { + if (VERBOSE) { // In verbose mode, log the warning for allowing the developer to // check the message. In normal mode, the test will be silent. Logging.getLogger(warning.getLoggerName()).log(warning); Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -233,14 +233,14 @@ abstract class AbstractDerivedCRS<C exte * instances to compare. The AbstractCoordinateOperation.equals(…) method implementation handles those * cases. */ - if (Semaphores.queryAndSet(Semaphores.COMPARING)) { + if (Semaphores.queryAndSet(Semaphores.CONVERSION_AND_CRS)) { return true; } else try { return deepEquals(strict ? conversionFromBase : getConversionFromBase(), strict ? ((AbstractDerivedCRS) object).conversionFromBase : ((GeneralDerivedCRS) object).getConversionFromBase(), mode); } finally { - Semaphores.clear(Semaphores.COMPARING); + Semaphores.clear(Semaphores.CONVERSION_AND_CRS); } } return false; Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -28,6 +28,7 @@ import org.opengis.referencing.operation import org.apache.sis.util.collection.BackingStoreException; import org.apache.sis.internal.util.AbstractMap; import org.apache.sis.util.collection.IntegerList; +import org.apache.sis.util.Debug; /** @@ -159,7 +160,7 @@ final class AuthorityCodes extends Abstr } } final int conditionStart = buffer.length(); - buffer.append(" ORDER BY ").append(table.codeColumn); + buffer.append(" ORDER BY ABS(DEPRECATED), ").append(table.codeColumn); sql[ALL] = factory.translator.apply(buffer.toString()); /* * Build the SQL query for fetching the name of a single object for a given code. @@ -245,7 +246,7 @@ final class AuthorityCodes extends Abstr @Override public boolean isEmpty() { try { - return getCodeAt(0) >= 0; + return getCodeAt(0) < 0; } catch (SQLException exception) { throw factoryFailure(exception); } @@ -348,6 +349,22 @@ final class AuthorityCodes extends Abstr } /** + * Returns a string representation of this map for debugging purpose. + * This method does not let the default implementation format all entry, since it would be a costly operation. + */ + @Debug + @Override + public String toString() { + final StringBuilder buffer = new StringBuilder("AuthorityCodes[").append(type.getSimpleName()); + synchronized (factory) { + if (codes != null) { + buffer.append(", size ").append(results != null ? ">= " : "= ").append(codes.size()); + } + } + return buffer.append(']').toString(); + } + + /** * Invoked when a SQL statement can not be executed, or the result retrieved. */ private BackingStoreException factoryFailure(final SQLException exception) { Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -2674,10 +2674,6 @@ addURIs: for (int i=0; ; i++) { * @return The operations from {@code sourceCRS} to {@code targetCRS}. * @throws NoSuchAuthorityCodeException if a specified code was not found. * @throws FactoryException if the object creation failed for some other reason. - * - * @todo The ordering is not consistent among all database software, because the "accuracy" column may contain null - * values. When used in an "ORDER BY" clause, PostgreSQL put null values last, while Access and HSQL put them - * first. The PostgreSQL's behavior is better for what we want (put operations with unknown accuracy last). */ @Override public synchronized Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes( @@ -2695,10 +2691,6 @@ addURIs: for (int i=0; ; i++) { * This 'do' loop is executed twice: the first time for searching defining conversions, and the second * time for searching all other kind of operations. Defining conversions are searched first because * they are, by definition, the most accurate operations. - * - * TODO: Remove the "area" and "accuracy" ordering since they should be replaced by Java code - * (because we need to compute intersections while supporting anti-meridian spanning). - * Also need to resolve ordering problem (see method javadoc) */ final String key, sql; if (searchTransformations) { @@ -2708,10 +2700,10 @@ addURIs: for (int i=0; ; i++) { " JOIN [Area] ON AREA_OF_USE_CODE = AREA_CODE" + " WHERE SOURCE_CRS_CODE = ?" + " AND TARGET_CRS_CODE = ?" + - " ORDER BY ABS(CO.DEPRECATED), COORD_OP_ACCURACY, " + - " ABS((AREA_EAST_BOUND_LON - AREA_WEST_BOUND_LON) *" + - " (AREA_NORTH_BOUND_LAT - AREA_SOUTH_BOUND_LAT) * COS(0.5*RADIANS" + - "(AREA_NORTH_BOUND_LAT + AREA_SOUTH_BOUND_LAT))) DESC"; + " ORDER BY ABS(CO.DEPRECATED), COORD_OP_ACCURACY ASC NULLS LAST, " + + " (AREA_EAST_BOUND_LON - AREA_WEST_BOUND_LON + CASE WHEN AREA_EAST_BOUND_LON < AREA_WEST_BOUND_LON THEN 360 ELSE 0 END)" + + " * (AREA_NORTH_BOUND_LAT - AREA_SOUTH_BOUND_LAT)" + + " * COS(RADIANS(AREA_NORTH_BOUND_LAT + AREA_SOUTH_BOUND_LAT)/2) DESC"; } else { key = "ConversionFromCRS"; sql = "SELECT PROJECTION_CONV_CODE" + Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -735,12 +735,12 @@ check: for (int isTarget=0; ; isTar Objects.equals(coordinateOperationAccuracy, that.coordinateOperationAccuracy)) { // Check against never-ending recursivity with DerivedCRS. - if (Semaphores.queryAndSet(Semaphores.COMPARING)) { + if (Semaphores.queryAndSet(Semaphores.CONVERSION_AND_CRS)) { return true; } else try { return Objects.equals(targetCRS, that.targetCRS); } finally { - Semaphores.clear(Semaphores.COMPARING); + Semaphores.clear(Semaphores.CONVERSION_AND_CRS); } } } else { @@ -773,7 +773,7 @@ check: for (int isTarget=0; ; isTar * this.sourceCRS == AbstractDerivedCRS.baseCRS. Consequently we can relax the check * sourceCRS axis order if the mode is ComparisonMode.IGNORE_METADATA. */ - if (Semaphores.queryAndSet(Semaphores.COMPARING)) { + if (Semaphores.queryAndSet(Semaphores.CONVERSION_AND_CRS)) { if (mode.isIgnoringMetadata()) { mode = ComparisonMode.ALLOW_VARIANT; } @@ -782,7 +782,7 @@ check: for (int isTarget=0; ; isTar return false; } } finally { - Semaphores.clear(Semaphores.COMPARING); + Semaphores.clear(Semaphores.CONVERSION_AND_CRS); } /* * Now compare the sourceCRS, potentially with a relaxed ComparisonMode (see above comment). Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -20,6 +20,8 @@ import java.util.Set; import java.util.List; import java.util.Locale; import java.util.Iterator; +import java.util.Collections; +import javax.measure.unit.Unit; import org.opengis.metadata.extent.GeographicBoundingBox; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.IdentifiedObject; @@ -27,6 +29,9 @@ import org.opengis.referencing.NoSuchAut import org.opengis.referencing.crs.*; import org.opengis.referencing.cs.AxisDirection; import org.opengis.referencing.cs.CoordinateSystem; +import org.opengis.referencing.datum.Datum; +import org.opengis.referencing.datum.GeodeticDatum; +import org.opengis.referencing.datum.VerticalDatum; import org.opengis.referencing.operation.Conversion; import org.opengis.referencing.operation.Transformation; import org.opengis.referencing.operation.CoordinateOperation; @@ -34,6 +39,7 @@ import org.opengis.referencing.operation import org.opengis.referencing.operation.SingleOperation; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.Projection; import org.opengis.util.FactoryException; import org.apache.sis.util.logging.Logging; import org.apache.sis.internal.system.Loggers; @@ -543,6 +549,142 @@ public final strictfp class EPSGFactoryT } /** + * Tests {@link EPSGDataAccess#getAuthorityCodes(Class)} method. + * Some parts of this test are very slow. The slow parts are disabled by default. + * + * @throws FactoryException if an error occurred while querying the factory. + */ + @Test + public void testAuthorityCodes() throws FactoryException { + assumeNotNull(factory); + /* + * DATUM - The amount of datum is not too large (612 in EPSG 7.9), so execution time should be reasonable + * for most tests even if a method call causes scanning of the whole Datum table. We nevertheless + * limit such tests to the VerticalDatum (unless EXTENSIVE is true), which is a smaller set. + */ + final Set<String> datum = factory.getAuthorityCodes(Datum.class); + assertFalse("Datum not found.", datum.isEmpty()); + assertTrue ("Shall contain WGS84.", datum.contains("6326")); + assertTrue ("Shall contain MSL.", datum.contains("5100")); + + final Set<String> geodeticDatum = factory.getAuthorityCodes(GeodeticDatum.class); + assertFalse("Geodetic datum not found.", geodeticDatum.isEmpty()); + assertTrue ("Shall contain WGS84.", geodeticDatum.contains("6326")); + assertFalse("Shall not contain vertical datum.", geodeticDatum.contains("5100")); + assertFalse("Geodetic datum should be a subset of datum.", geodeticDatum.containsAll(datum)); // Iteration should stop at the first mismatch. + + final Set<String> verticalDatum = factory.getAuthorityCodes(VerticalDatum.class); + assertFalse("Vertical datum not found.", verticalDatum.isEmpty()); + assertTrue ("Check size() consistency.", verticalDatum.size() > 0); // Cause a scanning of the full table. + assertFalse("Shall not contain WGS84.", verticalDatum.contains("6326")); + assertTrue ("Shall contain Mean Sea Level (MSL).", verticalDatum.contains("5100")); + assertFalse("Vertical datum should be a subset of datum.", verticalDatum.containsAll(datum)); // Iteration should stop at the first mismatch. + assertTrue ("Vertical datum should be a subset of datum.", datum.containsAll(verticalDatum)); // Iteration should over a small set (vertical datum). + + if (RUN_EXTENSIVE_TESTS) { + assertTrue ("Check size() consistency.", geodeticDatum.size() > 0); + assertTrue ("Geodetic datum should be a subset of datum.", datum.size() > geodeticDatum.size()); + assertTrue ("Vertical datum should be a subset of datum.", datum.size() > verticalDatum.size()); + assertTrue ("Geodetic datum should be a subset of datum.", datum.containsAll(geodeticDatum)); + } + + /* + * COORDINATE REFERENCE SYSTEMS - There is thousands of CRS, so we avoid all tests that may require + * an iteration over the full table unless EXTENSIVE is true. + */ + final Set<String> crs = factory.getAuthorityCodes(CoordinateReferenceSystem.class); + assertFalse ("CRS not found.", crs.isEmpty()); + assertTrue ("Shall contain WGS84.", crs.contains("4326")); + assertTrue ("Shall contain World Mercator.", crs.contains("3395")); + if (RUN_EXTENSIVE_TESTS) { + assertTrue ("Check size() consistency.", crs.size() > 0); // Cause a scanning of the full table. + assertEquals("Check size() consistency.", crs.size(), crs.size()); + } + + final Set<String> geographicCRS = factory.getAuthorityCodes(GeographicCRS.class); + assertFalse("GeographicCRS not found.", geographicCRS.isEmpty()); + assertTrue ("Shall contain WGS84.", geographicCRS.contains("4326")); + assertFalse("Shall not contain projected CRS.", geographicCRS.contains("3395")); + if (RUN_EXTENSIVE_TESTS) { + assertTrue ("Check size() consistency.", geographicCRS.size() > 0); + assertTrue ("Geographic CRS should be a subset of CRS.", geographicCRS.size() < crs.size()); + assertFalse("Geographic CRS should be a subset of CRS.", geographicCRS.containsAll(crs)); + assertTrue ("Geographic CRS should be a subset of CRS.", crs.containsAll(geographicCRS)); + } + + final Set<String> projectedCRS = factory.getAuthorityCodes(ProjectedCRS.class); + assertFalse("ProjectedCRS not found.", projectedCRS.isEmpty()); + assertFalse("Shall not contain geographic CRS.", projectedCRS.contains("4326")); + assertTrue ("Shall contain World Mercator.", projectedCRS.contains("3395")); + if (RUN_EXTENSIVE_TESTS) { + assertTrue ("Check size() consistency.", projectedCRS.size() > 0); + assertTrue ("Projected CRS should be a subset of CRS.", projectedCRS.size() < crs.size()); + assertFalse("Projected CRS should be a subset of CRS.", projectedCRS.containsAll(crs)); + assertTrue ("Projected CRS should be a subset of CRS.", crs.containsAll(projectedCRS)); + assertTrue ("Projected CRS can not be Geographic CRS.", Collections.disjoint(geographicCRS, projectedCRS)); + } + + /* + * COORDINATE OPERATIONS - There is thousands of operations, so we avoid all tests that may require + * an iteration over the full table unless EXTENSIVE is true. + */ + final Set<String> operations = factory.getAuthorityCodes(SingleOperation.class); + final Set<String> conversions = factory.getAuthorityCodes(Conversion .class); + final Set<String> projections = factory.getAuthorityCodes(Projection .class); + final Set<String> transformations = factory.getAuthorityCodes(Transformation .class); + + assertFalse("Operations not found.", operations .isEmpty()); + assertFalse("Conversions not found.", conversions .isEmpty()); + assertFalse("Projections not found.", projections .isEmpty()); + assertFalse("Transformations not found.", transformations.isEmpty()); + + assertTrue ("Shall contain “ED50 to WGS 84 (1)”", operations.contains("1133")); + assertFalse("Shall not contain “ED50 to WGS 84 (1)”", conversions.contains("1133")); + assertFalse("Shall not contain “ED50 to WGS 84 (1)”", projections.contains("1133")); + assertTrue ("Shall contain “ED50 to WGS 84 (1)”", transformations.contains("1133")); + + assertTrue ("Shall contain “UTM zone 1N”", operations.contains("16001")); + assertTrue ("Shall contain “UTM zone 1N”", conversions.contains("16001")); + assertTrue ("Shall contain “UTM zone 1N”", projections.contains("16001")); + assertFalse("Shall not contain “UTM zone 1N”", transformations.contains("16001")); + + if (RUN_EXTENSIVE_TESTS) { + assertTrue ("Conversions shall be a subset of operations.", conversions .size() < operations .size()); + assertTrue ("Projections shall be a subset of operations.", projections .size() < operations .size()); + assertTrue ("Projections shall be a subset of conversions.", projections .size() < conversions.size()); + assertTrue ("Transformations shall be a subset of operations.", transformations.size() < operations .size()); + + assertFalse("Projections shall be a subset of conversions.", projections.containsAll(conversions)); + assertTrue ("Projections shall be a subset of conversions.", conversions.containsAll(projections)); + assertTrue ("Conversion shall be a subset of operations.", operations .containsAll(conversions)); + assertTrue ("Transformations shall be a subset of operations.", operations .containsAll(transformations)); + + assertTrue ("Conversions can not be transformations.", Collections.disjoint(conversions, transformations)); + } + + // We are cheating here since we are breaking generic type check. + // However in the particular case of our EPSG factory, it works. + @SuppressWarnings({"unchecked","rawtypes"}) + final Set<?> units = factory.getAuthorityCodes((Class) Unit.class); + assertFalse(units.isEmpty()); + assertTrue (units.size() > 0); + + // Tests the fusion of all types + if (RUN_EXTENSIVE_TESTS) { + final Set<String> all = factory.getAuthorityCodes(IdentifiedObject.class); + assertTrue (all.containsAll(crs)); + assertTrue (all.containsAll(datum)); + assertTrue (all.containsAll(operations)); + assertFalse(all.containsAll(units)); // They are not IdentifiedObjects. + } + + // Try a dummy type. + @SuppressWarnings({"unchecked","rawtypes"}) + final Class<? extends IdentifiedObject> wrong = (Class) String.class; + assertTrue("Dummy type", factory.getAuthorityCodes(wrong).isEmpty()); + } + + /** * Tests the {@link EPSGDataAccess#getDescriptionText(String)} method. * * @throws FactoryException if an error occurred while querying the factory. @@ -700,11 +842,6 @@ public final strictfp class EPSGFactoryT /* * Creates from CRS codes. There is 40 such operations in EPSG version 6.7. * The preferred one (according the "supersession" table) is EPSG:1612. - * - * Note: PostgreSQL because its "ORDER BY" clause put null values last, while Access and HSQL put them first. - * The PostgreSQL behavior is better for what we want (operations with unknown accuracy last). Unfortunately, - * I do not know yet how to instructs Access to put null values last using standard SQL - * ("IIF" is not standard, and Access does not seem to understand "CASE ... THEN" clauses). */ final Set<CoordinateOperation> all = factory.createFromCoordinateReferenceSystemCodes("4230", "4326"); assertTrue("Number of coordinate operations.", all.size() >= 3); Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -100,7 +100,7 @@ public abstract strictfp class MatrixTes * * @see NonSquareMatrixTest#printStatistics() */ - static final Statistics statistics = verbose ? new Statistics("|SIS - JAMA|") : null; + static final Statistics statistics = VERBOSE ? new Statistics("|SIS - JAMA|") : null; /** * Random number generator, created by {@link #initialize(long)} as the first operation of Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -122,7 +122,7 @@ public final strictfp class MolodenskyTr final double[] expected = new double[srcPts.length]; transform.transform(srcPts, 0, actual, 0, srcPts.length / 3); reference.transform(srcPts, 0, expected, 0, srcPts.length / 3); - if (TestCase.verbose) { + if (TestCase.VERBOSE) { final Statistics[] stats = { new Statistics("|Δλ| (~cm)"), new Statistics("|Δφ| (~cm)"), Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -36,7 +36,7 @@ public final class Semaphores { * {@code AbstractDerivedCRS} objects contain a {@code conversionFromBase} field, which contains a * {@code DefaultConversion.targetCRS} field referencing back the {@code AbstractDerivedCRS} object. */ - public static final byte COMPARING = 1; + public static final byte CONVERSION_AND_CRS = 1; /** * A flag to indicate that {@link org.apache.sis.referencing.operation.AbstractCoordinateOperation} @@ -71,7 +71,7 @@ public final class Semaphores { /** * Returns {@code true} if the given flag is set. * - * @param flag One of {@link #COMPARING}, {@link #ENCLOSED_IN_OPERATION} or other constants. + * @param flag One of {@link #CONVERSION_AND_CRS}, {@link #ENCLOSED_IN_OPERATION} or other constants. * @return {@code true} if the given flag is set. */ public static boolean query(final byte flag) { @@ -82,7 +82,7 @@ public final class Semaphores { /** * Sets the given flag. * - * @param flag One of {@link #COMPARING}, {@link #ENCLOSED_IN_OPERATION} or other constants. + * @param flag One of {@link #CONVERSION_AND_CRS}, {@link #ENCLOSED_IN_OPERATION} or other constants. * @return {@code true} if the given flag was already set. */ public static boolean queryAndSet(final byte flag) { @@ -99,7 +99,7 @@ public final class Semaphores { /** * Clears the given flag. * - * @param flag One of {@link #COMPARING}, {@link #ENCLOSED_IN_OPERATION} or other constants. + * @param flag One of {@link #CONVERSION_AND_CRS}, {@link #ENCLOSED_IN_OPERATION} or other constants. */ public static void clear(final byte flag) { final Semaphores s = FLAGS.get(); Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -124,7 +124,7 @@ public strictfp class LoggingWatcher ext } maximumLogCount--; verifyMessage(formatter.formatMessage(record)); - return TestCase.verbose; + return TestCase.VERBOSE; } /** Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -27,9 +27,6 @@ import java.io.UnsupportedEncodingExcept import org.apache.sis.util.logging.Logging; import org.junit.runner.RunWith; -import static org.apache.sis.test.TestConfiguration.VERBOSE_OUTPUT_KEY; -import static org.apache.sis.test.TestConfiguration.OUTPUT_ENCODING_KEY; - /** * Base class of Apache SIS tests (except the ones that extend GeoAPI tests). @@ -50,7 +47,7 @@ import static org.apache.sis.test.TestCo * * @author Martin Desruisseaux (Geomatys) * @since 0.3 - * @version 0.6 + * @version 0.7 * @module */ @RunWith(TestRunner.class) @@ -110,14 +107,22 @@ public abstract strictfp class TestCase * {@code true} if the {@value org.apache.sis.test.TestConfiguration#VERBOSE_OUTPUT_KEY} * system property is set to {@code true}. */ - public static final boolean verbose; + public static final boolean VERBOSE; + + /** + * {@code true} if the {@value org.apache.sis.test.TestConfiguration#EXTENSIVE_TESTS_KEY} + * system property is set to {@code true}. + * If {@code true}, then Apache SIS will run some tests which were normally skipped because they are slow. + */ + public static final boolean RUN_EXTENSIVE_TESTS; /** * Sets the {@link #out} writer and its underlying {@link #buffer}. */ static { - verbose = Boolean.getBoolean(VERBOSE_OUTPUT_KEY); out = new PrintWriter(buffer = new StringWriter()); + VERBOSE = Boolean.getBoolean(TestConfiguration.VERBOSE_OUTPUT_KEY); + RUN_EXTENSIVE_TESTS = Boolean.getBoolean(TestConfiguration.EXTENSIVE_TESTS_KEY); } /** @@ -136,7 +141,7 @@ public abstract strictfp class TestCase * message and left the encoding unchanged.</p> */ static { - final String encoding = System.getProperty(OUTPUT_ENCODING_KEY); + final String encoding = System.getProperty(TestConfiguration.OUTPUT_ENCODING_KEY); if (encoding != null) try { for (Logger logger=LOGGER; logger!=null; logger=logger.getParent()) { for (final Handler handler : logger.getHandlers()) { @@ -200,7 +205,7 @@ public abstract strictfp class TestCase * Get the output writer, using the specified encoding if any. */ PrintWriter writer = null; - final String encoding = System.getProperty(OUTPUT_ENCODING_KEY); + final String encoding = System.getProperty(TestConfiguration.OUTPUT_ENCODING_KEY); if (encoding == null) { final Console console = System.console(); if (console != null) { Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestConfiguration.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestConfiguration.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestConfiguration.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestConfiguration.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -24,11 +24,18 @@ import org.apache.sis.util.Static; * * @author Martin Desruisseaux (Geomatys) * @since 0.3 - * @version 0.3 + * @version 0.7 * @module */ public final strictfp class TestConfiguration extends Static { /** + * The {@value} system property for enabling more extensive tests. + * If this {@linkplain System#getProperties() system property} is set to {@code true}, + * then Apache SIS will run some tests which were normally skipped because they are slow. + */ + public static final String EXTENSIVE_TESTS_KEY = "org.apache.sis.test.extensive"; + + /** * The {@value} system property for enabling verbose outputs. * If this {@linkplain System#getProperties() system property} is set to {@code true}, * then the content sent to the {@link TestCase#out} field will be printed after each test. Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -106,7 +106,7 @@ public final class TestRunner extends Bl */ @Override public void testStarted(final Description description) { - if (!TestCase.verbose) { + if (!TestCase.VERBOSE) { TestCase.clearBuffer(); } LogRecordCollector.INSTANCE.setCurrentTest(description); @@ -119,7 +119,7 @@ public final class TestRunner extends Bl */ @Override public void testFinished(final Description description) { - if (TestCase.verbose) { + if (TestCase.VERBOSE) { TestCase.flushOutput(); } TestCase.randomSeed = 0; @@ -147,7 +147,7 @@ public final class TestRunner extends Bl out.println('.'); // Seed we be cleared by testFinished(…). } - if (!TestCase.verbose) { + if (!TestCase.VERBOSE) { TestCase.flushOutput(); } // In verbose mode, the flush will be done by testFinished(…). Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] Fri Jan 8 14:59:44 2016 @@ -110,7 +110,7 @@ public final strictfp class TestUtilitie * @param title The title to write. */ public static void printSeparator(final String title) { - if (TestCase.verbose) { + if (TestCase.VERBOSE) { final PrintWriter out = TestCase.out; final boolean isAnsiSupported = X364.isAnsiSupported(); if (isAnsiSupported) { Modified: sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties URL: http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original) +++ sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Jan 8 14:59:44 2016 @@ -37,7 +37,7 @@ source.encoding = UTF-8 javac.source = 1.8 javac.target = 1.8 platform.active = default_platform -run.jvmargs = -ea -Dorg.apache.sis.test.verbose=true +run.jvmargs = -ea -Dorg.apache.sis.test.verbose=true -Dorg.apache.sis.test.extensive=true junit.forkmode = once # @@ -147,6 +147,7 @@ debug.test.classpath=\ # javac.compilerargs = -Xdoclint:syntax,html,missing/protected,accessibility/protected javac.deprecation = true +javac.external.vm = false javadoc.windowtitle = Apache SIS javadoc.encoding = ${source.encoding} javadoc.author = true Modified: sis/branches/JDK8/pom.xml URL: http://svn.apache.org/viewvc/sis/branches/JDK8/pom.xml?rev=1723735&r1=1723734&r2=1723735&view=diff ============================================================================== --- sis/branches/JDK8/pom.xml (original) +++ sis/branches/JDK8/pom.xml Fri Jan 8 14:59:44 2016 @@ -423,6 +423,7 @@ Apache SIS is a free software, Java lang <properties> <maven.compiler.debug>false</maven.compiler.debug> <!-- For smaller JAR files size. --> <maven.compiler.optimize>true</maven.compiler.optimize> + <org.apache.sis.test.extensive>true</org.apache.sis.test.extensive> </properties> </profile> <profile>