sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683756 [5/6] - in /sis/branches/JDK7: ./ 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 13:53:59 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] Fri Jun  5 13:53:58 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));
 
@@ -218,7 +219,7 @@ public final strictfp class BuilderTest
             final Object value = entry.getValue();
             switch (entry.getKey()) {
                 case Identifier.AUTHORITY_KEY: {
-                    assertSame("Authority and codespace shall be unchanged.", IOGP, value);
+                    assertSame("Authority and codespace shall be unchanged.", Citations.EPSG, value);
                     break;
                 }
                 case Identifier.CODESPACE_KEY: {
@@ -249,7 +250,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)",
@@ -260,7 +261,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",
@@ -272,7 +273,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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java [UTF-8] Fri Jun  5 13:53:58 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/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri Jun  5 13:53:58 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<>(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);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -37,24 +37,17 @@ import static org.apache.sis.internal.re
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn(BursaWolfParametersTest.class)
 public final strictfp class TimeDependentBWPTest extends TestCase {
     /**
-     * Tests the {@link BursaWolfParameters#setPositionVectorTransformation(Matrix, double)} method
-     * using the example given in the EPSG database for operation method EPSG:1053.
-     *
-     * @throws NoninvertibleMatrixException Should not happen.
+     * Creates a {@code TimeDependentBWP} using the example given in the EPSG database for operation method EPSG:1053.
+     * The target datum given by the EPG example is actually GDA94, but it is coincident with WGS84 to within 1 metre.
+     * For the purpose of this test, the target datum does not matter anyway.
      */
-    @Test
-    @DependsOnMethod("testEpsgCalculation")
-    public void testSetPositionVectorTransformation() throws NoninvertibleMatrixException {
-        /*
-         * The target datum is actually GDA94, but it is coincident with WGS84 to within 1 metre.
-         * For the purpose of this test, the target datum does not matter anyway.
-         */
+    private static TimeDependentBWP create() {
         final TimeDependentBWP p = new TimeDependentBWP(WGS84, null, date("1994-01-01 00:00:00"));
         p.tX = -0.08468;    p.dtX = +1.42;
         p.tY = -0.01942;    p.dtY = +1.34;
@@ -63,10 +56,49 @@ public final strictfp class TimeDependen
         p.rY = -0.0022578;  p.drY = -1.1820;
         p.rZ = -0.0024015;  p.drZ = -1.1551;
         p.dS = +0.00971;    p.ddS = +0.000109;
+        return p;
+    }
+
+    /**
+     * Tests {@link TimeDependentBWP#invert()}. This will indirectly tests {@link TimeDependentBWP#getValues()}
+     * followed by {@link TimeDependentBWP#setValues(double[])} because of the way the {@code invert()} method
+     * is implemented.
+     */
+    @Test
+    public void testInvert() {
+        /*
+         * Opportunistically test getValue() first because it is used by TimeDependentBWP.invert().
+         */
+        final double[] expected = {
+            -0.08468, -0.01942, +0.03201, +0.0004254, -0.0022578, -0.0024015, +0.00971,
+            +1.42,    +1.34,    +0.90,    -1.5461,    -1.1820,    -1.1551,    +0.000109
+        };
+        final TimeDependentBWP p = create();
+        assertArrayEquals(expected, p.getValues(), STRICT);
+        /*
+         * Now perform the actual TimeDependentBWP.invert() test.
+         */
+        for (int i=0; i<expected.length; i++) {
+            expected[i] = -expected[i];
+        }
+        p.invert();
+        assertArrayEquals(expected, p.getValues(), STRICT);
+    }
+
+    /**
+     * Tests the {@link TimeDependentBWP#setPositionVectorTransformation(Matrix, double)} method
+     * using the example given in the EPSG database for operation method EPSG:1053.
+     *
+     * @throws NoninvertibleMatrixException Should not happen.
+     */
+    @Test
+    @DependsOnMethod("testEpsgCalculation")
+    public void testSetPositionVectorTransformation() throws NoninvertibleMatrixException {
         /*
          * The transformation that we are going to test use as input
          * geocentric coordinates on ITRF2008 at epoch 2013.9.
          */
+        final TimeDependentBWP p = create();
         final Date time = p.getTimeReference();
         time.setTime(time.getTime() + StrictMath.round((2013.9 - 1994) * JULIAN_YEAR_LENGTH));
         assertEquals(date("2013-11-25 11:24:00"), time);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -20,10 +20,10 @@ import org.opengis.referencing.cs.CSFact
 import org.opengis.referencing.crs.CRSFactory;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.datum.DatumFactory;
+import org.opengis.referencing.operation.CoordinateOperationFactory;
 import org.opengis.test.referencing.ObjectFactoryTest;
 import org.opengis.util.FactoryException;
 import org.apache.sis.internal.system.DefaultFactories;
-import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
 import org.apache.sis.test.DependsOn;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -56,7 +56,7 @@ public final strictfp class GeodeticObje
         super(DefaultFactories.forBuildin(DatumFactory.class),
               DefaultFactories.forBuildin(CSFactory   .class),
               DefaultFactories.forBuildin(CRSFactory  .class),
-              new DefaultCoordinateOperationFactory());         // TODO: use DefaultFactories.
+              DefaultFactories.forBuildin(CoordinateOperationFactory.class));
     }
 
     @Override

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -30,7 +30,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -158,7 +158,7 @@ public final strictfp class DefaultConve
          */
         final Map<String, Object> properties = new HashMap<>(4);
         properties.put(DefaultTransformation.NAME_KEY, "Paris to Greenwich");
-        properties.put(OperationMethods.PARAMETERS_KEY, pg);
+        properties.put(ReferencingServices.PARAMETERS_KEY, pg);
         return new DefaultConversion(properties, sourceCRS, targetCRS, interpolationCRS,
                 method, MathTransforms.linear(rotation));
     }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -25,8 +25,8 @@ import org.opengis.referencing.operation
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -66,7 +66,7 @@ public final strictfp class DefaultOpera
         final Map<String,Object> properties = new HashMap<>(8);
         assertNull(properties.put(OperationMethod.NAME_KEY, method));
         assertNull(properties.put(Identifier.CODESPACE_KEY, "EPSG"));
-        assertNull(properties.put(Identifier.AUTHORITY_KEY, HardCodedCitations.IOGP));
+        assertNull(properties.put(Identifier.AUTHORITY_KEY, Citations.EPSG));
         /*
          * The parameter group for a Mercator projection is actually not empty, but it is not the purpose of
          * this class to test DefaultParameterDescriptorGroup. So we use an empty group of parameters here.
@@ -77,7 +77,7 @@ public final strictfp class DefaultOpera
          * Then define the other properties to be given to OperationMethod.
          */
         assertNotNull(properties.put(OperationMethod.NAME_KEY, pg.getName()));
-        assertNull(properties.put(OperationMethod.IDENTIFIERS_KEY, new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", identifier)));
+        assertNull(properties.put(OperationMethod.IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.EPSG, "EPSG", identifier)));
         assertNull(properties.put(OperationMethod.FORMULA_KEY, new DefaultCitation(formula)));
         return new DefaultOperationMethod(properties, dimension, dimension, pg);
     }
@@ -161,7 +161,7 @@ public final strictfp class DefaultOpera
     @DependsOnMethod("testConstruction")
     public void testWKT() {
         final OperationMethod method = create("Mercator (variant A)", "9804", "EPSG guidance note #7-2", 2);
-        assertWktEquals("Method[“Mercator (variant A)”, Id[“EPSG”, 9804, Citation[“IOGP”], URI[“urn:ogc:def:method:EPSG::9804”]]]", method);
+        assertWktEquals("Method[“Mercator (variant A)”, Id[“EPSG”, 9804, URI[“urn:ogc:def:method:EPSG::9804”]]]", method);
         assertWktEquals(Convention.WKT1, "PROJECTION[“Mercator (variant A)”, AUTHORITY[“EPSG”, “9804”]]", method);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -23,7 +23,7 @@ import org.opengis.parameter.ParameterVa
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.parameter.DefaultParameterDescriptorTest;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.cs.HardCodedCS;
@@ -95,7 +95,7 @@ public final strictfp class DefaultTrans
          */
         final Map<String, Object> properties = new HashMap<>(4);
         properties.put(DefaultTransformation.NAME_KEY, "Tokyo to JGD2000 (GSI)");
-        properties.put(OperationMethods.PARAMETERS_KEY, pg);
+        properties.put(ReferencingServices.PARAMETERS_KEY, pg);
         return new DefaultTransformation(properties,
                 createCRS(null,      HardCodedDatum.TOKYO),     // SourceCRS
                 createCRS("JGD2000", HardCodedDatum.JGD2000),   // TargetCRS
@@ -176,7 +176,7 @@ public final strictfp class DefaultTrans
                 "      Axis[“(Y)”, geocentricY, Order[2]],\n" +
                 "      Axis[“(Z)”, geocentricZ, Order[3]],\n" +
                 "      LengthUnit[“metre”, 1]]],\n" +
-                "  Method[“Geocentric translations”, Id[“EPSG”, 1031, Citation[“IOGP”]]],\n" +
+                "  Method[“Geocentric translations”, Id[“EPSG”, 1031]],\n" +
                 "  Parameter[“X-axis translation”, -146.414, Id[“EPSG”, 8605]],\n" +
                 "  Parameter[“Y-axis translation”, 507.337, Id[“EPSG”, 8606]],\n" +
                 "  Parameter[“Z-axis translation”, 680.507, Id[“EPSG”, 8607]]]", op);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -40,9 +40,9 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.util.iso.DefaultNameSpace;
+import org.apache.sis.internal.util.Constants;
 
 import static java.lang.StrictMath.*;
-import static org.apache.sis.internal.util.Constants.*;
 
 
 /**
@@ -73,13 +73,16 @@ public strictfp class ReferencingAssert
      */
     public static void assertOgcIdentifierEquals(final String expected, final Identifier actual) {
         assertNotNull(actual);
-        assertSame("Authority", Citations.OGC, actual.getAuthority());
-        assertIdentifierEquals(null, OGC, OGC, null, expected, actual);
+        assertEquals("code",       expected,      actual.getCode());
+        assertEquals("codeSpace",  Constants.OGC, actual.getCodeSpace());
+        assertSame  ("authority",  Citations.OGC, actual.getAuthority());
+        assertEquals("identifier", Constants.OGC + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+                IdentifiedObjects.toString(actual));
     }
 
     /**
      * Asserts that the given identifier has the expected code and the {@code "EPSG"} code space.
-     * The authority is expected to have the {@code "IOGP"} title or alternate title.
+     * The authority is expected to have the {@code "EPSG"} title, alternate title or identifier.
      *
      * @param expected The expected identifier code.
      * @param actual   The identifier to verify.
@@ -88,10 +91,10 @@ public strictfp class ReferencingAssert
      */
     public static void assertEpsgIdentifierEquals(final String expected, final Identifier actual) {
         assertNotNull(actual);
-        assertEquals("code",       expected, actual.getCode());
-        assertEquals("codeSpace",  EPSG,  actual.getCodeSpace());
-        assertEquals("authority",  IOGP,  Citations.getIdentifier(actual.getAuthority()));
-        assertEquals("identifier", EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+        assertEquals("code",       expected,        actual.getCode());
+        assertEquals("codeSpace",  Constants.EPSG,  actual.getCodeSpace());
+        assertEquals("authority",  Constants.EPSG,  Citations.getIdentifier(actual.getAuthority()));
+        assertEquals("identifier", Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
                 IdentifiedObjects.toString(actual));
     }
 
@@ -100,8 +103,8 @@ public strictfp class ReferencingAssert
      * EPSG code. As a special case if the given code is 0, then this method verifies that the given object has no
      * identifier.
      *
-     * @param expected    The expected EPSG code, or {@code 0} if we expect no EPSG code.
-     * @param actual The set of identifiers in which to verify the EPSG code.
+     * @param expected The expected EPSG code, or {@code 0} if we expect no EPSG code.
+     * @param actual   The set of identifiers in which to verify the EPSG code.
      */
     public static void assertEpsgIdentifierEquals(final int expected, final Collection<? extends Identifier> actual) {
         assertNotNull(actual);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -180,7 +180,8 @@ public final strictfp class ReferencingI
      * @param object The object to verify.
      */
     private static void verifyIdentifiers(final String code, final IdentifiedObject object) {
-        assertIdentifierEquals("identifier", "SIS", "SIS", null, code, getSingleton(object.getIdentifiers()));
+        assertIdentifierEquals("identifier", "Apache Spatial Information System", "SIS",
+                null, code, getSingleton(object.getIdentifiers()));
         assertIdentifierEquals("name", null, null, null, "Depth", object.getName());
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -33,7 +33,6 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.referencing.FormulasTest.class,
     org.apache.sis.internal.referencing.j2d.ShapeUtilitiesTest.class,
     org.apache.sis.internal.referencing.AxisDirectionsTest.class,
-    org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,
     org.apache.sis.internal.referencing.PositionalAccuracyConstantTest.class,
     org.apache.sis.internal.referencing.ReferencingUtilitiesTest.class,
     org.apache.sis.internal.jaxb.referencing.CodeTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -19,18 +19,10 @@ package org.apache.sis.internal.jaxb;
 import java.util.Iterator;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.io.Serializable;
-import java.lang.reflect.Field;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
-import org.apache.sis.internal.simple.SimpleCitation;
+import org.apache.sis.internal.simple.CitationConstant;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
-import org.apache.sis.util.Debug;
-import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.resources.Errors;
 import org.apache.sis.xml.IdentifierSpace;
 
 
@@ -65,29 +57,23 @@ import org.apache.sis.xml.IdentifierSpac
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.6
  * @module
  *
  * @see IdentifierSpace
  */
-public final class NonMarshalledAuthority<T> extends SimpleCitation implements IdentifierSpace<T>, Serializable {
+public final class NonMarshalledAuthority<T> extends CitationConstant.Authority<T> {
     /**
      * For cross-version compatibility.
      */
     private static final long serialVersionUID = 6299502270649111201L;
 
     /**
-     * Sets to {@code true} if {@link #getCitation(String)} has already logged a warning.
-     * This is used in order to avoid flooding the logs with the same message.
-     */
-    private static volatile boolean warningLogged;
-
-    /**
      * Ordinal values for switch statements. The constant defined here shall
      * mirror the constants defined in the {@link IdentifierSpace} interface
      * and {@link org.apache.sis.metadata.iso.citation.DefaultCitation} class.
      */
-    public static final int ID=0, UUID=1, HREF=2, XLINK=3, ISSN=4, ISBN=5;
+    public static final byte ID=0, UUID=1, HREF=2, XLINK=3, ISSN=4, ISBN=5;
     // If more codes are added, please update readResolve() below.
 
     /**
@@ -98,39 +84,21 @@ public final class NonMarshalledAuthorit
      * versions of the SIS library (the attribute name is more reliable). This instance should
      * be replaced by one of the exiting constants at deserialization time anyway.</p>
      */
-    final transient int ordinal;
+    final transient byte ordinal;
 
     /**
-     * Creates a new enum for the given attribute.
+     * Creates a new citation for the given XML attribute name.
      *
      * @param attribute The XML attribute name, to be returned by {@link #getName()}.
      * @param ordinal   Ordinal value for switch statement, as one of the {@link #ID},
      *                  {@link #UUID}, <i>etc.</i> constants.
      */
-    public NonMarshalledAuthority(final String attribute, final int ordinal) {
+    public NonMarshalledAuthority(final String attribute, final byte ordinal) {
         super(attribute);
         this.ordinal = ordinal;
     }
 
     /**
-     * Returns the XML attribute name with its prefix. Attribute names can be {@code "gml:id"},
-     * {@code "gco:uuid"} or {@code "xlink:href"}.
-     */
-    @Override
-    public String getName() {
-        return title;
-    }
-
-    /**
-     * Returns a string representation of this identifier space.
-     */
-    @Debug
-    @Override
-    public String toString() {
-        return "IdentifierSpace[" + title + ']';
-    }
-
-    /**
      * Returns the first marshallable identifier from the given collection. This method omits
      * "special" identifiers (ISO 19139 attributes, ISBN codes...), which are recognized by
      * the implementation class of their authority.
@@ -269,54 +237,25 @@ public final class NonMarshalledAuthorit
     }
 
     /**
-     * Returns one of the constants in the {@link org.apache.sis.metadata.iso.citation.DefaultCitation} class,
-     * or {@code null} if none. We need to use Java reflection because the {@code sis-metadata} module may not
-     * be in the classpath.
-     */
-    private static IdentifierSpace<?> getCitation(final String name) {
-        try {
-            final Field field = Class.forName("org.apache.sis.metadata.iso.citation.DefaultCitation").getDeclaredField(name);
-            field.setAccessible(true);
-            return (IdentifierSpace<?>) field.get(null);
-        } catch (ReflectiveOperationException e) {
-            if (!warningLogged) {
-                warningLogged = true;
-                final LogRecord record = Errors.getResources((Locale) null).getLogRecord(Level.WARNING,
-                        Errors.Keys.MissingRequiredModule_1, "sis-metadata");
-                /*
-                 * Log directly the the logger rather than invoking the Context.warningOccured(…) method because
-                 * this warning does not occur during XML (un)marshalling. It may occurs only during serialization.
-                 */
-                record.setThrown(e);
-                Logging.log(NonMarshalledAuthority.class, "readResolve", record);
-            }
-        }
-        return null;
-    }
-
-    /**
      * Invoked at deserialization time in order to replace the deserialized instance
      * by the appropriate instance defined in the {@link IdentifierSpace} interface.
+     *
+     * @return The instance to use, as an unique instance if possible.
      */
-    private Object readResolve() {
+    @Override
+    protected Object readResolve() {
+        final String name = getName();
+        IdentifierSpace<?> candidate;
         int code = 0;
-        while (true) {
-            final IdentifierSpace<?> candidate;
-            switch (code) {
+        do {
+            switch (code++) {
                 case ID:    candidate = IdentifierSpace.ID;    break;
                 case UUID:  candidate = IdentifierSpace.UUID;  break;
                 case HREF:  candidate = IdentifierSpace.HREF;  break;
                 case XLINK: candidate = IdentifierSpace.XLINK; break;
-                case ISBN:  candidate = getCitation("ISBN");   break;
-                case ISSN:  candidate = getCitation("ISSN");   break;
-                default: return this;
-            }
-            if (candidate instanceof NonMarshalledAuthority<?> &&
-                    ((NonMarshalledAuthority<?>) candidate).title.equals(title))
-            {
-                return candidate;
+                default: return super.readResolve();
             }
-            code++;
-        }
+        } while (!((NonMarshalledAuthority<?>) candidate).getName().equals(name));
+        return candidate;
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -63,6 +63,23 @@ public final class JDK8 {
     }
 
     /**
+     * Returns the value of the given key, or the given default value if there is no value for that key.
+     *
+     * @param <V> The type of values.
+     * @param map The map from which to get the value.
+     * @param key The key for the value to fetch.
+     * @param defaultValue The value to return if the map does not contain any value for the given key.
+     * @return The value for the given key (which may be {@code null}), or {@code defaultValue}.
+     */
+    public static <V> V getOrDefault(final Map<?,V> map, final Object key, final V defaultValue) {
+        V value = map.get(key);
+        if (value == null && !map.containsKey(key)) {
+            value = defaultValue;
+        }
+        return value;
+    }
+
+    /**
      * Stores the value in the given map, provided that no value were set.
      * This implementation presumes that the map can not contain null values.
      *



Mime
View raw message