Author: desruisseaux
Date: Mon Mar 23 10:34:43 2015
New Revision: 1668585
URL: http://svn.apache.org/r1668585
Log:
Referencing: enabled the JUnit tests in UnitaryProjection which were ignored.
Added:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
(with props)
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/UnitaryProjectionTest.java
Added:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java?rev=1668585&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
(added)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
[UTF-8] Mon Mar 23 10:34:43 2015
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.operation.projection;
+
+import java.util.Collections;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.referencing.operation.DefaultOperationMethod;
+import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.util.Workaround;
+
+
+/**
+ * A simple implementation of {@link UnitaryProjection} as a "no-operation".
+ * This is used for testing methods other than {@code transform(…)} and {@code
inverseTransform(…)}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.6
+ * @version 0.6
+ * @module
+ */
+@SuppressWarnings("serial")
+final strictfp class NoOp extends UnitaryProjection {
+ /**
+ * Creates a new "no-operation".
+ *
+ * @param ellipsoidal {@code true} for an ellipsoidal case, or {@code
false} for a spherical case.
+ */
+ NoOp(final boolean ellipsoidal) {
+ this(parameters(ellipsoidal));
+ }
+
+ /**
+ * Work around for RFE #4093999 in Sun's bug database
+ * ("Relax constraint on placement of this()/super() call in
constructors").
+ */
+ @Workaround(library="JDK", version="1.7")
+ private NoOp(final Parameters parameters) {
+ super(new DefaultOperationMethod(
+ Collections.singletonMap(DefaultOperationMethod.NAME_KEY,
parameters.getDescriptor().getName()),
+ 2, 2, parameters.getDescriptor()), parameters);
+ }
+
+ /**
+ * Work around for RFE #4093999 in Sun's bug database
+ * ("Relax constraint on placement of this()/super() call in
constructors").
+ */
+ @Workaround(library="JDK", version="1.7")
+ private static Parameters parameters(final boolean ellipsoidal) {
+ final ParameterValueGroup group = new ParameterBuilder()
+
.addName("No-operation").createGroupForMapProjection().createValue();
+ group.parameter(Constants.SEMI_MAJOR).setValue(ellipsoidal ? 6378137 :
6371007);
+ group.parameter(Constants.SEMI_MINOR).setValue(ellipsoidal ? 6356752 :
6371007);
+ return (Parameters) group;
+ }
+
+ /**
+ * Do nothing.
+ *
+ * @return {@code null}.
+ */
+ @Override
+ public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int
dstOff, boolean derivate) {
+ return null;
+ }
+
+ /**
+ * Do nothing.
+ */
+ @Override
+ protected void inverseTransform(double[] srcPts, int srcOff, double[]
dstPts, int dstOff) {
+ }
+}
Propchange:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/UnitaryProjectionTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/UnitaryProjectionTest.java?rev=1668585&r1=1668584&r2=1668585&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/UnitaryProjectionTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/UnitaryProjectionTest.java
[UTF-8] Mon Mar 23 10:34:43 2015
@@ -26,8 +26,7 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link UnitaryProjection} class. This class uses {@link Mercator}
- * for testing purpose, because it is the simplest non-trivial projection.
+ * Tests the {@link UnitaryProjection} class.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
@@ -126,11 +125,10 @@ public final strictfp class UnitaryProje
* }
*/
@Test
- @org.junit.Ignore("Pending port of the Mercator projection.")
public void test_t() {
- projection = null; // TODO: set spherical case here.
+ projection = new NoOp(false); // Spherical case
doTest_t();
- projection = null; // TODO: set ellipsoidal case here.
+ projection = new NoOp(true); // Ellipsoidal case
doTest_t();
}
@@ -170,11 +168,10 @@ public final strictfp class UnitaryProje
*/
@Test
@DependsOnMethod("test_t")
- @org.junit.Ignore("Pending port of the Mercator projection.")
public void test_φ() throws ProjectionException {
- projection = null; // TODO: set spherical case here.
+ projection = new NoOp(false); // Spherical case
doTest_φ(TOLERANCE);
- projection = null; // TODO: set ellipsoidal case here.
+ projection = new NoOp(true); // Ellipsoidal case
doTest_φ(UnitaryProjection.ITERATION_TOLERANCE);
}