Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -22,6 +22,7 @@ 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.DependsOnMethod; import org.apache.sis.test.DependsOn; import org.apache.sis.test.TestCase; import org.junit.Test; @@ -34,7 +35,7 @@ import static org.junit.Assert.*; * * @author Martin Desruisseaux (Geomatys) * @since 0.4 - * @version 0.4 + * @version 0.6 * @module */ @DependsOn({ @@ -44,9 +45,38 @@ import static org.junit.Assert.*; }) public final strictfp class ParameterBuilderTest extends TestCase { /** + * Tests various {@code create(…)} methods. + */ + @Test + public void testCreate() { + final ParameterBuilder builder = new ParameterBuilder(); + ParameterDescriptor<Double> p = builder.addName("Test 1").create(0, SI.METRE); + assertEquals("name", "Test 1", p.getName().getCode()); + assertEquals("defaultValue", 0.0, p.getDefaultValue(), 0); + assertNull ("minimumValue", p.getMinimumValue()); + assertNull ("maximumValue", p.getMaximumValue()); + assertEquals("unit", SI.METRE, p.getUnit()); + + p = builder.addName("Test 2").create(Double.NaN, SI.METRE); + assertEquals("name", "Test 2", p.getName().getCode()); + assertNull ("defaultValue", p.getDefaultValue()); + assertNull ("minimumValue", p.getMinimumValue()); + assertNull ("maximumValue", p.getMaximumValue()); + assertEquals("unit", SI.METRE, p.getUnit()); + + p = builder.addName("Test 3").createBounded(1, 4, 3, SI.METRE); + assertEquals("name", "Test 3", p.getName().getCode()); + assertEquals("defaultValue", 3.0, p.getDefaultValue(), 0); + assertEquals("minimumValue", 1.0, p.getMinimumValue()); + assertEquals("maximumValue", 4.0, p.getMaximumValue()); + assertEquals("unit", SI.METRE, p.getUnit()); + } + + /** * Tests the "<cite>Mercator (variant A)</cite>" example given in Javadoc. */ @Test + @DependsOnMethod("testCreate") public void testMercatorProjection() { final ParameterBuilder builder = new ParameterBuilder(); builder.setCodeSpace(HardCodedCitations.OGP, "EPSG").setRequired(true);
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -16,8 +16,9 @@ */ package org.apache.sis.parameter; -import java.util.Collection; import java.util.Set; +import java.util.Collection; +import java.util.Collections; import javax.measure.unit.SI; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterValue; @@ -41,12 +42,14 @@ import static org.junit.Assert.*; * * @author Martin Desruisseaux (Geomatys) * @since 0.4 - * @version 0.5 + * @version 0.6 * @module */ @DependsOn({ DefaultParameterDescriptorTest.class, - DefaultParameterValueTest.class + DefaultParameterDescriptorGroupTest.class, + DefaultParameterValueTest.class, + DefaultParameterValueGroupTest.class }) public final strictfp class ParametersTest extends TestCase { /** @@ -152,4 +155,38 @@ public final strictfp class ParametersTe assertEquals("Optional 4 (second occurrence)", 50, ((ParameterValue<?>) destination.values().get(4)).intValue()); } + + /** + * Tests {@link Parameters#getValue(ParameterDescriptor)} and {@link Parameters#intValue(ParameterDescriptor)}. + * + * @since 0.6 + */ + @Test + public void testGetIntValue() { + final ParameterDescriptor<Integer> descriptor = DefaultParameterDescriptorTest.create("My param", 5, 15, 10); + final ParameterDescriptor<Integer> incomplete = DefaultParameterDescriptorTest.createSimpleOptional("My param", Integer.class); + final Parameters group = Parameters.castOrWrap(new DefaultParameterDescriptorGroup(Collections.singletonMap( + DefaultParameterDescriptorGroup.NAME_KEY, "My group"), 1, 1, incomplete).createValue()); + /* + * Test when the ParameterValueGroup is empty. We test both with the "incomplete" descriptor, + * which contain no default value, and with the complete one, which provide a default value. + */ + assertNull("No value and no default value.", group.getValue(incomplete)); + assertEquals("No value, should fallback on default.", Integer.valueOf(10), group.getValue(descriptor)); + try { + group.intValue(incomplete); + fail("Can not return when there is no value."); + } catch (IllegalStateException e) { + final String message = e.getMessage(); + assertTrue(message, message.contains("My param")); + } + /* + * Define a value and test again. + */ + group.parameter("My param").setValue(12); + assertEquals(Integer.valueOf(12), group.getValue(incomplete)); + assertEquals(Integer.valueOf(12), group.getValue(descriptor)); + assertEquals(12, group.intValue(incomplete)); + assertEquals(12, group.intValue(descriptor)); + } } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -160,7 +160,7 @@ public strictfp class TensorParametersTe { assertEquals("name", names[row][column], actual.getName().getCode()); assertAliasTipEquals((aliases != null) ? aliases[row][column] : null, actual); - assertIdentifierEqualsEPSG((identifiers != null) ? identifiers[row][column] : 0, actual); + assertEpsgIdentifierEquals((identifiers != null) ? identifiers[row][column] : 0, actual.getIdentifiers()); assertEquals("defaultValue", defaultValue, actual.getDefaultValue()); } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -332,7 +332,7 @@ public final strictfp class TensorValues /** * Tests {@link TensorParameters#ALPHANUM} formatting. * <ul> - * <li>Group name shall be {@code "Affine general parametric transformation"}.</li> + * <li>Group name shall be {@code "Affine parametric transformation"}.</li> * <li>No {@code "num_row"} or {@code "num_col"} parameters if their value is equals to 3.</li> * <li>Parameter names shall be of the form {@code "A0"}.</li> * <li>Identifiers present, but only for A0-A2 and B0-B2.</li> @@ -348,7 +348,7 @@ public final strictfp class TensorValues singletonMap(TensorValues.NAME_KEY, Affine.NAME), matrix); validate(group); assertWktEquals( - "ParameterGroup[“Affine general parametric transformation”,\n" + + "ParameterGroup[“Affine parametric transformation”,\n" + " Parameter[“A2”, 4.0, Id[“EPSG”, 8625]],\n" + " Parameter[“B0”, -2.0, Id[“EPSG”, 8639]],\n" + " Parameter[“C2”, 7.0]]", group); Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -33,8 +33,7 @@ import org.apache.sis.test.DependsOn; import org.apache.sis.test.TestCase; import org.junit.Test; -import static org.apache.sis.test.MetadataAssert.*; -import static org.apache.sis.test.TestUtilities.getSingleton; +import static org.apache.sis.test.ReferencingAssert.*; /** @@ -88,7 +87,7 @@ public final strictfp class DefaultOpera public void testConstruction() { final OperationMethod method = create("Mercator (variant A)", "9804", "EPSG guidance note #7-2", 2); assertEpsgIdentifierEquals("Mercator (variant A)", method.getName()); - assertEpsgIdentifierEquals("9804", getSingleton(method.getIdentifiers())); + assertEpsgIdentifierEquals(9804, method.getIdentifiers()); assertEquals("formula", "EPSG guidance note #7-2", method.getFormula().getCitation().getTitle().toString()); assertEquals("sourceDimensions", Integer.valueOf(2), method.getSourceDimensions()); assertEquals("targetDimensions", Integer.valueOf(2), method.getTargetDimensions()); Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -16,14 +16,22 @@ */ package org.apache.sis.referencing.operation.transform; +import java.util.Set; import org.opengis.util.NoSuchIdentifierException; +import org.opengis.referencing.operation.Conversion; +import org.opengis.referencing.operation.Projection; +import org.opengis.referencing.operation.SingleOperation; +import org.opengis.referencing.operation.OperationMethod; +import org.apache.sis.internal.referencing.provider.Affine; +import org.apache.sis.internal.util.Constants; +import org.apache.sis.test.DependsOnMethod; import org.apache.sis.test.DependsOn; import org.apache.sis.test.TestCase; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.*; +import static org.opengis.test.Assert.*; /** @@ -37,7 +45,7 @@ import static org.junit.Assert.*; * @module */ @DependsOn({ - org.apache.sis.referencing.operation.DefaultOperationMethodTest.class, + org.apache.sis.internal.referencing.provider.AllProvidersTest.class, OperationMethodSetTest.class }) public final strictfp class DefaultMathTransformFactoryTest extends TestCase { @@ -63,9 +71,25 @@ public final strictfp class DefaultMathT } /** + * Tests the {@link DefaultMathTransformFactory#getOperationMethod(String)} method. + * + * @throws NoSuchIdentifierException Should never happen. + */ + @Test + public void testGetOperationMethod() throws NoSuchIdentifierException { + // A conversion which is not a projection. + OperationMethod method = factory.getOperationMethod(Constants.AFFINE); + assertInstanceOf("Affine", Affine.class, method); + + // Same than above, using EPSG code. + assertSame("EPSG:9624", method, factory.getOperationMethod("EPSG:9624")); + } + + /** * Tests non-existent operation method. */ @Test + @DependsOnMethod("testGetOperationMethod") public void testNonExistentCode() { try { factory.getOperationMethod("EPXX:9624"); @@ -75,4 +99,29 @@ public final strictfp class DefaultMathT assertTrue(message, message.contains("EPXX:9624")); } } + + /** + * Tests the {@link DefaultMathTransformFactory#getAvailableMethods(Class)} method. + * + * @throws NoSuchIdentifierException Should never happen. + */ + @Test + @DependsOnMethod("testGetOperationMethod") + public void testGetAvailableMethods() throws NoSuchIdentifierException { + final Set<OperationMethod> transforms = factory.getAvailableMethods(SingleOperation.class); + final Set<OperationMethod> conversions = factory.getAvailableMethods(Conversion.class); + final Set<OperationMethod> projections = factory.getAvailableMethods(Projection.class); + /* + * Following tests should not cause loading of more classes than needed. + */ + assertFalse(transforms .isEmpty()); + assertFalse(conversions.isEmpty()); + assertTrue (projections.isEmpty()); + assertTrue (conversions.contains(factory.getOperationMethod(Constants.AFFINE))); + /* + * Following tests will force instantiation of all remaining OperationMethod. + */ + assertTrue("Conversions should be a subset of transforms.", transforms .containsAll(conversions)); + assertTrue("Projections should be a subset of conversions.", conversions.containsAll(projections)); + } } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -17,12 +17,12 @@ package org.apache.sis.test; import java.util.Collection; -import java.util.Set; import java.awt.geom.Rectangle2D; import java.awt.geom.RectangularShape; import java.awt.geom.AffineTransform; import javax.measure.unit.Unit; import org.opengis.geometry.Envelope; +import org.opengis.metadata.Identifier; import org.opengis.parameter.GeneralParameterValue; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterValue; @@ -34,13 +34,14 @@ import org.opengis.referencing.cs.AxisDi import org.opengis.referencing.cs.CoordinateSystemAxis; import org.opengis.referencing.cs.RangeMeaning; import org.opengis.util.GenericName; -import org.apache.sis.internal.util.Constants; import org.apache.sis.geometry.AbstractEnvelope; import org.apache.sis.geometry.GeneralDirectPosition; +import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.util.iso.DefaultNameSpace; import static java.lang.StrictMath.*; +import static org.apache.sis.internal.util.Constants.EPSG; /** @@ -65,20 +66,53 @@ public strictfp class ReferencingAssert } /** - * Asserts that the string representation of the unique identifier of the given object is equals to the given + * Asserts that the given identifier has the expected code and the {@code "OGC"} code space. + * The authority is expected to be {@link Citations#OGC}. We expect the exact same authority + * instance because identifiers in OGC namespace are often hard-coded in SIS. + * + * @param expected The expected identifier code. + * @param actual The identifier to verify. + * + * @since 0.6 + */ + public static void assertOgcIdentifierEquals(final String expected, final ReferenceIdentifier actual) { + assertNotNull(actual); + assertSame("Authority", Citations.OGC, actual.getAuthority()); + Assert.assertIdentifierEquals(null, "OGC", "OGC", null, expected, actual); + } + + /** + * Asserts that the given identifier has the expected code and the {@code "EPSG"} code space. + * The authority is expected to have the {@code "OGP"} title or alternate title. + * + * @param expected The expected identifier code. + * @param actual The identifier to verify. + * + * @since 0.5 + */ + public static void assertEpsgIdentifierEquals(final String expected, final Identifier actual) { + assertNotNull(actual); + assertEquals("code", expected, actual.getCode()); + assertEquals("codeSpace", EPSG, (actual instanceof ReferenceIdentifier) ? ((ReferenceIdentifier) actual).getCodeSpace() : null); + assertEquals("authority", "OGP", Citations.getIdentifier(actual.getAuthority())); + assertEquals("identifier", EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected, + IdentifiedObjects.toString(actual)); + } + + /** + * Asserts that the string representation of the unique identifier in the given collection is equals to the given * EPSG code. As a special case if the given code is 0, then this method verifies that the given object has no * identifier. * - * @param code The expected EPSG code, or {@code 0} if we expect no EPSG code. - * @param object The object for which to test the EPSG code. + * @param expected The expected EPSG code, or {@code 0} if we expect no EPSG code. + * @param actual The set of identifiers in which to verify the EPSG code. */ - public static void assertIdentifierEqualsEPSG(final int code, final IdentifiedObject object) { - final Set<ReferenceIdentifier> identifiers = object.getIdentifiers(); - if (code == 0) { - assertTrue("identifiers.isEmpty()", identifiers.isEmpty()); + public static void assertEpsgIdentifierEquals(final int expected, final Collection<? extends Identifier> actual) { + assertNotNull(actual); + if (expected == 0) { + assertTrue("identifiers.isEmpty()", actual.isEmpty()); } else { - assertEquals("identifier", Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code, - IdentifiedObjects.toString(TestUtilities.getSingleton(identifiers))); + assertEpsgIdentifierEquals(String.valueOf(expected), TestUtilities.getSingleton(actual)); } } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -78,13 +78,17 @@ import org.junit.BeforeClass; org.apache.sis.parameter.MatrixParametersTest.class, org.apache.sis.parameter.MatrixParametersAlphaNumTest.class, org.apache.sis.parameter.TensorValuesTest.class, + org.apache.sis.parameter.MapProjectionParametersTest.class, org.apache.sis.referencing.operation.DefaultFormulaTest.class, org.apache.sis.referencing.operation.DefaultOperationMethodTest.class, + org.apache.sis.internal.referencing.provider.AffineTest.class, + org.apache.sis.internal.referencing.provider.LongitudeRotationTest.class, + org.apache.sis.internal.referencing.provider.MapProjectionTest.class, + org.apache.sis.internal.referencing.provider.AllProvidersTest.class, org.apache.sis.referencing.operation.transform.OperationMethodSetTest.class, org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class, org.apache.sis.internal.referencing.OperationMethodsTest.class, - org.apache.sis.internal.referencing.provider.AffineTest.class, org.apache.sis.referencing.datum.BursaWolfParametersTest.class, org.apache.sis.referencing.datum.TimeDependentBWPTest.class, Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -74,15 +74,23 @@ public final class Constants extends Sta /** * Name of the {@value} projection parameter, which is handled specially during WKT formatting. */ - public static final String SEMI_MAJOR = "semi_major", SEMI_MINOR = "semi_minor"; + public static final String SEMI_MAJOR = "semi_major", + SEMI_MINOR = "semi_minor"; + + /** + * The OGC parameter name for the standard parallels. + */ + public static final String STANDARD_PARALLEL_1 = "standard_parallel_1", + STANDARD_PARALLEL_2 = "standard_parallel_2"; /** * Name of the {@value} matrix parameters. */ - public static final String NUM_ROW = "num_row", NUM_COL = "num_col"; + public static final String NUM_ROW = "num_row", + NUM_COL = "num_col"; /** - * The OGC name for <cite>Affine general parametric transformation"</cite>. + * The OGC name for <cite>"Affine parametric transformation"</cite>. * * @see org.apache.sis.internal.referencing.provider.Affine#NAME */ Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -51,7 +51,7 @@ import org.apache.sis.internal.jdk7.Obje * * @author Martin Desruisseaux (IRD) * @since 0.3 - * @version 0.5 + * @version 0.6 * @module * * @see RangeFormat @@ -109,6 +109,22 @@ public class MeasurementRange<E extends } /** + * Constructs a range of {@code double} values greater than the given value. + * The {@code minValue} is often zero for creating a range of strictly positive values. + * This method may return a shared instance, at implementation choice. + * + * @param minValue The minimal value (exclusive), or {@link Double#NEGATIVE_INFINITY} if none. + * @param unit The unit of measurement, or {@code null} if unknown. + * @return The new range of numeric values greater than the given value. + * + * @since 0.6 + */ + public static MeasurementRange<Double> createGreaterThan(final double minValue, final Unit<?> unit) { + return unique(new MeasurementRange<Double>(Double.class, + valueOf("minValue", minValue, Double.NEGATIVE_INFINITY), false, null, false, unit)); + } + + /** * Constructs a range using the smallest type of {@link Number} that can hold the given values. * This method performs the same work than {@link NumberRange#createBestFit * NumberRange.createBestFit(…)} with an additional {@code unit} argument. @@ -133,7 +149,7 @@ public class MeasurementRange<E extends if (type == null) { return null; } - return (MeasurementRange) unique(new MeasurementRange(type, + return unique(new MeasurementRange(type, Numbers.cast(minValue, type), isMinIncluded, Numbers.cast(maxValue, type), isMaxIncluded, unit)); } Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -71,7 +71,8 @@ package org.apache.sis.util; * <td>Parses axis names and creates transforms between {@link org.opengis.referencing.cs.CoordinateSystem} * instances.</td></tr> * <tr><td>{@link org.apache.sis.parameter.Parameters}</td> - * <td>Creates, searches or modifies {@link org.opengis.parameter.ParameterValue} instances.</td></tr> + * <td>Creates, searches or modifies {@link org.opengis.parameter.ParameterValue} instances + * in a group of parameters.</td></tr> * * <tr><th colspan="2" class="hsep">Input / Output (including CRS, XML, images)</th></tr> * <tr><td>{@link org.apache.sis.io.IO}</td> @@ -97,7 +98,7 @@ package org.apache.sis.util; * <td>Create {@link ObjectConverter} instances, or collection views using object converters.</td></tr> * </table> * - * @author Martin Desruisseaux (Geomatys) + * @author Martin Desruisseaux (Geomatys) * @since 0.3 * @version 0.3 * @module Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -29,6 +29,7 @@ import java.util.NoSuchElementException; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.LogRecord; +import java.lang.reflect.Modifier; import org.opengis.util.CodeList; import org.opengis.util.InternationalString; import org.apache.sis.util.Debug; @@ -70,7 +71,7 @@ import org.apache.sis.internal.jdk7.JDK7 * * @author Martin Desruisseaux (IRD, Geomatys) * @since 0.3 - * @version 0.4 + * @version 0.6 * @module */ public class IndexedResourceBundle extends ResourceBundle implements Localized { @@ -407,7 +408,7 @@ public class IndexedResourceBundle exten } replacement = message; } else if (element instanceof Class<?>) { - replacement = Classes.getShortName((Class<?>) element); + replacement = Classes.getShortName(getPublicType((Class<?>) element)); } else if (element instanceof CodeList<?>) { replacement = Types.getCodeTitle((CodeList<?>) element).toString(getLocale()); } @@ -424,6 +425,23 @@ public class IndexedResourceBundle exten } /** + * If the given class is not public, returns the first public interface or the first public super-class. + * This is for avoiding confusing the user with private class in message like "Value can not be instance + * of XYZ". In the worst case (nothing public other than {@code Object}), returns {@code Object.class}. + */ + private static Class<?> getPublicType(Class<?> c) { + while (!Modifier.isPublic(c.getModifiers())) { + for (final Class<?> type : c.getInterfaces()) { + if (Modifier.isPublic(type.getModifiers())) { + return type; + } + } + c = c.getSuperclass(); + } + return c; + } + + /** * Gets a string for the given key and appends "…" to it. * This method is typically used for creating menu items. * Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] Tue Mar 17 21:32:34 2015 @@ -22,5 +22,5 @@ IgnoredPropertiesAfterFirst_1 = Des pr IgnoredPropertyAssociatedTo_1 = Une propri\u00e9t\u00e9 associ\u00e9e \u00e0 \u2018{0}\u2019 a \u00e9t\u00e9 ignor\u00e9e. PropertyHiddenBy_2 = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb est masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb. LocalesDiscarded = Des textes ont \u00e9t\u00e9 ignor\u00e9s pour certaines langues. -MismatchedEllipsoidAxisLength_3 = Le param\u00e8tre \u00ab\u202f{1}\u202f\u00bb aurait pu \u00eatre omis. Mais il lui a \u00e9t\u00e9 donn\u00e9 la {2} qui ne correspond pas \u00e0 la d\u00e9finition de l'ellipso\u00efde \u00ab\u202f{0}\u202f\u00bb. +MismatchedEllipsoidAxisLength_3 = Le param\u00e8tre \u00ab\u202f{1}\u202f\u00bb aurait pu \u00eatre omis. Mais il lui a \u00e9t\u00e9 donn\u00e9 la valeur {2} qui ne correspond pas \u00e0 la d\u00e9finition de l'ellipso\u00efde \u00ab\u202f{0}\u202f\u00bb. UnparsableValueStoredAsText_2 = La valeur \u00ab\u202f{1}\u202f\u00bb ne peut pas \u00eatre interpr\u00e9t\u00e9e comme une instance de \u2018{0}\u2019. Elle est donc m\u00e9moris\u00e9e sous sa forme textuelle, mais sera ignor\u00e9e par certains traitements. Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -18,6 +18,7 @@ package org.apache.sis.test; import java.util.Set; import java.util.Map; +import java.util.Collection; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.LinkedHashMap; @@ -142,13 +143,15 @@ public strictfp class Assert extends Geo } /** - * Asserts that the given set contains the same elements. + * Asserts that the given set contains the same elements, ignoring order. * In case of failure, this method lists the missing or unexpected elements. * + * <p>The given collections are typically instances of {@link Set}, but this is not mandatory.</p> + * * @param expected The expected set, or {@code null}. * @param actual The actual set, or {@code null}. */ - public static void assertSetEquals(final Set<?> expected, final Set<?> actual) { + public static void assertSetEquals(final Collection<?> expected, final Collection<?> actual) { if (expected != null && actual != null && !expected.isEmpty()) { final Set<Object> r = new LinkedHashSet<Object>(expected); assertTrue("The two sets are disjoint.", r.removeAll(actual)); @@ -157,7 +160,9 @@ public strictfp class Assert extends Geo assertTrue("The two sets are disjoint.", r.removeAll(expected)); assertTrue("The set contains unexpected elements: " + r, r.isEmpty()); } - assertEquals("Set.equals(Object) failed:", expected, actual); + if (expected instanceof Set<?> && actual instanceof Set<?>) { + assertEquals("Set.equals(Object) failed:", expected, actual); + } } /** Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Tue Mar 17 21:32:34 2015 @@ -26,7 +26,7 @@ import org.junit.BeforeClass; * * @author Martin Desruisseaux (Geomatys) * @since 0.3 - * @version 0.5 + * @version 0.6 * @module */ @Suite.SuiteClasses({ @@ -78,6 +78,7 @@ import org.junit.BeforeClass; org.apache.sis.util.collection.CodeListSetTest.class, org.apache.sis.internal.util.CollectionsExtTest.class, org.apache.sis.internal.util.AbstractMapTest.class, + org.apache.sis.internal.util.LazySetTest.class, // GeoAPI most basic types. org.apache.sis.internal.util.DefinitionURITest.class, Modified: sis/trunk/ide-project/NetBeans/build.xml URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/build.xml?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/ide-project/NetBeans/build.xml (original) +++ sis/trunk/ide-project/NetBeans/build.xml Tue Mar 17 21:32:34 2015 @@ -67,6 +67,13 @@ </fileset> </concat> + <!-- OperationMethod implementations to be loaded by ServiceLoader. --> + <concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.operation.OperationMethod" encoding="UTF-8" fixlastline="yes"> + <fileset dir="${project.root}"> + <include name="*/*/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod"/> + </fileset> + </concat> + <!-- ObjectConverter implementations to be loaded by ServiceLoader. --> <concat destfile="${build.classes.dir}/META-INF/services/org.apache.sis.util.ObjectConverter" encoding="UTF-8" fixlastline="yes"> <fileset dir="${project.root}"> Modified: sis/trunk/src/main/javadoc/stylesheet.css URL: http://svn.apache.org/viewvc/sis/trunk/src/main/javadoc/stylesheet.css?rev=1667413&r1=1667412&r2=1667413&view=diff ============================================================================== --- sis/trunk/src/main/javadoc/stylesheet.css (original) +++ sis/trunk/src/main/javadoc/stylesheet.css Tue Mar 17 21:32:34 2015 @@ -187,6 +187,9 @@ ul.verbose li { margin-bottom: 6px; } +span.deprecated { + text-decoration: line-through; +}
