sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683824 [5/7] - in /sis/branches/JDK6: ./ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metad...
Date Fri, 05 Jun 2015 17:46:10 GMT
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MismatchedMatrixSizeException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MismatchedMatrixSizeException.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MismatchedMatrixSizeException.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MismatchedMatrixSizeException.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -31,6 +31,9 @@ import org.opengis.geometry.MismatchedDi
  * @since   0.4
  * @version 0.4
  * @module
+ *
+ * @see org.opengis.geometry.MismatchedReferenceSystemException
+ * @see org.apache.sis.referencing.operation.MismatchedDatumException
  */
 public class MismatchedMatrixSizeException extends MismatchedDimensionException {
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -23,14 +23,14 @@ import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.logging.Level;
-import java.text.ParseException;
+import java.lang.reflect.Constructor;
 import javax.measure.quantity.Length;
 import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
 import javax.measure.converter.ConversionException;
 
-import org.opengis.metadata.Identifier;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
@@ -48,22 +48,21 @@ import org.opengis.util.NoSuchIdentifier
 
 import org.apache.sis.internal.util.LazySet;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.referencing.Pending;     // Temporary import.
+import org.apache.sis.internal.metadata.WKTParser;
 import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
 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.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Classes;
-import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.collection.WeakHashSet;
 import org.apache.sis.util.iso.AbstractFactory;
-import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Messages;
@@ -166,14 +165,6 @@ public class DefaultMathTransformFactory
      */
 
     /**
-     * The separator character between an identifier and its namespace in the argument given to
-     * {@link #getOperationMethod(String)}. For example this is the separator in {@code "EPSG:9807"}.
-     *
-     * This is defined as a constant for now, but we may make it configurable in a future version.
-     */
-    private static final char IDENTIFIER_SEPARATOR = DefaultNameSpace.DEFAULT_SEPARATOR;
-
-    /**
      * Minimal precision of ellipsoid semi-major and semi-minor axis lengths, in metres.
      * If the length difference between the axis of two ellipsoids is greater than this threshold,
      * we will report a mismatch. This is used for logging purpose only and do not have any impact
@@ -182,6 +173,14 @@ public class DefaultMathTransformFactory
     private static final double ELLIPSOID_PRECISION = Formulas.LINEAR_TOLERANCE;
 
     /**
+     * The constructor for WKT parsers, fetched when first needed. The WKT parser is defined in the
+     * same module than this class, so we will hopefully not have security issues.  But we have to
+     * use reflection because the parser class is not yet public (because we do not want to commit
+     * its API yet).
+     */
+    private static volatile Constructor<? extends WKTParser> parserConstructor;
+
+    /**
      * All methods specified at construction time or found on the classpath.
      * If the iterable is an instance of {@link ServiceLoader}, then it will
      * be reloaded when {@link #reload()} is invoked.
@@ -219,6 +218,13 @@ public class DefaultMathTransformFactory
     private final WeakHashSet<MathTransform> pool;
 
     /**
+     * The <cite>Well Known Text</cite> parser for {@code MathTransform} instances.
+     * This parser is not thread-safe, so we need to prevent two threads from using
+     * the same instance in same time.
+     */
+    private final AtomicReference<WKTParser> parser;
+
+    /**
      * Creates a new factory which will discover operation methods with a {@link ServiceLoader}.
      * The {@link OperationMethod} implementations shall be listed in the following file:
      *
@@ -288,6 +294,7 @@ public class DefaultMathTransformFactory
         methodsByType = new IdentityHashMap<Class<?>, OperationMethodSet>();
         lastMethod    = new ThreadLocal<OperationMethod>();
         pool          = new WeakHashSet<MathTransform>(MathTransform.class);
+        parser        = new AtomicReference<WKTParser>();
     }
 
     /**
@@ -353,33 +360,21 @@ public class DefaultMathTransformFactory
      * {@linkplain DefaultOperationMethod#isHeuristicMatchForName(String) heuristic}.</p>
      *
      * <p>If more than one method match the given identifier, then the first (according iteration order)
-     * non-{@linkplain Deprecable#isDeprecated() deprecated} matching method is returned. If all matching
-     * methods are deprecated, the first one is returned.</p>
+     * non-{@linkplain org.apache.sis.util.Deprecable#isDeprecated() deprecated} matching method is returned.
+     * If all matching methods are deprecated, the first one is returned.</p>
      *
      * @param  identifier The name or identifier of the operation method to search.
      * @return The coordinate operation method for the given name or identifier.
      * @throws NoSuchIdentifierException if there is no operation method registered for the specified identifier.
+     *
+     * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
      */
     public OperationMethod getOperationMethod(String identifier) throws NoSuchIdentifierException {
         identifier = CharSequences.trimWhitespaces(identifier);
         ArgumentChecks.ensureNonEmpty("identifier", identifier);
         OperationMethod method = methodsByName.get(identifier);
         if (method == null) {
-            for (final OperationMethod m : methods) {
-                if (matches(m, identifier)) {
-                    /*
-                     * Stop the iteration at the first non-deprecated method.
-                     * If we find only deprecated methods, take the first one.
-                     */
-                    final boolean isDeprecated = (m instanceof Deprecable) && ((Deprecable) m).isDeprecated();
-                    if (!isDeprecated || method == null) {
-                        method = m;
-                        if (!isDeprecated) {
-                            break;
-                        }
-                    }
-                }
-            }
+            method = ReferencingServices.getInstance().getOperationMethod(methods, identifier);
             if (method == null) {
                 throw new NoSuchIdentifierException(Errors.format(Errors.Keys.NoSuchOperationMethod_1, identifier), identifier);
             }
@@ -395,35 +390,6 @@ public class DefaultMathTransformFactory
     }
 
     /**
-     * Returns {@code true} if the name or an identifier of the given method matches the given {@code identifier}.
-     *
-     * This function is private and static for now, but we may consider to make it a protected member
-     * in a future SIS version in order to give users a chance to override the matching criterion.
-     * We don't do that yet because we would like to have at least one use case before doing so.
-     *
-     * @param  method     The method to test for a match.
-     * @param  identifier The name or identifier of the operation method to search.
-     * @return {@code true} if the given method is a match for the given identifier.
-     */
-    private static boolean matches(final OperationMethod method, final String identifier) {
-        if (IdentifiedObjects.isHeuristicMatchForName(method, identifier)) {
-            return true;
-        }
-        for (int s = identifier.indexOf(IDENTIFIER_SEPARATOR); s >= 0;
-                 s = identifier.indexOf(IDENTIFIER_SEPARATOR, s))
-        {
-            final String codespace = identifier.substring(0, s).trim();
-            final String code = identifier.substring(++s).trim();
-            for (final Identifier id : method.getIdentifiers()) {
-                if (codespace.equalsIgnoreCase(id.getCodeSpace()) && code.equalsIgnoreCase(id.getCode())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
      * Returns the default parameter values for a math transform using the given operation method.
      * The {@code method} argument is the name of any {@code OperationMethod} instance returned by
      * <code>{@link #getAvailableMethods(Class) getAvailableMethods}({@linkplain SingleOperation}.class)</code>.
@@ -628,8 +594,8 @@ public class DefaultMathTransformFactory
          */
         final Matrix swap1, swap3;
         try {
-            swap1 = CoordinateSystems.swapAndScaleAxes(baseCS, CoordinateSystems.normalize(baseCS));
-            swap3 = CoordinateSystems.swapAndScaleAxes(CoordinateSystems.normalize(derivedCS), derivedCS);
+            swap1 = CoordinateSystems.swapAndScaleAxes(baseCS, CoordinateSystems.replaceAxes(baseCS, AxesConvention.NORMALIZED));
+            swap3 = CoordinateSystems.swapAndScaleAxes(CoordinateSystems.replaceAxes(derivedCS, AxesConvention.NORMALIZED), derivedCS);
         } catch (IllegalArgumentException cause) {
             throw new FactoryException(cause);
         } catch (ConversionException cause) {
@@ -870,16 +836,26 @@ public class DefaultMathTransformFactory
     @Override
     public MathTransform createFromWKT(final String text) throws FactoryException {
         lastMethod.remove();
-        final Pending pending = Pending.getInstance();
-        try {
-            return pending.createFromWKT(this, text);
-        } catch (ParseException exception) {
-            final Throwable cause = exception.getCause();
-            if (cause instanceof FactoryException) {
-                throw (FactoryException) cause;
-            }
-            throw new FactoryException(exception);
+        WKTParser p = parser.getAndSet(null);
+        if (p == null) try {
+            Constructor<? extends WKTParser> c = parserConstructor;
+            if (c == null) {
+                c = Class.forName("org.apache.sis.io.wkt.MathTransformParser").asSubclass(WKTParser.class)
+                         .getConstructor(MathTransformFactory.class);
+                c.setAccessible(true);
+                parserConstructor = c;
+            }
+            p = c.newInstance(this);
+        } catch (Exception e) { // (ReflectiveOperationException) on JDK7 branch.
+            throw new FactoryException(e);
         }
+        /*
+         * No need to check the type of the parsed object, because MathTransformParser
+         * should return only instance of MathTransform.
+         */
+        final Object object = p.createFromWKT(text);
+        parser.set(p);
+        return (MathTransform) object;
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -20,9 +20,10 @@ import java.util.Collections;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.metadata.Identifier;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -35,16 +36,20 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final strictfp class CodeTest extends TestCase {
     /**
      * Tests the {@link Code#Code(Identifier)} constructor with {@code "EPSG:4326"} identifier.
+     * This test intentionally uses an identifier with the {@code IOGP} authority instead than
+     * EPSG in order to make sure that the {@code codeSpace} attribute is set from
+     * {@link Identifier#getCodeSpace()}, not from {@link Identifier#getAuthority()}.
      */
     @Test
     public void testSimple() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326");
+        final SimpleCitation IOGP = new SimpleCitation("IOGP");
+        final Identifier id = new ImmutableIdentifier(IOGP, "EPSG", "4326");  // See above javadoc.
         final Code value = new Code(id);
         assertEquals("codeSpace", "EPSG", value.codeSpace);
         assertEquals("code",      "4326", value.code);
@@ -61,11 +66,14 @@ public final strictfp class CodeTest ext
 
     /**
      * Tests the {@link Code#Code(Identifier)} constructor with {@code "EPSG:8.3:4326"} identifier.
+     * This test intentionally uses an identifier with the {@code IOGP} authority instead than EPSG
+     * for the same reason than {@link #testSimple()}.
      */
     @Test
     @DependsOnMethod("testSimple")
     public void testWithVersion() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326", "8.2", null);
+        final SimpleCitation IOGP = new SimpleCitation("IOGP");
+        final Identifier id = new ImmutableIdentifier(IOGP, "EPSG", "4326", "8.2", null);  // See above javadoc.
         final Code value = new Code(id);
         assertEquals("codeSpace", "EPSG:8.2", value.codeSpace);
         assertEquals("code",      "4326",     value.code);
@@ -86,7 +94,7 @@ public final strictfp class CodeTest ext
     @Test
     @DependsOnMethod("testWithVersion")
     public void testForIdentifiedObject() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326", "8.2", null);
+        final Identifier id = new ImmutableIdentifier(Citations.EPSG, "EPSG", "4326", "8.2", null);
         final Code value = Code.forIdentifiedObject(GeographicCRS.class, Collections.singleton(id));
         assertNotNull(value);
         assertEquals("codeSpace", Constants.IOGP, value.codeSpace);
@@ -94,9 +102,26 @@ public final strictfp class CodeTest ext
     }
 
     /**
+     * Tests {@link Code#forIdentifiedObject(Class, Iterable)} with the legacy "OGP" codespace
+     * (instead of "IOGP").
+     */
+    @Test
+    @DependsOnMethod("testForIdentifiedObject")
+    public void testLegacyCodeSpace() {
+        final DefaultCitation authority = new DefaultCitation("EPSG");
+        authority.getIdentifiers().add(new ImmutableIdentifier(null, "OGP", "EPSG"));
+
+        final Identifier id = new ImmutableIdentifier(authority, "EPSG", "4326", "8.2", null);
+        final Code value = Code.forIdentifiedObject(GeographicCRS.class, Collections.singleton(id));
+        assertNotNull(value);
+        assertEquals("codeSpace", "OGP", value.codeSpace);
+        assertEquals("code", "urn:ogc:def:crs:EPSG:8.2:4326", value.code);
+    }
+
+    /**
      * Tests {@link Code#getIdentifier()} with {@code "urn:ogc:def:crs:EPSG:8.2:4326"}.
-     * This test simulate the {@code Code} object state that we get after
-     * XML unmarshalling of an object from the EPSG registry.
+     * This test simulates the {@code Code} object state that we get after XML unmarshalling
+     * of an object from the EPSG registry.
      */
     @Test
     @DependsOnMethod("testForIdentifiedObject")
@@ -105,7 +130,7 @@ public final strictfp class CodeTest ext
         value.codeSpace = "OGP";
         value.code = "urn:ogc:def:crs:EPSG:8.2:4326";
         final Identifier actual = value.getIdentifier();
-        assertSame  ("authority",  Citations.OGP, actual.getAuthority());
+        assertSame  ("authority",  Citations.EPSG, actual.getAuthority());
         assertEquals("codeSpace", "EPSG", actual.getCodeSpace());
         assertEquals("version",   "8.2",  actual.getVersion());
         assertEquals("code",      "4326", actual.getCode());

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -18,6 +18,8 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.referencing.cs.HardCodedAxes;
 import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -33,7 +35,7 @@ import static org.opengis.referencing.cs
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final strictfp class AxisDirectionsTest extends TestCase {
@@ -357,4 +359,18 @@ public final strictfp class AxisDirectio
                 HardCodedCS.GEODETIC_3D,
                 HardCodedCS.DAYS));
     }
+
+    /**
+     * Tests {@link AxisDirections#appendTo(StringBuilder, CoordinateSystemAxis[])}.
+     *
+     * @since 0.6
+     */
+    @Test
+    public void testAppendTo() {
+        final StringBuilder buffer = new StringBuilder("Compound CS");
+        final String name = AxisDirections.appendTo(buffer, new CoordinateSystemAxis[] {
+            HardCodedAxes.EASTING, HardCodedAxes.NORTHING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME
+        });
+        assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).", name);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -83,7 +83,7 @@ public final strictfp class AffineTest e
         final Matrix matrix = Matrices.createDiagonal(3, 3);
         assertWktEquals(
                 "ParameterGroup[“Affine parametric transformation”," +
-                " Id[“EPSG”, 9624, Citation[“IOGP”]]]", Affine.parameters(matrix));
+                " Id[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Try arbitrary values.
          */
@@ -95,7 +95,7 @@ public final strictfp class AffineTest e
                 "  Parameter[“A1”, 2.0, Id[“EPSG”, 8624]],\n"  +
                 "  Parameter[“B1”, 0.0, Id[“EPSG”, 8640]],\n" +
                 "  Parameter[“B2”, -1.0, Id[“EPSG”, 8641]],\n" +
-                "  Id[“EPSG”, 9624, Citation[“IOGP”]]]", Affine.parameters(matrix));
+                "  Id[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Setting a value on the last row make the matrix non-affine.
          * So it should not be anymore EPSG:9624.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -203,7 +203,7 @@ public final strictfp class DefaultParam
          * but is reproduced here for easier comparison with the test following it.
          */
         final DefaultParameterDescriptor<Double> descriptor = DefaultParameterDescriptorTest.createEPSG("A0", Constants.A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”], URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
         /*
          * When the parameter is part of a larger element, we expect a simplification.
          * Here, the URI should be omitted because it is a long value which does not
@@ -212,7 +212,7 @@ public final strictfp class DefaultParam
         final DefaultParameterDescriptorGroup group = new DefaultParameterDescriptorGroup(
                 Collections.singletonMap(NAME_KEY, "Affine"), 1, 1, descriptor);
         assertWktEquals("ParameterGroup[“Affine”,\n" +
-                        "  Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”]]]]", group);
+                        "  Parameter[“A0”, Id[“EPSG”, 8623]]]", group);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -26,7 +26,7 @@ import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -147,7 +147,7 @@ public final strictfp class DefaultParam
     public static DefaultParameterDescriptor<Double> createEPSG(final String name, final short code) {
         final Map<String, Object> properties = properties(name);
         assertNull(properties.put(DefaultParameterDescriptor.IDENTIFIERS_KEY,
-                new ImmutableIdentifier(HardCodedCitations.IOGP, Constants.EPSG, Short.toString(code))));
+                new ImmutableIdentifier(Citations.EPSG, Constants.EPSG, Short.toString(code))));
         return new DefaultParameterDescriptor<Double>(properties, 0, 1, Double.class, null, null, null);
     }
 
@@ -323,6 +323,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final DefaultParameterDescriptor<Double> descriptor = createEPSG("A0", Constants.A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”], URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -604,6 +604,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final Watcher<Double> parameter = new Watcher<Double>(DefaultParameterDescriptorTest.createEPSG("A0", Constants.A0));
-        assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623, Citation[“IOGP”]]]", parameter);
+        assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623]]", parameter);
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -21,7 +21,7 @@ import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.util.GenericName;
 import org.opengis.parameter.ParameterDescriptor;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -79,11 +79,11 @@ public final strictfp class ParameterBui
     @DependsOnMethod("testCreate")
     public void testMercatorProjection() {
         final ParameterBuilder builder = new ParameterBuilder();
-        builder.setCodeSpace(HardCodedCitations.IOGP, "EPSG").setRequired(true);
+        builder.setCodeSpace(Citations.EPSG, "EPSG").setRequired(true);
         final ParameterDescriptor<?>[] parameters = {
             builder.addName("Longitude of natural origin")
-                   .addName(HardCodedCitations.OGC, "central_meridian")
-                   .addName(HardCodedCitations.GEOTIFF, "NatOriginLong")
+                   .addName(Citations.OGC, "central_meridian")
+                   .addName(Citations.GEOTIFF, "NatOriginLong")
                    .setRemarks("Some remarks.")               .createBounded(-180, +180, 0, NonSI.DEGREE_ANGLE),
             builder.addName("Latitude of natural origin")     .createBounded( -80,  +84, 0, NonSI.DEGREE_ANGLE),
             builder.addName("Scale factor at natural origin") .createStrictlyPositive(1, Unit.ONE),

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -35,8 +35,8 @@ import org.junit.AfterClass;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.OGC;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.IOGP;
+import static org.apache.sis.metadata.iso.citation.Citations.OGC;
+import static org.apache.sis.metadata.iso.citation.Citations.EPSG;
 
 
 /**
@@ -62,7 +62,7 @@ public final strictfp class ParameterFor
     @BeforeClass
     public static void createParameterDescriptor() {
         ParameterBuilder builder = new ParameterBuilder();
-        builder.setCodeSpace(IOGP, "EPSG").setRequired(true);
+        builder.setCodeSpace(EPSG, "EPSG").setRequired(true);
         ParameterDescriptor<?>[] parameters = {
             builder.addName("Latitude of natural origin")      .addName(OGC, "latitude_of_origin").createBounded( -80,  +84,  40, NonSI.DEGREE_ANGLE),
             builder.addName("Longitude of natural origin")     .addName(OGC, "central_meridian")  .createBounded(-180, +180, -60, NonSI.DEGREE_ANGLE),

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -20,6 +20,7 @@ import java.util.Set;
 import java.util.Collection;
 import java.util.Collections;
 import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDirection;
 import org.opengis.parameter.ParameterValue;
@@ -27,12 +28,12 @@ import org.opengis.parameter.ParameterVa
 import org.opengis.metadata.Identifier;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
-import javax.measure.unit.Unit;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.apache.sis.test.TestUtilities;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -135,28 +136,55 @@ public final strictfp class ParametersTe
 
     /**
      * Tests {@link Parameters#copy(ParameterValueGroup, ParameterValueGroup)}.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-202">SIS-202</a>
      */
     @Test
     public void testCopy() {
-        final ParameterValueGroup source = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
-        final ParameterValue<?> o1 = source.parameter("Optional 4");
+        /*
+         * The descriptor to be used for this test. This descriptor contain at least
+         * one subgroup, for testing the Parameters.copy(...) method recursivity.
+         */
+        final String subgroupName = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.getName().getCode();
+        final DefaultParameterDescriptorGroup descriptor = new DefaultParameterDescriptorGroup(
+                Collections.singletonMap(DefaultParameterDescriptorGroup.NAME_KEY, "parent"), 1, 1,
+                DefaultParameterDescriptorTest.createSimpleOptional("A parent parameter", String.class),
+                DefaultParameterDescriptorGroupTest.M1_M1_O1_O2);
+        /*
+         * Create the parameter value to copy. We set some values, but intentionally not all of them.
+         * The unset values will be used for verifying that they do not overwrite destination values.
+         */
+        final ParameterValueGroup source = descriptor.createValue();
+        final ParameterValueGroup sourceSubgroup = source.addGroup(subgroupName);
+        final ParameterValue<?> o1 = sourceSubgroup.parameter("Optional 4");
         final ParameterValue<?> o2 = o1.getDescriptor().createValue(); // See ParameterFormatTest.testMultiOccurrence()
-        source.parameter("Mandatory 2").setValue(20);
-        source.values().add(o2);
+        sourceSubgroup.parameter("Mandatory 2").setValue(20);
+        sourceSubgroup.values().add(o2);
         o1.setValue(40);
         o2.setValue(50);
-
-        final ParameterValueGroup destination = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
-        destination.parameter("Mandatory 1").setValue(-10);  // We expect this value to be overwritten.
-        destination.parameter("Optional 3") .setValue( 30);  // We expect this value to be preserved.
-        Parameters.copy(source, destination);
-
-        assertEquals("Mandatory 1", 10, destination.parameter("Mandatory 1").intValue());
-        assertEquals("Mandatory 2", 20, destination.parameter("Mandatory 2").intValue());
-        assertEquals("Optional 3",  30, destination.parameter("Optional 3") .intValue());
-        assertEquals("Optional 4",  40, destination.parameter("Optional 4") .intValue());
+        source.parameter("A parent parameter").setValue("A value from the source");
+        /*
+         * Create the parameter to use as the destination. We put some value in those parameters in order to
+         * verify that those values are overwritten (only those for which the value is set in the source).
+         */
+        final ParameterValueGroup target = descriptor.createValue();
+        final ParameterValueGroup targetSubgroup = target.addGroup(subgroupName);
+        targetSubgroup.parameter("Mandatory 1").setValue(-10);  // We expect this value to be overwritten.
+        targetSubgroup.parameter("Optional 3") .setValue( 30);  // We expect this value to be preserved.
+        target.parameter("A parent parameter") .setValue("A value to be overwritten");
+        /*
+         * The actual test.
+         */
+        Parameters.copy(source, target);
+        assertSame(sourceSubgroup, TestUtilities.getSingleton(source.groups(subgroupName)));
+        assertSame(targetSubgroup, TestUtilities.getSingleton(target.groups(subgroupName)));
+        assertEquals("A value from the source", target.parameter("A parent parameter").getValue());
+        assertEquals("Mandatory 1", 10, targetSubgroup.parameter("Mandatory 1").intValue());
+        assertEquals("Mandatory 2", 20, targetSubgroup.parameter("Mandatory 2").intValue());
+        assertEquals("Optional 3",  30, targetSubgroup.parameter("Optional 3") .intValue());
+        assertEquals("Optional 4",  40, targetSubgroup.parameter("Optional 4") .intValue());
         assertEquals("Optional 4 (second occurrence)", 50,
-                ((ParameterValue<?>) destination.values().get(4)).intValue());
+                ((ParameterValue<?>) targetSubgroup.values().get(4)).intValue());
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -34,7 +34,7 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
+import static org.apache.sis.metadata.iso.citation.Citations.EPSG;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -22,7 +22,7 @@ import java.util.Locale;
 import org.opengis.test.Validators;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
@@ -101,7 +101,7 @@ public final strictfp class AbstractRefe
         assertNull(properties.put(SCOPE_KEY, "Large scale topographic mapping and cadastre."));
         assertNull(properties.put(REMARKS_KEY, "注です。"));
         assertNull(properties.put(IDENTIFIERS_KEY, new ImmutableIdentifier(
-                HardCodedCitations.IOGP, "EPSG", "4326", "8.2", null)));
+                Citations.EPSG, "EPSG", "4326", "8.2", null)));
         assertNull(properties.put(DOMAIN_OF_VALIDITY_KEY, new DefaultExtent("Netherlands offshore.",
                 new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77),
                 new DefaultVerticalExtent(10, 1000, VerticalCRSMock.DEPTH),
@@ -122,7 +122,7 @@ public final strictfp class AbstractRefe
                 "  Area[“Netherlands offshore.”],\n" +
                 "  BBox[51.43, 2.54, 55.77, 6.40],\n" +
                 "  VerticalExtent[-1000, -10, LengthUnit[“metre”, 1]],\n" +
-                "  Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”], URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
+                "  Id[“EPSG”, 4326, “8.2”, URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
                 "  Remarks[“注です。”]]",
                 object);
 
@@ -132,7 +132,7 @@ public final strictfp class AbstractRefe
                 "  Area[“Netherlands offshore.”],\n" +
                 "  BBox[51.43, 2.54, 55.77, 6.40],\n" +
                 "  VerticalExtent[-1000, -10],\n" +
-                "  Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”], URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
+                "  Id[“EPSG”, 4326, “8.2”, URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
                 "  Remarks[“注です。”]]",
                 object);
 
@@ -142,7 +142,7 @@ public final strictfp class AbstractRefe
                 "  Area[“Netherlands offshore.”],\n" +
                 "  BBox[51.43, 2.54, 55.77, 6.40],\n" +
                 "  VerticalExtent[-1000, -10],\n" +
-                "  Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”]],\n" +
+                "  Id[“EPSG”, 4326, “8.2”],\n" +
                 "  Remarks[“注です。”]]",
                 object);
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -23,15 +23,16 @@ import org.opengis.util.GenericName;
 import org.opengis.util.NameFactory;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.Identifier;
+import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.*;
 
 
 /**
@@ -66,15 +67,16 @@ public final strictfp class BuilderTest
     @Test
     public void testSetCodeSpace() {
         final BuilderMock builder = new BuilderMock();
-        builder.setCodeSpace(IOGP, "EPSG");
+        builder.setCodeSpace(Citations.EPSG, "EPSG");
         builder.addName("Mercator (variant A)");
         /*
          * Setting the same codespace should have no effect, while attempt to
          * set a new codespace after we added a name shall not be allowed.
          */
-        builder.setCodeSpace(IOGP, "EPSG");
+        final SimpleCitation IOGP = new SimpleCitation("IOGP");
+        builder.setCodeSpace(Citations.EPSG, "EPSG");
         try {
-            builder.setCodeSpace(EPSG, "EPSG");
+            builder.setCodeSpace(IOGP, "EPSG");
             fail("Setting a different codespace shall not be allowed.");
         } catch (IllegalStateException e) {
             final String message = e.getMessage();
@@ -83,18 +85,18 @@ public final strictfp class BuilderTest
         /*
          * The failed attempt to set a new codespace shall not have modified builder state.
          */
-        assertEquals("EPSG", builder.properties.get(Identifier.CODESPACE_KEY));
-        assertSame  (IOGP,   builder.properties.get(Identifier.AUTHORITY_KEY));
+        assertEquals("EPSG",         builder.properties.get(Identifier.CODESPACE_KEY));
+        assertSame  (Citations.EPSG, builder.properties.get(Identifier.AUTHORITY_KEY));
         /*
          * After a cleanup (normally after a createXXX(…) method call), user shall be allowed to
          * set a new codespace again. Note that the cleanup operation shall not clear the codespace.
          */
         builder.onCreate(true);
+        assertEquals("EPSG",         builder.properties.get(Identifier.CODESPACE_KEY));
+        assertSame  (Citations.EPSG, builder.properties.get(Identifier.AUTHORITY_KEY));
+        builder.setCodeSpace(IOGP, "EPSG");
         assertEquals("EPSG", builder.properties.get(Identifier.CODESPACE_KEY));
-        assertSame  (IOGP,   builder.properties.get(Identifier.AUTHORITY_KEY));
-        builder.setCodeSpace(EPSG, "EPSG");
-        assertEquals("EPSG", builder.properties.get(Identifier.CODESPACE_KEY));
-        assertSame  ( EPSG,  builder.properties.get(Identifier.AUTHORITY_KEY));
+        assertSame  ( IOGP,  builder.properties.get(Identifier.AUTHORITY_KEY));
     }
 
     /**
@@ -137,16 +139,16 @@ public final strictfp class BuilderTest
      */
     private static BuilderMock createMercator(final boolean withNames, final boolean withIdentifiers) {
         final BuilderMock builder = new BuilderMock();
-        assertSame(builder, builder.setCodeSpace(IOGP, "EPSG"));
+        assertSame(builder, builder.setCodeSpace(Citations.EPSG, "EPSG"));
         if (withNames) {
-            assertSame(builder, builder.addName(         "Mercator (variant A)")); // EPSG version 7.6 and later.
-            assertSame(builder, builder.addName(         "Mercator (1SP)"));       // EPSG before version 7.6.
-            assertSame(builder, builder.addName(OGC,     "Mercator_1SP"));
-            assertSame(builder, builder.addName(GEOTIFF, "CT_Mercator"));
+            assertSame(builder, builder.addName(                   "Mercator (variant A)")); // EPSG version 7.6 and later.
+            assertSame(builder, builder.addName(                   "Mercator (1SP)"));       // EPSG before version 7.6.
+            assertSame(builder, builder.addName(Citations.OGC,     "Mercator_1SP"));
+            assertSame(builder, builder.addName(Citations.GEOTIFF, "CT_Mercator"));
         }
         if (withIdentifiers) {
-            assertSame(builder, builder.addIdentifier(      "9804"));
-            assertSame(builder, builder.addIdentifier(GEOTIFF, "7"));
+            assertSame(builder, builder.addIdentifier(                "9804"));
+            assertSame(builder, builder.addIdentifier(Citations.GEOTIFF, "7"));
         }
         builder.onCreate(false);
         return builder;
@@ -163,8 +165,8 @@ public final strictfp class BuilderTest
         // Expected values to be used later in the test.
         final String      name   = "Mercator (variant A)";
         final GenericName alias1 = factory.createLocalName(scope(factory, "EPSG"), "Mercator (1SP)");
-        final GenericName alias2 = new NamedIdentifier(OGC,     "Mercator_1SP");
-        final GenericName alias3 = new NamedIdentifier(GEOTIFF, "CT_Mercator");
+        final GenericName alias2 = new NamedIdentifier(Citations.OGC,     "Mercator_1SP");
+        final GenericName alias3 = new NamedIdentifier(Citations.GEOTIFF, "CT_Mercator");
         assertTrue ("That name should not have a scope.", alias3.scope().isGlobal());
         assertTrue ("That name should not have a scope.", alias2.scope().isGlobal());
         assertFalse("That name should be in EPSG scope.", alias1.scope().isGlobal());
@@ -187,14 +189,13 @@ public final strictfp class BuilderTest
     }
 
     /**
-     * Tests {@link Builder#addIdentifier(Citation, String)} and {@link Builder#addIdentifier(String)}
-     * with codespace.
+     * Tests {@link Builder#addIdentifier(Citation, String)} and {@link Builder#addIdentifier(String)} with code space.
      */
     @Test
     public void testAddIdentifiers() {
         // Expected values to be used later in the test.
-        final Identifier id1 = new ImmutableIdentifier(IOGP,     "EPSG",    "9804");
-        final Identifier id2 = new ImmutableIdentifier(GEOTIFF, "GeoTIFF", "7");
+        final Identifier id1 = new ImmutableIdentifier(Citations.EPSG,    "EPSG", "9804");
+        final Identifier id2 = new ImmutableIdentifier(Citations.GEOTIFF, "GeoTIFF", "7");
         assertEquals("EPSG:9804", IdentifiedObjects.toString(id1));
         assertEquals("GeoTIFF:7", IdentifiedObjects.toString(id2));
 
@@ -217,12 +218,14 @@ public final strictfp class BuilderTest
         for (final Map.Entry<String,?> entry : builder.properties.entrySet()) {
             final Object value = entry.getValue();
             final String key = entry.getKey();
-            if (key.equals(Identifier.AUTHORITY_KEY)) {
-                assertSame("Authority and codespace shall be unchanged.", IOGP, value);
-            } else if (key.equals(Identifier.CODESPACE_KEY)) {
-                assertEquals("Authority and codespace shall be unchanged.", "EPSG", value);
-            } else {
-                assertNull("Should not contain any non-null value except the authority.", value);
+            { // This is a switch(String) in the JDK7 branch.
+                if (key.equals(Identifier.AUTHORITY_KEY)) {
+                    assertSame("Authority and codespace shall be unchanged.", Citations.EPSG, value);
+                } else if (key.equals(Identifier.CODESPACE_KEY)) {
+                    assertEquals("Authority and codespace shall be unchanged.", "EPSG", value);
+                } else {
+                    assertNull("Should not contain any non-null value except the authority.", value);
+                }
             }
         }
         assertSame(builder, builder.addNamesAndIdentifiers(object));
@@ -243,7 +246,7 @@ public final strictfp class BuilderTest
         final BuilderMock builder = createMercator(true, false);
 
         // Replace "OGC:Mercator_1SP" and insert a new OGC code before the GeoTIFF one.
-        assertSame(builder, builder.rename(OGC, "Replacement 1", "Replacement 2"));
+        assertSame(builder, builder.rename(Citations.OGC, "Replacement 1", "Replacement 2"));
         builder.onCreate(false);
         assertArrayEquals(new String[] {
             "Mercator (variant A)",
@@ -254,7 +257,7 @@ public final strictfp class BuilderTest
         }, builder.getAsStrings(1));
 
         // Replace "EPSG:Mercator (variant A)" and "(1SP)", and insert a new EPSG code as an alias.
-        assertSame(builder, builder.rename(IOGP, "Replacement 3", "Replacement 4", "Replacement 5"));
+        assertSame(builder, builder.rename(Citations.EPSG, "Replacement 3", "Replacement 4", "Replacement 5"));
         builder.onCreate(false);
         assertArrayEquals(new String[] {
             "Replacement 3",
@@ -266,7 +269,7 @@ public final strictfp class BuilderTest
         }, builder.getAsStrings(1));
 
         // Remove all EPSG codes.
-        assertSame(builder, builder.rename(IOGP, (String[]) null));
+        assertSame(builder, builder.rename(Citations.EPSG, (String[]) null));
         builder.onCreate(false);
         assertArrayEquals(new String[] {
             "OGC:Replacement 1",

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -30,7 +30,7 @@ import org.opengis.referencing.cs.Ellips
 import org.opengis.referencing.datum.TemporalDatum;
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
-import org.apache.sis.internal.referencing.VerticalDatumTypes;
+import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -23,6 +23,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.NameFactory;
 import org.opengis.metadata.Identifier;
 import org.opengis.test.Validators;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.iso.DefaultInternationalString;
 import org.apache.sis.test.DependsOnMethod;
@@ -30,8 +31,6 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.IOGP;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
 
 
 /**
@@ -49,16 +48,16 @@ public final strictfp class NamedIdentif
      */
     @Test
     public void testCreateFromCode() {
-        final NamedIdentifier identifier = new NamedIdentifier(IOGP, "EPSG", "4326", "8.3", null);
+        final NamedIdentifier identifier = new NamedIdentifier(Citations.EPSG, "EPSG", "4326", "8.3", null);
         Validators.validate((Identifier)  identifier);
         Validators.validate((GenericName) identifier);
 
         // ImmutableIdentifier properties
-        assertEquals("code",      "4326", identifier.getCode());
-        assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
-        assertSame  ("authority",  IOGP,  identifier.getAuthority());
-        assertEquals("version",   "8.3",  identifier.getVersion());
-        assertNull  ("description",       identifier.getDescription());
+        assertEquals("code",       "4326",         identifier.getCode());
+        assertEquals("codeSpace",  "EPSG",         identifier.getCodeSpace());
+        assertSame  ("authority",  Citations.EPSG, identifier.getAuthority());
+        assertEquals("version",    "8.3",          identifier.getVersion());
+        assertNull  ("description",                identifier.getDescription());
 
         // NamedIdentifier properties
         assertEquals("depth",  2,          identifier.depth());
@@ -82,7 +81,7 @@ public final strictfp class NamedIdentif
         // ImmutableIdentifier properties
         assertEquals("code",      "4326", identifier.getCode());
         assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
-        assertEquals("authority", "IOGP", identifier.getAuthority().getTitle().toString());
+        assertEquals("authority", "OGP",  Citations.getIdentifier(identifier.getAuthority()));  // May change after resolution of SIS-200.
         assertNull  ("version",           identifier.getVersion());
         assertNull  ("description",       identifier.getDescription());
 
@@ -104,7 +103,7 @@ public final strictfp class NamedIdentif
         i18n.add(Locale.ENGLISH,  "name");
         i18n.add(Locale.FRENCH,   "nom");
         i18n.add(Locale.JAPANESE, "名前");
-        return new NamedIdentifier(EPSG, i18n);
+        return new NamedIdentifier(Citations.EPSG, i18n);
     }
 
     /**
@@ -118,11 +117,11 @@ public final strictfp class NamedIdentif
         Validators.validate((GenericName) identifier);
 
         // ImmutableIdentifier properties
-        assertEquals("code",      "name", identifier.getCode());
-        assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
-        assertSame  ("authority",  EPSG,  identifier.getAuthority());
-        assertNull  ("version",           identifier.getVersion());
-        assertNull  ("description",       identifier.getDescription());
+        assertEquals("code",      "name",         identifier.getCode());
+        assertEquals("codeSpace", "EPSG",         identifier.getCodeSpace());
+        assertSame  ("authority", Citations.EPSG, identifier.getAuthority());
+        assertNull  ("version",                   identifier.getVersion());
+        assertNull  ("description",               identifier.getDescription());
 
         // NamedIdentifier properties
         assertEquals("depth",  2,          identifier.depth());
@@ -142,7 +141,7 @@ public final strictfp class NamedIdentif
     @Test
     @DependsOnMethod("testCreateFromInternationalString")
     public void testSerialization() {
-        NamedIdentifier unserial = assertSerializedEquals(new NamedIdentifier(EPSG, "4326"));
+        NamedIdentifier unserial = assertSerializedEquals(new NamedIdentifier(Citations.EPSG, "4326"));
         assertEquals("EPSG:4326", unserial.toInternationalString().toString(Locale.ENGLISH));
         /*
          * Try again with an international string. We would not been able to get back the

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -95,7 +95,7 @@ public final strictfp class DefaultDeriv
      * Its purpose is only to perform easy tests.
      */
     private static DefaultDerivedCRS createLongitudeRotation() {
-        final DefaultConversion conversion = DefaultConversionTest.createLongitudeRotation();
+        final DefaultConversion conversion = DefaultConversionTest.createLongitudeRotation(false);
         return new DefaultDerivedCRS(Collections.singletonMap(DefaultDerivedCRS.NAME_KEY, conversion.getTargetCRS().getName()),
                 (SingleCRS) conversion.getSourceCRS(), conversion, HardCodedCS.GEODETIC_φλ);
     }
@@ -173,7 +173,7 @@ public final strictfp class DefaultDeriv
                 "      Ellipsoid[“NTF”, 6378249.2, 293.4660212936269, LengthUnit[“metre”, 1]]],\n" +
                 "      PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”, 0.015707963267948967]]],\n" +
                 "  DerivingConversion[“Paris to Greenwich”,\n" +
-                "    Method[“Longitude rotation”, Id[“EPSG”, 9601, Citation[“IOGP”]]],\n" +
+                "    Method[“Longitude rotation”, Id[“EPSG”, 9601]],\n" +
                 "    Parameter[“Longitude offset”, 2.33722917, Id[“EPSG”, 8602]]],\n" +
                 "  CS[“ellipsoidal”, 2],\n" +
                 "    Axis[“Latitude (B)”, north, Order[1]],\n" +

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -120,7 +120,7 @@ public final strictfp class DefaultProje
                 "      Ellipsoid[“NTF”, 6378249.2, 293.4660212936269, LengthUnit[“metre”, 1]]],\n" +
                 "      PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”, 0.015707963267948967]]],\n" +
                 "  Conversion[“Lambert zone II”,\n" +
-                "    Method[“Lambert Conic Conformal (1SP)”, Id[“EPSG”, 9801, Citation[“IOGP”]]],\n" +
+                "    Method[“Lambert Conic Conformal (1SP)”, Id[“EPSG”, 9801]],\n" +
                 "    Parameter[“Latitude of natural origin”, 52.0, AngleUnit[“grade”, 0.015707963267948967], Id[“EPSG”, 8801]],\n" +
                 "    Parameter[“Longitude of natural origin”, 0.0, AngleUnit[“degree”, 0.017453292519943295], Id[“EPSG”, 8802]],\n" +
                 "    Parameter[“Scale factor at natural origin”, 0.99987742, ScaleUnit[“unity”, 1], Id[“EPSG”, 8805]],\n" +
@@ -130,7 +130,7 @@ public final strictfp class DefaultProje
                 "    Axis[“Easting (E)”, east, Order[1]],\n" +
                 "    Axis[“Northing (N)”, north, Order[2]],\n" +
                 "    LengthUnit[“metre”, 1],\n" +
-                "  Id[“EPSG”, 27572, Citation[“IOGP”], URI[“urn:ogc:def:crs:EPSG::27572”]]]",
+                "  Id[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]",
                 crs);
     }
 

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -17,11 +17,17 @@
 package org.apache.sis.referencing.cs;
 
 import javax.measure.unit.SI;
+import javax.measure.unit.NonSI;
+import javax.measure.unit.Unit;
 import javax.measure.converter.ConversionException;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.VerticalCS;
 import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.measure.Units;
 import org.apache.sis.measure.Angle;
 import org.apache.sis.measure.ElevationAngle;
 import org.apache.sis.test.DependsOnMethod;
@@ -42,12 +48,13 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (IRD)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn({
     org.apache.sis.internal.referencing.AxisDirectionsTest.class,
-    DirectionAlongMeridianTest.class
+    DirectionAlongMeridianTest.class,
+    NormalizerTest.class
 })
 public final strictfp class CoordinateSystemsTest extends TestCase {
     /**
@@ -264,4 +271,62 @@ public final strictfp class CoordinateSy
                 0,     0,   0,   1
         }), matrix, STRICT);
     }
+
+    /**
+     * Tests {@link CoordinateSystems#replaceAxes(CoordinateSystem, AxisFilter)}
+     * without change of coordinate system type.
+     */
+    @Test
+    public void testReplaceAxes() {
+        final EllipsoidalCS    sourceCS = HardCodedCS.GEODETIC_3D;
+        final EllipsoidalCS    targetCS = HardCodedCS.ELLIPSOIDAL_gon;  // What we want to get.
+        final CoordinateSystem actualCS = CoordinateSystems.replaceAxes(sourceCS, new AxisFilter() {
+            @Override
+            public boolean accept(final CoordinateSystemAxis axis) {
+                return Units.isAngular(axis.getUnit());
+            }
+
+            @Override
+            public Unit<?> getUnitReplacement(Unit<?> unit) {
+                if (Units.isAngular(unit)) {
+                    unit = NonSI.GRADE;
+                }
+                return unit;
+            }
+
+            @Override
+            public AxisDirection getDirectionReplacement(final AxisDirection direction) {
+                return direction;
+            }
+        });
+        assertEqualsIgnoreMetadata(targetCS, actualCS);
+    }
+
+    /**
+     * Tests {@link CoordinateSystems#replaceAxes(CoordinateSystem, AxisFilter)}
+     * with a change of coordinate system type.
+     */
+    @Test
+    @DependsOnMethod("testReplaceAxes")
+    public void testReplaceAxesWithTypeChange() {
+        final EllipsoidalCS    sourceCS = HardCodedCS.GEODETIC_3D;
+        final VerticalCS       targetCS = HardCodedCS.ELLIPSOIDAL_HEIGHT;   // What we want to get.
+        final CoordinateSystem actualCS = CoordinateSystems.replaceAxes(sourceCS, new AxisFilter() {
+            @Override
+            public boolean accept(final CoordinateSystemAxis axis) {
+                return Units.isLinear(axis.getUnit());
+            }
+
+            @Override
+            public Unit<?> getUnitReplacement(final Unit<?> unit) {
+                return unit;
+            }
+
+            @Override
+            public AxisDirection getDirectionReplacement(final AxisDirection direction) {
+                return direction;
+            }
+        });
+        assertEqualsIgnoreMetadata(targetCS, actualCS);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -215,9 +215,9 @@ public final strictfp class DefaultCarte
         final CoordinateSystemAxis N = cs.getAxis(1);
         assertEquals("name",    "Easting, northing (E,N)", cs.getName().getCode());
         assertEquals("remarks", "Used in ProjectedCRS.", cs.getRemarks().toString());
-        assertIdentifierEquals(        "identifier", "IOGP", "EPSG", null, "4400", getSingleton(cs.getIdentifiers()));
-        assertIdentifierEquals("axis[0].identifier", "IOGP", "EPSG", null, "1",    getSingleton(E.getIdentifiers()));
-        assertIdentifierEquals("axis[1].identifier", "IOGP", "EPSG", null, "2",    getSingleton(N.getIdentifiers()));
+        assertIdentifierEquals(        "identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "4400", getSingleton(cs.getIdentifiers()));
+        assertIdentifierEquals("axis[0].identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "1",    getSingleton(E.getIdentifiers()));
+        assertIdentifierEquals("axis[1].identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "2",    getSingleton(N.getIdentifiers()));
         /*
          * Marshal and compare with the original file.
          */

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -16,7 +16,8 @@
  */
 package org.apache.sis.referencing.cs;
 
-import org.opengis.referencing.cs.CoordinateSystemAxis;
+import java.util.Collections;
+import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -28,19 +29,22 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
+@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
 public final strictfp class DefaultCompoundCSTest extends TestCase {
     /**
-     * Tests {@link DefaultCompoundCS#createName(StringBuilder, CoordinateSystemAxis[])}.
+     * Tests {@link DefaultCompoundCS} construction.
      */
     @Test
-    public void testCreateName() {
-        final StringBuilder buffer = new StringBuilder("Compound CS");
-        final String name = DefaultCompoundCS.createName(buffer, new CoordinateSystemAxis[] {
-            HardCodedAxes.EASTING, HardCodedAxes.NORTHING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME
-        });
-        assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).", name);
+    public void testConstruction() {
+        final DefaultCompoundCS cs = new DefaultCompoundCS(
+                HardCodedCS.PROJECTED,
+                new DefaultVerticalCS(Collections.singletonMap(DefaultVerticalCS.NAME_KEY,
+                        HardCodedAxes.HEIGHT_cm.getName()), HardCodedAxes.HEIGHT_cm),
+                HardCodedCS.DAYS
+        );
+        assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).", cs.getName().getCode());
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -129,9 +129,9 @@ public final strictfp class DefaultEllip
         final CoordinateSystemAxis λ = cs.getAxis(1);
         assertEquals("name",    "Latitude (north), Longitude (east)",     cs.getName().getCode());
         assertEquals("remarks", "Used in two-dimensional GeographicCRS.", cs.getRemarks().toString());
-        assertIdentifierEquals(        "identifier", "IOGP", "EPSG", null, "6422", getSingleton(cs.getIdentifiers()));
-        assertIdentifierEquals("axis[0].identifier", "IOGP", "EPSG", null, "106",  getSingleton(φ.getIdentifiers()));
-        assertIdentifierEquals("axis[1].identifier", "IOGP", "EPSG", null, "107",  getSingleton(λ.getIdentifiers()));
+        assertIdentifierEquals(        "identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "6422", getSingleton(cs.getIdentifiers()));
+        assertIdentifierEquals("axis[0].identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "106",  getSingleton(φ.getIdentifiers()));
+        assertIdentifierEquals("axis[1].identifier", "EPSG Geodetic Parameter Dataset", "EPSG", null, "107",  getSingleton(λ.getIdentifiers()));
         assertEquals("axis[0].abbreviation", "φ", φ.getAbbreviation());
         assertEquals("axis[1].abbreviation", "λ", λ.getAbbreviation());
         /*

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -30,7 +30,7 @@ import org.opengis.referencing.cs.RangeM
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final strictfp class HardCodedAxes {
@@ -125,9 +125,9 @@ public final strictfp class HardCodedAxe
             AxisDirection.UP, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
 
     /**
-     * A height in centimetres, for {@link CoordinateSystemsTest} only.
+     * A height in centimetres.
      */
-    static final DefaultCoordinateSystemAxis HEIGHT_cm = create("Height", "h",
+    public static final DefaultCoordinateSystemAxis HEIGHT_cm = create("Height", "h",
             AxisDirection.UP, SI.CENTIMETRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -36,7 +36,7 @@ import static org.apache.sis.test.Refere
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 @DependsOn({
@@ -162,31 +162,38 @@ public final strictfp class NormalizerTe
     }
 
     /**
+     * Asserts that a collection of pre-defined axes is not modified by the given {@link AxesConvention}.
+     */
+    private static void assertSameAfterNormalization(final AxisFilter changes) {
+        assertSame(HardCodedAxes.GEODETIC_LATITUDE,  Normalizer.normalize(HardCodedAxes.GEODETIC_LATITUDE, changes));
+        assertSame(HardCodedAxes.GEODETIC_LONGITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LONGITUDE, changes));
+        assertSame(HardCodedAxes.EASTING,            Normalizer.normalize(HardCodedAxes.EASTING, changes));
+        assertSame(HardCodedAxes.NORTHING,           Normalizer.normalize(HardCodedAxes.NORTHING, changes));
+        assertSame(HardCodedAxes.ALTITUDE,           Normalizer.normalize(HardCodedAxes.ALTITUDE, changes));
+        assertSame(HardCodedAxes.TIME,               Normalizer.normalize(HardCodedAxes.TIME, changes));
+    }
+
+    /**
      * Tests {@link Normalizer#normalize(CoordinateSystemAxis)}.
      */
     @Test
     public void testNormalizeAxis() {
-        boolean normalizeUnits = false;
-        do { // Executed twice, first without units normalization, then with units normalization.
-            assertSame(HardCodedAxes.GEODETIC_LATITUDE,  Normalizer.normalize(HardCodedAxes.GEODETIC_LATITUDE, normalizeUnits));
-            assertSame(HardCodedAxes.GEODETIC_LONGITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LONGITUDE, normalizeUnits));
-            assertSame(HardCodedAxes.EASTING,            Normalizer.normalize(HardCodedAxes.EASTING, normalizeUnits));
-            assertSame(HardCodedAxes.NORTHING,           Normalizer.normalize(HardCodedAxes.NORTHING, normalizeUnits));
-            assertSame(HardCodedAxes.ALTITUDE,           Normalizer.normalize(HardCodedAxes.ALTITUDE, normalizeUnits));
-            assertSame(HardCodedAxes.TIME,               Normalizer.normalize(HardCodedAxes.TIME, normalizeUnits));
-        } while ((normalizeUnits = !normalizeUnits) == true);
+        // Execute twice, first without units normalization, then with units normalization.
+        assertSameAfterNormalization(AxesConvention.CONVENTIONALLY_ORIENTED);
+        assertSameAfterNormalization(AxesConvention.NORMALIZED);
         /*
          * Test a change of unit from centimetre to metre.
          */
-        assertSame(HardCodedAxes.HEIGHT_cm, Normalizer.normalize(HardCodedAxes.HEIGHT_cm, false));
+        assertSame(HardCodedAxes.HEIGHT_cm, Normalizer.normalize(HardCodedAxes.HEIGHT_cm,
+                AxesConvention.CONVENTIONALLY_ORIENTED));   // Do not change unit.
         assertAxisEquals("Height", "h", AxisDirection.UP,
             Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, null,
-            Normalizer.normalize(HardCodedAxes.HEIGHT_cm, true));
+            Normalizer.normalize(HardCodedAxes.HEIGHT_cm, AxesConvention.NORMALIZED));
         /*
          * Test a change of direction from West to East.
          */
         assertAxisEquals(Vocabulary.format(Vocabulary.Keys.Unnamed), "E",
             AxisDirection.EAST, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, null,
-            Normalizer.normalize(HardCodedAxes.WESTING, true));
+            Normalizer.normalize(HardCodedAxes.WESTING, AxesConvention.NORMALIZED));
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -38,7 +38,7 @@ import static org.apache.sis.test.mock.G
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final strictfp class BursaWolfParametersTest extends TestCase {
@@ -117,6 +117,34 @@ public final strictfp class BursaWolfPar
     }
 
     /**
+     * Tests {@link BursaWolfParameters#getValues()}.
+     */
+    @Test
+    public void testGetValues() {
+        assertArrayEquals("Translation only", new double[] {-168, -60, 320},
+                createNTF_to_WGS84().getValues(), STRICT);
+        assertArrayEquals("All 7 params", new double[] {-82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143},
+                createED87_to_WGS84().getValues(), STRICT);
+        assertArrayEquals("Mixed", new double[] {0, 0, 4.5, 0, 0, 0.554, 0.219},
+                createWGS72_to_WGS84().getValues(), STRICT);
+    }
+
+    /**
+     * Tests {@link BursaWolfParameters#setValues(double[])}.
+     */
+    @Test
+    @DependsOnMethod("testGetValues")
+    public void testSetValues() {
+        final BursaWolfParameters actual =  createWGS72_to_WGS84();
+        final BursaWolfParameters expected = createED87_to_WGS84();
+        final double[] values = expected.getValues();
+        assertFalse("equals(Object) before to set the values.", actual.equals(expected));
+        actual.setValues(values);
+        assertArrayEquals("getValues() after setting the values.", values, actual.getValues(), STRICT);
+        // Can not test assertEquals(expected, actual) because of different geographic extent.
+    }
+
+    /**
      * Tests {@link BursaWolfParameters#getPositionVectorTransformation(Date)}.
      * This test transform a point from WGS72 to WGS84, and conversely,
      * as documented in the example section of EPSG operation method 9606.
@@ -194,9 +222,10 @@ public final strictfp class BursaWolfPar
      * Tests the string representation of <cite>ED87 to WGS 84</cite> parameters (EPSG:1146).
      */
     @Test
+    @DependsOnMethod("testGetValues")
     public void testToString() {
-        final BursaWolfParameters bursaWolf = createED87_to_WGS84();
-        assertEquals("ToWGS84[-82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143]", bursaWolf.toString());
+        assertEquals("ToWGS84[-82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143]", createED87_to_WGS84().toString());
+        assertEquals("ToWGS84[-168.0, -60.0, 320.0]", createNTF_to_WGS84().toString());
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -268,18 +268,18 @@ public final strictfp class DefaultGeode
         assertWktEquals(Convention.WKT2,
                 "Datum[“World Geodetic System 1984”,\n" +
                 "  Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]],\n" +
-                "  Id[“EPSG”, 6326, Citation[“IOGP”], URI[“urn:ogc:def:datum:EPSG::6326”]]]",
+                "  Id[“EPSG”, 6326, URI[“urn:ogc:def:datum:EPSG::6326”]]]",
                 datum);
 
         assertWktEquals(Convention.INTERNAL,
                 "Datum[“World Geodetic System 1984”,\n" +
-                "  Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, Id[“EPSG”, 7030, Citation[“IOGP”]],\n" +
+                "  Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, Id[“EPSG”, 7030],\n" +
                 "    Remarks[“Defining parameters cited in EPSG database.”]],\n" +
                 "  Anchor[“Station coordinates changed by a few centimetres in 1994, 1997, 2002 and 2012.”],\n" +
                 "  Scope[“Satellite navigation.”],\n" +
                 "  Area[“World.”],\n" +
                 "  BBox[-90.00, -180.00, 90.00, 180.00],\n" +
-                "  Id[“EPSG”, 6326, Citation[“IOGP”]],\n" +
+                "  Id[“EPSG”, 6326],\n" +
                 "  Remarks[“No distinction between the original and subsequent WGS 84 frames.”]]",
                 datum);
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -150,9 +150,9 @@ public final strictfp class DefaultPrime
         assertWktEquals(Convention.WKT1,
                 "PRIMEM[“Paris”, 2.33722917, AUTHORITY[“EPSG”, “8903”]]", pm);
         assertWktEquals(Convention.WKT2,
-                "PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”, 0.015707963267948967], Id[“EPSG”, 8903, Citation[“IOGP”], URI[“urn:ogc:def:meridian:EPSG::8903”]]]", pm);
+                "PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”, 0.015707963267948967], Id[“EPSG”, 8903, URI[“urn:ogc:def:meridian:EPSG::8903”]]]", pm);
         assertWktEquals(Convention.INTERNAL,
-                "PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”, 0.015707963267948967], Id[“EPSG”, 8903, Citation[“IOGP”]],\n" +
+                "PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”, 0.015707963267948967], Id[“EPSG”, 8903],\n" +
                 "  Remarks[“Equivalent to 2°20′14.025″.”]]", pm);
         assertXmlEquals(
                 "<gml:PrimeMeridian xmlns:gml=\"" + Namespaces.GML + "\">\n" +

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -104,7 +104,7 @@ public final strictfp class DefaultTempo
     @Test
     public void testUnmarshalling() throws JAXBException {
         final DefaultTemporalDatum datum = unmarshalFile(DefaultTemporalDatum.class, XML_FILE);
-        assertIdentifierEquals("identifier", "SIS", "SIS", null, "MJ",
+        assertIdentifierEquals("identifier", "Apache Spatial Information System", "SIS", null, "MJ",
                 getSingleton(datum.getIdentifiers()));
         assertEquals("name", "Modified Julian",
                 datum.getName().getCode());

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -21,14 +21,13 @@ import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import org.opengis.referencing.datum.VerticalDatumType;
-import org.apache.sis.internal.referencing.VerticalDatumTypes;
+import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.Version;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
 import static java.util.Collections.singletonMap;
@@ -44,7 +43,6 @@ import static org.apache.sis.referencing
  * @version 0.4
  * @module
  */
-@DependsOn(org.apache.sis.internal.referencing.VerticalDatumTypesTest.class)
 public final strictfp class DefaultVerticalDatumTest extends XMLTestCase {
     /**
      * An XML file in this package containing a vertical datum definition.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -25,8 +25,8 @@ import org.opengis.referencing.datum.Pix
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.referencing.NamedIdentifier;
-import org.apache.sis.internal.referencing.VerticalDatumTypes;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.internal.metadata.VerticalDatumTypes;
+import org.apache.sis.metadata.iso.citation.Citations;
 
 import static org.opengis.referencing.datum.Datum.*;
 
@@ -174,7 +174,7 @@ public final strictfp class HardCodedDat
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         properties.put(NAME_KEY, name);
         if (code != null) {
-            properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
+            properties.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, code));
         }
         if (scope != null) {
             properties.put(SCOPE_KEY, scope);



Mime
View raw message