sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1766508 [6/6] - in /sis/branches/JDK7: ./ application/ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-openoffice/ application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ core/ core/sis-metadata/sr...
Date Tue, 25 Oct 2016 10:45:15 GMT
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
[UTF-8] Tue Oct 25 10:45:14 2016
@@ -41,26 +41,22 @@ import static org.apache.sis.test.Assert
 })
 public final strictfp class UnitsTest extends TestCase {
     /**
-     * Sanity check of {@link UnitsMap}. This test fail if at least one code in the
-     * {@link UnitsMap#EPSG_CODES} static initializer is invalid.
+     * Verifies that the {@link Units#initialized} flag has been set.
      */
     @Test
-    public void testUnitsMap() {
-        assertFalse(UnitsMap.EPSG_CODES.containsKey(null));
+    public void testInitialized() {
+        assertTrue(Units.initialized);
     }
 
     /**
      * Tests serialization of units.
-     *
-     * @todo The {@code assertEquals} in this method should actually be {@code assertSame},
-     *       but JSR-275 0.9.3 does not resolve units on deserialization.
      */
     @Test
     public void testSerialization() {
-        assertEquals(DEGREE,     assertSerializedEquals(DEGREE));
+        assertSame  (DEGREE,     assertSerializedEquals(DEGREE));
         assertEquals(DMS,        assertSerializedEquals(DMS));
         assertEquals(DMS_SCALED, assertSerializedEquals(DMS_SCALED));
-        assertEquals(PPM,        assertSerializedEquals(PPM));
+        assertSame  (PPM,        assertSerializedEquals(PPM));
     }
 
     /**
@@ -70,7 +66,7 @@ public final strictfp class UnitsTest ex
     public void testIsTemporal() {
         // Standard units
         assertFalse(isTemporal(null));
-        assertFalse(isTemporal(ONE));
+        assertFalse(isTemporal(UNITY));
         assertFalse(isTemporal(METRE));
         assertFalse(isTemporal(RADIAN));
         assertFalse(isTemporal(DEGREE));
@@ -94,7 +90,7 @@ public final strictfp class UnitsTest ex
     public void testIsLinear() {
         // Standard units
         assertFalse(isLinear(null));
-        assertFalse(isLinear(ONE));
+        assertFalse(isLinear(UNITY));
         assertTrue (isLinear(METRE));
         assertFalse(isLinear(RADIAN));
         assertFalse(isLinear(DEGREE));
@@ -118,7 +114,7 @@ public final strictfp class UnitsTest ex
     public void testIsAngular() {
         // Standard units
         assertFalse(isAngular(null));
-        assertFalse(isAngular(ONE));
+        assertFalse(isAngular(UNITY));
         assertFalse(isAngular(METRE));
         assertTrue (isAngular(RADIAN));
         assertTrue (isAngular(DEGREE));
@@ -142,7 +138,7 @@ public final strictfp class UnitsTest ex
     public void testIsScale() {
         // Standard units
         assertFalse(isScale(null));
-        assertTrue (isScale(ONE));
+        assertTrue (isScale(UNITY));
         assertFalse(isScale(METRE));
         assertFalse(isScale(RADIAN));
         assertFalse(isScale(DEGREE));
@@ -182,7 +178,7 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testMultiply() {
-        assertSame(KILOMETRE, multiply(METRE,  1000));
+        assertSame(KILOMETRE, multiply(METRE, 1000));
         assertSame(DEGREE, multiply(RADIAN, 0.017453292519943295));
     }
 
@@ -243,8 +239,8 @@ public final strictfp class UnitsTest ex
         assertSame  (HERTZ,                         valueOf("1/s"));
         assertSame  (HERTZ,                         valueOf("s-1"));
         assertSame  (PERCENT,                       valueOf("%"));
-        assertSame  (ONE,                           valueOf("kg/kg"));
-        assertSame  (ONE,                           valueOf("kg.kg-1"));
+        assertSame  (UNITY,                         valueOf("kg/kg"));
+        assertSame  (UNITY,                         valueOf("kg.kg-1"));
         assertSame  (PPM,                           valueOf("ppm"));            // Parts
per million
         assertSame  (PSU,                           valueOf("psu"));            // Pratical
Salinity Unit
         assertSame  (SIGMA,                         valueOf("sigma"));
@@ -266,6 +262,25 @@ public final strictfp class UnitsTest ex
         assertSame(DEGREE, valueOf("urn:ogc:def:uom:EPSG::9102"));
         assertSame(METRE,  valueOf("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])"));
         assertSame(METRE,  valueOf("gmxUom.xml#m"));
+
+        assertSame(TROPICAL_YEAR,   valueOfEPSG(1029));
+        assertSame(SECOND,          valueOfEPSG(1040));
+        assertSame(FOOT,            valueOfEPSG(9002));
+        assertSame(US_SURVEY_FOOT,  valueOfEPSG(9003));
+        assertSame(NAUTICAL_MILE,   valueOfEPSG(9030));
+        assertSame(KILOMETRE,       valueOfEPSG(9036));
+        assertSame(RADIAN,          valueOfEPSG(9101));
+        assertSame(ARC_MINUTE,      valueOfEPSG(9103));
+        assertSame(ARC_SECOND,      valueOfEPSG(9104));
+        assertSame(GRAD,            valueOfEPSG(9105));
+        assertSame(MICRORADIAN,     valueOfEPSG(9109));
+        assertSame(SexagesimalConverter.DMS_SCALED, valueOfEPSG(9107));
+        assertSame(SexagesimalConverter.DMS_SCALED, valueOfEPSG(9108));
+        assertSame(SexagesimalConverter.DMS,        valueOfEPSG(9110));
+        assertSame(SexagesimalConverter.DM,         valueOfEPSG(9111));
+        assertSame(UNITY,           valueOfEPSG(9203));
+        assertSame(UNITY,           valueOfEPSG(9201));
+        assertSame(PPM,             valueOfEPSG(9202));
     }
 
     /**
@@ -273,10 +288,25 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testGetEpsgCode() {
-        assertEquals(Integer.valueOf(9001), getEpsgCode(METRE,  false));
-        assertEquals(Integer.valueOf(9102), getEpsgCode(DEGREE, false));
-        assertEquals(Integer.valueOf(9122), getEpsgCode(DEGREE, true));
-        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,    false));
-        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,    true));
+        assertEquals(Integer.valueOf(9001), getEpsgCode(METRE,          false));
+        assertEquals(Integer.valueOf(9102), getEpsgCode(DEGREE,         false));
+        assertEquals(Integer.valueOf(9122), getEpsgCode(DEGREE,         true));
+        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,            false));
+        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,            true));
+        assertEquals(Integer.valueOf(9108), getEpsgCode(DMS_SCALED,     false));
+        assertEquals(Integer.valueOf(9111), getEpsgCode(DM,             false));
+        assertEquals(Integer.valueOf(1029), getEpsgCode(TROPICAL_YEAR,  false));
+        assertEquals(Integer.valueOf(1040), getEpsgCode(SECOND,         false));
+        assertEquals(Integer.valueOf(9002), getEpsgCode(FOOT,           false));
+        assertEquals(Integer.valueOf(9003), getEpsgCode(US_SURVEY_FOOT, false));
+        assertEquals(Integer.valueOf(9030), getEpsgCode(NAUTICAL_MILE,  false));
+        assertEquals(Integer.valueOf(9036), getEpsgCode(KILOMETRE,      false));
+        assertEquals(Integer.valueOf(9101), getEpsgCode(RADIAN,         false));
+        assertEquals(Integer.valueOf(9103), getEpsgCode(ARC_MINUTE,     false));
+        assertEquals(Integer.valueOf(9104), getEpsgCode(ARC_SECOND,     false));
+        assertEquals(Integer.valueOf(9105), getEpsgCode(GRAD,           false));
+        assertEquals(Integer.valueOf(9109), getEpsgCode(MICRORADIAN,    false));
+        assertEquals(Integer.valueOf(9201), getEpsgCode(UNITY,          false));
+        assertEquals(Integer.valueOf(9202), getEpsgCode(PPM,            false));
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
[UTF-8] Tue Oct 25 10:45:14 2016
@@ -70,7 +70,7 @@ public final strictfp class VerticalCRSM
      * Depth as a fraction of the sea floor depth at the location of the point for which
the depth is evaluated.
      */
     public static final VerticalCRS SIGMA_LEVEL = new VerticalCRSMock("Sigma level",
-            VerticalDatumType.OTHER_SURFACE, 0, 1, Units.ONE, false);
+            VerticalDatumType.OTHER_SURFACE, 0, 1, Units.UNITY, false);
 
     /**
      * The datum type (geoidal, barometric, etc.).

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=1766508&r1=1766507&r2=1766508&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] Tue Oct 25 10:45:14 2016
@@ -56,6 +56,7 @@ import org.junit.BeforeClass;
     org.apache.sis.util.logging.WarningListenersTest.class,
     org.apache.sis.util.logging.MonolineFormatterTest.class,
     org.apache.sis.util.logging.LoggerAdapterTest.class,
+    org.apache.sis.math.FractionTest.class,
     org.apache.sis.math.VectorTest.class,
     org.apache.sis.math.MathFunctionsTest.class,
     org.apache.sis.math.DecimalFunctionsTest.class,
@@ -102,6 +103,11 @@ import org.junit.BeforeClass;
 
     // Measurements and formatting.
     org.apache.sis.measure.SexagesimalConverterTest.class,
+    org.apache.sis.measure.LinearConverterTest.class,
+    org.apache.sis.measure.UnitDimensionTest.class,
+    org.apache.sis.measure.SystemUnitTest.class,
+    org.apache.sis.measure.ConventionalUnitTest.class,
+    org.apache.sis.measure.UnitFormatTest.class,
     org.apache.sis.measure.UnitsTest.class,
     org.apache.sis.measure.RangeTest.class,
     org.apache.sis.measure.DateRangeTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
[UTF-8] Tue Oct 25 10:45:14 2016
@@ -34,7 +34,7 @@ import static org.apache.sis.util.CharSe
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @DependsOn({
@@ -233,6 +233,8 @@ public final strictfp class CharSequence
 
     /**
      * Tests the {@link CharSequences#toASCII(CharSequence)} method.
+     *
+     * @see StringBuildersTest#testToASCII()
      */
     @Test
     public void testToASCII() {
@@ -240,6 +242,8 @@ public final strictfp class CharSequence
         assertSame  (metre, toASCII(metre));
         assertEquals(metre, toASCII("mètre").toString());
         assertNull  (       toASCII(null));
+        assertEquals("kg, mg, cm, km, km2, km3, ml, m/s, Pa, Hz, mol, ms, μs, m3, rad",
+                toASCII("㎏, ㎎, ㎝, ㎞, ㎢, ㎦, ㎖, ㎧, ㎩, ㎐, ㏖, ㎳, ㎲,
㎥, ㎭").toString());
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
[UTF-8] Tue Oct 25 10:45:14 2016
@@ -29,7 +29,7 @@ import static org.apache.sis.util.String
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.8
  * @module
  */
 public final strictfp class StringBuildersTest extends TestCase {
@@ -87,13 +87,15 @@ public final strictfp class StringBuilde
         final StringBuilder buffer = new StringBuilder("4.10");
         trimFractionalPart(buffer);
         assertEquals("4.10", buffer.toString());
-        buffer.setCharAt(2, '0'); // Replace the '1' by '0'.
+        buffer.setCharAt(2, '0');                                   // Replace the '1' by
'0'.
         trimFractionalPart(buffer);
         assertEquals("4", buffer.toString());
     }
 
     /**
      * Tests the {@link StringBuilders#toASCII(StringBuilder)} method.
+     *
+     * @see CharSequencesTest#testToASCII()
      */
     @Test
     public void testToASCII() {
@@ -102,5 +104,26 @@ public final strictfp class StringBuilde
                 " ‘single’, “double”, \"ascii' 30°20′10″.");
         toASCII(s);
         assertEquals("metres\n 'single', \"double\", \"ascii' 30°20'10\".", s.toString());
+        /*
+         * Characters below are in the Unicode CJK compatibility block. They are not intended
for normal use.
+         * Note that in the decomposition form of ㎲, the first character is the Greek letter
μ (U+03BC) instead
+         * of the micro sign µ (U+0085).
+         */
+        s.setLength(0);
+        toASCII(s.append("㎏, ㎎, ㎝, ㎞, ㎢, ㎦, ㎖, ㎧, ㎩, ㎐, ㏖, ㎳, ㎲,
㎥, ㎭"));
+        assertEquals("kg, mg, cm, km, km2, km3, ml, m/s, Pa, Hz, mol, ms, μs, m3, rad",
s.toString());
+        /*
+         * Characters below are not from Unicode compatibility block, but nevertheless need
decomposition or
+         * replacement. Note that the first K is the Kelvin sign (U+212A), to be replaced
by the K letter.
+         */
+        s.setLength(0);
+        toASCII(s.append("℃, K, m⋅s"));
+        assertEquals("°C, K, m*s", s.toString());
+        /*
+         * Tests the shortcut code path.
+         */
+        s.setLength(0);
+        toASCII(s.append("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"));
+        assertEquals(    "AAAAAAÆCEEEEIIIIDNOOOOO*OUUUUYÞsaaaaaaæceeeeiiiionooooo/ouuuuyþy",
s.toString());
     }
 }

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Tue Oct
25 10:45:14 2016
@@ -83,7 +83,6 @@ project.GeoAPI       = ../../../../GeoAP
 # Those numbers should match the ones declared in the pom.xml files.
 #
 jsr363.version       = 1.0
-jsr363-ri.version    = 1.0.1
 jama.version         = 1.0.3
 geometry.version     = 1.2.1
 georss.version       = 0.9.8
@@ -109,7 +108,6 @@ endorsed.classpath=
 javac.classpath=\
     ${project.GeoAPI}/dist/geoapi.jar:\
     ${maven.repository}/javax/measure/unit-api/${jsr363.version}/unit-api-${jsr363.version}.jar:\
-    ${maven.repository}/tec/units/unit-ri/${jsr363-ri.version}/unit-ri-${jsr363-ri.version}.jar:\
     ${maven.repository}/com/esri/geometry/esri-geometry-api/${geometry.version}/esri-geometry-api-${geometry.version}.jar:\
     ${maven.repository}/org/geonames/georss-rome/${georss.version}/georss-rome-${georss.version}.jar:\
     ${maven.repository}/rome/rome/${rome.version}/rome-${rome.version}.jar:\

Modified: sis/branches/JDK7/ide-project/eclipse/classpath
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/eclipse/classpath?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/eclipse/classpath (original)
+++ sis/branches/JDK7/ide-project/eclipse/classpath Tue Oct 25 10:45:14 2016
@@ -20,7 +20,6 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="M2_REPO/org/opengis/geoapi/3.0.0/geoapi-3.0.0.jar"/>
 	<classpathentry kind="var" path="M2_REPO/org/opengis/geoapi-conformance/3.0.0/geoapi-conformance-3.0.0.jar"/>
-	<classpathentry kind="var" path="M2_REPO/javax/measure/jsr-275/0.9.3/jsr-275-0.9.3.jar"/>
 	<classpathentry kind="var" path="M2_REPO/junit/junit/4.8.1/junit-4.8.1.jar"/>
 	<classpathentry kind="var" path="M2_REPO/org/osgi/org.osgi.core/5.0.0/org.osgi.core-5.0.0.jar"/>
 	<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-core/3.0.4/maven-core-3.0.4.jar"/>

Modified: sis/branches/JDK7/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Tue Oct 25 10:45:14 2016
@@ -418,6 +418,7 @@ Apache SIS is a free software, Java lang
         <groupId>gov.nist.math</groupId>
         <artifactId>jama</artifactId>
         <version>1.0.3</version>
+        <scope>test</scope>
       </dependency>
       <dependency>
         <groupId>javax</groupId>



Mime
View raw message