sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1779139 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/ sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/main/java/org/apache/sis/referencing/crs/ sis-referencing/sr...
Date Tue, 17 Jan 2017 06:00:44 GMT
Author: desruisseaux
Date: Tue Jan 17 06:00:44 2017
New Revision: 1779139

URL: http://svn.apache.org/viewvc?rev=1779139&view=rev
Log:
Add tests for CRS.suggestTargetCRS(…) together with a bug fix.
This commit contains opportunistic javadoc formatting in classes that have been reviewed as
a side-effect of this work.

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -113,10 +113,10 @@ public class DefaultExtent extends ISOMe
      * While a valid {@code Extent} requires at least one component to be non-null,
      * this constructor does not perform such verification.
      *
-     * @param description        A description, or {@code null} if none.
-     * @param geographicElements A geographic component, or {@code null} if none.
-     * @param verticalElements   A vertical component, or {@code null} if none.
-     * @param temporalElements   A temporal component, or {@code null} if none.
+     * @param  description         a description, or {@code null} if none.
+     * @param  geographicElements  a geographic component, or {@code null} if none.
+     * @param  verticalElements    a vertical component, or {@code null} if none.
+     * @param  temporalElements    a temporal component, or {@code null} if none.
      */
     public DefaultExtent(final CharSequence     description,
                          final GeographicExtent geographicElements,
@@ -134,7 +134,7 @@ public class DefaultExtent extends ISOMe
      * This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
      * given object are not recursively copied.
      *
-     * @param object The metadata to copy values from, or {@code null} if none.
+     * @param  object  the metadata to copy values from, or {@code null} if none.
      *
      * @see #castOrCopy(Extent)
      */
@@ -162,8 +162,8 @@ public class DefaultExtent extends ISOMe
      *       metadata contained in the given object are not recursively copied.</li>
      * </ul>
      *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
+     * @param  object  the object to get as a SIS implementation, or {@code null} if none.
+     * @return a SIS implementation containing the values of the given object (may be the
      *         given object itself), or {@code null} if the argument was null.
      */
     public static DefaultExtent castOrCopy(final Extent object) {
@@ -176,7 +176,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Returns the spatial and temporal extent for the referring object.
      *
-     * @return The spatial and temporal extent, or {@code null} in none.
+     * @return the spatial and temporal extent, or {@code null} in none.
      */
     @Override
     @XmlElement(name = "description")
@@ -187,7 +187,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Sets the spatial and temporal extent for the referring object.
      *
-     * @param newValue The new description.
+     * @param  newValue  the new description.
      */
     public void setDescription(final InternationalString newValue) {
         checkWritePermission();
@@ -197,7 +197,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Provides geographic component of the extent of the referring object
      *
-     * @return The geographic extent, or an empty set if none.
+     * @return the geographic extent, or an empty set if none.
      */
     @Override
     @XmlElement(name = "geographicElement")
@@ -208,7 +208,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Sets geographic component of the extent of the referring object.
      *
-     * @param newValues The new geographic elements.
+     * @param  newValues  the new geographic elements.
      */
     public void setGeographicElements(final Collection<? extends GeographicExtent>
newValues) {
         geographicElements = writeCollection(newValues, geographicElements, GeographicExtent.class);
@@ -217,7 +217,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Provides vertical component of the extent of the referring object.
      *
-     * @return The vertical extent, or an empty set if none.
+     * @return the vertical extent, or an empty set if none.
      */
     @Override
     @XmlElement(name = "verticalElement")
@@ -228,7 +228,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Sets vertical component of the extent of the referring object.
      *
-     * @param newValues The new vertical elements.
+     * @param  newValues  the new vertical elements.
      */
     public void setVerticalElements(final Collection<? extends VerticalExtent> newValues)
{
         verticalElements = writeCollection(newValues, verticalElements, VerticalExtent.class);
@@ -237,7 +237,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Provides temporal component of the extent of the referring object.
      *
-     * @return The temporal extent, or an empty set if none.
+     * @return the temporal extent, or an empty set if none.
      */
     @Override
     @XmlElement(name = "temporalElement")
@@ -248,7 +248,7 @@ public class DefaultExtent extends ISOMe
     /**
      * Sets temporal component of the extent of the referring object.
      *
-     * @param newValues The new temporal elements.
+     * @param  newValues  the new temporal elements.
      */
     public void setTemporalElements(final Collection<? extends TemporalExtent> newValues)
{
         temporalElements = writeCollection(newValues, temporalElements, TemporalExtent.class);
@@ -262,7 +262,7 @@ public class DefaultExtent extends ISOMe
      *
      * <p><b>Note:</b> this method is available only if the referencing
module is on the classpath.</p>
      *
-     * @param  envelope The envelope to use for inferring the additional extents.
+     * @param  envelope  the envelope to use for inferring the additional extents.
      * @throws UnsupportedOperationException if the referencing module is not on the classpath.
      * @throws TransformException if a coordinate transformation was required and failed.
      *

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -393,7 +393,7 @@ public final class CRS extends Static {
                     }
                     domain.intersect(regionOfInterest);
                     final double area = insideArea;
-                    insideArea = Extents.area(bbox);
+                    insideArea = Extents.area(domain);
                     outsideArea = area - insideArea;
                 }
                 if (insideArea > maxInsideArea || (insideArea == maxInsideArea &&
outsideArea < minOutsideArea)) {

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -29,7 +29,7 @@ import org.opengis.parameter.GeneralPara
 import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.cs.CartesianCS;
-import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
+import org.opengis.referencing.cs.CoordinateSystem;                 // For javadoc
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.Conversion;
@@ -137,12 +137,12 @@ public class DefaultProjectedCRS extends
      * for performing {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes
unit
      * conversions and change of axis order} since those operations will be inferred by this
constructor.
      *
-     * @param  properties The properties to be given to the new derived CRS object.
-     * @param  baseCRS    Coordinate reference system to base the derived CRS on.
-     * @param  conversion The defining conversion from a {@linkplain AxesConvention#NORMALIZED
normalized} base
-     *                    to a normalized derived CRS.
-     * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
-     *         must match the target dimension of the {@code baseToDerived} transform.
+     * @param  properties  the properties to be given to the new derived CRS object.
+     * @param  baseCRS     coordinate reference system to base the derived CRS on.
+     * @param  conversion  the defining conversion from a {@linkplain AxesConvention#NORMALIZED
normalized}
+     *                     base to a normalized derived CRS.
+     * @param  derivedCS   the coordinate system for the derived CRS. The number of axes
must match
+     *                     the target dimension of the {@code baseToDerived} transform.
      * @throws MismatchedDimensionException if the source and target dimensions of {@code
baseToDerived}
      *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      *
@@ -164,7 +164,7 @@ public class DefaultProjectedCRS extends
      *
      * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
      *
-     * @param crs The coordinate reference system to copy.
+     * @param  crs  the coordinate reference system to copy.
      *
      * @see #castOrCopy(ProjectedCRS)
      */
@@ -178,8 +178,8 @@ public class DefaultProjectedCRS extends
      * Otherwise if the given object is already a SIS implementation, then the given object
is returned unchanged.
      * Otherwise a new SIS implementation is created and initialized to the attribute values
of the given object.
      *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
+     * @param  object  the object to get as a SIS implementation, or {@code null} if none.
+     * @return a SIS implementation containing the values of the given object (may be the
      *         given object itself), or {@code null} if the argument was null.
      */
     public static DefaultProjectedCRS castOrCopy(final ProjectedCRS object) {
@@ -215,7 +215,7 @@ public class DefaultProjectedCRS extends
     /**
      * Returns the datum of the {@linkplain #getBaseCRS() base CRS}.
      *
-     * @return The datum of the base CRS.
+     * @return the datum of the base CRS.
      */
     @Override
     public GeodeticDatum getDatum() {
@@ -228,10 +228,10 @@ public class DefaultProjectedCRS extends
      * the {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS()
source}
      * of the {@linkplain #getConversionFromBase() conversion from base}.
      *
-     * @return The base coordinate reference system, which must be geographic.
+     * @return the base coordinate reference system, which must be geographic.
      */
     @Override
-    @XmlElement(name = "baseGeodeticCRS", required = true)  // Note: older GML version used
"baseGeographicCRS".
+    @XmlElement(name = "baseGeodeticCRS", required = true)        // Note: older GML version
used "baseGeographicCRS".
     public GeographicCRS getBaseCRS() {
         final Projection projection = super.getConversionFromBase();
         return (projection != null) ? projection.getSourceCRS() : null;
@@ -251,7 +251,7 @@ public class DefaultProjectedCRS extends
      * <div class="note"><b>Note:</b>
      * This is different than ISO 19111, which allows source and target CRS to be {@code
null}.</div>
      *
-     * @return The map projection from base CRS to this CRS.
+     * @return the map projection from base CRS to this CRS.
      */
     @Override
     public Projection getConversionFromBase() {
@@ -264,8 +264,10 @@ public class DefaultProjectedCRS extends
     @Override
     @XmlElement(name = "cartesianCS", required = true)
     public final CartesianCS getCoordinateSystem() {
-        // See AbstractDerivedCRS.createConversionFromBase(…) for
-        // an explanation about why this method is declared final.
+        /*
+         * See AbstractDerivedCRS.createConversionFromBase(…) for
+         * an explanation about why this method is declared final.
+         */
         return (CartesianCS) super.getCoordinateSystem();
     }
 
@@ -297,10 +299,10 @@ public class DefaultProjectedCRS extends
      * then axis order of the base geographic CRS are ignored
      * (but <strong>not</strong> axis order of <strong>this</strong>
projected CRS).
      *
-     * @param  object The object to compare to {@code this}.
-     * @param  mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison,
or
-     *         {@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} for comparing only
properties
-     *         relevant to coordinate transformations.
+     * @param  object  the object to compare to {@code this}.
+     * @param  mode    {@link ComparisonMode#STRICT STRICT} for performing a strict comparison,
or
+     *                 {@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} for comparing
only
+     *                 properties relevant to coordinate transformations.
      * @return {@code true} if both objects are equal.
      */
     @Override
@@ -403,10 +405,10 @@ public class DefaultProjectedCRS extends
         final Parameters p = new Parameters(this);
         final boolean isBaseCRS;
         if (isWKT1) {
-            p.append(formatter);    // Format outside of any "Conversion" element.
+            p.append(formatter);                        // Format outside of any "Conversion"
element.
             isBaseCRS = false;
         } else {
-            formatter.append(p);    // Format inside a "Conversion" element.
+            formatter.append(p);                        // Format inside a "Conversion" element.
             isBaseCRS = isBaseCRS(formatter);
         }
         /*

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -16,18 +16,28 @@
  */
 package org.apache.sis.referencing;
 
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Arrays;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.SingleCRS;
+import org.opengis.referencing.cs.CartesianCS;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
-import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.referencing.crs.DefaultProjectedCRS;
+import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.metadata.iso.extent.DefaultExtent;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Utilities;
 
 // Test imports
+import org.apache.sis.referencing.operation.HardCodedConversions;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -139,6 +149,71 @@ public final strictfp class CRSTest exte
     }
 
     /**
+     * Tests {@link CRS#suggestTargetCRS(GeographicBoundingBox, CoordinateReferenceSystem...)}.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testSuggestTargetCRS() {
+        /*
+         * Prepare 4 CRS with different datum (so we can more easily differentiate them in
the assertions) and
+         * different domain of validity. CRS[1] is given a domain large enough for all CRS
except the last one.
+         */
+        final Map<String,Object> properties = new HashMap<>(4);
+        final CartesianCS cs = (CartesianCS) StandardDefinitions.createCoordinateSystem(Constants.EPSG_PROJECTED_CS);
+        final ProjectedCRS[] crs = new ProjectedCRS[4];
+        for (int i=0; i<crs.length; i++) {
+            final CommonCRS baseCRS;
+            final double ymin, ymax;
+            switch (i) {
+                case 0: baseCRS = CommonCRS.WGS84;  ymin = 2; ymax = 4; break;
+                case 1: baseCRS = CommonCRS.WGS72;  ymin = 1; ymax = 4; break;
+                case 2: baseCRS = CommonCRS.SPHERE; ymin = 2; ymax = 3; break;
+                case 3: baseCRS = CommonCRS.NAD27;  ymin = 3; ymax = 5; break;
+                default: throw new AssertionError(i);
+            }
+            properties.put(DefaultProjectedCRS.NAME_KEY, "CRS #" + i);
+            properties.put(DefaultProjectedCRS.DOMAIN_OF_VALIDITY_KEY, new DefaultExtent(
+                    null, new DefaultGeographicBoundingBox(-1, +1, ymin, ymax), null, null));
+            crs[i] = new DefaultProjectedCRS(properties, baseCRS.geographic(), HardCodedConversions.MERCATOR,
cs);
+        }
+        final ProjectedCRS[] overlappingCRS = Arrays.copyOf(crs, 3);   // Exclude the last
CRS only.
+        /*
+         * Test between the 3 overlapping CRS without region of interest. We expect the CRS
having a domain
+         * of validity large enough for all CRS; this is the second CRS created in above
'switch' statement.
+         */
+        assertSame("Expected CRS with widest domain of validity.", crs[1],
+                   CRS.suggestTargetCRS(null, overlappingCRS));
+        /*
+         * If we specify a smaller region of interest, we should get the CRS having the smallest
domain of validity that
+         * cover the ROI. Following lines gradually increase the ROI size and verify that
we get CRS for larger domain.
+         */
+        final DefaultGeographicBoundingBox regionOfInterest = new DefaultGeographicBoundingBox(-1,
+1, 2.1, 2.9);
+        assertSame("Expected best fit for [2.1 … 2.9]°N", crs[2],
+                   CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+
+        regionOfInterest.setNorthBoundLatitude(3.1);
+        assertSame("Expected best fit for [2.1 … 3.1]°N", crs[0],
+                   CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+
+        regionOfInterest.setSouthBoundLatitude(1.9);
+        assertSame("Expected best fit for [1.9 … 3.1]°N", crs[1],
+                   CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+        /*
+         * All above tests returned one of the CRS in the given array. Test now a case where
none of those CRS
+         * have a domain of validity wide enough, so suggestTargetCRS(…) need to search
among the base CRS.
+         */
+        assertSame("Expected a GeodeticCRS since none of the ProjectedCRS have a domain of
validity wide enough.",
+                   crs[0].getBaseCRS(), CRS.suggestTargetCRS(null, crs));
+        /*
+         * With the same domain of validity than above, suggestTargetCRS(…) should not
need to fallback on the
+         * base CRS anymore.
+         */
+        assertSame("Expected best fit for [1.9 … 3.1]°N", crs[1],
+                   CRS.suggestTargetCRS(regionOfInterest, crs));
+    }
+
+    /**
      * Tests {@link CRS#isHorizontalCRS(CoordinateReferenceSystem)}.
      */
     @Test

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -112,7 +112,7 @@ public final strictfp class DefaultConve
      *
      * @param  useGreenwich {@code true} for using Greenwich prime meridian in the {@code
targetCRS},
      *         or {@code false} for staying on the Paris one.
-     * @return A pseudo-conversion performing a longitude rotation.
+     * @return a pseudo-conversion performing a longitude rotation.
      */
     public static DefaultConversion createLongitudeRotation(final boolean useGreenwich) {
         return createLongitudeRotation(HardCodedCRS.NTF_NORMALIZED_AXES,
@@ -125,9 +125,9 @@ public final strictfp class DefaultConve
      * at least conceptually. See {@link #createLongitudeRotation(boolean)} for an explanation
about why
      * this is not really a valid conversion.
      *
-     * @param sourceCRS A CRS using the Paris prime meridian.
-     * @param targetCRS A CRS using the Greenwich prime meridian.
-     * @param interpolationCRS A dummy interpolation CRS, or {@code null} if none.
+     * @param  sourceCRS         a CRS using the Paris prime meridian.
+     * @param  targetCRS         a CRS using the Greenwich prime meridian.
+     * @param  interpolationCRS  a dummy interpolation CRS, or {@code null} if none.
      */
     private static DefaultConversion createLongitudeRotation(final GeographicCRS sourceCRS,
             final GeographicCRS targetCRS, final TemporalCRS interpolationCRS)
@@ -148,8 +148,8 @@ public final strictfp class DefaultConve
         final ParameterValueGroup pg = method.getParameters().createValue();
         pg.parameter("Longitude offset").setValue(OFFSET);
         final Matrix rotation = Matrices.createDiagonal(
-                targetDim + interpDim + 1,      // Number of rows.
-                sourceDim + interpDim + 1);     // Number of columns.
+                targetDim + interpDim + 1,                                  // Number of
rows.
+                sourceDim + interpDim + 1);                                 // Number of
columns.
         rotation.setElement(interpDim, interpDim + sourceDim, OFFSET);
         /*
          * In theory we should not need to provide the parameters explicitly to the constructor
since
@@ -218,7 +218,7 @@ public final strictfp class DefaultConve
      * <div class="note"><b>Note:</b>
      * By contrast, {@link #testSpecialize()} will test swapping axis order in the <em>target</em>
CRS.</div>
      *
-     * @throws FactoryException Should not happen in this test.
+     * @throws FactoryException if an error occurred while creating the conversion.
      */
     @Test
     @DependsOnMethod("testConstruction")
@@ -257,7 +257,7 @@ public final strictfp class DefaultConve
      * <div class="note"><b>Note:</b>
      * By contrast, {@link #testDefiningConversion()} tested swapping axis order in the <em>source</em>
CRS.</div>
      *
-     * @throws FactoryException Should not happen in this test.
+     * @throws FactoryException if an error occurred while creating the conversion.
      */
     @Test
     @DependsOnMethod("testDefiningConversion")
@@ -300,7 +300,7 @@ public final strictfp class DefaultConve
      * staying to a strict interpretation like "the meridian passing through the main telescope",
      * that meridian would indeed more with time.</div>
      *
-     * @throws FactoryException Should not happen in this test.
+     * @throws FactoryException if an error occurred while creating the conversion.
      */
     @Test
     @DependsOnMethod("testDefiningConversion")
@@ -329,7 +329,7 @@ public final strictfp class DefaultConve
     /**
      * Ensures that {@link DefaultConversion#specialize DefaultConversion.specialize(…)}
verifies the datum.
      *
-     * @throws FactoryException Should not happen in this test.
+     * @throws FactoryException if an error occurred while creating the conversion.
      */
     @Test
     public void testDatumCheck() throws FactoryException {

Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java?rev=1779139&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.operation;
+
+import java.util.Collections;
+import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.internal.referencing.provider.Mercator1SP;
+
+
+/**
+ * Collection of defining conversions for testing purpose.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public final strictfp class HardCodedConversions {
+    /**
+     * A defining conversion for a <cite>Mercator (variant A)</cite> (also known
as "1SP") projection
+     * with a scale factor of 1.
+     */
+    public static final DefaultConversion MERCATOR;
+    static {
+        final OperationMethod method = new Mercator1SP();
+        MERCATOR = new DefaultConversion(Collections.singletonMap(OperationMethod.NAME_KEY,
"Mercator"),
+                method, null, method.getParameters().createValue());
+    }
+
+    /**
+     * Do not allow instantiation of this class.
+     */
+    private HardCodedConversions() {
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1779139&r1=1779138&r2=1779139&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
[UTF-8] Tue Jan 17 06:00:44 2017
@@ -69,7 +69,7 @@ public final strictfp class DefaultMathT
     /**
      * Returns the factory to use for the tests.
      *
-     * @return The factory to use for the tests.
+     * @return the factory to use for the tests.
      */
     static DefaultMathTransformFactory factory() {
         final MathTransformFactory factory = DefaultFactories.forClass(MathTransformFactory.class);
@@ -82,7 +82,7 @@ public final strictfp class DefaultMathT
     /**
      * Tests the {@link DefaultMathTransformFactory#getOperationMethod(String)} method.
      *
-     * @throws NoSuchIdentifierException Should never happen.
+     * @throws NoSuchIdentifierException if the operation was not found.
      */
     @Test
     public void testGetOperationMethod() throws NoSuchIdentifierException {
@@ -118,7 +118,7 @@ public final strictfp class DefaultMathT
     /**
      * Tests the {@link DefaultMathTransformFactory#getAvailableMethods(Class)} method.
      *
-     * @throws NoSuchIdentifierException Should never happen.
+     * @throws NoSuchIdentifierException if the operation was not found.
      */
     @Test
     @DependsOnMethod("testGetOperationMethod")
@@ -145,7 +145,7 @@ public final strictfp class DefaultMathT
      * Asks for names which are known to be duplicated. One of the duplicated elements is
deprecated.
      * However Apache SIS uses the same implementation.
      *
-     * @throws NoSuchIdentifierException Should never happen.
+     * @throws NoSuchIdentifierException if the operation was not found.
      */
     @Test
     public void testDuplicatedNames() throws NoSuchIdentifierException {
@@ -202,8 +202,10 @@ public final strictfp class DefaultMathT
             try {
                 mt = mtFactory.createParameterizedTransform(param);
             } catch (InvalidGeodeticParameterException e) {
-                // Some map projections have mandatory parameters which we ignore for now
-                // except for a few well-known projection that we know should not fail.
+                /*
+                 * Some map projections have mandatory parameters which we ignore for now
+                 * except for a few well-known projection that we know should not fail.
+                 */
                 if (classification.contains("Mercator")) {
                     throw e;
                 }



Mime
View raw message