sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1536920 - in /sis/branches/JDK7: application/sis-console/src/main/resources/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/ core/sis-metad...
Date Tue, 29 Oct 2013 22:35:21 GMT
Author: desruisseaux
Date: Tue Oct 29 22:35:20 2013
New Revision: 1536920

URL: http://svn.apache.org/r1536920
Log:
Bug fix: ordering of metadata properties was ignoring the ordering specified in parent classes.

Added:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
  (with props)
Modified:
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
    sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] Tue Oct 29 22:35:20 2013
@@ -4,6 +4,6 @@ locale=The locale to use for the command
 timezone=The timezone for the dates to be formatted.
 encoding=The encoding to use for the command output.
 colors=Whether colorized output shall be enabled.
-brief=Whether the output should contains only brief information.
-verbose=Whether the output should contains more detailed information.
+brief=Reduce the output to only brief information.
+verbose=Request the output to contain more detailed information.
 help=Lists the options available for a specific command.

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] Tue Oct 29 22:35:20 2013
@@ -4,6 +4,6 @@ locale=Les paramètres régionaux à uti
 timezone=Le fuseau horaire des dates à écrire.
 encoding=L\u2019encodage des caractères à utiliser pour la sortie de la commande.
 colors=Indique si l\u2019affichage peut être en couleurs.
-brief=Indique si la sortie de la commande ne doit contenir que de brèves informations.
-verbose=Indique si la sortie de la commande doit contenir des informations plus détaillées.
+brief=Indique que la sortie de la commande ne doit contenir que de brèves informations.
+verbose=Indique que la sortie de la commande doit contenir des informations plus détaillées.
 help=Liste les options disponibles pour une commande spécifique.

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -18,7 +18,7 @@ package org.apache.sis.metadata;
 
 import java.util.Comparator;
 import java.util.Map;
-import java.util.IdentityHashMap;
+import java.util.HashMap;
 import java.lang.reflect.Method;
 import javax.xml.bind.annotation.XmlType;
 
@@ -43,7 +43,7 @@ import org.opengis.annotation.Obligation
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 final class PropertyComparator implements Comparator<Method> {
@@ -63,29 +63,51 @@ final class PropertyComparator implement
     static final String SET = "set";
 
     /**
-     * Methods specified in the {@link XmlType} annotation, or {@code null} if none.
-     */
-    private final String[] order;
-
-    /**
-     * Indices of methods in the {@link #order} array, created when first needed.
+     * Methods and property names specified in the {@link XmlType} annotation.
+     * Entries description:
+     *
+     * <ul>
+     *   <li>Keys in this map are either {@link String} or {@link Method} instances:
+     *     <ul>
+     *       <li>{@code String} keys property names as given by {@link XmlType#propOrder()}.
+     *           They are computed at construction time and do not change after construction.</li>
+     *       <li>{@code Method} keys will be added after construction, only as needed.</li>
+     *     </ul>
+     *   </li>
+     *
+     *   <li>Key is associated to an index that specify its position in descending
order.
+     *       For example the property associated to integer 0 shall be sorted last.
+     *       This descending order is only an implementation convenience.</li>
+     * </ul>
      */
-    private Map<Method,Integer> indices;
+    private final Map<Object,Integer> order;
 
     /**
      * Creates a new comparator for the given implementation class.
      *
      * @param implementation The implementation class, or {@code null} if unknown.
      */
-    PropertyComparator(final Class<?> implementation) {
-        if (implementation != null) {
+    PropertyComparator(Class<?> implementation) {
+        order = new HashMap<>();
+        while (implementation != null) {
             final XmlType xml = implementation.getAnnotation(XmlType.class);
             if (xml != null) {
-                order = xml.propOrder();
-                return;
+                final String[] propOrder = xml.propOrder();
+                for (int i=propOrder.length; --i>=0;) {
+                    /*
+                     * Add the entries in reverse order because we are iterating from the
child class to
+                     * the parent class, and we want the properties in the parent class to
be sorted first.
+                     * If duplicated properties are found, keep the first occurence (i.e.
sort the property
+                     * with the most specialized child that declared it).
+                     */
+                    final Integer old = order.put(propOrder[i], order.size());
+                    if (old != null) {
+                        order.put(propOrder[i], old);
+                    }
+                }
             }
+            implementation = implementation.getSuperclass();
         }
-        order = null;
     }
 
     /**
@@ -93,7 +115,7 @@ final class PropertyComparator implement
      */
     @Override
     public int compare(final Method m1, final Method m2) {
-        int c = indexOf(m1) - indexOf(m2);
+        int c = indexOf(m2) - indexOf(m1); // indexOf(…) are sorted in descending order.
         if (c == 0) {
             final UML a1 = m1.getAnnotation(UML.class);
             final UML a2 = m2.getAnnotation(UML.class);
@@ -131,30 +153,21 @@ final class PropertyComparator implement
     }
 
     /**
-     * Returns the index of the given method, or {@code order.length} if the method is not
found.
+     * Returns the index of the given method, or -1 if the method is not found.
+     * If positive, the index returned by this method correspond to a sorting in descending
order.
      */
     private int indexOf(final Method method) {
-        int i = 0;
-        if (order != null) {
-            if (indices == null) {
-                indices = new IdentityHashMap<>();
-            } else {
-                Integer index = indices.get(method);
-                if (index != null) {
-                    return index;
-                }
-            }
+        Integer index = order.get(method);
+        if (index == null) {
             String name = method.getName();
             name = toPropertyName(name, prefix(name).length());
-            while (i < order.length) {
-                if (name.equals(order[i])) {
-                    break;
-                }
-                i++;
+            index = order.get(name);
+            if (index == null) {
+                index = -1;
             }
-            indices.put(method, i);
+            order.put(method, index);
         }
-        return i;
+        return index;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -71,7 +71,7 @@ import java.util.Objects;
  * {@linkplain #getEastBoundLongitude() east bound longitude}, then the box spans the anti-meridian.
  * See {@linkplain org.apache.sis.geometry.GeneralEnvelope} for more information on anti-meridian
spanning.
  *
- * {@section Relationship with Envelope classes}
+ * <blockquote><font size="-1"><b>Note: relationship with Envelope classes</b><br>
  * The {@link org.apache.sis.geometry} package provides various {@code Envelope} classes
serving a simular purpose.
  * The main difference is that envelopes can be expressed in any {@linkplain org.apache.sis.referencing.crs.AbstractCRS
  * Coordinate Reference System} (for example using any map projection), may have any number
of dimensions, axes may have
@@ -84,6 +84,7 @@ import java.util.Objects;
  * box should be used only as a convenient way to give an <em>approximate</em>
description of a location.
  * Users can assume a precision of about 0.01° for the latitude and longitude values in
this class.
  * If more precision is desired, an {@code Envelope} should be considered instead.
+ * </font></blockquote>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -115,7 +115,7 @@ public class DefaultDataIdentification e
      * @param topicCategory The main theme of the dataset, or {@code null} if none.
      */
     public DefaultDataIdentification(final Citation citation,
-                                     final InternationalString abstracts,
+                                     final CharSequence abstracts,
                                      final Locale language,
                                      final TopicCategory topicCategory)
     {

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -31,6 +31,11 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.citation.CitationDate;
 import org.opengis.metadata.citation.PresentationForm;
 import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.distribution.Format;
+import org.opengis.metadata.constraint.Constraints;
+import org.opengis.metadata.identification.*; // Really using almost everything.
+import org.opengis.metadata.maintenance.MaintenanceInformation;
+import org.opengis.metadata.spatial.SpatialRepresentationType;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.ReferenceSystem;
 import org.opengis.referencing.ReferenceIdentifier;
@@ -45,6 +50,7 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -70,7 +76,7 @@ import static org.apache.sis.metadata.Pr
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @DependsOn(PropertyInformationTest.class)
@@ -174,6 +180,39 @@ public final strictfp class PropertyAcce
     }
 
     /**
+     * Tests the constructor with the {@link DefaultDataIdentification} implementation.
+     * The purpose of this test is to ensure that the properties defined in the parent
+     * class are sorted first.
+     */
+    @Test
+    @DependsOnMethod("testConstructor")
+    public void testConstructorWithInheritance() {
+        assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO_19115, DataIdentification.class,
DefaultDataIdentification.class),
+        //……Declaring type………………………Method………………………………………………………………………JavaBeans………………………………………………………UML
identifier………………………………………Sentence……………………………………………………………Type………………………………………………………………
+            Identification.class, "getCitation",                   "citation",          
        "citation",                  "Citation",                     Citation.class,
+            Identification.class, "getAbstract",                   "abstract",          
        "abstract",                  "Abstract",                     InternationalString.class,
+            Identification.class, "getPurpose",                    "purpose",           
        "purpose",                   "Purpose",                      InternationalString.class,
+            Identification.class, "getCredits",                    "credits",           
        "credit",                    "Credits",                      String[].class,
+            Identification.class, "getStatus",                     "status",            
        "status",                    "Status",                       Progress[].class,
+            Identification.class, "getPointOfContacts",            "pointOfContacts",   
        "pointOfContact",            "Point of contacts",            ResponsibleParty[].class,
+            Identification.class, "getResourceMaintenances",       "resourceMaintenances",
      "resourceMaintenance",       "Resource maintenances",        MaintenanceInformation[].class,
+            Identification.class, "getGraphicOverviews",           "graphicOverviews",  
        "graphicOverview",           "Graphic overviews",            BrowseGraphic[].class,
+            Identification.class, "getResourceFormats",            "resourceFormats",   
        "resourceFormat",            "Resource formats",             Format[].class,
+            Identification.class, "getDescriptiveKeywords",        "descriptiveKeywords",
       "descriptiveKeywords",       "Descriptive keywords",         Keywords[].class,
+            Identification.class, "getResourceSpecificUsages",     "resourceSpecificUsages",
    "resourceSpecificUsage",     "Resource specific usages",     Usage[].class,
+            Identification.class, "getResourceConstraints",        "resourceConstraints",
       "resourceConstraints",       "Resource constraints",         Constraints[].class,
+            Identification.class, "getAggregationInfo",            "aggregationInfo",   
        "aggregationInfo",           "Aggregation info",             AggregateInformation[].class,
+        DataIdentification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes",
"spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class,
+        DataIdentification.class, "getSpatialResolutions",         "spatialResolutions",
        "spatialResolution",         "Spatial resolutions",          Resolution[].class,
+        DataIdentification.class, "getLanguages",                  "languages",         
        "language",                  "Languages",                    Locale[].class,
+        DataIdentification.class, "getCharacterSets",              "characterSets",     
        "characterSet",              "Character sets",               CharacterSet[].class,
+        DataIdentification.class, "getTopicCategories",            "topicCategories",   
        "topicCategory",             "Topic categories",             TopicCategory[].class,
+        DataIdentification.class, "getEnvironmentDescription",     "environmentDescription",
    "environmentDescription",    "Environment description",      InternationalString.class,
+        DataIdentification.class, "getExtents",                    "extents",           
        "extent",                    "Extents",                      Extent[].class,
+        DataIdentification.class, "getSupplementalInformation",    "supplementalInformation",
   "supplementalInformation",   "Supplemental information",     InternationalString.class);
+    }
+
+    /**
      * Tests the constructor with a method which override an other method with covariant
      * return type. This test may need to be updated if a future GeoAPI release modifies
      * the {@link GeographicCRS} interface.
@@ -181,7 +220,7 @@ public final strictfp class PropertyAcce
      * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-205">GEOTK-205</a>
      */
     @Test
-    @DependsOnMethod("testConstructor")
+    @DependsOnMethod("testConstructorWithInheritance")
     public void testConstructorWithCovariantReturnType() {
         final Class<?> type = GeographicCRS.class;
         assertMappingEquals(new PropertyAccessor(HardCodedCitations.ISO, type, type),

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -195,12 +195,13 @@ public final strictfp class TreeTableFor
         final String text = format.format(identification.asTreeTable());
         assertMultilinesEquals(
             "Data identification\n" +
+            "  ├─Descriptive keywords\n" +
+            "  │   ├─Keyword (1 of 3)…………… Apple\n" +
+            "  │   ├─Keyword (2 of 3)…………… Orange\n" +
+            "  │   └─Keyword (3 of 3)…………… Kiwi\n" +
             "  ├─Topic category (1 of 3)…… Health\n" +
             "  ├─Topic category (2 of 3)…… Oceans\n" +
-            "  ├─Topic category (3 of 3)…… Test\n" +
-            "  └─Descriptive keywords\n" +
-            "      ├─Keyword (1 of 3)…………… Apple\n" +
-            "      ├─Keyword (2 of 3)…………… Orange\n" +
-            "      └─Keyword (3 of 3)…………… Kiwi\n", text);
+            "  └─Topic category (3 of 3)…… Test\n",
+            text);
     }
 }

Added: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1536920&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
(added)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -0,0 +1,147 @@
+/*
+ * 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.metadata.iso.identification;
+
+import org.opengis.metadata.citation.DateType;
+import org.opengis.metadata.identification.KeywordType;
+import org.opengis.metadata.spatial.SpatialRepresentationType;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
+import org.apache.sis.metadata.iso.constraint.DefaultConstraints;
+import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.apache.sis.test.TestUtilities;
+import org.junit.Test;
+
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link DefaultDataIdentification}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+@DependsOn({
+    org.apache.sis.metadata.PropertyAccessorTest.class, // For properties order
+    org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
+    org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
+    org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBoxTest.class,
+    DefaultKeywordsTest.class
+})
+public final strictfp class DefaultDataIdentificationTest extends TestCase {
+    /**
+     * Creates the instance to test.
+     */
+    private static DefaultDataIdentification create() {
+        /*
+         * Citation
+         *   ├─Title………………………………………………………………………………
Sea Surface Temperature Analysis Model
+         *   ├─Date
+         *   │   ├─Date………………………………………………………………………
Sep 22, 2005 00:00:00 AM
+         *   │   └─Date type…………………………………………………………
Creation
+         *   └─Identifier
+         *       └─Code………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc
+         */
+        final DefaultCitation citation = new DefaultCitation("Sea Surface Temperature Analysis
Model");
+        citation.getDates().add(new DefaultCitationDate(TestUtilities.date("2005-09-22 00:00:00"),
DateType.CREATION));
+        citation.getIdentifiers().add(new DefaultIdentifier("SST_Global.nc"));
+        /*
+         * Descriptive keywords
+         *   ├─Keyword…………………………………………………………………………
EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
+         *   ├─Type…………………………………………………………………………………
Theme
+         *   └─Thesaurus name
+         *       └─Title……………………………………………………………………
GCMD Science Keywords
+         */
+        final DefaultKeywords keywords = new DefaultKeywords(
+                "EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature");
+        keywords.setType(KeywordType.THEME);
+        keywords.setThesaurusName(new DefaultCitation("GCMD Science Keywords"));
+        /*
+         * Identification info
+         *  ├─(above objects)
+         *  ├─Abstract…………………………………………………………………………………
NCEP SST Global 5.0 x 2.5 degree model data
+         *  ├─Descriptive keywords
+         *  │   ├─Keyword…………………………………………………………………………
EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
+         *  │   ├─Type…………………………………………………………………………………
Theme
+         *  │   └─Thesaurus name
+         *  │       └─Title……………………………………………………………………
GCMD Science Keywords
+         *  ├─Resource constraints
+         *  │   └─Use limitation………………………………………………………
Freely available
+         *  ├─Spatial representation type……………………………… Grid
+         *  └─Extent
+         *      └─Geographic element
+         *          ├─West bound longitude…………………………… 180°W
+         *          ├─East bound longitude…………………………… 180°E
+         *          ├─South bound latitude…………………………… 90°S
+         *          ├─North bound latitude…………………………… 90°N
+         *          └─Extent type code……………………………………… true
+         */
+        final DefaultDataIdentification info = new DefaultDataIdentification(citation,
+                "NCEP SST Global 5.0 x 2.5 degree model data", null, null);
+        info.getSpatialRepresentationTypes().add(SpatialRepresentationType.GRID);
+        info.getDescriptiveKeywords().add(keywords);
+        info.getResourceConstraints().add(new DefaultConstraints("Freely available"));
+        info.getExtents().add(Extents.WORLD);
+        return info;
+    }
+
+    /**
+     * Tests {@link DefaultDataIdentification#toString()}.
+     * This is an integration tests for (among others):
+     *
+     * <ul>
+     *   <li>Property order</li>
+     *   <li>Date formatting</li>
+     *   <li>Angle formatting</li>
+     * </ul>
+     */
+    @Test
+    public void testToString() {
+        assertMultilinesEquals(
+                "Data identification\n" +
+                "  ├─Citation\n" +
+                "  │   ├─Title………………………………………………………
Sea Surface Temperature Analysis Model\n" +
+                "  │   ├─Date\n" +
+                "  │   │   ├─Date………………………………………………
2005-09-22 00:00:00\n" +
+                "  │   │   └─Date type…………………………………
Creation\n" +
+                "  │   └─Identifier\n" +
+                "  │       └─Code………………………………………………
SST_Global.nc\n" +
+                "  ├─Abstract…………………………………………………………
NCEP SST Global 5.0 x 2.5 degree model data\n" +
+                "  ├─Descriptive keywords\n" +
+                "  │   ├─Keyword…………………………………………………
EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature\n" +
+                "  │   ├─Type…………………………………………………………
Theme\n" +
+                "  │   └─Thesaurus name\n" +
+                "  │       └─Title……………………………………………
GCMD Science Keywords\n" +
+                "  ├─Resource constraints\n" +
+                "  │   └─Use limitation……………………………… Freely
available\n" +
+                "  ├─Spatial representation type……… Grid\n" +
+                "  └─Extent\n" +
+                "      ├─Description………………………………………
World\n" +
+                "      └─Geographic element\n" +
+                "          ├─West bound longitude…… 180°W\n" +
+                "          ├─East bound longitude…… 180°E\n" +
+                "          ├─South bound latitude…… 90°S\n" +
+                "          ├─North bound latitude…… 90°N\n" +
+                "          └─Extent type code……………… true\n",
+            TestUtilities.formatNameAndValue(create().asTreeTable()));
+    }
+}

Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -31,17 +31,6 @@ import org.junit.BeforeClass;
  */
 @Suite.SuiteClasses({
     org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
-    org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
-    org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
-    org.apache.sis.metadata.iso.identification.DefaultKeywordsTest.class,
-    org.apache.sis.metadata.iso.identification.DefaultRepresentativeFractionTest.class,
-    org.apache.sis.metadata.iso.identification.DefaultResolutionTest.class,
-    org.apache.sis.metadata.iso.identification.DefaultBrowseGraphicTest.class,
-    org.apache.sis.metadata.iso.spatial.DefaultGeorectifiedTest.class,
-    org.apache.sis.metadata.iso.maintenance.DefaultScopeDescriptionTest.class,
-    org.apache.sis.metadata.iso.quality.AbstractElementTest.class,
-    org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBoxTest.class,
-    org.apache.sis.metadata.iso.extent.ExtentsTest.class,
 
     // Classes using Java reflection.
     org.apache.sis.metadata.PropertyInformationTest.class,
@@ -58,8 +47,6 @@ import org.junit.BeforeClass;
     org.apache.sis.metadata.MetadataStandardTest.class,
     org.apache.sis.metadata.PrunerTest.class,
     org.apache.sis.metadata.AbstractMetadataTest.class,
-    org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
-    org.apache.sis.metadata.iso.AllMetadataTest.class,
 
     // XML marshalling.
     org.apache.sis.internal.jaxb.code.CodeListMarshallingTest.class,
@@ -69,6 +56,24 @@ import org.junit.BeforeClass;
     org.apache.sis.xml.NilReasonMarshallingTest.class,
     org.apache.sis.xml.AnchorMarshallingTest.class,
     org.apache.sis.xml.ObjectReferenceMarshallingTest.class,
+
+    // ISO implementations.
+    org.apache.sis.metadata.iso.citation.DefaultCitationDateTest.class,
+    org.apache.sis.metadata.iso.citation.DefaultCitationTest.class,
+    org.apache.sis.metadata.iso.maintenance.DefaultScopeDescriptionTest.class,
+    org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBoxTest.class,
+    org.apache.sis.metadata.iso.extent.ExtentsTest.class,
+    org.apache.sis.metadata.iso.spatial.DefaultGeorectifiedTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultKeywordsTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultRepresentativeFractionTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultResolutionTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultBrowseGraphicTest.class,
+    org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class,
+    org.apache.sis.metadata.iso.quality.AbstractElementTest.class,
+    org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
+    org.apache.sis.metadata.iso.AllMetadataTest.class,
+
+    // XML marshalling (integration tests).
     org.apache.sis.xml.CustomMetadataTest.class,
     org.apache.sis.xml.ImageryMarshallingTest.class,
     org.apache.sis.xml.MetadataMarshallingTest.class

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -391,7 +391,7 @@ public abstract class CompoundFormat<T> 
             if (!Locale.ROOT.equals(locale)) {
                 format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT,
locale);
             } else {
-                format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ROOT);
+                format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
             }
             format.setTimeZone(getTimeZone());
             return format;
@@ -405,6 +405,8 @@ public abstract class CompoundFormat<T> 
 
     /**
      * Returns a clone of this format.
+     *
+     * @return A clone of this format.
      */
     @Override
     public CompoundFormat<T> clone() {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8]
Tue Oct 29 22:35:20 2013
@@ -461,6 +461,7 @@ public final class Units extends Static 
              * with "deg", then the check should be put in the above block instead.
              */
             if (uom.equals("°")                      || equalsIgnorePlural(uom, "decimal_degree"))
return NonSI.DEGREE_ANGLE;
+            if (uom.equalsIgnoreCase("arcsec"))                                         
          return NonSI.SECOND_ANGLE;
             if (uom.equalsIgnoreCase("rad")          || equalsIgnorePlural(uom, "radian"))
        return SI.RADIAN;
             if (equalsIgnorePlural(uom, "kilometer") || equalsIgnorePlural(uom, "kilometre"))
     return SI.KILOMETRE;
             if (equalsIgnorePlural(uom, "meter")     || equalsIgnorePlural(uom, "metre"))
         return SI.METRE;

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -238,6 +238,7 @@ public final strictfp class UnitsTest ex
         assertSame(DEGREE_ANGLE, valueOf("degrees_east"));
         assertSame(DEGREE_ANGLE, valueOf("degrées_north"));
         assertSame(DEGREE_ANGLE, valueOf("decimal_degree"));
+        assertSame(SECOND_ANGLE, valueOf("arcsec"));
         assertSame(RADIAN,       valueOf("rad"));
         assertSame(RADIAN,       valueOf("radian"));
         assertSame(RADIAN,       valueOf("radians"));

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -223,6 +223,7 @@ public final strictfp class TestUtilitie
 
     /**
      * Returns a unlocalized string representation of {@code NAME} and {@code VALUE} columns
of the given tree table.
+     * Dates and times, if any, will be formatted using the {@code "yyyy-MM-dd HH:mm:ss"}
pattern in UTC timezone.
      * This method is used mostly as a convenient way to verify the content of an ISO 19115
metadata object.
      *
      * @param  table The table for which to get a string representation.

Modified: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1536920&r1=1536919&r2=1536920&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] Tue Oct 29 22:35:20 2013
@@ -104,22 +104,10 @@ public final strictfp class MetadataRead
             "  │   ├─Cell geometry……………………………………………………………………
Area\n" +
             "  │   └─Transformation parameter availability…… false\n" +
             "  ├─Identification info\n" +
-            "  │   ├─Spatial representation type………………………………
Grid\n" +
-            "  │   ├─Extent\n" +
-            "  │   │   ├─Geographic element\n" +
-            "  │   │   │   ├─West bound longitude……………………………
180°W\n" +
-            "  │   │   │   ├─East bound longitude……………………………
180°E\n" +
-            "  │   │   │   ├─South bound latitude……………………………
90°S\n" +
-            "  │   │   │   ├─North bound latitude……………………………
90°N\n" +
-            "  │   │   │   └─Extent type code………………………………………
true\n" +
-            "  │   │   └─Vertical element\n" +
-            "  │   │       ├─Minimum value………………………………………………
0.0\n" +
-            "  │   │       └─Maximum value………………………………………………
0.0\n" +
-            "  │   ├─Abstract…………………………………………………………………………………
NCEP SST Global 5.0 x 2.5 degree model data\n" +
             "  │   ├─Citation\n" +
             "  │   │   ├─Title………………………………………………………………………………
Sea Surface Temperature Analysis Model\n" +
             "  │   │   ├─Date\n" +
-            "  │   │   │   ├─Date………………………………………………………………………
2005/09/22 00:00:00\n" +
+            "  │   │   │   ├─Date………………………………………………………………………
2005-09-22 00:00:00\n" +
             "  │   │   │   └─Date type…………………………………………………………
Creation\n" +
             "  │   │   ├─Identifier\n" +
             "  │   │   │   ├─Code………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
@@ -128,20 +116,32 @@ public final strictfp class MetadataRead
             "  │   │   └─Cited responsible party\n" +
             "  │   │       ├─Individual name…………………………………………
NOAA/NWS/NCEP\n" +
             "  │   │       └─Role………………………………………………………………………
Originator\n" +
+            "  │   ├─Abstract…………………………………………………………………………………
NCEP SST Global 5.0 x 2.5 degree model data\n" +
+            "  │   ├─Point of contact\n" +
+            "  │   │   ├─Individual name……………………………………………………
NOAA/NWS/NCEP\n" +
+            "  │   │   └─Role…………………………………………………………………………………
Point of contact\n" +
             "  │   ├─Descriptive keywords\n" +
             "  │   │   ├─Keyword…………………………………………………………………………
EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature\n" +
             "  │   │   ├─Type…………………………………………………………………………………
Theme\n" +
             "  │   │   └─Thesaurus name\n" +
             "  │   │       └─Title……………………………………………………………………
GCMD Science Keywords\n" +
-            "  │   ├─Point of contact\n" +
-            "  │   │   ├─Individual name……………………………………………………
NOAA/NWS/NCEP\n" +
-            "  │   │   └─Role…………………………………………………………………………………
Point of contact\n" +
-            "  │   └─Resource constraints\n" +
-            "  │       └─Use limitation………………………………………………………
Freely available\n" +
+            "  │   ├─Resource constraints\n" +
+            "  │   │   └─Use limitation………………………………………………………
Freely available\n" +
+            "  │   ├─Spatial representation type………………………………
Grid\n" +
+            "  │   └─Extent\n" +
+            "  │       ├─Geographic element\n" +
+            "  │       │   ├─West bound longitude……………………………
180°W\n" +
+            "  │       │   ├─East bound longitude……………………………
180°E\n" +
+            "  │       │   ├─South bound latitude……………………………
90°S\n" +
+            "  │       │   ├─North bound latitude……………………………
90°N\n" +
+            "  │       │   └─Extent type code………………………………………
true\n" +
+            "  │       └─Vertical element\n" +
+            "  │           ├─Minimum value………………………………………………
0.0\n" +
+            "  │           └─Maximum value………………………………………………
0.0\n" +
             "  ├─Content info\n" +
             "  │   └─Dimension\n" +
-            "  │       ├─Descriptor…………………………………………………………………
Sea temperature\n" +
-            "  │       └─Sequence identifier…………………………………………
SST\n" +
+            "  │       ├─Sequence identifier…………………………………………
SST\n" +
+            "  │       └─Descriptor…………………………………………………………………
Sea temperature\n" +
             "  └─Data quality info\n" +
             "      └─Lineage\n" +
             "          └─Statement……………………………………………………………………
2003-04-07 12:12:50 - created by gribtocdl" +



Mime
View raw message