sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1722969 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/parameter/ main/java/org/apache/sis/referencing/factory/ main/java/org/apache/sis/referencing/factory/sql/ main/java/org/apache/sis/referencing/operation/ m...
Date Mon, 04 Jan 2016 22:34:58 GMT
Author: desruisseaux
Date: Mon Jan  4 22:34:57 2016
New Revision: 1722969

URL: http://svn.apache.org/viewvc?rev=1722969&view=rev
Log:
Bug fix: creation of ProjectedCRS or DerivedCRS shall not modify the parameter values of defining conversion.
The reason is that the same defining conversion can be used by more than one CRS, with different source and target ellipsoids.
To protect defining conversion against changes, this commit add an UnmodifiableParameterValueGroup class.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java   (with props)
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/UnmodifiableParameterValueGroupTest.java   (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.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/AbstractSingleOperation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -852,6 +852,8 @@ public class DefaultParameterValue<T> ex
      * @return An unmodifiable implementation of the given parameter, or {@code null} if the given parameter was null.
      *
      * @since 0.6
+     *
+     * @see DefaultParameterValueGroup#unmodifiable(ParameterValueGroup)
      */
     public static <T> DefaultParameterValue<T> unmodifiable(final ParameterValue<T> parameter) {
         return UnmodifiableParameterValue.create(parameter);
@@ -918,9 +920,9 @@ public class DefaultParameterValue<T> ex
         WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER);
         final Convention convention = formatter.getConvention();
         final boolean isWKT1 = convention.majorVersion() == 1;
-        Unit<?> unit = getUnit();   // Gives to users a chance to override this property.
+        Unit<?> unit = getUnit();                                   // Gives to users a chance to override this property.
         if (unit == null) {
-            final T value = getValue();   // Gives to users a chance to override this property.
+            final T value = getValue();                             // Gives to users a chance to override this property.
             if (!isWKT1 && isFile(value)) {
                 formatter.append(value.toString(), null);
                 return WKTKeywords.ParameterFile;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -18,8 +18,10 @@ package org.apache.sis.parameter;
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.IdentityHashMap;
+import java.util.Iterator;
 import java.io.Serializable;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
@@ -38,9 +40,7 @@ import org.apache.sis.util.LenientCompar
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
-
-import static org.apache.sis.util.Utilities.deepEquals;
-import static org.apache.sis.referencing.IdentifiedObjects.isHeuristicMatchForName;
+import org.apache.sis.util.Utilities;
 
 // Branch-dependent imports
 import java.util.Objects;
@@ -103,7 +103,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see DefaultParameterDescriptorGroup
@@ -206,7 +206,7 @@ public class DefaultParameterValueGroup
     @Override
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
     public List<GeneralParameterValue> values() {
-        return values;  // Intentionally modifiable.
+        return values;                                          // Intentionally modifiable.
     }
 
     /**
@@ -305,7 +305,7 @@ public class DefaultParameterValueGroup
         for (int i=0; i<size; i++) {
             final GeneralParameterDescriptor descriptor = values.descriptor(i);
             if (descriptor instanceof ParameterDescriptor<?>) {
-                if (isHeuristicMatchForName(descriptor, name)) {
+                if (IdentifiedObjects.isHeuristicMatchForName(descriptor, name)) {
                     if (fallback < 0) {
                         fallback = i;
                     } else {
@@ -334,7 +334,7 @@ public class DefaultParameterValueGroup
      *
      * @param  name The name of the parameter to search for.
      * @return The set of all parameter group for the given name.
-     * @throws ParameterNotFoundException If no descriptor was found for the given name.
+     * @throws ParameterNotFoundException if no descriptor was found for the given name.
      */
     @Override
     public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException {
@@ -345,7 +345,7 @@ public class DefaultParameterValueGroup
         for (int i=0; i<size; i++) {
             final GeneralParameterDescriptor descriptor = values.descriptor(i);
             if (descriptor instanceof ParameterDescriptorGroup) {
-                if (isHeuristicMatchForName(descriptor, name)) {
+                if (IdentifiedObjects.isHeuristicMatchForName(descriptor, name)) {
                     groups.add((ParameterValueGroup) values.get(i));
                 }
             }
@@ -358,8 +358,8 @@ public class DefaultParameterValueGroup
         if (groups.isEmpty()) {
             final ParameterDescriptorGroup descriptor = values.descriptor;
             if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
-                throw new ParameterNotFoundException(Errors.format(
-                        Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
+                throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+                        Verifier.getDisplayName(descriptor), name), name);
             }
         }
         return groups;
@@ -377,8 +377,8 @@ public class DefaultParameterValueGroup
      *
      * @param  name The name of the parameter group to create.
      * @return A newly created parameter group for the given name.
-     * @throws ParameterNotFoundException If no descriptor was found for the given name.
-     * @throws InvalidParameterCardinalityException If this parameter group already contains the
+     * @throws ParameterNotFoundException if no descriptor was found for the given name.
+     * @throws InvalidParameterCardinalityException if this parameter group already contains the
      *         {@linkplain ParameterDescriptorGroup#getMaximumOccurs() maximum number of occurrences}
      *         of subgroups of the given name.
      */
@@ -400,7 +400,14 @@ public class DefaultParameterValueGroup
 
     /**
      * Compares the specified object with this parameter for equality.
-     * The strictness level is controlled by the second argument.
+     * The strictness level is controlled by the second argument:
+     *
+     * <ul>
+     *   <li>{@link ComparisonMode#STRICT} and {@link ComparisonMode#BY_CONTRACT BY_CONTRACT}
+     *       take in account the parameter order.</li>
+     *   <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}
+     *       ignore the order of parameter values (but not necessarily the order of parameter descriptors).</li>
+     * </ul>
      *
      * @param  object The object to compare to {@code this}.
      * @param  mode The strictness level of the comparison.
@@ -420,15 +427,37 @@ public class DefaultParameterValueGroup
                            Objects.equals(values, that.values);
                 }
             } else if (object instanceof ParameterValueGroup) {
-                final ParameterValueGroup that = (ParameterValueGroup) object;
-                return deepEquals(getDescriptor(), that.getDescriptor(), mode) &&
-                       deepEquals(values(), that.values(), mode);
+                return equals(this, (ParameterValueGroup) object, mode);
             }
         }
         return false;
     }
 
     /**
+     * Compares the given objects for equality, ignoring parameter order in "ignore metadata" mode.
+     */
+    static boolean equals(final Parameters expected, final ParameterValueGroup actual, final ComparisonMode mode) {
+        if (!Utilities.deepEquals(expected.getDescriptor(), actual.getDescriptor(), mode)) {
+            return false;
+        }
+        if (!mode.isIgnoringMetadata()) {
+            return Utilities.deepEquals(expected.values(), actual.values(), mode);
+        }
+        final List<GeneralParameterValue> values = new LinkedList<>(expected.values());
+scan:   for (final GeneralParameterValue param : actual.values()) {
+            final Iterator<GeneralParameterValue> it = values.iterator();
+            while (it.hasNext()) {
+                if (Utilities.deepEquals(it.next(), param, mode)) {
+                    it.remove();
+                    continue scan;
+                }
+            }
+            return false;   // A parameter from 'actual' has not been found in 'expected'.
+        }
+        return values.isEmpty();
+    }
+
+    /**
      * Compares the specified object with this parameter for equality.
      * This method is implemented as below:
      *
@@ -449,7 +478,7 @@ public class DefaultParameterValueGroup
     /**
      * Returns a hash value for this parameter.
      *
-     * @return The hash code value. This value doesn't need to be the same
+     * @return The hash code value. This value does not need to be the same
      *         in past or future versions of this class.
      */
     @Override

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -121,6 +121,24 @@ public abstract class Parameters impleme
     }
 
     /**
+     * Returns the given parameter value group as an unmodifiable {@code Parameters} instance.
+     * If the given parameters is already an unmodifiable instance of {@code Parameters},
+     * then it is returned as-is. Otherwise this method copies all parameter values in a new,
+     * unmodifiable, parameter group instance.
+     *
+     * @param  parameters The parameters to make unmodifiable, or {@code null}.
+     * @return An unmodifiable group with the same parameters than the given group,
+     *         or {@code null} if the given argument was null.
+     *
+     * @since 0.7
+     *
+     * @see DefaultParameterValue#unmodifiable(ParameterValue)
+     */
+    public static Parameters unmodifiable(final ParameterValueGroup parameters) {
+        return UnmodifiableParameterValueGroup.create(parameters);
+    }
+
+    /**
      * Returns the given parameter value group as a {@code Parameters} instance.
      * If the given parameters is already an instance of {@code Parameters}, then it is returned as-is.
      * Otherwise this method returns a wrapper which delegate all method invocations to the given instance.
@@ -349,15 +367,32 @@ public abstract class Parameters impleme
      * The {@link DefaultParameterValueGroup} subclass will override this method with a more efficient
      * implementation which avoid creating some deferred parameters.
      */
+    @SuppressWarnings("null")
     ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException {
+        ParameterValue<?> fallback  = null;
+        ParameterValue<?> ambiguity = null;
         for (final GeneralParameterValue value : values()) {
             if (value instanceof ParameterValue<?>) {
-                if (isHeuristicMatchForName(value.getDescriptor(), name)) {
-                    return (ParameterValue<?>) value;
+                final ParameterValue<?> param = (ParameterValue<?>) value;
+                final ParameterDescriptor<?> descriptor = param.getDescriptor();
+                if (name.equals(descriptor.getName().toString())) {
+                    return param;
+                }
+                if (isHeuristicMatchForName(descriptor, name)) {
+                    if (fallback == null) {
+                        fallback = param;
+                    } else {
+                        ambiguity = param;
+                    }
                 }
             }
         }
-        return null;
+        if (ambiguity != null) {
+            throw new ParameterNotFoundException(Errors.format(Errors.Keys.AmbiguousName_3,
+                    IdentifiedObjects.toString(fallback .getDescriptor().getName()),
+                    IdentifiedObjects.toString(ambiguity.getDescriptor().getName()), name), name);
+        }
+        return fallback;
     }
 
     /**
@@ -742,7 +777,7 @@ public abstract class Parameters impleme
                     target.setValue(((Number) v).doubleValue(), unit);
                 } else if (v instanceof double[]) {
                     target.setValue((double[]) v, unit);
-                } else {
+                } else if (v != target.getValue()) {    // Accept null value if the target value is already null.
                     throw new InvalidParameterValueException(Errors.format(
                             Errors.Keys.IllegalArgumentValue_2, name, v), name, v);
                 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.parameter;
 
 import javax.measure.unit.Unit;
+import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.parameter.ParameterValue;
 import org.apache.sis.internal.util.Cloner;
 import org.apache.sis.util.collection.WeakHashSet;
@@ -54,6 +55,7 @@ import org.apache.sis.util.resources.Err
  * @version 0.6
  * @module
  */
+@XmlTransient
 final class UnmodifiableParameterValue<T> extends DefaultParameterValue<T> {
     /**
      * For cross-version compatibility.
@@ -117,6 +119,7 @@ final class UnmodifiableParameterValue<T
      * Returns a modifiable copy of this parameter.
      */
     @Override
+    @SuppressWarnings("CloneDoesntCallSuperClone")
     public DefaultParameterValue<T> clone() {
         return new DefaultParameterValue<>(this);
     }

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java?rev=1722969&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -0,0 +1,237 @@
+/*
+ * 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.parameter;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.IdentityHashMap;
+import java.io.Serializable;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.GeneralParameterValue;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.ParameterNotFoundException;
+import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.LenientComparable;
+import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
+
+// Branch-dependent imports
+import java.util.Objects;
+
+
+/**
+ * A parameter value group which can not be modified. This is especially important for parameters of
+ * <cite>defining conversions</cite> since the same instance can be used for various source and target CRS.
+ * Since {@link org.apache.sis.referencing.factory.sql.EPSGFactory} caches the {@code Conversion} instances,
+ * unexpected behavior results if the parameters of a cached conversion have been modified, for example with
+ * the addition of {@code semi_major} and {@code semi_minor} parameters by {@code DefaultMathTransformFactory}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+final class UnmodifiableParameterValueGroup extends Parameters implements LenientComparable, Serializable {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -7980778116268449513L;
+
+    /**
+     * The parameter descriptor.
+     *
+     * @see #getDescriptor()
+     */
+    private final ParameterDescriptorGroup descriptor;
+
+    /**
+     * The parameter values.
+     *
+     * @see #values()
+     */
+    private final List<GeneralParameterValue> values;
+
+    /**
+     * Creates a new unmodifiable parameter group.
+     *
+     * @param group The group of values to copy.
+     * @param done  An initially empty map used for protection against circular references.
+     *
+     * @see #create(ParameterValueGroup)
+     */
+    private UnmodifiableParameterValueGroup(final ParameterValueGroup group, final Map<ParameterValueGroup,Boolean> done) {
+        if (done.put(group, Boolean.TRUE) != null) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.CircularReference));
+        }
+        descriptor = group.getDescriptor();
+        final List<GeneralParameterValue> values = group.values();
+        final GeneralParameterValue[] array = new GeneralParameterValue[values.size()];
+        for (int i=0; i<array.length; i++) {
+            GeneralParameterValue value = values.get(i);
+            ArgumentChecks.ensureNonNullElement("values", i, value);
+            if (value instanceof ParameterValue<?>) {
+                value = UnmodifiableParameterValue.create((ParameterValue<?>) value);
+            } else if (value instanceof ParameterValueGroup) {
+                value = new UnmodifiableParameterValueGroup((ParameterValueGroup) value, done);
+            }
+            array[i] = value;
+        }
+        this.values = UnmodifiableArrayList.wrap(array);
+    }
+
+    /**
+     * Creates a new unmodifiable parameter group.
+     *
+     * @param  group The group of values to copy, or {@code null}.
+     * @return The unmodifiable parameter group, or {@code null} if the given argument was null.
+     */
+    static UnmodifiableParameterValueGroup create(final ParameterValueGroup group) {
+        if (group == null || group instanceof UnmodifiableParameterValueGroup) {
+            return (UnmodifiableParameterValueGroup) group;
+        }
+        return new UnmodifiableParameterValueGroup(group, new IdentityHashMap<>(4));
+    }
+
+    /**
+     * Returns the abstract definition of this group of parameters.
+     */
+    @Override
+    public ParameterDescriptorGroup getDescriptor() {
+        return descriptor;
+    }
+
+    /**
+     * Returns the values in this group.
+     */
+    @Override
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
+    public List<GeneralParameterValue> values() {
+        return values;                                  // Unmodifiable
+    }
+
+    /**
+     * Specifies that this class does not override {@link #parameter(String)} in a way incompatible with
+     * {@link #parameterIfExist(String)}.
+     */
+    @Override
+    boolean isKnownImplementation() {
+        return true;
+    }
+
+    /**
+     * Returns the value in this group for the specified name.
+     */
+    @Override
+    public ParameterValue<?> parameter(final String name) throws ParameterNotFoundException {
+        ArgumentChecks.ensureNonNull("name", name);
+        final ParameterValue<?> value = parameterIfExist(name);
+        if (value != null) {
+            return value;
+        }
+        throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+                Verifier.getDisplayName(descriptor), name), name);
+    }
+
+    /**
+     * Returns all subgroups with the specified name.
+     */
+    @Override
+    public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException {
+        ArgumentChecks.ensureNonNull("name", name);
+        final List<ParameterValueGroup> groups = new ArrayList<>(4);
+        for (final GeneralParameterValue value : values) {
+            if (value instanceof ParameterValueGroup) {
+                if (IdentifiedObjects.isHeuristicMatchForName(value.getDescriptor(), name)) {
+                    groups.add((ParameterValueGroup) value);
+                }
+            }
+        }
+        if (groups.isEmpty()) {
+            if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
+                throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+                        Verifier.getDisplayName(descriptor), name), name);
+            }
+        }
+        return groups;
+    }
+
+    /**
+     * Operation not allowed.
+     */
+    @Override
+    public ParameterValueGroup addGroup(final String name) throws IllegalStateException {
+        throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableObject_1, ParameterValueGroup.class));
+    }
+
+    /**
+     * Compares the specified object with this parameter for equality.
+     * The strictness level is controlled by the second argument:
+     *
+     * <ul>
+     *   <li>{@link ComparisonMode#STRICT} and {@link ComparisonMode#BY_CONTRACT BY_CONTRACT}
+     *       take in account the parameter order.</li>
+     *   <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}
+     *       ignore the order of parameter values (but not necessarily the order of parameter descriptors).</li>
+     * </ul>
+     *
+     * @param  object The object to compare to {@code this}.
+     * @param  mode The strictness level of the comparison.
+     * @return {@code true} if both objects are equal according the given comparison mode.
+     */
+    @Override
+    public boolean equals(final Object object, final ComparisonMode mode) {
+        if (object == this) {
+            // Slight optimization
+            return true;
+        }
+        if (object != null) {
+            if (mode == ComparisonMode.STRICT) {
+                if (getClass() == object.getClass()) {
+                    final UnmodifiableParameterValueGroup that = (UnmodifiableParameterValueGroup) object;
+                    return Objects.equals(descriptor, that.descriptor) &&
+                           Objects.equals(values,     that.values);
+                }
+            } else if (object instanceof ParameterValueGroup) {
+                return DefaultParameterValueGroup.equals(this, (ParameterValueGroup) object, mode);
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Compares the specified object with this parameter for equality.
+     *
+     * @param  object The object to compare to {@code this}.
+     * @return {@code true} if both objects are equal.
+     */
+    @Override
+    public final boolean equals(final Object object) {
+        return equals(object, ComparisonMode.STRICT);
+    }
+
+    /**
+     * Returns a hash value for this parameter.
+     */
+    @Override
+    public int hashCode() {
+        return descriptor.hashCode() ^ values.hashCode();
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -757,6 +757,10 @@ public class GeodeticObjectFactory exten
         try {
             crs = new DefaultProjectedCRS(complete(properties), baseCRS, conversion, derivedCS);
         } catch (IllegalArgumentException exception) {
+            final Throwable cause = exception.getCause();
+            if (cause instanceof FactoryException) {
+                throw (FactoryException) cause;         // Must be propagated for allowing caller to catch NoSuchIdentifierException.
+            }
             throw new InvalidGeodeticParameterException(exception);
         }
         return unique("createProjectedCRS", crs);
@@ -837,6 +841,10 @@ public class GeodeticObjectFactory exten
         try {
             crs = DefaultDerivedCRS.create(complete(properties), (SingleCRS) baseCRS, conversion, derivedCS);
         } catch (IllegalArgumentException exception) {
+            final Throwable cause = exception.getCause();
+            if (cause instanceof FactoryException) {
+                throw (FactoryException) cause;         // Must be propagated for allowing caller to catch NoSuchIdentifierException.
+            }
             throw new InvalidGeodeticParameterException(exception);
         }
         return unique("createDerivedCRS", crs);

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=1722969&r1=1722968&r2=1722969&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] Mon Jan  4 22:34:57 2016
@@ -1020,6 +1020,7 @@ addURIs:    for (int i=0; ; i++) {
             properties.put(IdentifiedObject.ALIAS_KEY, aliases.toArray(new GenericName[aliases.size()]));
         }
         properties.put(AbstractIdentifiedObject.LOCALE_KEY, locale);
+        properties.put(ReferencingServices.MT_FACTORY, parent.mtFactory);
         return properties;
     }
 
@@ -2525,16 +2526,6 @@ addURIs:    for (int i=0; ; i++) {
                      * Get the operation method. This is mandatory for conversions and transformations
                      * (it was checked by getInteger(code, result, …) above in this method) but optional
                      * for concatenated operations. Fetching parameter values is part of this block.
-                     *
-                     * We will create the ParameterValueGroup from the MathTransformFactory (which means that
-                     * we will use the parameter descriptors that are hard-coded in Apache SIS) instead than
-                     * from the OperationMethod created from the EPSG database. The reasons are:
-                     *
-                     *   1) For detecting now if the EPSG database defines a parameter not recognized by SIS.
-                     *   2) Because SIS implementation sometime needs additional parameters not explicitly given in
-                     *      EPSG database because considered implicit (e.g. length of semi-major and semi-minor axes).
-                     *      By letting MathTransformFactory create the ParameterValueGroup itself, we give it a chance
-                     *      to include such implicit parameter values in the group.
                      */
                     OperationMethod method;
                     ParameterValueGroup parameters;
@@ -2544,25 +2535,7 @@ addURIs:    for (int i=0; ; i++) {
                     } else {
                         method = parent.createOperationMethod(methodCode.toString());
                         method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions);
-                        final String methodName = method.getName().getCode();
-                        String methodIdentifier = IdentifiedObjects.toString(IdentifiedObjects.getIdentifier(method, Citations.EPSG));
-                        if (methodIdentifier == null) {
-                            methodIdentifier = methodName;
-                        }
-                        try {
-                            parameters = parent.mtFactory.getDefaultParameters(methodIdentifier);
-                        } catch (NoSuchIdentifierException exception) {
-                            /*
-                             * We gave priority to EPSG identifier because operation method names are sometime ambiguous
-                             * (e.g. "Lambert Azimuthal Equal Area (Spherical)"). If we failed to find the method by its
-                             * EPSG code, try searching by operation name. As a side effect, this second attempt will
-                             * produce a better error message if the operation is really not found.
-                             */
-                            if (methodIdentifier.equals(methodName)) throw exception;
-                            parameters = parent.mtFactory.getDefaultParameters(methodName);
-                            Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY),
-                                    EPSGDataAccess.class, "createCoordinateOperation", exception);
-                        }
+                        parameters = method.getParameters().createValue();
                         fillParameterValues(methodCode, epsg, parameters);
                     }
                     /*

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -93,7 +93,7 @@ class AbstractSingleOperation extends Ab
      * The operation method.
      *
      * <p><b>Consider this field as final!</b>
-     * This field is modified only at unmarshalling time by {@link #setMethod(OperationMethod)}</p>
+     * This field is modified only at unmarshalling time by {@link #setMethod(OperationMethod)}.</p>
      *
      * @see #getMethod()
      */
@@ -104,7 +104,7 @@ class AbstractSingleOperation extends Ab
      *
      * <p><b>Consider this field as final!</b>
      * This field is non-final only for the convenience of constructors and for initialization
-     * at XML unmarshalling time by {@link #setParameters(GeneralParameterValue[])}</p>
+     * at XML unmarshalling time by {@link #setParameters(GeneralParameterValue[])}.</p>
      */
     ParameterValueGroup parameters;
 
@@ -128,8 +128,7 @@ class AbstractSingleOperation extends Ab
          * However there is a few cases, for example the Molodenski transform, where we can not infer the
          * parameters easily because the operation is implemented by a concatenation of math transforms.
          */
-        parameters = Containers.property(properties, ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class);
-        // No clone since this is a SIS internal property and SIS does not modify those values after construction.
+        parameters = Parameters.unmodifiable(Containers.property(properties, ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class));
     }
 
     /**
@@ -164,7 +163,7 @@ class AbstractSingleOperation extends Ab
     protected AbstractSingleOperation(final SingleOperation operation) {
         super(operation);
         method = operation.getMethod();
-        parameters = getParameterValues(operation);
+        parameters = Parameters.unmodifiable(operation.getParameterValues());
     }
 
     /**
@@ -314,9 +313,8 @@ class AbstractSingleOperation extends Ab
      * Returns the parameter values. The default implementation performs the following choice:
      *
      * <ul>
-     *   <li>If parameter values were specified explicitely at construction time, then a
-     *       {@linkplain org.apache.sis.parameter.DefaultParameterValueGroup#clone() clone}
-     *       of those parameters is returned.</li>
+     *   <li>If parameter values were specified explicitely at construction time, then they are returned as an
+     *       {@linkplain Parameters#unmodifiable(ParameterValueGroup) unmodifiable parameter group}.</li>
      *   <li>Otherwise if this method can infer the parameter values from the
      *       {@linkplain #getMathTransform() math transform}, then those parameters are returned.</li>
      *   <li>Otherwise throw {@link org.apache.sis.util.UnsupportedImplementationException}.</li>
@@ -330,18 +328,7 @@ class AbstractSingleOperation extends Ab
      */
     @Override
     public ParameterValueGroup getParameterValues() {
-        return (parameters != null) ? parameters.clone() : super.getParameterValues();
-    }
-
-    /**
-     * Gets the parameter values of the given operation without computing and without cloning them (if possible).
-     * If the parameters are automatically inferred from the math transform, do not compute them and instead return
-     * {@code null} (in conformance with {@link #parameters} contract).
-     */
-    private static ParameterValueGroup getParameterValues(final SingleOperation operation) {
-        return (operation instanceof AbstractSingleOperation)
-               ? ((AbstractSingleOperation) operation).parameters   // Null if inferred from MathTransform
-               : operation.getParameterValues();
+        return (parameters != null) ? parameters : super.getParameterValues();
     }
 
     /**
@@ -507,6 +494,7 @@ class AbstractSingleOperation extends Ab
              */
             parameters = new DefaultParameterValueGroup(method.getParameters());
             CC_OperationMethod.store(values, parameters.values(), replacements);
+            parameters = Parameters.unmodifiable(parameters);
         } else {
             ReferencingUtilities.propertyAlreadySet(AbstractSingleOperation.class, "setParameters", "parameterValue");
         }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -35,6 +35,7 @@ import org.apache.sis.referencing.cs.Coo
 import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.parameter.Parameters;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Utilities;
@@ -212,7 +213,7 @@ public class DefaultConversion extends A
                     .getString(Errors.Keys.UnspecifiedParameterValues));
         }
         if (parameters != null) {
-            this.parameters = parameters.clone();
+            this.parameters = Parameters.unmodifiable(parameters);
         }
         checkDimensions(properties);
     }
@@ -236,17 +237,34 @@ public class DefaultConversion extends A
         int interpDim = ReferencingUtilities.getDimension(super.getInterpolationCRS());
         if (transform == null) {
             /*
-             * If the user did not specified explicitely a MathTransform, we will need to create it
-             * from the parameters. This case happen often when creating a ProjectedCRS, because the
-             * user often did not have all needed information when he created the defining conversion:
-             * the length of semi-major and semi-minor axes were often missing. But now we know those
-             * lengths thanks to the 'sourceCRS' argument given to this method. So we can complete the
-             * parameters. This is the job of MathTransformFactory.createBaseToDerived(…).
+             * If the user did not specified explicitely a MathTransform, we will need to create it from the parameters.
+             * This case happen when creating a ProjectedCRS because the length of semi-major and semi-minor axes are
+             * often missing at defining conversion creation time. Since this constructor know those semi-axis lengths
+             * thanks to the 'sourceCRS' argument, we can complete the parameters.
              */
             if (parameters == null) {
                 throw new IllegalArgumentException(Errors.format(Errors.Keys.UnspecifiedParameterValues));
             }
-            transform = factory.createBaseToDerived(source, parameters, target.getCoordinateSystem());
+            if (factory instanceof DefaultMathTransformFactory) {
+                /*
+                 * Apache SIS specific API (not yet defined in GeoAPI, but could be proposed).
+                 * Note that setTarget(…) intentionally uses only the CoordinateSystem instead than the full
+                 * CoordinateReferenceSystem because the targetCRS is typically under construction when this
+                 * method in invoked, and attempts to use it can cause NullPointerException.
+                 */
+                final DefaultMathTransformFactory.Context context = new DefaultMathTransformFactory.Context();
+                context.setSource(source);
+                context.setTarget(target.getCoordinateSystem());
+                transform = ((DefaultMathTransformFactory) factory).createParameterizedTransform(parameters, context);
+                parameters = Parameters.unmodifiable(context.getCompletedParameters());
+            } else {
+                /*
+                 * Fallback for non-SIS implementation. Equivalent to the above code, except that we can
+                 * not get the parameters completed with semi-major and semi-minor axis lengths. Most of
+                 * the code should work anyway.
+                 */
+                transform = factory.createBaseToDerived(source, parameters, target.getCoordinateSystem());
+            }
         } else {
             /*
              * If the user specified explicitely a MathTransform, we may still need to swap or scale axes.
@@ -257,9 +275,10 @@ public class DefaultConversion extends A
             final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
             final CoordinateReferenceSystem targetCRS = super.getTargetCRS();
             if (sourceCRS == null && targetCRS == null && factory instanceof DefaultMathTransformFactory) {
-                transform = ((DefaultMathTransformFactory) factory).createBaseToDerived(
-                        source.getCoordinateSystem(), transform,
-                        target.getCoordinateSystem());
+                final DefaultMathTransformFactory.Context context = new DefaultMathTransformFactory.Context();
+                context.setSource(source);
+                context.setTarget(target);
+                transform = ((DefaultMathTransformFactory) factory).swapAndScaleAxes(transform, context);
             } else {
                 /*
                  * If we can not use our SIS factory implementation, or if this conversion is not a defining

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -58,6 +58,10 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.provider.AbstractProvider;
 import org.apache.sis.internal.referencing.provider.VerticalOffset;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.parameter.DefaultParameterValueGroup;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
@@ -481,6 +485,13 @@ public class DefaultMathTransformFactory
         OperationMethod provider;
 
         /**
+         * The parameters actually used.
+         *
+         * @see #getCompletedParameters()
+         */
+        ParameterValueGroup parameters;
+
+        /**
          * Creates a new context with all properties initialized to {@code null}.
          */
         public Context() {
@@ -571,6 +582,40 @@ public class DefaultMathTransformFactory
         }
 
         /**
+         * Returns the parameter values used for the math transform creation, including the parameters completed
+         * by the factory.
+         *
+         * @return The parameter values used by the factory.
+         * @throws IllegalStateException if {@link DefaultMathTransformFactory#createParameterizedTransform(ParameterValueGroup, Context)}
+         *         has not yet been invoked.
+         */
+        public ParameterValueGroup getCompletedParameters() {
+            if (parameters != null) {
+                return parameters;
+            }
+            throw new IllegalStateException(Errors.format(Errors.Keys.UnspecifiedParameterValues));
+        }
+
+        /**
+         * If the parameters given by the user were not created by {@code getDefaultParameters(String)}
+         * or something equivalent, copies those parameters into the structure expected by the provider.
+         * The intend is to make sure that we have room for the parameters that {@code setEllipsoids(…)}
+         * may write.
+         */
+        private void ensureCompatibleParameters() {
+            final ParameterDescriptorGroup expected = provider.getParameters();
+            if (parameters.getDescriptor() != expected || !(parameters instanceof DefaultParameterValueGroup)) {
+                /*
+                 * The above check for DefaultParameterValueGroup is for replacing ImmutableParameterValueGroup
+                 * by a writable instance.
+                 */
+                final ParameterValueGroup copy = expected.createValue();
+                Parameters.copy(parameters, copy);
+                parameters = copy;
+            }
+        }
+
+        /**
          * Returns the value of the given parameter in the given unit, or {@code NaN} if the parameter is not set.
          *
          * <p><b>NOTE:</b> Do not merge this function with {@code ensureSet(…)}. We keep those two methods
@@ -610,11 +655,10 @@ public class DefaultMathTransformFactory
         }
 
         /**
-         * Completes the given parameter group with information about source or target ellipsoid axis lengths,
+         * Completes the parameter group with information about source or target ellipsoid axis lengths,
          * if available. This method writes semi-major and semi-minor parameter values only if they do not
          * already exists in the given parameters.
          *
-         * @param  parameters The parameter values for the transform.
          * @param  ellipsoid  The ellipsoid from which to get axis lengths of flattening factor, or {@code null}.
          * @param  semiMajor  {@code "semi_major}, {@code "src_semi_major} or {@code "tgt_semi_major} parameter name.
          * @param  semiMinor  {@code "semi_minor}, {@code "src_semi_minor} or {@code "tgt_semi_minor} parameter name.
@@ -623,8 +667,8 @@ public class DefaultMathTransformFactory
          *         because the caller may succeed in creating the transform anyway, or otherwise may produce a more
          *         informative exception.
          */
-        private static RuntimeException setEllipsoid(final ParameterValueGroup parameters, final Ellipsoid ellipsoid,
-                final String semiMajor, final String semiMinor, final boolean inverseFlattening, RuntimeException failure)
+        private RuntimeException setEllipsoid(final Ellipsoid ellipsoid, final String semiMajor, final String semiMinor,
+                final boolean inverseFlattening, RuntimeException failure)
         {
             /*
              * Note: we could also consider to set the "dim" parameter here based on the number of dimensions
@@ -634,6 +678,7 @@ public class DefaultMathTransformFactory
              * projections, which is not allowed.
              */
             if (ellipsoid != null) {
+                ensureCompatibleParameters();
                 ParameterValue<?> mismatchedParam = null;
                 double mismatchedValue = 0;
                 try {
@@ -703,17 +748,16 @@ public class DefaultMathTransformFactory
         }
 
         /**
-         * Completes the given parameter group with information about source and target ellipsoid axis lengths,
+         * Completes the parameter group with information about source and target ellipsoid axis lengths,
          * if available. This method writes semi-major and semi-minor parameter values only if they do not
          * already exists in the given parameters.
          *
          * @param  method Description of the transform to be created, or {@code null} if unknown.
-         * @param  parameters The parameter values for the transform.
          * @return The exception if the operation failed, or {@code null} if none. This exception is not thrown now
          *         because the caller may succeed in creating the transform anyway, or otherwise may produce a more
          *         informative exception.
          */
-        final RuntimeException setEllipsoids(final OperationMethod method, final ParameterValueGroup parameters) {
+        final RuntimeException setEllipsoids(final OperationMethod method) {
             int n;
             if (method instanceof AbstractProvider) {
                 n = ((AbstractProvider) method).getEllipsoidsMask();
@@ -726,11 +770,12 @@ public class DefaultMathTransformFactory
             }
             switch (n) {
                 case 0: return null;
-                case 1: return setEllipsoid(parameters, getSourceEllipsoid(), Constants.SEMI_MAJOR, Constants.SEMI_MINOR, true, null);
-                case 2: return setEllipsoid(parameters, getTargetEllipsoid(), Constants.SEMI_MAJOR, Constants.SEMI_MINOR, true, null);
+                case 1: return setEllipsoid(getSourceEllipsoid(), Constants.SEMI_MAJOR, Constants.SEMI_MINOR, true, null);
+                case 2: return setEllipsoid(getTargetEllipsoid(), Constants.SEMI_MAJOR, Constants.SEMI_MINOR, true, null);
                 case 3: {
                     RuntimeException failure = null;
                     if (sourceCS != null) try {
+                        ensureCompatibleParameters();
                         final ParameterValue<?> p = parameters.parameter("dim");
                         if (p.getValue() == null) {
                             p.setValue(sourceCS.getDimension());
@@ -738,8 +783,8 @@ public class DefaultMathTransformFactory
                     } catch (IllegalArgumentException | IllegalStateException e) {
                         failure = e;
                     }
-                    failure = setEllipsoid(parameters, getSourceEllipsoid(), "src_semi_major", "src_semi_minor", false, failure);
-                    failure = setEllipsoid(parameters, getTargetEllipsoid(), "tgt_semi_major", "tgt_semi_minor", false, failure);
+                    failure = setEllipsoid(getSourceEllipsoid(), "src_semi_major", "src_semi_minor", false, failure);
+                    failure = setEllipsoid(getTargetEllipsoid(), "tgt_semi_major", "tgt_semi_minor", false, failure);
                     return failure;
                 }
                 default: throw new AssertionError(n);
@@ -776,10 +821,10 @@ public class DefaultMathTransformFactory
      *       with any other transforms required for performing units changes and ordinates swapping.</li>
      * </ol>
      *
-     * If this method needs to set the values of {@code "semi_major"}, {@code "semi_minor"} or similar parameters,
-     * then it sets those values directly on the given {@code parameters} instance – not on a clone – for allowing
-     * the caller to get back the complete parameter values.
-     * However this method only fills missing values, it never modify existing values.
+     * The complete group of parameters, including {@code "semi_major"}, {@code "semi_minor"} or other calculated values,
+     * can be obtained by a call to {@link Context#getCompletedParameters()} after {@code createParameterizedTransform(…)}
+     * returned. Note that the completed parameters may only have additional parameters compared to the given parameter
+     * group; existing parameter values are never modified.
      *
      * <p>The {@code OperationMethod} instance used by this constructor can be obtained by a call to
      * {@link #getLastMethodUsed()}.</p>
@@ -798,18 +843,39 @@ public class DefaultMathTransformFactory
      * @see #getLastMethodUsed()
      * @see org.apache.sis.parameter.ParameterBuilder#createGroupForMapProjection(ParameterDescriptor...)
      */
-    public MathTransform createParameterizedTransform(final ParameterValueGroup parameters,
+    public MathTransform createParameterizedTransform(ParameterValueGroup parameters,
             final Context context) throws NoSuchIdentifierException, FactoryException
     {
-        ArgumentChecks.ensureNonNull("parameters", parameters);
-        final String methodName  = parameters.getDescriptor().getName().getCode();
         OperationMethod  method  = null;
         RuntimeException failure = null;
         MathTransform transform;
         try {
-            method = getOperationMethod(methodName);
+            ArgumentChecks.ensureNonNull("parameters", parameters);
+            final ParameterDescriptorGroup descriptor = parameters.getDescriptor();
+            final String methodName = descriptor.getName().getCode();
+            String methodIdentifier = IdentifiedObjects.toString(IdentifiedObjects.getIdentifier(descriptor, Citations.EPSG));
+            if (methodIdentifier == null) {
+                methodIdentifier = methodName;
+            }
+            /*
+             * Get the MathTransformProvider of the same name or identifier than the given parameter group.
+             * We give precedence to EPSG identifier because operation method names are sometime ambiguous
+             * (e.g. "Lambert Azimuthal Equal Area (Spherical)"). If we fail to find the method by its EPSG code,
+             * we will try searching by method name. As a side effect, this second attempt will produce a better
+             * error message if the method is really not found.
+             */
+            try {
+                method = getOperationMethod(methodIdentifier);
+            } catch (NoSuchIdentifierException exception) {
+                if (methodIdentifier.equals(methodName)) {
+                    throw exception;
+                }
+                method = getOperationMethod(methodName);
+                Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+                        DefaultMathTransformFactory.class, "createParameterizedTransform", exception);
+            }
             if (!(method instanceof MathTransformProvider)) {
-                throw new NoSuchIdentifierException(Errors.format( // For now, handle like an unknown operation.
+                throw new NoSuchIdentifierException(Errors.format(          // For now, handle like an unknown operation.
                         Errors.Keys.UnsupportedImplementation_1, Classes.getClass(method)), methodName);
             }
             /*
@@ -818,7 +884,10 @@ public class DefaultMathTransformFactory
              * since the standard place where to provide this information is in the ellipsoid object.
              */
             if (context != null) {
-                failure = context.setEllipsoids(method, parameters);
+                context.provider   = method;
+                context.parameters = parameters;
+                failure = context.setEllipsoids(method);
+                parameters = context.parameters;
             }
             /*
              * Catch only exceptions which may be the result of improper parameter usage (e.g. a value out of range).
@@ -837,13 +906,8 @@ public class DefaultMathTransformFactory
             transform = unique(transform);
             method = DefaultOperationMethod.redimension(method, transform.getSourceDimensions(),
                                                                 transform.getTargetDimensions());
-            if (context != null) try {
-                context.provider = method;
+            if (context != null) {
                 transform = swapAndScaleAxes(transform, context);
-            } finally {
-                context.provider = null;
-                // For now we conservatively reset the provider information to null. But if we choose to make
-                // that information public in a future SIS version, then we would remove this 'finally' block.
             }
         } catch (FactoryException e) {
             if (failure != null) {
@@ -852,6 +916,11 @@ public class DefaultMathTransformFactory
             throw e;
         } finally {
             lastMethod.set(method);     // May be null in case of failure, which is intended.
+            if (context != null) {
+                context.provider = null;
+                // For now we conservatively reset the provider information to null. But if we choose to make
+                // that information public in a future SIS version, then we would remove this code.
+            }
         }
         return transform;
     }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -19,6 +19,7 @@ package org.apache.sis.parameter;
 import java.util.List;
 import java.util.Arrays;
 import java.util.ArrayList;
+import java.util.Collections;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.GeneralParameterValue;
 import org.opengis.parameter.ParameterDescriptor;
@@ -27,6 +28,7 @@ import org.opengis.parameter.ParameterVa
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.InvalidParameterNameException;
 import org.opengis.parameter.InvalidParameterCardinalityException;
+import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -43,7 +45,7 @@ import static org.opengis.referencing.Id
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -413,6 +415,26 @@ public final strictfp class DefaultParam
     }
 
     /**
+     * Tests {@link #equals(Object, ComparisonMode)}.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testEqualsAndHashCode")
+    public void testEqualsIgnoreMetadata() {
+        final DefaultParameterValueGroup g1 = createGroup(10);
+        final DefaultParameterValueGroup g2 = new DefaultParameterValueGroup(g1.getDescriptor());
+        final List<GeneralParameterValue> values = new ArrayList<>(g1.values());
+        Collections.swap(values, 2, 3);
+        g2.values().addAll(values);
+
+        assertFalse("STRICT",          g1.equals(g2, ComparisonMode.STRICT));
+        assertFalse("BY_CONTRACT",     g1.equals(g2, ComparisonMode.BY_CONTRACT));
+        assertTrue ("IGNORE_METADATA", g1.equals(g2, ComparisonMode.IGNORE_METADATA));
+        assertTrue ("APPROXIMATIVE",   g1.equals(g2, ComparisonMode.APPROXIMATIVE));
+    }
+
+    /**
      * Tests {@link DefaultParameterValueGroup} serialization.
      */
     @Test

Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/UnmodifiableParameterValueGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/UnmodifiableParameterValueGroupTest.java?rev=1722969&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/UnmodifiableParameterValueGroupTest.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/UnmodifiableParameterValueGroupTest.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -0,0 +1,90 @@
+/*
+ * 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.parameter;
+
+import org.opengis.parameter.ParameterNotFoundException;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link UnmodifiableParameterValueGroup} class.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+@DependsOn(UnmodifiableParameterValueTest.class)
+public final strictfp class UnmodifiableParameterValueGroupTest extends TestCase {
+    /**
+     * Tests creation of an {@link UnmodifiableParameterValueGroup} and verify the values.
+     */
+    @Test
+    public void testCreate() {
+        ParameterValueGroup group = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
+        group.parameter("Mandatory 1").setValue(5);
+        group.parameter("Optional 3") .setValue(8);
+        group = UnmodifiableParameterValueGroup.create(group);
+
+        assertEquals("values.size()",             3,  group.values().size());
+        assertEquals("values[0].name", "Mandatory 1", group.values().get(0).getDescriptor().getName().toString());
+        assertEquals("values[1].name", "Mandatory 2", group.values().get(1).getDescriptor().getName().toString());
+        assertEquals("values[2].name", "Optional 3",  group.values().get(2).getDescriptor().getName().toString());
+        assertEquals("values[0].value",           5,  group.parameter("Mandatory 1").getValue());
+        assertEquals("values[1].value",          10,  group.parameter("Mandatory 2").getValue());
+        assertEquals("values[2].value",           8,  group.parameter("Optional 3") .getValue());
+
+        try {
+            group.groups("dummy");
+            fail("Shall not return non-existent groups.");
+        } catch (ParameterNotFoundException e) {
+            assertTrue(e.getMessage().contains("Test group"));
+            assertTrue(e.getMessage().contains("dummy"));
+        }
+    }
+
+    /**
+     * Ensures that {@link UnmodifiableParameterValueGroup} is unmodifiable.
+     */
+    @Test
+    public void ensureUnmodifiable() {
+        ParameterValueGroup group = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
+        group.parameter("Mandatory 1").setValue(5);
+        group.parameter("Optional 3") .setValue(8);
+        group = UnmodifiableParameterValueGroup.create(group);
+
+        ParameterValue<?> param = group.parameter("Mandatory 1");
+        try {
+            param.setValue(5);
+            fail("Shall not allow modification.");
+        } catch (UnsupportedOperationException e) {
+            assertTrue(e.getMessage().contains("ParameterValue"));
+        }
+        try {
+            group.addGroup("dummy");
+            fail("Shall not allow modification.");
+        } catch (UnsupportedOperationException e) {
+            assertTrue(e.getMessage().contains("ParameterValueGroup"));
+        }
+    }
+}

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

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

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -38,6 +39,10 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2001.class,     // Units created from EPSG codes
+    GIGS3002.class      // Ellipsoids created from properties
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2002 extends org.opengis.test.referencing.gigs.GIGS2002 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -38,6 +39,10 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2001.class,     // Units created from EPSG codes
+    GIGS3003.class      // Prime meridians created from properties
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2003 extends org.opengis.test.referencing.gigs.GIGS2003 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,11 +23,12 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
  * Tests {@link org.apache.sis.referencing.factory.sql.EPSGDataAccess#createCoordinateReferenceSystem(String)}
- * for geodetic CRS.
+ * for geodetic (geographic or geocentric) CRS.
  * This is part of <cite>Geospatial Integrity of Geoscience Software</cite> (GIGS) tests implemented in GeoAPI.
  *
  * <div class="note"><b>Note:</b>
@@ -39,6 +40,11 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2002.class,     // Ellipsoids created from EPSG codes
+    GIGS2003.class,     // Prime meridians created from EPSG codes
+    GIGS3004.class      // Geodetic datums created from properties
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2004 extends org.opengis.test.referencing.gigs.GIGS2004 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -39,6 +40,10 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2001.class,     // Units created from EPSG codes
+    GIGS3005.class      // Conversions created from properties
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2005 extends org.opengis.test.referencing.gigs.GIGS2005 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -39,6 +40,10 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2004.class,     // Geodetic CRSs created from EPSG codes
+    GIGS2005.class      // Conversions created from EPSG codes
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2006 extends org.opengis.test.referencing.gigs.GIGS2006 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -39,6 +40,9 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2006.class      // Projected CRSs created from EPSG codes
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2007 extends org.opengis.test.referencing.gigs.GIGS2007 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -39,6 +40,9 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2001.class      // Units created from EPSG codes
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2008 extends org.opengis.test.referencing.gigs.GIGS2008 {
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -23,6 +23,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.apache.sis.test.DependsOn;
 
 
 /**
@@ -39,6 +40,9 @@ import org.junit.runners.JUnit4;
  * @version 0.7
  * @module
  */
+@DependsOn({
+    GIGS2008.class      // Vertical CRSs created from EPSG codes
+})
 @RunWith(JUnit4.class)
 public final strictfp class GIGS2009 extends org.opengis.test.referencing.gigs.GIGS2009 {
     /**
@@ -66,5 +70,6 @@ public final strictfp class GIGS2009 ext
     @AfterClass
     public static void close() throws FactoryException {
         GIGS2001.close();
+        GIGS2001.INSTANCE = null;       // Since this is the last test of the 2000 series, we can let GC do its work.
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -32,10 +32,10 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.datum.DefaultEllipsoidTest.class
 })
+@RunWith(JUnit4.class)
 public final strictfp class GIGS3002 extends org.opengis.test.referencing.gigs.GIGS3002 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -32,10 +32,10 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.datum.DefaultPrimeMeridianTest.class
 })
+@RunWith(JUnit4.class)
 public final strictfp class GIGS3003 extends org.opengis.test.referencing.gigs.GIGS3003 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -35,11 +35,12 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
-    GIGS3002.class, GIGS3003.class,
+    GIGS3002.class,     // Ellipsoids created from properties
+    GIGS3003.class,     // Prime meridians created from properties
     org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class
 })
+@RunWith(JUnit4.class)
 public final strictfp class GIGS3004 extends org.opengis.test.referencing.gigs.GIGS3004 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -32,10 +32,10 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.operation.DefaultConversionTest.class
 })
+@RunWith(JUnit4.class)
 public final strictfp class GIGS3005 extends org.opengis.test.referencing.gigs.GIGS3005 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1722969&r1=1722968&r2=1722969&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Mon Jan  4 22:34:57 2016
@@ -52,7 +52,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.matrix.Matrix2Test.class,
     org.apache.sis.referencing.operation.matrix.Matrix3Test.class,
     org.apache.sis.referencing.operation.matrix.Matrix4Test.class,
-    org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class, // Expected to be last MatrixTestCase - see javadoc.
+    org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class,          // Expected to be last MatrixTestCase - see javadoc.
     org.apache.sis.referencing.operation.matrix.MatricesTest.class,
     org.apache.sis.referencing.operation.matrix.AffineTransforms2DTest.class,
 
@@ -62,6 +62,7 @@ import org.junit.BeforeClass;
     org.apache.sis.parameter.DefaultParameterValueTest.class,
     org.apache.sis.parameter.DefaultParameterValueGroupTest.class,
     org.apache.sis.parameter.UnmodifiableParameterValueTest.class,
+    org.apache.sis.parameter.UnmodifiableParameterValueGroupTest.class,
     org.apache.sis.parameter.ParametersTest.class,
     org.apache.sis.parameter.ParameterBuilderTest.class,
     org.apache.sis.parameter.ParameterFormatTest.class,



Mime
View raw message