sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1574060 - in /sis/branches/JDK7: core/sis-referencing/src/main/java/org/apache/sis/parameter/ core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/sis-referencing/src/test/java/org/apache/sis/parameter/ core/sis-referencing/...
Date Tue, 04 Mar 2014 12:36:08 GMT
Author: desruisseaux
Date: Tue Mar  4 12:36:07 2014
New Revision: 1574060

URL: http://svn.apache.org/r1574060
Log:
Renamed some 'DescriptorBuilder' methods and added new methods for metadata properties.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DescriptorBuilder.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DescriptorBuilderTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
    sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/DripByteChannel.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DescriptorBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DescriptorBuilder.java?rev=1574060&r1=1574059&r2=1574060&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DescriptorBuilder.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DescriptorBuilder.java
[UTF-8] Tue Mar  4 12:36:07 2014
@@ -19,33 +19,40 @@ package org.apache.sis.parameter;
 import java.util.Map;
 import java.util.HashMap;
 import javax.measure.unit.Unit;
+import org.opengis.util.GenericName;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.Range;
 
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+
 
 /**
- * Builds instances of {@link DefaultParameterDescriptor}.
- * This convenience class aims to facilitate the creation of group of parameter descriptors.
+ * Provides convenience methods for easier {@link DefaultParameterDescriptor} instantiations.
+ * This builder can be helpful for map projection <em>providers</em>, or for
implementation of
+ * any process that use parameters. Map projection or process <em>users</em>
should rather invoke
+ * {@link ParameterDescriptor#createValue()} on the descriptor provided by the implementor.
  *
- * {@section Example}
- * The following example creates the parameters for "<cite>Mercator (variant A)</cite>"
projection method
- * (EPSG:9804). All parameter names will be in the "EPSG" namespace. The default values define
a projection
- * centered on (0°,0°) with no scale factor and no false easting/northing.
+ * {@section Usage example}
+ * Parameter descriptors are typically grouped in a {@link ParameterDescriptorGroup}.
+ * All parameters usually have the same namespace, which can be declared only once.
+ * The following example creates parameters for "<cite>Mercator (variant A)</cite>"
projection method (EPSG:9804)
+ * with all parameter names in the "EPSG" namespace. The default values define a projection
centered on (0°,0°)
+ * with no scale factor and no false easting/northing.
  *
  * {@preformat java
  *   DescriptorBuilder builder = new DescriptorBuilder();
  *   builder.codespace(Citations.OGP, "EPSG").mandatory();
  *   ParameterDescriptor<Double>[] parameters = {
- *       builder.name("Latitude of natural origin")     .create( -80,  +80, 0, NonSI.DEGREE_ANGLE),
- *       builder.name("Longitude of natural origin")    .create(-180, +180, 0, NonSI.DEGREE_ANGLE),
+ *       builder.name("Latitude of natural origin")     .createBounded( -80,  +80, 0, NonSI.DEGREE_ANGLE),
+ *       builder.name("Longitude of natural origin")    .createBounded(-180, +180, 0, NonSI.DEGREE_ANGLE),
  *       builder.name("Scale factor at natural origin") .createStrictlyPositive(1, Unit.ONE),
- *       builder.name("False easting")                  .createUnbounded(0, SI.METRE),
- *       builder.name("False northing")                 .createUnbounded(0, SI.METRE)
+ *       builder.name("False easting")                  .create(0, SI.METRE),
+ *       builder.name("False northing")                 .create(0, SI.METRE)
  *   };
  * }
  *
@@ -62,6 +69,9 @@ public class DescriptorBuilder {
 
     /**
      * {@code true} if the parameter is mandatory, or {@code false} if optional.
+     *
+     * @see #mandatory()
+     * @see #optional()
      */
     private boolean required;
 
@@ -73,15 +83,28 @@ public class DescriptorBuilder {
     }
 
     /**
-     * Sets the name to the given identifier. If an authority, {@linkplain #codespace(Citation,
String) code space}
-     * or {@linkplain #version(String) version} have been specified to this builder, they
will be ignored since the
-     * given identifier is expected to contain all those information.
+     * Sets the authority and code space. This method is typically invoked only once, since
+     * a group of parameters often uses the same code space for all individual parameters.
      *
-     * @param  name The parameter name as an identifier.
+     * @param  authority Bibliographic reference to the authority defining the codes, or
{@code null} if none.
+     * @param  codespace The parameter codespace, or {@code null} for inferring it from the
authority.
      * @return {@code this}, for method call chaining.
      */
-    public DescriptorBuilder name(final ReferenceIdentifier name) {
-        properties.put(ParameterDescriptor.NAME_KEY, name);
+    public DescriptorBuilder codespace(final Citation authority, final String codespace)
{
+        properties.put(ReferenceIdentifier.AUTHORITY_KEY, authority);
+        properties.put(ReferenceIdentifier.CODESPACE_KEY, codespace);
+        return this;
+    }
+
+    /**
+     * Sets the version of code definitions. This method is typically invoked only once,
+     * since a group of parameters often uses the same version for all individual parameters.
+     *
+     * @param  version The version of code definitions, or {@code null} if none.
+     * @return {@code this}, for method call chaining.
+     */
+    public DescriptorBuilder version(final String version) {
+        properties.put(ReferenceIdentifier.VERSION_KEY, version);
         return this;
     }
 
@@ -99,28 +122,75 @@ public class DescriptorBuilder {
     }
 
     /**
-     * Sets the authority and code space. This method is typically invoked only once, since
-     * a group of parameters often uses the same code space for all individual parameters.
+     * Sets the name to the given identifier. If an authority, {@linkplain #codespace(Citation,
String) code space}
+     * or {@linkplain #version(String) version} have been specified to this builder, they
will be ignored since the
+     * given identifier is expected to contain all those information.
      *
-     * @param  authority Bibliographic reference to the authority defining the codes, or
{@code null} if none.
-     * @param  codespace The parameter codespace, or {@code null} for inferring it from the
authority.
+     * @param  name The parameter name as an identifier.
      * @return {@code this}, for method call chaining.
      */
-    public DescriptorBuilder codespace(final Citation authority, final String codespace)
{
-        properties.put(ReferenceIdentifier.AUTHORITY_KEY, authority);
-        properties.put(ReferenceIdentifier.CODESPACE_KEY, codespace);
+    public DescriptorBuilder name(final ReferenceIdentifier name) {
+        properties.put(ParameterDescriptor.NAME_KEY, name);
         return this;
     }
 
     /**
-     * Sets the version of code definitions. This method is typically invoked only once,
-     * since a group of parameters often uses the same version for all individual parameters.
+     * Sets the aliases as {@code String} or {@code InternationalString} instances.
+     * An arbitrary amount of aliases can be specified. Each alias is parsed using
+     * using the {@value org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR}
+     * separator.
+     *
+     * <div class="note"><b>Example:</b>
+     * The "<cite>Longitude of natural origin</cite>" parameter defined by EPSG
is named differently
+     * by OGC and GeoTIFF. Those alternative names can be defined as below:
+     *
+     * {@preformat java
+     *   builder.aliases("OGC:central_meridian", "GeoTIFF:NatOriginLong");
+     * }
+     *
+     * In this example, {@code "central_meridian"} will be the name
+     * {@linkplain org.apache.sis.util.iso.DefaultScopedName#tip() tip} and {@code "OGC"}
will be the name
+     * {@linkplain org.apache.sis.util.iso.DefaultScopedName#head() head}.</div>
      *
-     * @param  version The version of code definitions, or {@code null} if none.
+     * @param  aliases The aliases, or {@code null} or empty if none.
      * @return {@code this}, for method call chaining.
      */
-    public DescriptorBuilder version(final String version) {
-        properties.put(ReferenceIdentifier.VERSION_KEY, version);
+    public DescriptorBuilder aliases(final CharSequence... aliases) {
+        properties.put(ParameterDescriptor.ALIAS_KEY, aliases);
+        return this;
+    }
+
+    /**
+     * Sets aliases as {@code GenericName} instances.
+     *
+     * @param  aliases The aliases, or {@code null} or empty if none.
+     * @return {@code this}, for method call chaining.
+     */
+    public DescriptorBuilder aliases(final GenericName... aliases) {
+        properties.put(ParameterDescriptor.ALIAS_KEY, aliases);
+        return this;
+    }
+
+    /**
+     * Sets the identifiers as {@code ReferenceIdentifier} instances.
+     * This information is optional and can be specified as a complement to the parameter
name.
+     *
+     * @param  identifiers The identifiers, or {@code null} or empty if none.
+     * @return {@code this}, for method call chaining.
+     */
+    public DescriptorBuilder identifiers(final ReferenceIdentifier... identifiers) {
+        properties.put(ParameterDescriptor.IDENTIFIERS_KEY, identifiers);
+        return this;
+    }
+
+    /**
+     * Sets remarks as {@code String} or {@code InternationalString} instances.
+     *
+     * @param  remarks The remarks, or {@code null} if none.
+     * @return {@code this}, for method call chaining.
+     */
+    public DescriptorBuilder remarks(final CharSequence remarks) {
+        properties.put(ParameterDescriptor.REMARKS_KEY, remarks);
         return this;
     }
 
@@ -147,47 +217,27 @@ public class DescriptorBuilder {
     }
 
     /**
-     * Constructs a descriptor for a parameter in a range of integer values.
+     * Creates a descriptor for floating point values without domain restriction.
+     * All {@code double} values are considered valid.
      *
-     * @param  minimumValue The minimum parameter value (inclusive).
-     * @param  maximumValue The maximum parameter value (inclusive).
-     * @param  defaultValue The default value for the parameter.
-     * @return The parameter descriptor for the given range of values.
-     */
-    public ParameterDescriptor<Integer> create(final int minimumValue, final int maximumValue,
-            final int defaultValue)
-    {
-        return new DefaultParameterDescriptor<>(properties, Integer.class,
-                NumberRange.create(minimumValue, true, maximumValue, true), null, defaultValue,
required);
-    }
-
-    /**
-     * Constructs a descriptor for a parameter in a range of floating point values.
-     *
-     * @param  minimumValue The minimum parameter value (inclusive), or {@link Double#NEGATIVE_INFINITY}
if none.
-     * @param  maximumValue The maximum parameter value (inclusive), or {@link Double#POSITIVE_INFINITY}
if none.
      * @param  defaultValue The default value for the parameter, or {@link Double#NaN} if
none.
-     * @param  unit         The unit for default, minimum and maximum values, or {@code null}
if none.
-     * @return The parameter descriptor for the given range of values.
+     * @param  unit         The default unit, or {@code null} if none.
+     * @return The parameter descriptor for the given default value and unit.
      */
-    public ParameterDescriptor<Double> create(final double minimumValue, final double
maximumValue,
-            final double defaultValue, final Unit<?> unit)
-    {
+    public ParameterDescriptor<Double> create(final double defaultValue, final Unit<?>
unit) {
         final Range<Double> valueDomain;
         if (unit != null) {
-            valueDomain = MeasurementRange.create(minimumValue, true, maximumValue, true,
unit);
-        } else if (minimumValue != Double.NEGATIVE_INFINITY || maximumValue != Double.POSITIVE_INFINITY)
{
-            valueDomain = NumberRange.create(minimumValue, true, maximumValue, true);
+            valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY, false, Double.POSITIVE_INFINITY,
false, unit);
         } else {
             valueDomain = null;
         }
         return new DefaultParameterDescriptor<>(properties, Double.class,
-                valueDomain, null, Numerics.valueOf(defaultValue), required);
+                valueDomain, null, Double.valueOf(defaultValue), required);
     }
 
     /**
-     * Constructs a descriptor for a strictly positive parameter value.
-     * The value must be greater than zero, and there is no maximum value.
+     * Creates a descriptor for floating point values greater than zero.
+     * The zero value is not considered valid. There is no maximal value.
      *
      * @param  defaultValue The default value for the parameter, or {@link Double#NaN} if
none.
      * @param  unit         The default unit, or {@code null} if none.
@@ -201,41 +251,63 @@ public class DescriptorBuilder {
             valueDomain = NumberRange.create(0.0, false, Double.POSITIVE_INFINITY, false);
         }
         return new DefaultParameterDescriptor<>(properties, Double.class,
-                valueDomain, null, Numerics.valueOf(defaultValue), required);
+                valueDomain, null, Double.valueOf(defaultValue), required);
     }
 
     /**
-     * Constructs a descriptor without any restriction on the range of values.
+     * Creates a descriptor for floating point values restricted to the given domain.
      *
+     * @param  minimumValue The minimum parameter value (inclusive), or {@link Double#NEGATIVE_INFINITY}
if none.
+     * @param  maximumValue The maximum parameter value (inclusive), or {@link Double#POSITIVE_INFINITY}
if none.
      * @param  defaultValue The default value for the parameter, or {@link Double#NaN} if
none.
-     * @param  unit         The default unit, or {@code null} if none.
-     * @return The parameter descriptor for the given default value and unit.
+     * @param  unit         The unit for default, minimum and maximum values, or {@code null}
if none.
+     * @return The parameter descriptor for the given domain of values.
      */
-    public ParameterDescriptor<Double> createUnbounded(final double defaultValue, final
Unit<?> unit) {
+    public ParameterDescriptor<Double> createBounded(final double minimumValue, final
double maximumValue,
+            final double defaultValue, final Unit<?> unit)
+    {
         final Range<Double> valueDomain;
         if (unit != null) {
-            valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY, false, Double.POSITIVE_INFINITY,
false, unit);
+            valueDomain = MeasurementRange.create(minimumValue, true, maximumValue, true,
unit);
+        } else if (minimumValue != Double.NEGATIVE_INFINITY || maximumValue != Double.POSITIVE_INFINITY)
{
+            valueDomain = NumberRange.create(minimumValue, true, maximumValue, true);
         } else {
             valueDomain = null;
         }
         return new DefaultParameterDescriptor<>(properties, Double.class,
-                valueDomain, null, Numerics.valueOf(defaultValue), required);
+                valueDomain, null, Double.valueOf(defaultValue), required);
     }
 
     /**
-     * Constructs a descriptor for a parameter in a range of values.
+     * Creates a descriptor for integer values restricted to the given domain.
      *
-     * @param <T>          The compile-time type of the {@code valueClass} argument.
-     * @param valueClass   The class that describe the type of the parameter values.
-     * @param minimumValue The minimum parameter value (inclusive), or {@code null} if none.
-     * @param maximumValue The maximum parameter value (inclusive), or {@code null} if none.
-     * @param defaultValue The default value for the parameter, or {@code null} if none.
-     * @return The parameter descriptor for the given range of values.
+     * @param  minimumValue The minimum parameter value (inclusive).
+     * @param  maximumValue The maximum parameter value (inclusive).
+     * @param  defaultValue The default value for the parameter.
+     * @return The parameter descriptor for the given domain of values.
+     */
+    public ParameterDescriptor<Integer> createBounded(final int minimumValue, final
int maximumValue,
+            final int defaultValue)
+    {
+        return new DefaultParameterDescriptor<>(properties, Integer.class,
+                NumberRange.create(minimumValue, true, maximumValue, true), null, defaultValue,
required);
+    }
+
+    /**
+     * Creates a descriptor for values of the given type restricted to the given domain.
+     *
+     * @param  <T>          The compile-time type of the {@code valueClass} argument.
+     * @param  valueClass   The class that describe the type of the parameter values.
+     * @param  minimumValue The minimum parameter value (inclusive), or {@code null} if none.
+     * @param  maximumValue The maximum parameter value (inclusive), or {@code null} if none.
+     * @param  defaultValue The default value for the parameter, or {@code null} if none.
+     * @return The parameter descriptor for the given domain of values.
      */
     @SuppressWarnings({"unchecked", "rawtypes"})
-    public <T extends Comparable<? super T>> ParameterDescriptor<T> create(final
Class<T> valueClass,
+    public <T extends Comparable<? super T>> ParameterDescriptor<T> createBounded(final
Class<T> valueClass,
             final T minimumValue, final T maximumValue, final T defaultValue)
     {
+        ensureNonNull("valueClass", valueClass);
         final Range<T> valueDomain;
         if (minimumValue == null && maximumValue == null) {
             valueDomain = null;
@@ -248,9 +320,13 @@ public class DescriptorBuilder {
     }
 
     /**
-     * Constructs a descriptor for a parameter having a set of valid values.
+     * Creates a descriptor for a parameter restricted to a set of valid values.
      * The descriptor has no minimal or maximal value and no unit.
      *
+     * <p>The {@code validValues} property is mostly for restricting values to
+     * a {@linkplain org.opengis.util.CodeList code list} or enumeration subset.
+     * It is not necessary to provide this property when all values from the code list or
enumeration are valid.</p>
+     *
      * @param <T>          The compile-time type of the {@code valueClass} argument.
      * @param valueClass   The class that describe the type of the parameter values.
      * @param validValues  A finite set of valid values (usually from a {@linkplain CodeList
code list})
@@ -258,7 +334,7 @@ public class DescriptorBuilder {
      * @param defaultValue The default value for the parameter, or {@code null} if none.
      * @return The parameter descriptor for the given set of valid values.
      */
-    public <T> ParameterDescriptor<T> createForEnumeration(final Class<T>
valueClass, final T[] validValues, final T defaultValue) {
+    public <T> ParameterDescriptor<T> createEnumerated(final Class<T> valueClass,
final T[] validValues, final T defaultValue) {
         return new DefaultParameterDescriptor<>(properties, valueClass, null, validValues,
defaultValue, required);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1574060&r1=1574059&r2=1574060&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Tue Mar  4 12:36:07 2014
@@ -296,6 +296,10 @@ public class AbstractIdentifiedObject ex
         // -------------------------------------
         Object value = properties.get(NAME_KEY);
         if (value == null || value instanceof String) {
+            if (value == null && properties.get(ReferenceIdentifier.CODE_KEY) ==
null) {
+                throw new IllegalArgumentException(Errors.getResources(properties)
+                        .getString(Errors.Keys.MissingValueForProperty_1, NAME_KEY));
+            }
             name = new NamedIdentifier(PropertiesConverter.convert(properties));
         } else if (value instanceof ReferenceIdentifier) {
             name = (ReferenceIdentifier) value;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DescriptorBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DescriptorBuilderTest.java?rev=1574060&r1=1574059&r2=1574060&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DescriptorBuilderTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DescriptorBuilderTest.java
[UTF-8] Tue Mar  4 12:36:07 2014
@@ -19,6 +19,7 @@ package org.apache.sis.parameter;
 import javax.measure.unit.Unit;
 import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
+import org.opengis.util.GenericName;
 import org.opengis.parameter.ParameterDescriptor;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.test.DependsOn;
@@ -46,16 +47,24 @@ public final strictfp class DescriptorBu
         final DescriptorBuilder builder = new DescriptorBuilder();
         builder.codespace(HardCodedCitations.OGP, "EPSG").mandatory();
         final ParameterDescriptor[] parameters = {
-            builder.name("Latitude of natural origin")     .create( -80,  +80, 0, NonSI.DEGREE_ANGLE),
-            builder.name("Longitude of natural origin")    .create(-180, +180, 0, NonSI.DEGREE_ANGLE),
+            builder.name   ("Longitude of natural origin")
+                   .aliases("OGC:central_meridian", "GeoTIFF:NatOriginLong")
+                   .remarks("Some remarks.")               .createBounded(-180, +180, 0,
NonSI.DEGREE_ANGLE),
+            builder.name("Latitude of natural origin")     .createBounded( -80,  +80, 0,
NonSI.DEGREE_ANGLE),
             builder.name("Scale factor at natural origin") .createStrictlyPositive(1, Unit.ONE),
-            builder.name("False easting")                  .createUnbounded(0, SI.METRE),
-            builder.name("False northing")                 .createUnbounded(0, SI.METRE)
+            builder.name("False easting")                  .create(0, SI.METRE),
+            builder.name("False northing")                 .create(0, SI.METRE)
         };
         // Tests random properties.
-        assertEquals("EPSG",             parameters[0].getName().getCodeSpace());
+        assertEquals("EPSG",             parameters[1].getName().getCodeSpace());
         assertEquals("False easting",    parameters[3].getName().getCode());
-        assertEquals(Double.valueOf(80), parameters[0].getMaximumValue());
+        assertEquals("Some remarks.",    parameters[0].getRemarks().toString());
+        assertEquals(Double.valueOf(80), parameters[1].getMaximumValue());
         assertEquals(SI.METRE,           parameters[4].getUnit());
+
+        final GenericName alias = parameters[0].getAlias().iterator().next();
+        assertEquals("central_meridian",     alias.tip().toString());
+        assertEquals("OGC",                  alias.head().toString());
+        assertEquals("OGC:central_meridian", alias.toString());
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1574060&r1=1574059&r2=1574060&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] Tue Mar  4 12:36:07 2014
@@ -109,7 +109,7 @@ public final strictfp class AbstractIden
             // The message may be in any language, but shall
             // contain at least the missing property name.
             final String message = e.getMessage();
-            assertTrue(message, message.contains("code"));
+            assertTrue(message, message.contains("name"));
         }
         // Try again, with error messages forced to English.
         assertNull(properties.put(AbstractIdentifiedObject.LOCALE_KEY, Locale.US));
@@ -117,7 +117,7 @@ public final strictfp class AbstractIden
             new AbstractIdentifiedObject(properties);
             fail("Should not allow unnamed object.");
         } catch (IllegalArgumentException e) {
-            assertEquals("Missing value for “code” property.", e.getMessage());
+            assertEquals("Missing value for “name” property.", e.getMessage());
         }
         // "code" with String value is accepted as well.
         assertNull(properties.put("code", "Test"));

Modified: sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/DripByteChannel.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/DripByteChannel.java?rev=1574060&r1=1574059&r2=1574060&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/DripByteChannel.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/DripByteChannel.java
[UTF-8] Tue Mar  4 12:36:07 2014
@@ -80,6 +80,7 @@ public final strictfp class DripByteChan
      * Reads a random number of bytes from the data array.
      *
      * @param buffer The buffer where to copy the bytes.
+     * @throws IOException If this channel is closed.
      */
     @Override
     public int read(final ByteBuffer buffer) throws IOException {



Mime
View raw message