sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1740141 [2/2] - in /sis/branches/JDK8: core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/internal/feature/ core/sis-feature/src/test/java/org/apache/sis/internal/feature/ core/sis-feature/...
Date Wed, 20 Apr 2016 13:01:55 GMT
Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -16,11 +16,11 @@
  */
 package org.apache.sis.internal.feature;
 
-import java.util.List;
-import java.util.ArrayList;
+import java.util.Iterator;
 import com.esri.core.geometry.Geometry;
 import com.esri.core.geometry.Point;
-import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -35,200 +35,206 @@ import org.opengis.feature.PropertyType;
 /**
  * Tests {@link FeatureTypeBuilder}.
  *
- * @author Johann Sorel (Geomatys)
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
  */
 public final strictfp class FeatureTypeBuilderTest extends TestCase {
     /**
-     * Test a builder with the minimum number of parameters.
+     * Tests a {@code FeatureTypeBuilder.Property} with the minimum number of parameters.
      */
     @Test
-    public void buildMinimal() {
-        final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-
-        //check at least name must be set
+    public void testEmptyProperty() {
+        final FeatureTypeBuilder.Property<String> builder = new FeatureTypeBuilder().addAttribute(String.class);
         try {
-            ftb.build();
+            builder.build();
             fail("Builder should have failed if there is not at least a name set.");
         } catch (IllegalArgumentException ex) {
-            //ok
+            final String message = ex.getMessage();
+            assertTrue(message, message.contains("name"));
         }
+        builder.setName("myScope", "myName");
+        final AttributeType<?> att = (AttributeType<?>) builder.build();
 
-        ftb.clear();
-        ftb.setName("scope","test");
-        FeatureType type = ftb.build();
+        assertEquals("name",       "myScope:myName", att.getName().toString());
+        assertEquals("valueClass", String.class,     att.getValueClass());
+        assertNull  ("defaultValue",                 att.getDefaultValue());
+        assertNull  ("definition",                   att.getDefinition());
+        assertNull  ("description",                  att.getDescription());
+        assertNull  ("designation",                  att.getDesignation());
+        assertEquals("minimumOccurs", 1,             att.getMinimumOccurs());
+        assertEquals("maximumOccurs", 1,             att.getMaximumOccurs());
+    }
 
-        assertEquals("scope:test", type.getName().toString());
-        assertFalse(type.isAbstract());
-        assertEquals(0, type.getProperties(true).size());
-        assertEquals(0, type.getSuperTypes().size());
+    /**
+     * Tests a {@code FeatureTypeBuilder} with the minimum number of parameters (no property and no super type).
+     */
+    @Test
+    @DependsOnMethod("testEmptyProperty")
+    public void testEmptyFeature() {
+        final FeatureTypeBuilder builder = new FeatureTypeBuilder();
+        try {
+            builder.build();
+            fail("Builder should have failed if there is not at least a name set.");
+        } catch (IllegalArgumentException ex) {
+            final String message = ex.getMessage();
+            assertTrue(message, message.contains("name"));
+        }
+        testEmptyFeature(builder);
+    }
 
+    /**
+     * Implementation of {@link #testEmptyFeature()} using the given pre-existing builder.
+     */
+    private static void testEmptyFeature(final FeatureTypeBuilder builder) {
+        builder.setName("scope", "test");
+        final FeatureType type = builder.build();
+
+        assertEquals("name", "scope:test",   type.getName().toString());
+        assertFalse ("isAbstract",           type.isAbstract());
+        assertEquals("properties count",  0, type.getProperties(true).size());
+        assertEquals("super-types count", 0, type.getSuperTypes().size());
+    }
+
+    /**
+     * Test creation of a single property.
+     */
+    @Test
+    @DependsOnMethod("testEmptyProperty")
+    public void testPropertyBuild() {
+        final FeatureTypeBuilder.Property<String> builder = new FeatureTypeBuilder().addAttribute(String.class);
+        builder.setName        ("myScope", "myName");
+        builder.setDefinition  ("test definition");
+        builder.setDesignation ("test designation");
+        builder.setDescription ("test description");
+        builder.setDefaultValue("test default value.");
+        builder.setCardinality(10, 60);
+        builder.setMaximalLengthCharacteristic(80);
+        final AttributeType<?> att = (AttributeType<?>) builder.build();
+
+        assertEquals("name",          "myScope:myName",      att.getName().toString());
+        assertEquals("definition",    "test definition",     att.getDefinition().toString());
+        assertEquals("description",   "test description",    att.getDescription().toString());
+        assertEquals("designation",   "test designation",    att.getDesignation().toString());
+        assertEquals("valueClass",    String.class,          att.getValueClass());
+        assertEquals("defaultValue",  "test default value.", att.getDefaultValue());
+        assertEquals("minimumOccurs", 10,                    att.getMinimumOccurs());
+        assertEquals("maximumOccurs", 60,                    att.getMaximumOccurs());
+        assertTrue  ("characterizedByMaximalLength", NameConvention.characterizedByMaximalLength(att));
+        assertEquals("maximalLengthCharacteristic", Integer.valueOf(80),
+                NameConvention.getMaximalLengthCharacteristic(att.newInstance()));
     }
 
     /**
-     * Test adding properties.
+     * Tests {@link FeatureTypeBuilder#addAttribute(Class)}.
      */
     @Test
+    @DependsOnMethod("testEmptyFeature")
     public void testAddProperties() {
+        testAddProperties(new FeatureTypeBuilder());
+    }
+
+    /**
+     * Implementation of {@link #testAddProperties()} using the given pre-existing builder.
+     */
+    private static void testAddProperties(final FeatureTypeBuilder builder) {
+        builder.setName("myScope", "myName");
+        builder.setDefinition ("test definition");
+        builder.setDesignation("test designation");
+        builder.setDescription("test description");
+        builder.setAbstract(true);
+        builder.addAttribute(String .class).setName("name");
+        builder.addAttribute(Integer.class).setName("age");
+        builder.addAttribute(Point  .class).setName("location").setCRSCharacteristic(HardCodedCRS.WGS84);
+        builder.addAttribute(Double .class).setName("score").setCardinality(5, 50).setDefaultValue(10.0);
+
+        final FeatureType type = builder.build();
+        assertEquals("name",        "myScope:myName",   type.getName().toString());
+        assertEquals("definition",  "test definition",  type.getDefinition().toString());
+        assertEquals("description", "test description", type.getDescription().toString());
+        assertEquals("designation", "test designation", type.getDesignation().toString());
+        assertTrue  ("isAbstract",                      type.isAbstract());
+
+        final Iterator<? extends PropertyType> it = type.getProperties(true).iterator();
+        final AttributeType<?> a0 = (AttributeType<?>) it.next();
+        final AttributeType<?> a1 = (AttributeType<?>) it.next();
+        final AttributeType<?> a2 = (AttributeType<?>) it.next();
+        final AttributeType<?> a3 = (AttributeType<?>) it.next();
+        assertFalse("properties count", it.hasNext());
+
+        assertEquals("name", "name",     a0.getName().toString());
+        assertEquals("name", "age",      a1.getName().toString());
+        assertEquals("name", "location", a2.getName().toString());
+        assertEquals("name", "score",    a3.getName().toString());
+
+        assertEquals("valueClass", String.class,  a0.getValueClass());
+        assertEquals("valueClass", Integer.class, a1.getValueClass());
+        assertEquals("valueClass", Point.class,   a2.getValueClass());
+        assertEquals("valueClass", Double.class,  a3.getValueClass());
+
+        assertEquals("minimumOccurs",   1, a0.getMinimumOccurs());
+        assertEquals("minimumOccurs",   1, a1.getMinimumOccurs());
+        assertEquals("minimumOccurs",   1, a2.getMinimumOccurs());
+        assertEquals("minimumOccurs",   5, a3.getMinimumOccurs());
+
+        assertEquals("maximumOccurs",   1, a0.getMaximumOccurs());
+        assertEquals("maximumOccurs",   1, a1.getMaximumOccurs());
+        assertEquals("maximumOccurs",   1, a2.getMaximumOccurs());
+        assertEquals("maximumOccurs",  50, a3.getMaximumOccurs());
+
+        assertEquals("defaultValue", null, a0.getDefaultValue());
+        assertEquals("defaultValue", null, a1.getDefaultValue());
+        assertEquals("defaultValue", null, a2.getDefaultValue());
+        assertEquals("defaultValue", 10.0, a3.getDefaultValue());
+
+        assertFalse("characterizedByCRS", NameConvention.characterizedByCRS(a0));
+        assertFalse("characterizedByCRS", NameConvention.characterizedByCRS(a1));
+        assertTrue ("characterizedByCRS", NameConvention.characterizedByCRS(a2));
+        assertFalse("characterizedByCRS", NameConvention.characterizedByCRS(a3));
+    }
 
-        final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-        ftb.setName("myScope","myName");
-        ftb.setDefinition("test definition");
-        ftb.setDesignation("test designation");
-        ftb.setDescription("test description");
-        ftb.setAbstract(true);
-        ftb.addProperty("name", String.class);
-        ftb.addProperty("age", Integer.class);
-        ftb.addProperty("location", Point.class, CommonCRS.WGS84.normalizedGeographic());
-        ftb.addProperty("score", Double.class, 5, 50, 10.0);
-
-        final FeatureType type = ftb.build();
-        assertEquals("myScope:myName", type.getName().toString());
-        assertEquals("test definition", type.getDefinition().toString());
-        assertEquals("test description", type.getDescription().toString());
-        assertEquals("test designation", type.getDesignation().toString());
-        assertTrue(type.isAbstract());
-        assertEquals(4, type.getProperties(true).size());
-
-        final List<PropertyType> properties = new ArrayList<>(type.getProperties(true));
-        assertEquals("name",    properties.get(0).getName().toString());
-        assertEquals("age",     properties.get(1).getName().toString());
-        assertEquals("location",properties.get(2).getName().toString());
-        assertEquals("score",   properties.get(3).getName().toString());
-
-        assertEquals(String.class,  ((AttributeType)properties.get(0)).getValueClass());
-        assertEquals(Integer.class, ((AttributeType)properties.get(1)).getValueClass());
-        assertEquals(Point.class,   ((AttributeType)properties.get(2)).getValueClass());
-        assertEquals(Double.class,  ((AttributeType)properties.get(3)).getValueClass());
-
-        assertEquals(1, ((AttributeType)properties.get(0)).getMinimumOccurs());
-        assertEquals(1, ((AttributeType)properties.get(1)).getMinimumOccurs());
-        assertEquals(1, ((AttributeType)properties.get(2)).getMinimumOccurs());
-        assertEquals(5, ((AttributeType)properties.get(3)).getMinimumOccurs());
-
-        assertEquals( 1, ((AttributeType)properties.get(0)).getMaximumOccurs());
-        assertEquals( 1, ((AttributeType)properties.get(1)).getMaximumOccurs());
-        assertEquals( 1, ((AttributeType)properties.get(2)).getMaximumOccurs());
-        assertEquals(50, ((AttributeType)properties.get(3)).getMaximumOccurs());
-
-        assertEquals(null, ((AttributeType)properties.get(0)).getDefaultValue());
-        assertEquals(null, ((AttributeType)properties.get(1)).getDefaultValue());
-        assertEquals(null, ((AttributeType)properties.get(2)).getDefaultValue());
-        assertEquals(10.0, ((AttributeType)properties.get(3)).getDefaultValue());
-    }
-
-    /**
-     * Test adding properties.
-     */
-    @Test
-    public void testCopy() {
-
-        FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-        ftb.setName("myScope","myName");
-        ftb.setDefinition("test definition");
-        ftb.setDesignation("test designation");
-        ftb.setDescription("test description");
-        ftb.setAbstract(true);
-        ftb.addProperty("name", String.class);
-        ftb.addProperty("age", Integer.class);
-        ftb.addProperty("location", Point.class, CommonCRS.WGS84.normalizedGeographic());
-        ftb.addProperty("score", Double.class, 5, 50, 10.0);
-
-        FeatureType type = ftb.build();
-
-        //copy the feature type
-        ftb = new FeatureTypeBuilder();
-        ftb.copy(type);
-        type = ftb.build();
-
-
-        assertEquals("myScope:myName", type.getName().toString());
-        assertEquals("test definition", type.getDefinition().toString());
-        assertEquals("test description", type.getDescription().toString());
-        assertEquals("test designation", type.getDesignation().toString());
-        assertTrue(type.isAbstract());
-        assertEquals(4, type.getProperties(true).size());
-
-        final List<PropertyType> properties = new ArrayList<>(type.getProperties(true));
-        assertEquals("name",    properties.get(0).getName().toString());
-        assertEquals("age",     properties.get(1).getName().toString());
-        assertEquals("location",properties.get(2).getName().toString());
-        assertEquals("score",   properties.get(3).getName().toString());
-
-        assertEquals(String.class,  ((AttributeType)properties.get(0)).getValueClass());
-        assertEquals(Integer.class, ((AttributeType)properties.get(1)).getValueClass());
-        assertEquals(Point.class,   ((AttributeType)properties.get(2)).getValueClass());
-        assertEquals(Double.class,  ((AttributeType)properties.get(3)).getValueClass());
-
-        assertEquals(1, ((AttributeType)properties.get(0)).getMinimumOccurs());
-        assertEquals(1, ((AttributeType)properties.get(1)).getMinimumOccurs());
-        assertEquals(1, ((AttributeType)properties.get(2)).getMinimumOccurs());
-        assertEquals(5, ((AttributeType)properties.get(3)).getMinimumOccurs());
-
-        assertEquals( 1, ((AttributeType)properties.get(0)).getMaximumOccurs());
-        assertEquals( 1, ((AttributeType)properties.get(1)).getMaximumOccurs());
-        assertEquals( 1, ((AttributeType)properties.get(2)).getMaximumOccurs());
-        assertEquals(50, ((AttributeType)properties.get(3)).getMaximumOccurs());
-
-        assertEquals(null, ((AttributeType)properties.get(0)).getDefaultValue());
-        assertEquals(null, ((AttributeType)properties.get(1)).getDefaultValue());
-        assertEquals(null, ((AttributeType)properties.get(2)).getDefaultValue());
-        assertEquals(10.0, ((AttributeType)properties.get(3)).getDefaultValue());
-    }
-
-    /**
-     * Test reset operation.
-     */
-    @Test
-    public void testReset(){
-
-        final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-        ftb.setName("myScope","myName");
-        ftb.setDefinition("test definition");
-        ftb.setDesignation("test designation");
-        ftb.setDescription("test description");
-        ftb.setAbstract(true);
-        ftb.addProperty("name", String.class);
-        ftb.addProperty("age", Integer.class);
-        ftb.addProperty("location", Point.class, CommonCRS.WGS84.normalizedGeographic());
-        ftb.addProperty("score", Double.class, 5, 50, 10.0);
-
-        FeatureType type = ftb.build();
-        ftb.clear();
-        ftb.setName("scope","test");
-        type = ftb.build();
-
-        assertEquals("scope:test", type.getName().toString());
-        assertFalse(type.isAbstract());
-        assertEquals(0, type.getProperties(true).size());
-        assertEquals(0, type.getSuperTypes().size());
-    }
-
-    /**
-     * Test convention properties.
-     */
-    @Test
-    @org.junit.Ignore("Temporarily broken builder.")
-    public void testConventionProperties() {
-        final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-        ftb.setName("scope","test");
-        ftb.setIdOperation("pref.", "-", ftb.name(null, "name"));
-        ftb.setDefaultGeometryOperation(ftb.name(null, "shape"));
-        ftb.addProperty("name", String.class);
-        ftb.addProperty("shape", Geometry.class, CommonCRS.WGS84.normalizedGeographic());
-
-        final FeatureType type = ftb.build();
-        assertEquals("scope:test", type.getName().toString());
-        assertFalse(type.isAbstract());
-        assertEquals(5, type.getProperties(true).size());
-
-        final List<PropertyType> properties = new ArrayList<>(type.getProperties(true));
-        assertEquals(NameConvention.ID_PROPERTY, properties.get(0).getName());
-        assertEquals(NameConvention.DEFAULT_GEOMETRY_PROPERTY, properties.get(1).getName());
-        assertEquals(NameConvention.ENVELOPE_PROPERTY, properties.get(2).getName());
-        assertEquals("name", properties.get(3).getName().toString());
-        assertEquals("shape", properties.get(4).getName().toString());
+    /**
+     * Test {@link FeatureTypeBuilder#clear()}.
+     */
+    @Test
+    @DependsOnMethod({"testEmptyFeature", "testAddProperties"})
+    public void testClear() {
+        final FeatureTypeBuilder builder = new FeatureTypeBuilder();
+        testAddProperties(builder);
+        builder.clear();
+        testEmptyFeature(builder);
+    }
+
+    /**
+     * Tests {@link FeatureTypeBuilder#addIdentifier(Class)}.
+     */
+    @Test
+    @DependsOnMethod("testAddProperties")
+    public void testAddIdentifier() {
+        final FeatureTypeBuilder builder = new FeatureTypeBuilder();
+        builder.setName("scope", "test");
+        builder.setIdentifierDelimiters("-", "pref.", null);
+        builder.addIdentifier(String.class).setName("name");
+        builder.addDefaultGeometry(Geometry.class).setName("shape").setCRSCharacteristic(HardCodedCRS.WGS84);
+
+        final FeatureType type = builder.build();
+        assertEquals("name", "scope:test", type.getName().toString());
+        assertFalse ("isAbstract", type.isAbstract());
+
+        final Iterator<? extends PropertyType> it = type.getProperties(true).iterator();
+        final PropertyType a0 = it.next();
+        final PropertyType a1 = it.next();
+        final PropertyType a2 = it.next();
+        final PropertyType a3 = it.next();
+        final PropertyType a4 = it.next();
+        assertFalse("properties count", it.hasNext());
+
+        assertEquals("name", NameConvention.ID_PROPERTY,                a0.getName());
+        assertEquals("name", NameConvention.ENVELOPE_PROPERTY,          a1.getName());
+        assertEquals("name", NameConvention.DEFAULT_GEOMETRY_PROPERTY,  a2.getName());
+        assertEquals("name", "name",                                    a3.getName().toString());
+        assertEquals("name", "shape",                                   a4.getName().toString());
     }
 }

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -69,14 +69,14 @@ public final strictfp class NameConventi
 
     /**
      * Tests {@link NameConvention#characterizedByCRS(IdentifiedType)} and
-     * {@link NameConvention#getCrsCharacteristic(Property)} methods.
+     * {@link NameConvention#getCRSCharacteristic(Property)} methods.
      */
     @Test
     public void testGetCrsCharacteristic() {
         final Map<String,?> properties = Collections.singletonMap(DefaultAttributeType.NAME_KEY, "geometry");
         DefaultAttributeType<Point> type = new DefaultAttributeType<>(properties, Point.class, 1, 1, null);
         assertFalse("characterizedByCRS",  NameConvention.characterizedByCRS(type));
-        assertNull("getCrsCharacteristic", NameConvention.getCrsCharacteristic(type.newInstance()));
+        assertNull("getCRSCharacteristic", NameConvention.getCRSCharacteristic(type.newInstance()));
         /*
          * Creates an attribute associated to an attribute (i.e. a "characteristic") for storing
          * the Coordinate Reference System of the "geometry" attribute. Then test again.
@@ -87,7 +87,7 @@ public final strictfp class NameConventi
 
         type = new DefaultAttributeType<>(properties, Point.class, 1, 1, null, characteristic);
         assertTrue(NameConvention.characterizedByCRS(type));
-        assertEquals(HardCodedCRS.WGS84, NameConvention.getCrsCharacteristic(type.newInstance()));
+        assertEquals(HardCodedCRS.WGS84, NameConvention.getCRSCharacteristic(type.newInstance()));
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -51,7 +51,6 @@ import org.junit.BeforeClass;
     org.apache.sis.filter.DefaultLiteralTest.class,
     org.apache.sis.filter.DefaultPropertyNameTest.class,
     org.apache.sis.internal.feature.NameConventionTest.class,
-    org.apache.sis.internal.feature.AttributeTypeBuilderTest.class,
     org.apache.sis.internal.feature.FeatureTypeBuilderTest.class
 })
 public final strictfp class FeatureTestSuite extends TestSuite {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -1228,9 +1228,9 @@ public final class Errors extends Indexe
     /**
      * Returns resources in the given locale.
      *
-     * @param  locale The locale, or {@code null} for the default locale.
-     * @return Resources in the given locale.
-     * @throws MissingResourceException if resources can't be found.
+     * @param  locale  the locale, or {@code null} for the default locale.
+     * @return resources in the given locale.
+     * @throws MissingResourceException if resources can not be found.
      */
     public static Errors getResources(final Locale locale) throws MissingResourceException {
         return getBundle(Errors.class, locale);

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.util.resources;
 
 import java.net.URL;
+import java.util.Map;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import javax.annotation.Generated;
@@ -28,7 +29,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.7
  * @module
  */
 public final class Vocabulary extends IndexedResourceBundle {
@@ -631,6 +632,21 @@ public final class Vocabulary extends In
     }
 
     /**
+     * Returns resources in the locale specified in the given property map. This convenience method looks
+     * for the {@link #LOCALE_KEY} entry. If the given map is null, or contains no entry for the locale key,
+     * or the value is not an instance of {@link Locale}, then this method fallback on the default locale.
+     *
+     * @param  properties  the map of properties, or {@code null} if none.
+     * @return resources in the given locale.
+     * @throws MissingResourceException if resources can not be found.
+     *
+     * @since 0.7
+     */
+    public static Vocabulary getResources(final Map<?,?> properties) throws MissingResourceException {
+        return getResources(getLocale(properties));
+    }
+
+    /**
      * Gets a string for the given key from this resource bundle or one of its parents.
      *
      * @param  key The key for the desired string.
@@ -638,7 +654,7 @@ public final class Vocabulary extends In
      * @throws MissingResourceException If no object for the given key can be found.
      */
     public static String format(final short key) throws MissingResourceException {
-        return getResources(null).getString(key);
+        return getResources((Locale) null).getString(key);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -228,6 +228,7 @@ public final class TestRunner extends Bl
      *
      * @return The test method to be executed in dependencies order.
      */
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
     private FrameworkMethod[] getFilteredChildren() {
         if (filteredChildren == null) {
             final List<FrameworkMethod> children = super.getChildren();

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -16,24 +16,29 @@
  */
 package org.apache.sis.internal.gpx;
 
-import com.esri.core.geometry.Point;
 import java.net.URI;
 import java.time.temporal.Temporal;
 import java.util.Collections;
+import java.util.Map;
+import com.esri.core.geometry.Point;
+import org.opengis.util.LocalName;
+import org.opengis.util.NameFactory;
+import org.opengis.util.FactoryException;
 import org.apache.sis.feature.AbstractIdentifiedType;
-import org.apache.sis.internal.feature.AttributeTypeBuilder;
 import org.apache.sis.feature.DefaultAttributeType;
+import org.apache.sis.feature.DefaultFeatureType;
+import org.apache.sis.feature.DefaultAssociationRole;
 import org.apache.sis.internal.feature.FeatureTypeBuilder;
+import org.apache.sis.internal.feature.NameConvention;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.util.Static;
-import org.opengis.feature.AttributeType;
-import org.opengis.feature.FeatureAssociationRole;
+
+// Branch-dependent imports
 import org.opengis.feature.FeatureType;
-import org.opengis.feature.Operation;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.util.GenericName;
-import org.opengis.util.NameFactory;
+import org.opengis.feature.PropertyType;
+import org.apache.sis.feature.FeatureOperations;
+
 
 /**
  * GPX XML tags and feature types.
@@ -44,8 +49,7 @@ import org.opengis.util.NameFactory;
  * @module
  */
 public final class GPXConstants extends Static {
-
-    /**
+    /*
      * Main GPX xml tag.
      */
     /** used in version : 1.0 and 1.1 */
@@ -56,7 +60,7 @@ public final class GPXConstants extends
     public static final String ATT_GPX_CREATOR = "creator";
 
     /**
-     * Attributs used a bit everywhere.
+     * Attributes used a bit everywhere.
      */
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_NAME = "name";
@@ -77,7 +81,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_NUMBER = "number";
 
-    /**
+    /*
      * Metadata tag.
      */
     /** used in version : 1.1 */
@@ -87,7 +91,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_METADATA_KEYWORDS = "keywords";
 
-    /**
+    /*
      * Person tag.
      */
     /** used in version : 1.0(as attribut) and 1.1(as tag) */
@@ -95,7 +99,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_AUTHOR_EMAIL = "email";
 
-    /**
+    /*
      * CopyRight tag.
      */
     /** used in version : 1.1 */
@@ -107,7 +111,7 @@ public final class GPXConstants extends
     /** used in version : 1.1 */
     public static final String ATT_COPYRIGHT_AUTHOR = "author";
 
-    /**
+    /*
      * Bounds tag.
      */
     /** used in version : 1.0 and 1.1 */
@@ -121,7 +125,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String ATT_BOUNDS_MAXLON = "maxlon";
 
-    /**
+    /*
      * Link tag.
      */
     /** used in version : 1.1 */
@@ -131,7 +135,7 @@ public final class GPXConstants extends
     /** used in version : 1.1 */
     public static final String ATT_LINK_HREF = "href";
 
-    /**
+    /*
      * WPT tag.
      */
     /** used in version : 1.0 and 1.1 */
@@ -165,7 +169,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_WPT_DGPSID = "dgpsid";
 
-    /**
+    /*
      * RTE tag.
      */
     /** used in version : 1.0 and 1.1 */
@@ -173,7 +177,7 @@ public final class GPXConstants extends
     /** used in version : 1.0 and 1.1 */
     public static final String TAG_RTE_RTEPT = "rtept";
 
-    /**
+    /*
      * TRK tag.
      */
     /** used in version : 1.0 and 1.1 */
@@ -184,13 +188,10 @@ public final class GPXConstants extends
     public static final String TAG_TRK_SEG_PT = "trkpt";
 
     /**
-     * Coordinate reference system used by gpx files.
-     */
-    public static final CoordinateReferenceSystem GPX_CRS = CommonCRS.WGS84.normalizedGeographic();
-    /**
      * GPX scope name used for feature type names.
      */
     public static final String GPX_NAMESPACE = "http://www.topografix.com";
+
     /**
      * GPX 1.1 xml namespace
      */
@@ -204,203 +205,186 @@ public final class GPXConstants extends
      * Parent feature type of all gpx types.
      */
     public static final FeatureType TYPE_GPX_ENTITY;
+
     /**
      * Waypoint GPX feature type.
      */
     public static final FeatureType TYPE_WAYPOINT;
+
     /**
      * Track GPX feature type.
      */
     public static final FeatureType TYPE_TRACK;
+
     /**
      * Route GPX feature type.
      */
     public static final FeatureType TYPE_ROUTE;
+
     /**
      * Track segment GPX feature type.
      */
     public static final FeatureType TYPE_TRACK_SEGMENT;
 
-
     static {
-        final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
-        final AttributeTypeBuilder atb = new AttributeTypeBuilder();
+        final NameFactory   factory  = DefaultFactories.forBuildin(NameFactory.class);
+        final LocalName     geomName = NameConvention.DEFAULT_GEOMETRY_PROPERTY;
+        final Map<String,?> geomInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, geomName);
 
         //-------------------- GENERIC GPX ENTITY ------------------------------
-        final AttributeType<Integer> attIndex = createAttribute("index", Integer.class, 1, 1);
-        final String geomName = "geometry";
-
-        ftb.clear();
-        ftb.setName(GPX_NAMESPACE, "GPXEntity");
-        ftb.setAbstract(true);
-        ftb.addProperty(attIndex);
-        TYPE_GPX_ENTITY = ftb.build();
+        final FeatureTypeBuilder builder = new FeatureTypeBuilder(factory);
+        builder.setDefaultScope(GPX_NAMESPACE).setName("GPXEntity").setAbstract(true);
+        builder.addAttribute(Integer.class).setName("index");
+        TYPE_GPX_ENTITY = builder.build();
 
         //------------------- WAY POINT TYPE -----------------------------------
-        //lat="latitudeType [1] ?"
-        //lon="longitudeType [1] ?">
-        //<ele> xsd:decimal </ele> [0..1] ?
-        //<time> xsd:dateTime </time> [0..1] ?
-        //<magvar> degreesType </magvar> [0..1] ?
-        //<geoidheight> xsd:decimal </geoidheight> [0..1] ?
-        //<name> xsd:string </name> [0..1] ?
-        //<cmt> xsd:string </cmt> [0..1] ?
-        //<desc> xsd:string </desc> [0..1] ?
-        //<src> xsd:string </src> [0..1] ?
-        //<link> linkType </link> [0..*] ?
-        //<sym> xsd:string </sym> [0..1] ?
-        //<type> xsd:string </type> [0..1] ?
-        //<fix> fixType </fix> [0..1] ?
-        //<sat> xsd:nonNegativeInteger </sat> [0..1] ?
-        //<hdop> xsd:decimal </hdop> [0..1] ?
-        //<vdop> xsd:decimal </vdop> [0..1] ?
-        //<pdop> xsd:decimal </pdop> [0..1] ?
-        //<ageofdgpsdata> xsd:decimal </ageofdgpsdata> [0..1] ?
-        //<dgpsid> dgpsStationType </dgpsid> [0..1] ?
-        //<extensions> extensionsType </extensions> [0..1] ?
-        atb.setName(createName(geomName));
-        atb.setValueClass(Point.class);
-        atb.setCRSCharacteristic(GPX_CRS);
-        atb.setMinimumOccurs(1);
-        atb.setMaximumOccurs(1);
-        final AttributeType attPointGeometry =    atb.build();
-        final AttributeType attWptEle =           createAttribute(TAG_WPT_ELE,            Double.class);
-        final AttributeType attWptTime =          createAttribute(TAG_WPT_TIME,           Temporal.class);
-        final AttributeType attWptMagvar =        createAttribute(TAG_WPT_MAGVAR,         Double.class);
-        final AttributeType attWptGeoHeight =     createAttribute(TAG_WPT_GEOIHEIGHT,     Double.class);
-        final AttributeType attName =             createAttribute(TAG_NAME,               String.class);
-        final AttributeType attCmt =              createAttribute(TAG_CMT,                String.class);
-        final AttributeType attDesc =             createAttribute(TAG_DESC,               String.class);
-        final AttributeType attSrc =              createAttribute(TAG_SRC,                String.class);
-        final AttributeType attLink =             createAttribute(TAG_LINK,               URI.class, 0, Integer.MAX_VALUE);
-        final AttributeType attWptSym =           createAttribute(TAG_WPT_SYM,            String.class);
-        final AttributeType attType =             createAttribute(TAG_TYPE,               String.class);
-        final AttributeType attWptFix =           createAttribute(TAG_WPT_FIX,            String.class);
-        final AttributeType attWptSat =           createAttribute(TAG_WPT_SAT,            Integer.class);
-        final AttributeType attWptHdop =          createAttribute(TAG_WPT_HDOP,           Double.class);
-        final AttributeType attWptVdop =          createAttribute(TAG_WPT_VDOP,           Double.class);
-        final AttributeType attWptPdop =          createAttribute(TAG_WPT_PDOP,           Double.class);
-        final AttributeType attWptAgeofGpsData =  createAttribute(TAG_WPT_AGEOFGPSDATA,   Double.class);
-        final AttributeType attWptDgpsid =        createAttribute(TAG_WPT_DGPSID,         Integer.class);
-
-        ftb.clear();
-        ftb.setName(GPX_NAMESPACE, "WayPoint");
-        ftb.setSuperTypes(TYPE_GPX_ENTITY);
-        ftb.addProperty(attIndex);
-        ftb.addProperty(attPointGeometry);
-        ftb.addProperty(attWptEle);
-        ftb.addProperty(attWptTime);
-        ftb.addProperty(attWptMagvar);
-        ftb.addProperty(attWptGeoHeight);
-        ftb.addProperty(attName);
-        ftb.addProperty(attCmt);
-        ftb.addProperty(attDesc);
-        ftb.addProperty(attSrc);
-        ftb.addProperty(attLink);
-        ftb.addProperty(attWptSym);
-        ftb.addProperty(attType);
-        ftb.addProperty(attWptFix);
-        ftb.addProperty(attWptSat);
-        ftb.addProperty(attWptHdop);
-        ftb.addProperty(attWptVdop);
-        ftb.addProperty(attWptPdop);
-        ftb.addProperty(attWptAgeofGpsData);
-        ftb.addProperty(attWptDgpsid);
-        ftb.setDefaultGeometryOperation(attPointGeometry.getName());
-        TYPE_WAYPOINT = ftb.build();
-
+        /*
+         * lat="latitudeType [1] ?"
+         * lon="longitudeType [1] ?">
+         * <ele> xsd:decimal </ele> [0..1] ?
+         * <time> xsd:dateTime </time> [0..1] ?
+         * <magvar> degreesType </magvar> [0..1] ?
+         * <geoidheight> xsd:decimal </geoidheight> [0..1] ?
+         * <name> xsd:string </name> [0..1] ?
+         * <cmt> xsd:string </cmt> [0..1] ?
+         * <desc> xsd:string </desc> [0..1] ?
+         * <src> xsd:string </src> [0..1] ?
+         * <link> linkType </link> [0..*] ?
+         * <sym> xsd:string </sym> [0..1] ?
+         * <type> xsd:string </type> [0..1] ?
+         * <fix> fixType </fix> [0..1] ?
+         * <sat> xsd:nonNegativeInteger </sat> [0..1] ?
+         * <hdop> xsd:decimal </hdop> [0..1] ?
+         * <vdop> xsd:decimal </vdop> [0..1] ?
+         * <pdop> xsd:decimal </pdop> [0..1] ?
+         * <ageofdgpsdata> xsd:decimal </ageofdgpsdata> [0..1] ?
+         * <dgpsid> dgpsStationType </dgpsid> [0..1] ?
+         * <extensions> extensionsType </extensions> [0..1] ?
+         */
+        builder.clear().setDefaultScope(GPX_NAMESPACE).setName("WayPoint").setSuperTypes(TYPE_GPX_ENTITY);
+        builder.addDefaultGeometry(Point.class).setName(geomName).setCRSCharacteristic(CommonCRS.defaultGeographic());
+        builder.setDefaultCardinality(0, 1);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_ELE);
+        builder.addAttribute(Temporal.class).setName(TAG_WPT_TIME);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_MAGVAR);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_GEOIHEIGHT);
+        builder.addAttribute(String  .class).setName(TAG_NAME);
+        builder.addAttribute(String  .class).setName(TAG_CMT);
+        builder.addAttribute(String  .class).setName(TAG_DESC);
+        builder.addAttribute(String  .class).setName(TAG_SRC);
+        builder.addAttribute(URI     .class).setName(TAG_LINK).setCardinality(0, Integer.MAX_VALUE);
+        builder.addAttribute(String  .class).setName(TAG_WPT_SYM);
+        builder.addAttribute(String  .class).setName(TAG_TYPE);
+        builder.addAttribute(String  .class).setName(TAG_WPT_FIX);
+        builder.addAttribute(Integer .class).setName(TAG_WPT_SAT);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_HDOP);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_VDOP);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_PDOP);
+        builder.addAttribute(Double  .class).setName(TAG_WPT_AGEOFGPSDATA);
+        builder.addAttribute(Integer .class).setName(TAG_WPT_DGPSID);
+        TYPE_WAYPOINT = builder.build();
 
         //------------------- ROUTE TYPE ---------------------------------------
-        //<name> xsd:string </name> [0..1] ?
-        //<cmt> xsd:string </cmt> [0..1] ?
-        //<desc> xsd:string </desc> [0..1] ?
-        //<src> xsd:string </src> [0..1] ?
-        //<link> linkType </link> [0..*] ?
-        //<number> xsd:nonNegativeInteger </number> [0..1] ?
-        //<type> xsd:string </type> [0..1] ?
-        //<extensions> extensionsType </extensions> [0..1] ?
-        //<rtept> wptType </rtept> [0..*] ?
-        final AttributeType<Integer> attNumber = createAttribute(TAG_NUMBER, Integer.class);
-
-        ftb.clear();
-        ftb.setName(GPX_NAMESPACE, "Route");
-        ftb.setSuperTypes(TYPE_GPX_ENTITY);
-        ftb.addProperty(attIndex);
-        ftb.addProperty(attName);
-        ftb.addProperty(attCmt);
-        ftb.addProperty(attDesc);
-        ftb.addProperty(attSrc);
-        ftb.addProperty(attLink);
-        ftb.addProperty(attNumber);
-        ftb.addProperty(attType);
-        final FeatureAssociationRole attWayPoints = ftb.addAssociation(createName(TAG_RTE_RTEPT),TYPE_WAYPOINT,0,Integer.MAX_VALUE);
-        final Operation attRouteGeometry = new GroupPointsAsPolylineOperation(createName(geomName),attWayPoints.getName(), attPointGeometry.getName());
-        ftb.addProperty(attRouteGeometry);
-        ftb.setDefaultGeometryOperation(attRouteGeometry.getName());
-        TYPE_ROUTE = ftb.build();
+        /*
+         * <name> xsd:string </name> [0..1] ?
+         * <cmt> xsd:string </cmt> [0..1] ?
+         * <desc> xsd:string </desc> [0..1] ?
+         * <src> xsd:string </src> [0..1] ?
+         * <link> linkType </link> [0..*] ?
+         * <number> xsd:nonNegativeInteger </number> [0..1] ?
+         * <type> xsd:string </type> [0..1] ?
+         * <extensions> extensionsType </extensions> [0..1] ?
+         * <rtept> wptType </rtept> [0..*] ?
+         */
+        final DefaultAssociationRole attWayPoints = new DefaultAssociationRole(
+                identification(factory, TAG_RTE_RTEPT), TYPE_WAYPOINT, 0, Integer.MAX_VALUE);
+        PropertyType[] properties = {
+                TYPE_WAYPOINT.getProperty(TAG_NAME),
+                TYPE_WAYPOINT.getProperty(TAG_CMT),
+                TYPE_WAYPOINT.getProperty(TAG_DESC),
+                TYPE_WAYPOINT.getProperty(TAG_SRC),
+                TYPE_WAYPOINT.getProperty(TAG_LINK),
+                new DefaultAttributeType<>(identification(factory, TAG_NUMBER), Integer.class, 0, 1, null),
+                TYPE_WAYPOINT.getProperty(TAG_TYPE),
+                attWayPoints,
+                new GroupPointsAsPolylineOperation(geomInfo, attWayPoints.getName(), geomName),
+                null
+        };
+        final Map<String,?> envelopeInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, NameConvention.ENVELOPE_PROPERTY);
+        try {
+            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
+        } catch (FactoryException e) {
+            throw new IllegalStateException(e);
+        }
+        TYPE_ROUTE = new DefaultFeatureType(identification(factory, "Route"), false,
+                new FeatureType[] {TYPE_GPX_ENTITY}, properties);
 
 
         //------------------- TRACK SEGMENT TYPE -------------------------------
-        //<trkpt> wptType </trkpt> [0..*] ?
-        //<extensions> extensionsType </extensions> [0..1] ?
-        ftb.clear();
-        ftb.setName(GPX_NAMESPACE, "TrackSegment");
-        ftb.addProperty(attIndex);
-        final FeatureAssociationRole attTrackPoints = ftb.addAssociation(createName(TAG_TRK_SEG_PT),TYPE_WAYPOINT,0,Integer.MAX_VALUE);
-        final Operation attTrackSegGeometry = new GroupPointsAsPolylineOperation(createName(geomName),attTrackPoints.getName(), attPointGeometry.getName());
-        ftb.addProperty(attTrackSegGeometry);
-        ftb.setDefaultGeometryOperation(attTrackSegGeometry.getName());
-        TYPE_TRACK_SEGMENT = ftb.build();
+        /*
+         * <trkpt> wptType </trkpt> [0..*] ?
+         * <extensions> extensionsType </extensions> [0..1] ?
+         */
+        final DefaultAssociationRole attTrackPoints = new DefaultAssociationRole(
+                identification(factory, TAG_TRK_SEG_PT), TYPE_WAYPOINT, 0, Integer.MAX_VALUE);
+        properties = new PropertyType[] {
+                attTrackPoints,
+                new GroupPointsAsPolylineOperation(geomInfo, attTrackPoints.getName(), geomName),
+                null
+        };
+        try {
+            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
+        } catch (FactoryException e) {
+            throw new IllegalStateException(e);
+        }
+        TYPE_TRACK_SEGMENT = new DefaultFeatureType(identification(factory, "TrackSegment"), false,
+                new FeatureType[] {TYPE_GPX_ENTITY}, properties
+        );
 
         //------------------- TRACK TYPE ---------------------------------------
-        //<name> xsd:string </name> [0..1] ?
-        //<cmt> xsd:string </cmt> [0..1] ?
-        //<desc> xsd:string </desc> [0..1] ?
-        //<src> xsd:string </src> [0..1] ?
-        //<link> linkType </link> [0..*] ?
-        //<number> xsd:nonNegativeInteger </number> [0..1] ?
-        //<type> xsd:string </type> [0..1] ?
-        //<extensions> extensionsType </extensions> [0..1] ?
-        //<trkseg> trksegType </trkseg> [0..*] ?
-        ftb.clear();
-        ftb.setName(GPX_NAMESPACE, "Track");
-        ftb.setSuperTypes(TYPE_GPX_ENTITY);
-        ftb.addProperty(attIndex);
-        ftb.addProperty(attName);
-        ftb.addProperty(attCmt);
-        ftb.addProperty(attDesc);
-        ftb.addProperty(attSrc);
-        ftb.addProperty(attLink);
-        ftb.addProperty(attNumber);
-        ftb.addProperty(attType);
-        final FeatureAssociationRole attTrackSegments = ftb.addAssociation(createName(TAG_TRK_SEG), TYPE_TRACK_SEGMENT, 0, Integer.MAX_VALUE);
-        final Operation attTrackGeometry = new GroupPolylinesOperation(createName(geomName),attTrackSegments.getName(), attTrackSegGeometry.getName());
-        ftb.addProperty(attTrackGeometry);
-        ftb.setDefaultGeometryOperation(attTrackGeometry.getName());
-        TYPE_TRACK = ftb.build();
-
-    }
-
-    /**
-     * Shortcut method to create attribute type.
-     */
-    private static <V> AttributeType<V> createAttribute(String name, Class<V> valueClass, int min, int max) {
-        return new DefaultAttributeType<>(Collections.singletonMap(AbstractIdentifiedType.NAME_KEY,
-                createName(name)), valueClass, min, max, null);
+        /*
+         * <name> xsd:string </name> [0..1] ?
+         * <cmt> xsd:string </cmt> [0..1] ?
+         * <desc> xsd:string </desc> [0..1] ?
+         * <src> xsd:string </src> [0..1] ?
+         * <link> linkType </link> [0..*] ?
+         * <number> xsd:nonNegativeInteger </number> [0..1] ?
+         * <type> xsd:string </type> [0..1] ?
+         * <extensions> extensionsType </extensions> [0..1] ?
+         * <trkseg> trksegType </trkseg> [0..*] ?
+         */
+        final DefaultAssociationRole attTrackSegments = new DefaultAssociationRole(
+                identification(factory, TAG_TRK_SEG), TYPE_TRACK_SEGMENT, 0, Integer.MAX_VALUE);
+        properties = new PropertyType[] {
+                TYPE_ROUTE.getProperty(TAG_NAME),
+                TYPE_ROUTE.getProperty(TAG_CMT),
+                TYPE_ROUTE.getProperty(TAG_DESC),
+                TYPE_ROUTE.getProperty(TAG_SRC),
+                TYPE_ROUTE.getProperty(TAG_LINK),
+                TYPE_ROUTE.getProperty(TAG_NUMBER),
+                TYPE_ROUTE.getProperty(TAG_TYPE),
+                attTrackSegments,
+                new GroupPolylinesOperation(geomInfo, attTrackSegments.getName(), geomName),
+                null
+        };
+        try {
+            properties[properties.length - 1] = FeatureOperations.envelope(envelopeInfo, null, properties);
+        } catch (FactoryException e) {
+            throw new IllegalStateException(e);
+        }
+        TYPE_TRACK = new DefaultFeatureType(identification(factory, "Track"), false,
+                new FeatureType[] {TYPE_GPX_ENTITY}, properties
+        );
     }
 
-    private static <V> AttributeType<V> createAttribute(String name, Class<V> valueClass) {
-        return createAttribute(name, valueClass, 0, 1);
+    private static Map<String,?> identification(final NameFactory factory, final String localPart) {
+        return Collections.singletonMap(AbstractIdentifiedType.NAME_KEY,
+                factory.createGenericName(null, GPX_NAMESPACE, localPart));
     }
 
     /**
-     * Shortcut method to create generic name in GPX scope.
+     * Do not allow instantiation of this class.
      */
-    private static GenericName createName(String localPart) {
-        final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
-        return factory.createGenericName(null, GPX_NAMESPACE, localPart);
-    }
-
     private GPXConstants() {
-    };
+    }
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXReader.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -166,7 +166,7 @@ public class GPXReader extends StaxStrea
 
     /**
      * Returns true if there is a next feature in the stream.
-     * 
+     *
      * @return true if there is next feature
      * @throws javax.xml.stream.XMLStreamException if xml parser encounter an invalid
      *                          element or underlying stream caused an exception
@@ -178,7 +178,7 @@ public class GPXReader extends StaxStrea
 
     /**
      * Get next feature in the stream.
-     * 
+     *
      * @return GPX WayPoint, Route or track
      * @throws javax.xml.stream.XMLStreamException if xml parser encounter an invalid
      *                          element or underlying stream caused an exception
@@ -331,7 +331,7 @@ public class GPXReader extends StaxStrea
      * @return CopyRight
      */
     private CopyRight parseCopyRight() throws XMLStreamException {
-        
+
         final CopyRight copyright = new CopyRight();
         copyright.setAuthor(reader.getAttributeValue(null, ATT_COPYRIGHT_AUTHOR));
 
@@ -483,7 +483,7 @@ public class GPXReader extends StaxStrea
         if(lat == null || lon == null){
             throw new XMLStreamException("Error in xml file, way point lat/lon not defined correctly");
         }else{
-            feature.setPropertyValue("geometry", new Point(Double.parseDouble(lon), Double.parseDouble(lat)));
+            feature.setPropertyValue("@geometry", new Point(Double.parseDouble(lon), Double.parseDouble(lat)));
         }
 
         while (reader.hasNext()) {
@@ -738,5 +738,5 @@ public class GPXReader extends StaxStrea
             }
         }
     }
-    
+
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter100.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter100.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter100.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXWriter100.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -198,7 +198,7 @@ public class GPXWriter100 extends StaxSt
 
     /**
      * Write GPX Metadata.
-     * 
+     *
      * @param metadata no null
      * @throws XMLStreamException if underlying xml stax writer encounter an error
      */
@@ -237,7 +237,7 @@ public class GPXWriter100 extends StaxSt
 
         writer.writeStartElement(namespace, tagName);
 
-        final Point pt = (Point) feature.getProperty("geometry").getValue();
+        final Point pt = (Point) feature.getProperty("@geometry").getValue();
         writer.writeAttribute(ATT_WPT_LAT, Double.toString(pt.getY()));
         writer.writeAttribute(ATT_WPT_LON, Double.toString(pt.getX()));
 
@@ -317,7 +317,7 @@ public class GPXWriter100 extends StaxSt
 
     /**
      * Write a track segment feature.
-     * 
+     *
      * @param feature track segment, can be null
      * @throws XMLStreamException if underlying xml stax writer encounter an error
      */
@@ -347,7 +347,7 @@ public class GPXWriter100 extends StaxSt
 
     /**
      * Write a link tag.
-     * 
+     *
      * @param uri if null nothing will be written
      * @throws XMLStreamException if underlying xml stax writer encounter an error
      */
@@ -361,7 +361,7 @@ public class GPXWriter100 extends StaxSt
 
     /**
      * Write bounds gpx tag.
-     * 
+     *
      * @param env if null nothing will be written
      * @throws XMLStreamException if underlying xml stax writer encounter an error
      */
@@ -397,7 +397,7 @@ public class GPXWriter100 extends StaxSt
 
     /**
      * Convert temporal object to it's most appropriate ISO-8601 string representation.
-     * 
+     *
      * @param temp not null
      * @return String representation
      */

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GroupPointsAsPolylineOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GroupPointsAsPolylineOperation.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GroupPointsAsPolylineOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GroupPointsAsPolylineOperation.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -34,6 +34,7 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.util.GenericName;
 
+
 /**
  * A calculated attribute that define a Polyline geometry calculated
  * from other attributes of the feature.
@@ -43,17 +44,17 @@ import org.opengis.util.GenericName;
  * This class while extract each position and create a line as a new attribute.
  * Any change applied to the positions will be visible on the line.
  *
- * @author Johann Sorel (Geomatys)
+ * @author  Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
  */
-public final class GroupPointsAsPolylineOperation extends AbstractOperation {
+final class GroupPointsAsPolylineOperation extends AbstractOperation {
     /**
      * For cross-version compatibility.
      */
     private static final long serialVersionUID = -5169104838093353092L;
-    
+
     private static final AttributeType<Polyline> TYPE = new DefaultAttributeType<>(
             Collections.singletonMap(NAME_KEY, "Polyline"),Polyline.class,1,1,null);
 
@@ -67,19 +68,10 @@ public final class GroupPointsAsPolyline
 
     /**
      *
-     * @param name operation name
-     * @param attributePath names of the properties to group
-     */
-    public GroupPointsAsPolylineOperation(GenericName name, GenericName ... attributePath) {
-        this(Collections.singletonMap(DefaultAttributeType.NAME_KEY, name),attributePath);
-    }
-
-    /**
-     *
      * @param identification operation identification parameters
      * @param attributePath names of the properties to group
      */
-    public GroupPointsAsPolylineOperation(Map<String, ?> identification, GenericName ... attributePath) {
+    GroupPointsAsPolylineOperation(Map<String,?> identification, GenericName... attributePath) {
         super(identification);
         this.path = attributePath;
     }
@@ -94,7 +86,7 @@ public final class GroupPointsAsPolyline
     }
 
     /**
-     * {@inheritDoc }
+     * {@inheritDoc}
      */
     @Override
     public IdentifiedType getResult() {
@@ -102,7 +94,7 @@ public final class GroupPointsAsPolyline
     }
 
     /**
-     * {@inheritDoc }
+     * {@inheritDoc}
      */
     @Override
     public Property apply(Feature feature, ParameterValueGroup parameters) {
@@ -110,31 +102,35 @@ public final class GroupPointsAsPolyline
     }
 
     private boolean explore(final Feature att, final int depth, Polyline geom, boolean first) {
-        if(depth == path.length-1){
-            //we are on the field that hold the geometry points
+        if (depth == path.length - 1) {
+            // We are on the field that hold the geometry points
             for (final Object propVal : asCollection(att, path[depth])) {
-                if(first){
-                    geom.startPath(((Point)propVal));
+                if (first) {
+                    geom.startPath(((Point) propVal));
                     first = false;
-                }else{
-                    geom.lineTo(((Point)propVal));
+                } else {
+                    geom.lineTo(((Point) propVal));
                 }
             }
-        }else{
-            //explore children
-            int d = depth+1;
-            for (final Object prop : asCollection(att,path[depth])) {
+        } else {
+            // Explore children
+            int d = depth + 1;
+            for (final Object prop : asCollection(att, path[depth])) {
                 final Feature child = (Feature) prop;
-                first = explore(child, d, geom,first);
+                first = explore(child, d, geom, first);
             }
         }
         return first;
     }
 
-    private static Collection asCollection(Feature att, GenericName property) {
+    private static Collection<?> asCollection(Feature att, GenericName property) {
         final Object value = att.getPropertyValue(property.toString());
-        if(value == null) return Collections.EMPTY_LIST;
-        if(value instanceof Collection) return (Collection) value;
+        if (value == null) {
+            return Collections.emptyList();
+        }
+        if (value instanceof Collection<?>) {
+            return (Collection<?>) value;
+        }
         return Collections.singletonList(value);
     }
 
@@ -149,7 +145,7 @@ public final class GroupPointsAsPolyline
 
         private final Feature feature;
 
-        public GeomAtt(final Feature feature) {
+        GeomAtt(final Feature feature) {
             super(TYPE);
             this.feature = feature;
         }
@@ -157,7 +153,7 @@ public final class GroupPointsAsPolyline
         @Override
         public Polyline getValue() throws MultiValuedPropertyException {
             final Polyline geom = new Polyline();
-            explore(feature,0,geom,true);
+            explore(feature, 0, geom, true);
             return geom;
         }
 
@@ -165,7 +161,5 @@ public final class GroupPointsAsPolyline
         public void setValue(Polyline value) {
             throw new UnsupportedOperationException("Operation attribute can not be set.");
         }
-
     }
-
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXReaderTest.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -16,31 +16,31 @@
  */
 package org.apache.sis.internal.gpx;
 
-import com.esri.core.geometry.Point;
-import java.io.IOException;
 import java.net.URI;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.Temporal;
-import java.time.temporal.TemporalAccessor;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import javax.xml.stream.XMLStreamException;
+import com.esri.core.geometry.Point;
+import org.opengis.geometry.Envelope;
 import org.apache.sis.geometry.GeneralEnvelope;
 import org.apache.sis.geometry.ImmutableEnvelope;
 import org.apache.sis.referencing.CommonCRS;
-
 import org.junit.Test;
 
 import static org.junit.Assert.*;
+
+// Branch-dependent imports
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
 import org.opengis.feature.Feature;
-import org.opengis.geometry.Envelope;
+
 
 /**
- * GPX Reader test class.
- * 
- * @author Johann Sorel (Geomatys)
+ * Test {@link GPXReader} class.
+ *
+ * @author  Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
@@ -48,12 +48,12 @@ import org.opengis.geometry.Envelope;
 public class GPXReaderTest {
 
     private static final double DELTA = 0.000001;
-    
+
 
     /**
-     * Test gpx version 1.0.0 metadata tag parsing.
-     * 
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * Tests GPX version 1.0.0 metadata tag parsing.
+     *
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testMetadataRead100() throws Exception {
@@ -82,9 +82,9 @@ public class GPXReaderTest {
     }
 
     /**
-     * Test gpx version 1.1.0 metadata tag parsing.
+     * Tests GPX version 1.1.0 metadata tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testMetadataRead110() throws Exception {
@@ -118,9 +118,9 @@ public class GPXReaderTest {
 
 
     /**
-     * Test gpx version 1.0.0 way point tag parsing.
+     * Tests GPX version 1.0.0 way point tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testWayPointRead100() throws Exception {
@@ -151,9 +151,9 @@ public class GPXReaderTest {
     }
 
     /**
-     * Test gpx version 1.1.0 way point tag parsing.
+     * Tests GPX version 1.1.0 way point tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testWayPointRead110() throws Exception {
@@ -184,11 +184,10 @@ public class GPXReaderTest {
 
     }
 
-
     /**
-     * Test gpx version v1.0.0 route tag parsing.
+     * Tests GPX version v1.0.0 route tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testRouteRead100() throws Exception {
@@ -216,17 +215,17 @@ public class GPXReaderTest {
             assertEquals("route type",          f.getPropertyValue("type"));
             assertEquals(7,                     f.getPropertyValue("number"));
 
-            List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(1,links.size());
             assertEquals("http://route-adress1.org", links.get(0).toString());
 
-            List<Feature> points = new ArrayList<>((Collection)f.getPropertyValue("rtept"));
+            List<Feature> points = new ArrayList<>((Collection<Feature>) f.getPropertyValue("rtept"));
             assertEquals(3,points.size());
             checkPoint(points.get(0), 0, false);
             checkPoint(points.get(1), 1, false);
             checkPoint(points.get(2), 2, false);
 
-            Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 15.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 35.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 10.0d, DELTA);
@@ -241,13 +240,13 @@ public class GPXReaderTest {
             assertEquals(null,                  f.getPropertyValue("type"));
             assertEquals(null,                  f.getPropertyValue("number"));
 
-            links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(0,links.size());
 
-            points = new ArrayList<>((Collection)f.getPropertyValue("rtept"));
+            points = new ArrayList<>((Collection<Feature>) f.getPropertyValue("rtept"));
             assertEquals(0,points.size());
 
-            bbox = (Envelope) f.getPropertyValue("@bounds");
+            bbox = (Envelope) f.getPropertyValue("@envelope");
             assertNull(bbox);
 
             assertFalse(reader.hasNext());
@@ -255,9 +254,9 @@ public class GPXReaderTest {
     }
 
     /**
-     * Test gpx version 1.1.0 route tag parsing.
+     * Tests GPX version 1.1.0 route tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testRouteRead110() throws Exception {
@@ -285,19 +284,19 @@ public class GPXReaderTest {
             assertEquals("route type",          f.getPropertyValue("type"));
             assertEquals(7,                     f.getPropertyValue("number"));
 
-            List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(3,links.size());
             assertEquals("http://route-adress1.org", links.get(0).toString());
             assertEquals("http://route-adress2.org", links.get(1).toString());
             assertEquals("http://route-adress3.org", links.get(2).toString());
 
-            List<Feature> points = new ArrayList<>((Collection)f.getPropertyValue("rtept"));
+            List<Feature> points = new ArrayList<>((Collection<Feature>) f.getPropertyValue("rtept"));
             assertEquals(3,points.size());
             checkPoint(points.get(0), 0, true);
             checkPoint(points.get(1), 1, true);
             checkPoint(points.get(2), 2, true);
 
-            Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 15.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 35.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 10.0d, DELTA);
@@ -312,13 +311,13 @@ public class GPXReaderTest {
             assertEquals(null,                  f.getPropertyValue("type"));
             assertEquals(null,                  f.getPropertyValue("number"));
 
-            links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(0,links.size());
 
-            points = new ArrayList<>((Collection)f.getPropertyValue("rtept"));
+            points = new ArrayList<>((Collection<Feature>) f.getPropertyValue("rtept"));
             assertEquals(0,points.size());
 
-            bbox = (Envelope) f.getPropertyValue("@bounds");
+            bbox = (Envelope) f.getPropertyValue("@envelope");
             assertNull(bbox);
 
             assertFalse(reader.hasNext());
@@ -326,9 +325,9 @@ public class GPXReaderTest {
     }
 
     /**
-     * Test gpx version 1.0.0 track tag parsing.
+     * Tests GPX version 1.0.0 track tag parsing.
      *
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * @throws Exception if reader failed to be created or failed at reading.
      */
     @Test
     public void testTrackRead100() throws Exception {
@@ -356,23 +355,23 @@ public class GPXReaderTest {
             assertEquals("track type",          f.getPropertyValue("type"));
             assertEquals(7,                     f.getPropertyValue("number"));
 
-            List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(1,links.size());
             assertEquals("http://track-adress1.org", links.get(0).toString());
 
-            List<Feature> segments = new ArrayList<>((Collection)f.getPropertyValue("trkseg"));
+            List<Feature> segments = new ArrayList<>((Collection<Feature>) f.getPropertyValue("trkseg"));
             assertEquals(2,segments.size());
             Feature seg1 = segments.get(0);
             Feature seg2 = segments.get(1);
-            List<Feature> points = new ArrayList<>((Collection)seg1.getPropertyValue("trkpt"));
+            List<Feature> points = new ArrayList<>((Collection<Feature>) seg1.getPropertyValue("trkpt"));
             assertEquals(3, points.size());
             checkPoint((Feature) points.get(0), 0, false);
             checkPoint((Feature) points.get(1), 1, false);
             checkPoint((Feature) points.get(2), 2, false);
-            points = new ArrayList<>((Collection)seg2.getPropertyValue("trkpt"));
+            points = new ArrayList<>((Collection<Feature>) seg2.getPropertyValue("trkpt"));
             assertEquals(0, points.size());
 
-            Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 15.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 35.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 10.0d, DELTA);
@@ -386,24 +385,23 @@ public class GPXReaderTest {
             assertEquals(null,                  f.getPropertyValue("type"));
             assertEquals(null,                  f.getPropertyValue("number"));
 
-            links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(0,links.size());
 
-            segments = new ArrayList<>((Collection)f.getPropertyValue("trkseg"));
+            segments = new ArrayList<>((Collection<Feature>) f.getPropertyValue("trkseg"));
             assertEquals(0,segments.size());
 
-            bbox = (Envelope) f.getPropertyValue("@bounds");
+            bbox = (Envelope) f.getPropertyValue("@envelope");
             assertNull(bbox);
 
-
             assertFalse(reader.hasNext());
         }
     }
 
     /**
-     * Test gpx version 1.1.0 track tag parsing.
-     * 
-     * @throws java.lang.Exception if reader failed to be created or failed at reading
+     * Tests GPX version 1.1.0 track tag parsing.
+     *
+     * @throws Exception if reader failed to be created or failed at reading
      */
     @Test
     public void testTrackRead110() throws Exception {
@@ -431,25 +429,25 @@ public class GPXReaderTest {
             assertEquals("track type",          f.getPropertyValue("type"));
             assertEquals(7,                     f.getPropertyValue("number"));
 
-            List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(3,links.size());
             assertEquals("http://track-adress1.org", links.get(0).toString());
             assertEquals("http://track-adress2.org", links.get(1).toString());
             assertEquals("http://track-adress3.org", links.get(2).toString());
 
-            List<Feature> segments = new ArrayList<>((Collection)f.getPropertyValue("trkseg"));
+            List<Feature> segments = new ArrayList<>((Collection<Feature>) f.getPropertyValue("trkseg"));
             assertEquals(2,segments.size());
             Feature seg1 = segments.get(0);
             Feature seg2 = segments.get(1);
-            List<Feature> points = new ArrayList<>((Collection)seg1.getPropertyValue("trkpt"));
+            List<Feature> points = new ArrayList<>((Collection<Feature>) seg1.getPropertyValue("trkpt"));
             assertEquals(3, points.size());
             checkPoint(points.get(0), 0,true);
             checkPoint(points.get(1), 1,true);
             checkPoint(points.get(2), 2,true);
-            points = new ArrayList<>((Collection)seg2.getPropertyValue("trkpt"));
+            points = new ArrayList<>((Collection<Feature>) seg2.getPropertyValue("trkpt"));
             assertEquals(0, points.size());
 
-            Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 15.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 35.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 10.0d, DELTA);
@@ -463,13 +461,13 @@ public class GPXReaderTest {
             assertEquals(null,                  f.getPropertyValue("type"));
             assertEquals(null,                  f.getPropertyValue("number"));
 
-            links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(0,links.size());
 
-            segments = new ArrayList<>((Collection)f.getPropertyValue("trkseg"));
+            segments = new ArrayList<>((Collection<Feature>) f.getPropertyValue("trkseg"));
             assertEquals(0,segments.size());
 
-            bbox = (Envelope) f.getPropertyValue("@bounds");
+            bbox = (Envelope) f.getPropertyValue("@envelope");
             assertNull(bbox);
 
 
@@ -480,8 +478,8 @@ public class GPXReaderTest {
     private void checkPoint(final Feature f, final int num, final boolean v11) throws Exception {
         if (num == 0) {
             assertEquals(0,                     f.getPropertyValue("index"));
-            assertEquals(15.0,                  ((Point)f.getPropertyValue("geometry")).getX(), DELTA);
-            assertEquals(10.0,                  ((Point)f.getPropertyValue("geometry")).getY(), DELTA);
+            assertEquals(15.0,                  ((Point)f.getPropertyValue("@geometry")).getX(), DELTA);
+            assertEquals(10.0,                  ((Point)f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(140.0,                 f.getPropertyValue("ele"));
             assertEquals(parseTime("2010-01-10"),f.getPropertyValue("time"));
             assertEquals(35.0,                  f.getPropertyValue("magvar"));
@@ -500,7 +498,7 @@ public class GPXReaderTest {
             assertEquals(55.55,                 f.getPropertyValue("ageofdgpsdata"));
             assertEquals(256,                   f.getPropertyValue("dgpsid"));
 
-            final List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            final List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             if (v11) {
                 assertEquals(3,links.size());
                 assertEquals("http://first-adress1.org", links.get(0).toString());
@@ -511,7 +509,7 @@ public class GPXReaderTest {
                 assertEquals("http://first-adress1.org", links.get(0).toString());
             }
 
-            final Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            final Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 15.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 15.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 10.0d, DELTA);
@@ -519,8 +517,8 @@ public class GPXReaderTest {
 
         } else if (num == 1) {
             assertEquals(1,                     f.getPropertyValue("index"));
-            assertEquals(25.0,                  ((Point)f.getPropertyValue("geometry")).getX(), DELTA);
-            assertEquals(20.0,                  ((Point)f.getPropertyValue("geometry")).getY(), DELTA);
+            assertEquals(25.0,                  ((Point)f.getPropertyValue("@geometry")).getX(), DELTA);
+            assertEquals(20.0,                  ((Point)f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(null,                  f.getPropertyValue("ele"));
             assertEquals(null,                  f.getPropertyValue("time"));
             assertEquals(null,                  f.getPropertyValue("magvar"));
@@ -539,10 +537,10 @@ public class GPXReaderTest {
             assertEquals(null,                  f.getPropertyValue("ageofdgpsdata"));
             assertEquals(null,                  f.getPropertyValue("dgpsid"));
 
-            final List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            final List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             assertEquals(0,links.size());
 
-            final Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            final Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 25.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 25.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 20.0d, DELTA);
@@ -550,8 +548,8 @@ public class GPXReaderTest {
 
         } else if (num == 2) {
             assertEquals(2,                     f.getPropertyValue("index"));
-            assertEquals(35.0,                  ((Point)f.getPropertyValue("geometry")).getX(), DELTA);
-            assertEquals(30.0,                  ((Point)f.getPropertyValue("geometry")).getY(), DELTA);
+            assertEquals(35.0,                  ((Point) f.getPropertyValue("@geometry")).getX(), DELTA);
+            assertEquals(30.0,                  ((Point) f.getPropertyValue("@geometry")).getY(), DELTA);
             assertEquals(150.0,                 f.getPropertyValue("ele"));
             assertEquals(parseTime("2010-01-30"),f.getPropertyValue("time"));
             assertEquals(25.0,                  f.getPropertyValue("magvar"));
@@ -570,7 +568,7 @@ public class GPXReaderTest {
             assertEquals(85.55,                 f.getPropertyValue("ageofdgpsdata"));
             assertEquals(456,                   f.getPropertyValue("dgpsid"));
 
-            final List<URI> links = new ArrayList<>((Collection)f.getPropertyValue("link"));
+            final List<URI> links = new ArrayList<>((Collection<URI>) f.getPropertyValue("link"));
             if (v11) {
                 assertEquals(2,links.size());
                 assertEquals("http://third-adress1.org", links.get(0).toString());
@@ -580,7 +578,7 @@ public class GPXReaderTest {
                 assertEquals("http://third-adress1.org", links.get(0).toString());
             }
 
-            final Envelope bbox = (Envelope) f.getPropertyValue("@bounds");
+            final Envelope bbox = (Envelope) f.getPropertyValue("@envelope");
             assertEquals(bbox.getMinimum(0), 35.0d, DELTA);
             assertEquals(bbox.getMaximum(0), 35.0d, DELTA);
             assertEquals(bbox.getMinimum(1), 30.0d, DELTA);
@@ -605,5 +603,4 @@ public class GPXReaderTest {
         return new ImmutableEnvelope(envelope);
 
     }
-
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java?rev=1740141&r1=1740140&r2=1740141&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/gpx/GPXWriterTest.java [UTF-8] Wed Apr 20 13:01:55 2016
@@ -17,7 +17,6 @@
 
 package org.apache.sis.internal.gpx;
 
-import com.esri.core.geometry.Point;
 import java.io.File;
 import java.net.URI;
 import java.time.Instant;
@@ -26,24 +25,28 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import com.esri.core.geometry.Point;
 import org.apache.sis.geometry.GeneralEnvelope;
 import org.apache.sis.geometry.ImmutableEnvelope;
+import org.apache.sis.referencing.CommonCRS;
 import org.junit.Test;
-import static org.junit.Assert.*;
+
 import static org.apache.sis.internal.gpx.GPXConstants.*;
+import static org.junit.Assert.*;
+
+// Branch-dependent imports
 import org.opengis.feature.Feature;
 
+
 /**
  * GPX Writer tests.
- * 
- * @author Johann Sorel (Geomatys)
+ *
+ * @author  Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
  */
-public class GPXWriterTest {
-
-
+public final strictfp class GPXWriterTest {
     /**
      * Test writing gpx metadata.
      *
@@ -54,7 +57,7 @@ public class GPXWriterTest {
         final File f = new File("output.xml");
         f.deleteOnExit();
         if (f.exists()) f.delete();
-        final GPXWriter110 writer = new GPXWriter110("Geotoolkit.org");
+        final GPXWriter110 writer = new GPXWriter110("Apache SIS");
         writer.setOutput(f);
 
         final Person person = new Person();
@@ -67,7 +70,7 @@ public class GPXWriterTest {
         copyright.setYear(2010);
         copyright.setLicense(new URI("http://gnu.org"));
 
-        final GeneralEnvelope bounds = new GeneralEnvelope(GPXConstants.GPX_CRS);
+        final GeneralEnvelope bounds = new GeneralEnvelope(CommonCRS.defaultGeographic());
         bounds.setRange(0, -10, 20);
         bounds.setRange(1, -30, 40);
 
@@ -96,7 +99,7 @@ public class GPXWriterTest {
 
     /**
      * Test writing the various gpx feature types.
-     * 
+     *
      * @throws Exception
      */
     @Test
@@ -105,13 +108,13 @@ public class GPXWriterTest {
         final File f = new File("output.xml");
         f.deleteOnExit();
         if (f.exists()) f.delete();
-        final GPXWriter110 writer = new GPXWriter110("Geotoolkit.org");
+        final GPXWriter110 writer = new GPXWriter110("Apache SIS");
         writer.setOutput(f);
 
         //way points -----------------------------------------------------------
         Feature point1 = TYPE_WAYPOINT.newInstance();
         point1.setPropertyValue("index", 0);
-        point1.setPropertyValue("geometry", new Point(-10, 10));
+        point1.setPropertyValue("@geometry", new Point(-10, 10));
         point1.setPropertyValue("ele", 15.6);
         point1.setPropertyValue("time", LocalDate.now());
         point1.setPropertyValue("magvar", 31.7);
@@ -132,7 +135,7 @@ public class GPXWriterTest {
         point1.setPropertyValue("dgpsid", 6);
         Feature point2 = TYPE_WAYPOINT.newInstance();
         point2.setPropertyValue("index", 1);
-        point2.setPropertyValue("geometry", new Point(-15, 15));
+        point2.setPropertyValue("@geometry", new Point(-15, 15));
         point2.setPropertyValue("ele", 15.6);
         point2.setPropertyValue("time", LocalDate.now());
         point2.setPropertyValue("magvar", 31.7);
@@ -153,7 +156,7 @@ public class GPXWriterTest {
         point2.setPropertyValue("dgpsid", 6);
         Feature point3 = TYPE_WAYPOINT.newInstance();
         point3.setPropertyValue("index", 2);
-        point3.setPropertyValue("geometry", new Point(-20, 20));
+        point3.setPropertyValue("@geometry", new Point(-20, 20));
         point3.setPropertyValue("ele", 15.6);
         point3.setPropertyValue("time", LocalDate.now());
         point3.setPropertyValue("magvar", 31.7);
@@ -215,7 +218,7 @@ public class GPXWriterTest {
         final Feature seg3 = TYPE_TRACK_SEGMENT.newInstance();
         seg3.setPropertyValue("index", 2);
         seg3.setPropertyValue("trkpt", wayPoints);
-        
+
         final Feature track1 = TYPE_TRACK.newInstance();
         track1.setPropertyValue("index", 0);
         track1.setPropertyValue("name", "tc");



Mime
View raw message