You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/01/17 16:59:09 UTC
svn commit: r1559162 - in /sis/branches/JDK7/core:
sis-metadata/src/test/java/org/apache/sis/test/suite/
sis-referencing/src/main/java/org/apache/sis/referencing/crs/
sis-referencing/src/test/java/org/apache/sis/referencing/
sis-referencing/src/test/ja...
Author: desruisseaux
Date: Fri Jan 17 15:59:08 2014
New Revision: 1559162
URL: http://svn.apache.org/r1559162
Log:
Added tests.
Added:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java (with props)
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java (with props)
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java (with props)
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
- copied, changed from r1558919, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CommonAxes.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java (with props)
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java (with props)
Removed:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CommonAxes.java
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -51,7 +51,6 @@ import org.junit.BeforeClass;
// XML marshalling.
org.apache.sis.internal.jaxb.code.CodeListMarshallingTest.class,
org.apache.sis.internal.jaxb.code.PT_LocaleTest.class,
- org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class,
org.apache.sis.internal.jaxb.gml.TimePeriodTest.class,
org.apache.sis.xml.FreeTextMarshallingTest.class,
org.apache.sis.xml.NilReasonMarshallingTest.class,
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -86,6 +86,7 @@ final class SubTypes implements Comparat
if (TYPE_ORDER[i].isInstance(object)) {
break;
}
+ i++;
}
return i;
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -23,7 +23,7 @@ import org.apache.sis.test.mock.Geodetic
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.opengis.test.Validators;
-import org.apache.sis.referencing.cs.CommonAxes;
+import org.apache.sis.referencing.cs.HardCodedAxes;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -83,8 +83,8 @@ public final strictfp class StandardDefi
}
/**
- * Compares the values created by {@link StandardDefinitions#createAxis(short)} against the {@link CommonAxes}
- * constants. Actually this is more a {@code CommonAxes} test than a {@code StandardDefinitions} one - in case
+ * Compares the values created by {@link StandardDefinitions#createAxis(short)} against the {@link HardCodedAxes}
+ * constants. Actually this is more a {@code HardCodedAxes} test than a {@code StandardDefinitions} one - in case
* of test failure, both classes could be at fault.
*/
@Test
@@ -93,11 +93,11 @@ public final strictfp class StandardDefi
106, 107, 110, 114, 113
};
final CoordinateSystemAxis[] axes = {
- CommonAxes.GEODETIC_LATITUDE,
- CommonAxes.GEODETIC_LONGITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT,
- CommonAxes.GRAVITY_RELATED_HEIGHT,
- CommonAxes.DEPTH
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT,
+ HardCodedAxes.GRAVITY_RELATED_HEIGHT,
+ HardCodedAxes.DEPTH
};
for (int i=0; i<codes.length; i++) {
final CoordinateSystemAxis axis = StandardDefinitions.createAxis(codes[i]);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -17,7 +17,7 @@
package org.apache.sis.referencing.crs;
import org.apache.sis.referencing.cs.AbstractCS;
-import org.apache.sis.referencing.cs.CommonAxes;
+import org.apache.sis.referencing.cs.HardCodedAxes;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -46,10 +46,10 @@ public final strictfp class AbstractCRST
final AbstractCRS toTest, expected, actual;
toTest = new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
new AbstractCS (singletonMap(NAME_KEY, "My strange CS"),
- CommonAxes.TIME, CommonAxes.ALTITUDE, CommonAxes.LATITUDE, CommonAxes.LONGITUDE));
+ HardCodedAxes.TIME, HardCodedAxes.ALTITUDE, HardCodedAxes.LATITUDE, HardCodedAxes.LONGITUDE));
expected = new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
new AbstractCS (singletonMap(NAME_KEY, "Coordinate system: East (deg), North (deg), Up (m), Future (d)."),
- CommonAxes.LONGITUDE, CommonAxes.LATITUDE, CommonAxes.ALTITUDE, CommonAxes.TIME));
+ HardCodedAxes.LONGITUDE, HardCodedAxes.LATITUDE, HardCodedAxes.ALTITUDE, HardCodedAxes.TIME));
actual = toTest.forConvention(AxesConvention.RIGHT_HANDED);
assertEquals("forConvention(RIGHT_HANDED)", expected, actual);
Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1559162&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static java.util.Collections.singletonMap;
+import static org.opengis.referencing.cs.CoordinateSystem.NAME_KEY;
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link DefaultCompoundCRS}
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+@DependsOn({SubTypesTest.class, AbstractCRSTest.class})
+public final strictfp class DefaultCompoundCRSTest extends TestCase {
+ /**
+ * Tests construction and serialization of a {@link DefaultCompoundCRS}.
+ */
+ @Test
+ public void testConstructionAndSerialization() {
+ final DefaultCompoundCRS crs3 = new DefaultCompoundCRS(singletonMap(NAME_KEY, "3D"),
+ HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT); // Not legal, but we just want to test.
+ final DefaultCompoundCRS crs4 = new DefaultCompoundCRS(singletonMap(NAME_KEY, "4D"),
+ crs3, HardCodedCRS.TIME);
+
+ verify(crs3, crs4);
+ verify(crs3, assertSerializedEquals(crs4));
+ }
+
+ /**
+ * Verifies the components of the CRS created by {@link #testConstructionAndSerialization()}.
+ */
+ private static void verify(final DefaultCompoundCRS crs3, final DefaultCompoundCRS crs4) {
+ assertArrayEquals("getComponents()", new AbstractCRS[] {
+ crs3, HardCodedCRS.TIME
+ }, crs4.getComponents().toArray());
+
+ assertArrayEquals("getSingleComponents()", new AbstractCRS[] {
+ HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT, HardCodedCRS.TIME
+ }, crs4.getSingleComponents().toArray());
+ }
+}
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1559162&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import java.util.Map;
+import java.util.HashMap;
+import org.opengis.referencing.datum.PixelInCell;
+import org.apache.sis.referencing.cs.HardCodedCS;
+import org.apache.sis.referencing.datum.HardCodedDatum;
+import org.apache.sis.metadata.iso.extent.Extents;
+
+import static org.opengis.referencing.IdentifiedObject.*;
+import static org.opengis.referencing.ReferenceSystem.DOMAIN_OF_VALIDITY_KEY;
+import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
+
+
+/**
+ * Collection of coordinate reference systems for testing purpose.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class HardCodedCRS {
+ /**
+ * A two-dimensional geographic coordinate reference system using the WGS84 datum.
+ * This CRS uses (<var>longitude</var>, <var>latitude</var>) ordinates with longitude values
+ * increasing towards the East and latitude values increasing towards the North.
+ * The angular units are decimal degrees and the prime meridian is Greenwich.
+ *
+ * <p>This CRS is equivalent to {@code EPSG:4326} except for axis order,
+ * since EPSG puts latitude before longitude.</p>
+ */
+ public static final DefaultGeographicCRS WGS84 = new DefaultGeographicCRS(
+ properties("WGS 84"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_2D);
+
+ /**
+ * A three-dimensional geographic coordinate reference system using the WGS84 datum.
+ * This CRS uses (<var>longitude</var>, <var>latitude</var>, <var>height</var>) ordinates with longitude values
+ * increasing towards East, latitude values increasing towards North and height positive above the ellipsoid.
+ * The angular units are decimal degrees, the height unit is the metre, and the prime meridian is Greenwich.
+ *
+ * <p>This CRS is equivalent to {@code EPSG:4979} (the successor to {@code EPSG:4329}, itself the successor
+ * to {@code EPSG:4327}) except for axis order, since EPSG puts latitude before longitude.</p>
+ */
+ public static final DefaultGeographicCRS WGS84_3D = new DefaultGeographicCRS(
+ properties("WGS 84 (3D)"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_3D);
+
+ /**
+ * A two-dimensional geographic coordinate reference system using a spherical datum.
+ * This CRS uses (<var>longitude</var>, <var>latitude</var>) ordinates with longitude values
+ * increasing towards the East and latitude values increasing towards the North.
+ * The angular units are decimal degrees and the prime meridian is Greenwich.
+ */
+ public static final DefaultGeographicCRS SPHERE = new DefaultGeographicCRS(
+ getProperties(HardCodedDatum.SPHERE), HardCodedDatum.SPHERE, HardCodedCS.GEODETIC_2D);
+
+ /**
+ * A geocentric CRS with a spherical coordinate system.
+ * Prime meridian is Greenwich, geodetic datum is WGS84 and linear units are metres.
+ */
+ public static final DefaultGeocentricCRS SPHERICAL = new DefaultGeocentricCRS(
+ getProperties(HardCodedCS.SPHERICAL), HardCodedDatum.WGS84, HardCodedCS.SPHERICAL);
+
+ /**
+ * A geocentric CRS with a Cartesian coordinate system.
+ * Prime meridian is Greenwich, geodetic datum is WGS84 and linear units are metres.
+ * The <var>X</var> axis points towards the prime meridian.
+ * The <var>Y</var> axis points East.
+ * The <var>Z</var> axis points North.
+ */
+ public static final DefaultGeocentricCRS GEOCENTRIC = new DefaultGeocentricCRS(
+ getProperties(HardCodedCS.GEOCENTRIC), HardCodedDatum.WGS84, HardCodedCS.GEOCENTRIC);
+
+ /**
+ * A two-dimensional Cartesian coordinate reference system with (x,y) axes in metres.
+ * By default, this CRS has no transformation path to any other CRS (i.e. a map using
+ * this CS can't be reprojected to a geographic coordinate reference system for example).
+ */
+ public static final DefaultEngineeringCRS CARTESIAN_2D = new DefaultEngineeringCRS(
+ getProperties(HardCodedCS.CARTESIAN_2D), HardCodedDatum.UNKNOWN, HardCodedCS.CARTESIAN_2D);
+
+ /**
+ * A two-dimensional Cartesian coordinate reference system with (x,y,z) axes in metres.
+ * By default, this CRS has no transformation path to any other CRS (i.e. a map using
+ * this CS can't be reprojected to a geographic coordinate reference system for example).
+ */
+ public static final DefaultEngineeringCRS CARTESIAN_3D = new DefaultEngineeringCRS(
+ getProperties(HardCodedCS.CARTESIAN_3D), HardCodedDatum.UNKNOWN, HardCodedCS.CARTESIAN_3D);
+
+ /**
+ * A vertical coordinate reference system using ellipsoidal datum.
+ * Ellipsoidal heights are measured along the normal to the ellipsoid used in the definition of horizontal datum.
+ *
+ * <p>This is not a valid vertical CRS according ISO 19111.
+ * This CRS is used by Apache SIS for internal calculation.</p>
+ */
+ public static final DefaultVerticalCRS ELLIPSOIDAL_HEIGHT = new DefaultVerticalCRS(
+ getProperties(HardCodedCS.ELLIPSOIDAL_HEIGHT), HardCodedDatum.ELLIPSOID, HardCodedCS.ELLIPSOIDAL_HEIGHT);
+
+ /**
+ * A vertical coordinate reference system using Mean Sea Level datum.
+ */
+ public static final DefaultVerticalCRS GRAVITY_RELATED_HEIGHT = new DefaultVerticalCRS(
+ getProperties(HardCodedCS.GRAVITY_RELATED_HEIGHT), HardCodedDatum.MEAN_SEA_LEVEL, HardCodedCS.GRAVITY_RELATED_HEIGHT);
+
+ /**
+ * A temporal coordinate reference system for time in days elapsed since the Unix epoch.
+ */
+ public static final DefaultTemporalCRS TIME = new DefaultTemporalCRS(
+ getProperties(HardCodedCS.DAYS), HardCodedDatum.UNIX, HardCodedCS.DAYS);
+
+ /**
+ * A two-dimensional Cartesian coordinate reference system with (column, row) axes.
+ * By default, this CRS has no transformation path to any other CRS (i.e. a map using
+ * this CS can't be reprojected to a geographic coordinate reference system for example).
+ *
+ * <p>The {@code PixelInCell} attribute of the associated {@link ImageDatum}
+ * is set to {@link PixelInCell#CELL_CENTER}.</p>
+ */
+ public static final DefaultImageCRS IMAGE = new DefaultImageCRS(
+ getProperties(HardCodedDatum.IMAGE), HardCodedDatum.IMAGE, HardCodedCS.GRID);
+
+ /**
+ * Creates a map of properties for the given name.
+ */
+ private static Map<String,?> properties(final String name) {
+ final Map<String,Object> properties = new HashMap<>(4);
+ properties.put(NAME_KEY, name);
+ properties.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
+ return properties;
+ }
+
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private HardCodedCRS() {
+ }
+}
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java?rev=1559162&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import java.util.Arrays;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link SubTypes}
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+@DependsOn(AbstractCRSTest.class)
+public final strictfp class SubTypesTest extends TestCase {
+ /**
+ * Tests the {@link SubTypes#BY_TYPE} comparator.
+ */
+ @Test
+ public void testComparator() {
+ final AbstractCRS[] components = {
+ HardCodedCRS.IMAGE,
+ HardCodedCRS.TIME,
+ HardCodedCRS.WGS84,
+ HardCodedCRS.GRAVITY_RELATED_HEIGHT
+ };
+ Arrays.sort(components, SubTypes.BY_TYPE);
+ assertArrayEquals(new AbstractCRS[] {
+ HardCodedCRS.WGS84,
+ HardCodedCRS.GRAVITY_RELATED_HEIGHT,
+ HardCodedCRS.TIME,
+ HardCodedCRS.IMAGE
+ }, components);
+ }
+}
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/SubTypesTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -71,9 +71,9 @@ public final strictfp class AbstractCSTe
@Test
public void testForRightHandedConvention() {
final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"),
- CommonAxes.LATITUDE, CommonAxes.TIME, CommonAxes.ALTITUDE, CommonAxes.LONGITUDE);
+ HardCodedAxes.LATITUDE, HardCodedAxes.TIME, HardCodedAxes.ALTITUDE, HardCodedAxes.LONGITUDE);
verifyAxesConvention(AxesConvention.RIGHT_HANDED, cs,
- CommonAxes.LONGITUDE, CommonAxes.LATITUDE, CommonAxes.ALTITUDE, CommonAxes.TIME);
+ HardCodedAxes.LONGITUDE, HardCodedAxes.LATITUDE, HardCodedAxes.ALTITUDE, HardCodedAxes.TIME);
assertSame("Right-handed CS shall be same as normalized.",
cs.forConvention(AxesConvention.RIGHT_HANDED),
cs.forConvention(AxesConvention.NORMALIZED));
@@ -87,7 +87,7 @@ public final strictfp class AbstractCSTe
@DependsOnMethod("testForRightHandedConvention")
public void testForNormalizedConvention() {
/*
- * Some expected axes, identical to the ones in CommonAxes except for name or units.
+ * Some expected axes, identical to the ones in HardCodedAxes except for name or units.
*/
final DefaultCoordinateSystemAxis EASTING = new DefaultCoordinateSystemAxis(
singletonMap(NAME_KEY, Vocabulary.format(Vocabulary.Keys.Unnamed)), "E",
@@ -99,11 +99,11 @@ public final strictfp class AbstractCSTe
* Test RIGHT_HANDED as a matter of principle before to test NORMALIZED.
*/
final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"),
- CommonAxes.TIME, CommonAxes.NORTHING, CommonAxes.WESTING, CommonAxes.HEIGHT_cm);
+ HardCodedAxes.TIME, HardCodedAxes.NORTHING, HardCodedAxes.WESTING, HardCodedAxes.HEIGHT_cm);
verifyAxesConvention(AxesConvention.RIGHT_HANDED, cs,
- CommonAxes.NORTHING, CommonAxes.WESTING, CommonAxes.HEIGHT_cm, CommonAxes.TIME);
+ HardCodedAxes.NORTHING, HardCodedAxes.WESTING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME);
verifyAxesConvention(AxesConvention.NORMALIZED, cs,
- EASTING, CommonAxes.NORTHING, HEIGHT, CommonAxes.TIME);
+ EASTING, HardCodedAxes.NORTHING, HEIGHT, HardCodedAxes.TIME);
}
/**
@@ -112,8 +112,8 @@ public final strictfp class AbstractCSTe
*/
@Test
public void testForPositiveRangeConvention() {
- final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), CommonAxes.LONGITUDE, CommonAxes.LATITUDE);
- verifyAxesConvention(AxesConvention.POSITIVE_RANGE, cs, CommonAxes.SHIFTED_LONGITUDE, CommonAxes.LATITUDE);
+ final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), HardCodedAxes.LONGITUDE, HardCodedAxes.LATITUDE);
+ verifyAxesConvention(AxesConvention.POSITIVE_RANGE, cs, HardCodedAxes.SHIFTED_LONGITUDE, HardCodedAxes.LATITUDE);
}
/**
@@ -121,7 +121,7 @@ public final strictfp class AbstractCSTe
*/
@Test
public void testSerialization() {
- final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), CommonAxes.X, CommonAxes.Y);
+ final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), HardCodedAxes.X, HardCodedAxes.Y);
assertNotSame(cs, assertSerializedEquals(cs));
}
}
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=1559162&r1=1559161&r2=1559162&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 Jan 17 15:59:08 2014
@@ -166,11 +166,11 @@ public final strictfp class CoordinateSy
@Test
public void testSwapAndScaleAxes2D() throws ConversionException {
final CoordinateSystem λφ = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(λ,φ)"),
- CommonAxes.GEODETIC_LONGITUDE,
- CommonAxes.GEODETIC_LATITUDE);
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.GEODETIC_LATITUDE);
final CoordinateSystem φλ = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(φ,λ)"),
- CommonAxes.GEODETIC_LATITUDE,
- CommonAxes.GEODETIC_LONGITUDE);
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.GEODETIC_LONGITUDE);
final Matrix expected = Matrices.create(3, 3, new double[] {
0, 1, 0,
1, 0, 0,
@@ -191,13 +191,13 @@ public final strictfp class CoordinateSy
@DependsOnMethod("testSwapAndScaleAxes2D")
public void testSwapAndScaleAxes3D() throws ConversionException {
final CoordinateSystem λφh = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(λ,φ,h)"),
- CommonAxes.GEODETIC_LONGITUDE,
- CommonAxes.GEODETIC_LATITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT);
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT);
final CoordinateSystem φλh = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(φ,λ,h)"),
- CommonAxes.GEODETIC_LATITUDE,
- CommonAxes.GEODETIC_LONGITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT);
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT);
final Matrix expected = Matrices.create(4, 4, new double[] {
0, 1, 0, 0,
1, 0, 0, 0,
@@ -219,13 +219,13 @@ public final strictfp class CoordinateSy
@DependsOnMethod("testSwapAndScaleAxes3D")
public void testSwapAndScaleAxes() throws ConversionException {
final CoordinateSystem hxy = new DefaultCartesianCS(singletonMap(NAME_KEY, "(h,x,y)"),
- CommonAxes.HEIGHT_cm,
- CommonAxes.EASTING,
- CommonAxes.NORTHING);
+ HardCodedAxes.HEIGHT_cm,
+ HardCodedAxes.EASTING,
+ HardCodedAxes.NORTHING);
final CoordinateSystem yxh = new DefaultCartesianCS(singletonMap(NAME_KEY, "(y,x,h)"),
- CommonAxes.SOUTHING,
- CommonAxes.EASTING,
- CommonAxes.DEPTH);
+ HardCodedAxes.SOUTHING,
+ HardCodedAxes.EASTING,
+ HardCodedAxes.DEPTH);
assertTrue(swapAndScaleAxes(hxy, hxy).isIdentity());
assertTrue(swapAndScaleAxes(yxh, yxh).isIdentity());
assertMatrixEquals("(h,x,y) → (y,x,h)", Matrices.create(4, 4, new double[] {
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=1559162&r1=1559161&r2=1559162&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 Jan 17 15:59:08 2014
@@ -56,22 +56,22 @@ public final strictfp class DefaultCarte
* (E,N) : legal axes for the usual projected CRS.
*/
cs = new DefaultCartesianCS(properties,
- CommonAxes.EASTING,
- CommonAxes.NORTHING);
+ HardCodedAxes.EASTING,
+ HardCodedAxes.NORTHING);
Validators.validate(cs);
/*
* (NE,SE) : same CS rotated by 45°
*/
cs = new DefaultCartesianCS(properties,
- CommonAxes.NORTH_EAST,
- CommonAxes.SOUTH_EAST);
+ HardCodedAxes.NORTH_EAST,
+ HardCodedAxes.SOUTH_EAST);
Validators.validate(cs);
/*
* (NE,h) : considered perpendicular.
*/
cs = new DefaultCartesianCS(properties,
- CommonAxes.NORTH_EAST,
- CommonAxes.ALTITUDE);
+ HardCodedAxes.NORTH_EAST,
+ HardCodedAxes.ALTITUDE);
Validators.validate(cs);
}
@@ -86,8 +86,8 @@ public final strictfp class DefaultCarte
*/
try {
final DefaultCartesianCS cs = new DefaultCartesianCS(properties,
- CommonAxes.LONGITUDE,
- CommonAxes.LATITUDE);
+ HardCodedAxes.LONGITUDE,
+ HardCodedAxes.LATITUDE);
fail("Angular units should not be accepted for " + cs);
} catch (IllegalArgumentException e) {
assertFalse(e.getMessage().isEmpty());
@@ -97,16 +97,16 @@ public final strictfp class DefaultCarte
*/
try {
final DefaultCartesianCS cs = new DefaultCartesianCS(properties,
- CommonAxes.SOUTHING,
- CommonAxes.NORTHING);
+ HardCodedAxes.SOUTHING,
+ HardCodedAxes.NORTHING);
fail("Colinear units should not be accepted for " + cs);
} catch (IllegalArgumentException e) {
assertFalse(e.getMessage().isEmpty());
}
try {
final DefaultCartesianCS cs = new DefaultCartesianCS(properties,
- CommonAxes.NORTH_EAST,
- CommonAxes.EASTING);
+ HardCodedAxes.NORTH_EAST,
+ HardCodedAxes.EASTING);
fail("Non-perpendicular axis should not be accepted for " + cs);
} catch (IllegalArgumentException e) {
assertFalse(e.getMessage().isEmpty());
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=1559162&r1=1559161&r2=1559162&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 Jan 17 15:59:08 2014
@@ -39,7 +39,7 @@ public final strictfp class DefaultCompo
public void testCreateName() {
final StringBuilder buffer = new StringBuilder("Compound CS");
final String name = DefaultCompoundCS.createName(buffer, new CoordinateSystemAxis[] {
- CommonAxes.EASTING, CommonAxes.NORTHING, CommonAxes.HEIGHT_cm, CommonAxes.TIME
+ HardCodedAxes.EASTING, HardCodedAxes.NORTHING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME
});
assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).", name);
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -24,7 +24,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.apache.sis.referencing.Assert.*;
-import static org.apache.sis.referencing.cs.CommonAxes.*;
+import static org.apache.sis.referencing.cs.HardCodedAxes.*;
/**
@@ -41,7 +41,7 @@ import static org.apache.sis.referencing
})
public final strictfp class DefaultCoordinateSystemAxisTest extends TestCase {
/**
- * Validates the {@link CommonAxes} constants.
+ * Validates the {@link HardCodedAxes} constants.
*/
@Test
public void validate() {
Copied: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java (from r1558919, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CommonAxes.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?p2=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CommonAxes.java&r1=1558919&r2=1559162&rev=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CommonAxes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -16,11 +16,11 @@
*/
package org.apache.sis.referencing.cs;
+import javax.measure.unit.Unit;
+import javax.measure.unit.SI;
+import javax.measure.unit.NonSI;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
import static java.util.Collections.singletonMap;
@@ -33,8 +33,7 @@ import static java.util.Collections.sing
* @version 0.4
* @module
*/
-@SuppressWarnings("serial")
-public final strictfp class CommonAxes {
+public final strictfp class HardCodedAxes {
/**
* Axis info for geodetic longitudes in a
* {@linkplain org.opengis.referencing.crs.GeographicCRS geographic CRS}.
@@ -449,6 +448,6 @@ public final strictfp class CommonAxes {
/**
* Do not allow instantiation of this class.
*/
- private CommonAxes() {
+ private HardCodedAxes() {
}
}
Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java?rev=1559162&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.cs;
+
+import java.util.Map;
+import javax.measure.unit.SI;
+import org.opengis.referencing.cs.AxisDirection;
+import org.apache.sis.measure.Units;
+
+import static java.util.Collections.singletonMap;
+import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
+
+
+/**
+ * Collection of coordinate systems for testing purpose.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class HardCodedCS {
+ /**
+ * A two-dimensional ellipsoidal CS with
+ * <var>{@linkplain HardCodedAxes#GEODETIC_LONGITUDE geodetic longitude}</var>,
+ * <var>{@linkplain HardCodedAxes#GEODETIC_LATITUDE geodetic latitude}</var>
+ * axes in decimal degrees.
+ */
+ public static final DefaultEllipsoidalCS GEODETIC_2D = new DefaultEllipsoidalCS(
+ singletonMap(NAME_KEY, "Geodetic 2D"),
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.GEODETIC_LATITUDE);
+
+ /**
+ * A three-dimensional ellipsoidal CS with
+ * <var>{@linkplain HardCodedAxes#GEODETIC_LONGITUDE geodetic longitude}</var>,
+ * <var>{@linkplain HardCodedAxes#GEODETIC_LATITUDE geodetic latitude}</var>,
+ * <var>{@linkplain HardCodedAxes#ELLIPSOIDAL_HEIGHT ellipsoidal height}</var>
+ * axes.
+ */
+ public static final DefaultEllipsoidalCS GEODETIC_3D = new DefaultEllipsoidalCS(
+ singletonMap(NAME_KEY, "Geodetic 3D"),
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT);
+
+ /**
+ * A three-dimensional spherical CS with
+ * <var>{@linkplain HardCodedAxes#SPHERICAL_LONGITUDE longitude}</var>,
+ * <var>{@linkplain HardCodedAxes#SPHERICAL_LATITUDE latitude}</var>,
+ * <var>{@linkplain HardCodedAxes#GEOCENTRIC_RADIUS radius}</var>
+ * axes.
+ */
+ public static final DefaultSphericalCS SPHERICAL = new DefaultSphericalCS(
+ singletonMap(NAME_KEY, "Spherical"),
+ HardCodedAxes.SPHERICAL_LONGITUDE,
+ HardCodedAxes.SPHERICAL_LATITUDE,
+ HardCodedAxes.GEOCENTRIC_RADIUS);
+
+ /**
+ * A three-dimensional Cartesian CS with geocentric
+ * <var>{@linkplain HardCodedAxes#GEOCENTRIC_X x}</var>,
+ * <var>{@linkplain HardCodedAxes#GEOCENTRIC_Y y}</var>,
+ * <var>{@linkplain HardCodedAxes#GEOCENTRIC_Z z}</var>
+ * axes in metres.
+ */
+ public static final DefaultCartesianCS GEOCENTRIC = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Geocentric"),
+ HardCodedAxes.GEOCENTRIC_X,
+ HardCodedAxes.GEOCENTRIC_Y,
+ HardCodedAxes.GEOCENTRIC_Z);
+
+ /**
+ * A two-dimensional Cartesian CS with
+ * <var>{@linkplain HardCodedAxes#EASTING Easting}</var>,
+ * <var>{@linkplain HardCodedAxes#NORTHING Northing}</var>
+ * axes in metres.
+ */
+ public static final DefaultCartesianCS PROJECTED = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Projected"),
+ HardCodedAxes.EASTING,
+ HardCodedAxes.NORTHING);
+
+ /**
+ * A two-dimensional Cartesian CS with
+ * <var>{@linkplain HardCodedAxes#X x}</var>,
+ * <var>{@linkplain HardCodedAxes#Y y}</var>
+ * axes in metres.
+ */
+ public static final DefaultCartesianCS CARTESIAN_2D = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Cartesian 2D"),
+ HardCodedAxes.X,
+ HardCodedAxes.Y);
+
+ /**
+ * A three-dimensional Cartesian CS with
+ * <var>{@linkplain HardCodedAxes#X x}</var>,
+ * <var>{@linkplain HardCodedAxes#Y y}</var>,
+ * <var>{@linkplain HardCodedAxes#Z z}</var>
+ * axes in metres.
+ */
+ public static final DefaultCartesianCS CARTESIAN_3D = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Cartesian 3D"),
+ HardCodedAxes.X,
+ HardCodedAxes.Y,
+ HardCodedAxes.Z);
+
+ /**
+ * A two-dimensional Cartesian CS with
+ * <var>{@linkplain HardCodedAxes#COLUMN column}</var>,
+ * <var>{@linkplain HardCodedAxes#ROW row}</var>
+ * axes.
+ */
+ public static final DefaultCartesianCS GRID = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Grid"),
+ HardCodedAxes.COLUMN,
+ HardCodedAxes.ROW);
+
+ /**
+ * A two-dimensional Cartesian CS with
+ * <var>{@linkplain HardCodedAxes#DISPLAY_X display x}</var>,
+ * <var>{@linkplain HardCodedAxes#DISPLAY_Y display y}</var>
+ * axes.
+ */
+ public static final DefaultCartesianCS DISPLAY = new DefaultCartesianCS(
+ singletonMap(NAME_KEY, "Display"),
+ HardCodedAxes.DISPLAY_X,
+ HardCodedAxes.DISPLAY_Y);
+
+ /**
+ * A one-dimensional vertical CS with
+ * <var>{@linkplain HardCodedAxes#ELLIPSOIDAL_HEIGHT
+ * ellipsoidal height}</var> axis in metres.
+ */
+ public static final DefaultVerticalCS ELLIPSOIDAL_HEIGHT = new DefaultVerticalCS(
+ getProperties(HardCodedAxes.ELLIPSOIDAL_HEIGHT), HardCodedAxes.ELLIPSOIDAL_HEIGHT);
+
+ /**
+ * A one-dimensional vertical CS with
+ * <var>{@linkplain HardCodedAxes#GRAVITY_RELATED_HEIGHT
+ * gravity-related height}</var> axis in metres.
+ */
+ public static final DefaultVerticalCS GRAVITY_RELATED_HEIGHT = new DefaultVerticalCS(
+ getProperties(HardCodedAxes.GRAVITY_RELATED_HEIGHT), HardCodedAxes.GRAVITY_RELATED_HEIGHT);
+
+ /**
+ * A one-dimensional vertical CS with
+ * <var>{@linkplain HardCodedAxes#DEPTH depth}</var>
+ * axis in metres.
+ */
+ public static final DefaultVerticalCS DEPTH = new DefaultVerticalCS(
+ getProperties(HardCodedAxes.DEPTH), HardCodedAxes.DEPTH);
+
+ /**
+ * A one-dimensional temporal CS with
+ * <var>{@linkplain HardCodedAxes#TIME time}</var>,
+ * axis in {@linkplain javax.measure.unit.NonSI#DAY day} units.
+ */
+ public static final DefaultTimeCS DAYS;
+
+ /**
+ * A one-dimensional temporal CS with
+ * <var>{@linkplain HardCodedAxes#TIME time}</var>,
+ * axis in {@linkplain javax.measure.unit.SI#SECOND second} units.
+ */
+ public static final DefaultTimeCS SECONDS;
+
+ /**
+ * A one-dimensional temporal CS with
+ * <var>{@linkplain HardCodedAxes#TIME time}</var>,
+ * axis in millisecond units.
+ */
+ public static final DefaultTimeCS MILLISECONDS;
+ static {
+ final Map<String,?> properties = getProperties(HardCodedAxes.TIME);
+ DAYS = new DefaultTimeCS(properties, HardCodedAxes.TIME);
+ SECONDS = new DefaultTimeCS(properties, new DefaultCoordinateSystemAxis(properties, "t", AxisDirection.FUTURE, SI.SECOND));
+ MILLISECONDS = new DefaultTimeCS(properties, new DefaultCoordinateSystemAxis(properties, "t", AxisDirection.FUTURE, Units.MILLISECOND));
+ }
+
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private HardCodedCS() {
+ }
+}
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
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=1559162&r1=1559161&r2=1559162&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 Jan 17 15:59:08 2014
@@ -50,22 +50,22 @@ public final strictfp class NormalizerTe
@Test
public void testSort() {
assertOrdered(new CoordinateSystemAxis[] {
- CommonAxes.LONGITUDE,
- CommonAxes.LATITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT
+ HardCodedAxes.LONGITUDE,
+ HardCodedAxes.LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT
}, new CoordinateSystemAxis[] {
- CommonAxes.LONGITUDE,
- CommonAxes.LATITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT
+ HardCodedAxes.LONGITUDE,
+ HardCodedAxes.LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT
});
assertOrdered(new CoordinateSystemAxis[] {
- CommonAxes.LONGITUDE,
- CommonAxes.LATITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT
+ HardCodedAxes.LONGITUDE,
+ HardCodedAxes.LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT
}, new CoordinateSystemAxis[] {
- CommonAxes.LATITUDE,
- CommonAxes.ELLIPSOIDAL_HEIGHT,
- CommonAxes.LONGITUDE
+ HardCodedAxes.LATITUDE,
+ HardCodedAxes.ELLIPSOIDAL_HEIGHT,
+ HardCodedAxes.LONGITUDE
});
// A plausible CS.
@@ -166,23 +166,23 @@ public final strictfp class NormalizerTe
*/
@Test
public void testNormalizeAxis() {
- assertSame(CommonAxes.LATITUDE, Normalizer.normalize(CommonAxes.LATITUDE));
- assertSame(CommonAxes.LONGITUDE, Normalizer.normalize(CommonAxes.LONGITUDE));
- assertSame(CommonAxes.EASTING, Normalizer.normalize(CommonAxes.EASTING));
- assertSame(CommonAxes.NORTHING, Normalizer.normalize(CommonAxes.NORTHING));
- assertSame(CommonAxes.ALTITUDE, Normalizer.normalize(CommonAxes.ALTITUDE));
- assertSame(CommonAxes.TIME, Normalizer.normalize(CommonAxes.TIME));
+ assertSame(HardCodedAxes.LATITUDE, Normalizer.normalize(HardCodedAxes.LATITUDE));
+ assertSame(HardCodedAxes.LONGITUDE, Normalizer.normalize(HardCodedAxes.LONGITUDE));
+ assertSame(HardCodedAxes.EASTING, Normalizer.normalize(HardCodedAxes.EASTING));
+ assertSame(HardCodedAxes.NORTHING, Normalizer.normalize(HardCodedAxes.NORTHING));
+ assertSame(HardCodedAxes.ALTITUDE, Normalizer.normalize(HardCodedAxes.ALTITUDE));
+ assertSame(HardCodedAxes.TIME, Normalizer.normalize(HardCodedAxes.TIME));
/*
* Test a change of unit from centimetre to metre.
*/
assertAxisEquals("Height", "h", AxisDirection.UP,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, null,
- Normalizer.normalize(CommonAxes.HEIGHT_cm));
+ Normalizer.normalize(HardCodedAxes.HEIGHT_cm));
/*
* 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(CommonAxes.WESTING));
+ Normalizer.normalize(HardCodedAxes.WESTING));
}
}
Added: 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=1559162&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.datum;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+import javax.measure.unit.NonSI;
+import org.opengis.referencing.datum.PixelInCell;
+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 static org.opengis.referencing.IdentifiedObject.*;
+
+
+/**
+ * Collection of datum for testing purpose.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class HardCodedDatum {
+ /**
+ * Greenwich meridian (EPSG:8901), with angular measurements in decimal degrees.
+ */
+ public static final DefaultPrimeMeridian GREENWICH = new DefaultPrimeMeridian(
+ properties("Greenwich", "8901"), 0, NonSI.DEGREE_ANGLE);;
+
+ /**
+ * WGS 1984 datum (EPSG:6326). Prime meridian is Greenwich.
+ * This datum is used in GPS systems.
+ */
+ public static final DefaultGeodeticDatum WGS84 = new DefaultGeodeticDatum(
+ properties("World Geodetic System 1984", "6326"),
+ new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
+
+ /**
+ * WGS 1972 datum (EPSG:6322). Prime meridian is Greenwich.
+ * This datum is used, together with {@linkplain #WGS84}, in
+ * {@linkplain org.apache.sis.referencing.operation.transform.EarthGravitationalModel
+ * Earth Gravitational Model}.
+ */
+ public static final DefaultGeodeticDatum WGS72 = new DefaultGeodeticDatum(
+ properties("World Geodetic System 1972", "6322"),
+ new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
+
+ /**
+ * Spherical datum based on GRS 1980 Authalic Sphere (EPSG:6047). Prime meridian is Greenwich.
+ */
+ public static final DefaultGeodeticDatum SPHERE = new DefaultGeodeticDatum(
+ properties("Not specified (based on GRS 1980 Authalic Sphere)", "6047"),
+ new DefaultEllipsoid(GeodeticDatumMock.SPHERE.getEllipsoid()), GREENWICH);
+
+ /**
+ * Mean sea level, which can be used as an approximation of geoid.
+ */
+ public static final DefaultVerticalDatum MEAN_SEA_LEVEL = new DefaultVerticalDatum(
+ properties("Mean Sea Level", "5700"), VerticalDatumType.GEOIDAL);
+
+ /**
+ * Ellipsoid for measurements of height above the ellipsoid.
+ * This is not a valid datum according ISO 19111, but is used by Apache SIS for internal calculation.
+ */
+ public static final DefaultVerticalDatum ELLIPSOID = new DefaultVerticalDatum(
+ properties("Ellipsoid", null), VerticalDatumTypes.ELLIPSOIDAL);
+
+ /**
+ * Default datum for time measured since January 1st, 1970 at 00:00 UTC.
+ */
+ public static final DefaultTemporalDatum UNIX = new DefaultTemporalDatum(
+ properties("UNIX", null), new Date(0));
+
+ /**
+ * Image with {@link PixelInCell#CELL_CENTER}.
+ */
+ public static final DefaultImageDatum IMAGE = new DefaultImageDatum(
+ properties("Image", null), PixelInCell.CELL_CENTER);
+
+ /**
+ * An engineering datum for unknown coordinate reference system. Such CRS are usually
+ * assumed Cartesian, but will not have any transformation path to other CRS.
+ */
+ public static final DefaultEngineeringDatum UNKNOWN = new DefaultEngineeringDatum(properties("Unknown", null));
+
+ /**
+ * Creates a map of properties for the given name and EPSG code.
+ */
+ private static Map<String,?> properties(final String name, final String code) {
+ 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));
+ }
+ return properties;
+ }
+
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private HardCodedDatum() {
+ }
+}
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
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=1559162&r1=1559161&r2=1559162&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 Jan 17 15:59:08 2014
@@ -71,6 +71,8 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
org.apache.sis.referencing.crs.AbstractCRSTest.class,
org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
+ org.apache.sis.referencing.crs.SubTypesTest.class,
+ org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,
org.apache.sis.referencing.GeodeticObjectsTest.class,
org.apache.sis.referencing.CRSTest.class,
@@ -84,6 +86,7 @@ import org.junit.BeforeClass;
org.apache.sis.geometry.SubEnvelopeTest.class,
org.apache.sis.geometry.ImmutableEnvelopeTest.class,
org.apache.sis.geometry.Envelope2DTest.class,
+ org.apache.sis.geometry.EnvelopesTest.class,
org.apache.sis.test.integration.ReferencingInMetadataTest.class
})
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -19,6 +19,8 @@ package org.apache.sis.test;
import java.util.Arrays;
import java.util.Set;
import java.util.HashSet;
+import java.util.List;
+import java.util.ArrayList;
import java.io.File;
import java.net.URL;
import java.net.URISyntaxException;
@@ -86,16 +88,31 @@ public abstract strictfp class TestSuite
* In some IDE configuration, all the ".class" files are in the same directory, in which case the
* verification performed by this method become irrelevant.
*/
- if (!new File(root.getParent(), ".." + File.separatorChar + "pom.xml").isFile()) {
+ File moduleDir = root;
+ for (int i=0; i<3; i++) {
+ moduleDir = moduleDir.getParentFile();
+ if (moduleDir == null) {
+ return;
+ }
+ }
+ if (!new File(moduleDir, "pom.xml").isFile()) {
return;
}
/*
* Now scan all "*Test.class" in the "target/org" directory and and sub-directories,
* and fail on the first missing test file if any.
*/
- final Set<Class<?>> tests = new HashSet<>(Arrays.asList(suite.getAnnotation(Suite.SuiteClasses.class).value()));
+ List<Class<?>> declared = Arrays.asList(suite.getAnnotation(Suite.SuiteClasses.class).value());
+ final Set<Class<?>> tests = new HashSet<>(declared);
+ if (tests.size() != declared.size()) {
+ declared = new ArrayList<>(declared);
+ assertTrue(declared.removeAll(tests));
+ fail("Classes defined twice in " + suite.getSimpleName() + ": " + declared);
+ }
removeExistingTests(loader, root, new StringBuilder(120).append(root.getName()), tests);
- assertTrue(tests.toString(), tests.isEmpty());
+ if (!tests.isEmpty()) {
+ fail("Classes not found. Are they defined in an other module? " + tests);
+ }
}
/**
@@ -124,7 +141,9 @@ public abstract strictfp class TestSuite
fail(e.toString());
return;
}
- assertTrue(classname, tests.remove(test));
+ if (!tests.remove(test)) {
+ fail("Class " + classname + " is not specified in the test suite.");
+ }
}
}
path.setLength(length);
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1559162&r1=1559161&r2=1559162&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Fri Jan 17 15:59:08 2014
@@ -86,6 +86,7 @@ import org.junit.BeforeClass;
org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
org.apache.sis.util.iso.AbstractNameTest.class,
org.apache.sis.util.iso.DefaultNameFactoryTest.class,
+ org.apache.sis.internal.simple.SimpleReferenceIdentifierTest.class,
// Measurements and formatting.
org.apache.sis.measure.SexagesimalConverterTest.class,