sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1519024 - in /sis/branches/JDK7/core/sis-referencing: ./ src/test/java/org/apache/sis/referencing/ src/test/java/org/apache/sis/test/suite/
Date Fri, 30 Aug 2013 16:59:09 GMT
Author: desruisseaux
Date: Fri Aug 30 16:59:09 2013
New Revision: 1519024

URL: http://svn.apache.org/r1519024
Log:
Added some tests.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/pom.xml
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java

Modified: sis/branches/JDK7/core/sis-referencing/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/pom.xml?rev=1519024&r1=1519023&r2=1519024&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/pom.xml (original)
+++ sis/branches/JDK7/core/sis-referencing/pom.xml Fri Aug 30 16:59:09 2013
@@ -138,6 +138,13 @@ Implementations of Coordinate Reference 
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sis.core</groupId>
+      <artifactId>sis-metadata</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Added: 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=1519024&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] Fri Aug 30 16:59:09 2013
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Locale;
+import org.opengis.test.Validators;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link AbstractIdentifiedObject}.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.4 (derived from geotk-2.2)
+ * @version 0.4
+ * @module
+ */
+@DependsOn(NamedIdentifierTest.class)
+public final strictfp class AbstractIdentifiedObjectTest extends TestCase {
+    /**
+     * Tests the {@link AbstractIdentifiedObject#AbstractIdentifiedObject(Map)} constructor.
+     */
+    @Test
+    public void testCreateFromMap() {
+        final Map<String,Object> properties = new HashMap<>(10);
+        assertNull(properties.put("name",             "This is a name"));
+        assertNull(properties.put("remarks",          "There is remarks"));
+        assertNull(properties.put("remarks_fr",       "Voici des remarques"));
+        assertNull(properties.put("anchorPoint",      "Anchor point"));
+        assertNull(properties.put("realizationEpoch", "Realization epoch"));
+        assertNull(properties.put("validArea",        "Valid area"));
+
+        final AbstractIdentifiedObject reference = new AbstractIdentifiedObject(properties);
+        Validators.validate(reference);
+
+        assertEquals("name",       "This is a name",      reference.getName().getCode());
+        assertNull  ("codeSpace",                         reference.getName().getCodeSpace());
+        assertNull  ("version",                           reference.getName().getVersion());
+        assertEquals("remarks",    "There is remarks",    reference.getRemarks().toString(Locale.ENGLISH));
+        assertEquals("remarks_fr", "Voici des remarques", reference.getRemarks().toString(Locale.FRENCH));
+        assertTrue  ("identifiers",                       reference.getIdentifiers().isEmpty());
+        assertNull  ("identifier",                        reference.getIdentifier());
+        assertTrue  ("aliases",                           reference.getAlias().isEmpty());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: 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=1519024&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
[UTF-8] Fri Aug 30 16:59:09 2013
@@ -0,0 +1,99 @@
+/*
+ * 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;
+
+import java.util.Locale;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.util.GenericName;
+import org.opengis.test.Validators;
+import org.apache.sis.util.iso.DefaultInternationalString;
+import org.apache.sis.test.DependsOnMethod;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
+
+
+/**
+ * Tests {@link NamedIdentifier}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class NamedIdentifierTest extends TestCase {
+    /**
+     * Tests the {@link NamedIdentifier#NamedIdentifier(Citation, String)} constructor.
+     */
+    @Test
+    public void testCreateFromCode() {
+        final NamedIdentifier identifier = new NamedIdentifier(EPSG, "4326");
+        Validators.validate((ReferenceIdentifier) identifier);
+        Validators.validate((GenericName) identifier);
+
+        // ImmutableIdentifier properties
+        assertEquals("code",      "4326", identifier.getCode());
+        assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
+        assertSame  ("authority",  EPSG,  identifier.getAuthority());
+        assertNull  ("version",           identifier.getVersion());
+        assertNull  ("remarks",           identifier.getRemarks());
+        assertFalse ("isDeprecated",      identifier.isDeprecated());
+
+        // NamedIdentifier properties
+        assertEquals("depth",  2,          identifier.depth());
+        assertEquals("tip",   "4326",      identifier.tip().toString());
+        assertEquals("head",  "EPSG",      identifier.head().toString());
+        assertEquals("name",  "EPSG:4326", identifier.toString());
+        assertTrue  ("scope",              identifier.scope().isGlobal());
+    }
+
+    /**
+     * Tests the {@link NamedIdentifier#NamedIdentifier(Citation, InternationalString)} constructor.
+     */
+    @Test
+    @DependsOnMethod("testCreateFromCode")
+    public void testCreateFromInternationalString() {
+        final DefaultInternationalString i18n = new DefaultInternationalString();
+        i18n.add(Locale.ENGLISH,  "name");
+        i18n.add(Locale.FRENCH,   "nom");
+        i18n.add(Locale.JAPANESE, "名前");
+        final NamedIdentifier identifier = new NamedIdentifier(EPSG, i18n);
+        Validators.validate((ReferenceIdentifier) identifier);
+        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  ("remarks",           identifier.getRemarks());
+        assertFalse ("isDeprecated",      identifier.isDeprecated());
+
+        // NamedIdentifier properties
+        assertEquals("depth",  2,          identifier.depth());
+        assertEquals("tip",   "name",      identifier.tip().toInternationalString().toString(Locale.ENGLISH));
+        assertEquals("tip",   "nom",       identifier.tip().toInternationalString().toString(Locale.FRENCH));
+        assertEquals("tip",   "名前",       identifier.tip().toInternationalString().toString(Locale.JAPANESE));
+        assertEquals("head",  "EPSG",      identifier.head().toString());
+        assertEquals("name",  "EPSG:name", identifier.toInternationalString().toString(Locale.ENGLISH));
+        assertEquals("name",  "EPSG:nom",  identifier.toInternationalString().toString(Locale.FRENCH));
+        assertEquals("name",  "EPSG:名前",  identifier.toInternationalString().toString(Locale.JAPANESE));
+        assertTrue  ("scope",              identifier.scope().isGlobal());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.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=1519024&r1=1519023&r2=1519024&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 Aug 30 16:59:09 2013
@@ -26,10 +26,15 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @Suite.SuiteClasses({
+    org.apache.sis.io.wkt.ConventionTest.class,
+    org.apache.sis.io.wkt.SymbolsTest.class,
+    org.apache.sis.io.wkt.FormatterTest.class,
+    org.apache.sis.referencing.NamedIdentifierTest.class,
+    org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
     org.apache.sis.geometry.AbstractDirectPositionTest.class,
     org.apache.sis.geometry.GeneralDirectPositionTest.class,
     org.apache.sis.geometry.DirectPosition1DTest.class,
@@ -38,10 +43,7 @@ import org.junit.BeforeClass;
     org.apache.sis.geometry.GeneralEnvelopeTest.class,
     org.apache.sis.geometry.SubEnvelopeTest.class,
     org.apache.sis.geometry.ImmutableEnvelopeTest.class,
-    org.apache.sis.geometry.Envelope2DTest.class,
-    org.apache.sis.io.wkt.ConventionTest.class,
-    org.apache.sis.io.wkt.SymbolsTest.class,
-    org.apache.sis.io.wkt.FormatterTest.class
+    org.apache.sis.geometry.Envelope2DTest.class
 })
 public final strictfp class ReferencingTestSuite extends TestSuite {
     /**



Mime
View raw message