sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1689877 - in /sis/branches/JDK8/core: sis-metadata/src/test/java/org/apache/sis/metadata/iso/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/ sis-me...
Date Wed, 08 Jul 2015 13:50:29 GMT
Author: desruisseaux
Date: Wed Jul  8 13:50:28 2015
New Revision: 1689877

URL: http://svn.apache.org/r1689877
Log:
Move LoggingWatcher in the sis-utility tests so we can use it in other tests than metadata.

Added:
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
      - copied, changed from r1689672, sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/LoggingWatcher.java
Removed:
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/LoggingWatcher.java
Modified:
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1689877&r1=1689876&r2=1689877&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Wed Jul  8 13:50:28 2015
@@ -23,6 +23,7 @@ import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
 import org.apache.sis.metadata.MetadataStandard;
 import org.apache.sis.metadata.MetadataTestCase;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.xml.Namespaces;
 import org.junit.Rule;
@@ -47,7 +48,7 @@ public final strictfp class AllMetadataT
      * details (it should have been a private field).
      */
     @Rule
-    public final LoggingWatcher listener = new LoggingWatcher();
+    public final LoggingWatcher listener = new LoggingWatcher(ISOMetadata.LOGGER);
 
     /**
      * Creates a new test case with all GeoAPI interfaces and code lists to test.

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1689877&r1=1689876&r2=1689877&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
[UTF-8] Wed Jul  8 13:50:28 2015
@@ -20,8 +20,8 @@ import javax.xml.bind.JAXBException;
 import org.opengis.metadata.identification.RepresentativeFraction;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.metadata.iso.LoggingWatcher;
 import org.apache.sis.internal.jaxb.Schemas;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Rule;
@@ -46,7 +46,7 @@ public final strictfp class DefaultResol
      * details (it should have been a private field).
      */
     @Rule
-    public final LoggingWatcher listener = new LoggingWatcher() {
+    public final LoggingWatcher listener = new LoggingWatcher(DefaultResolution.LOGGER) {
         /**
          * Ensures that the logging message contains the name of the exclusive properties.
          */

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java?rev=1689877&r1=1689876&r2=1689877&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
[UTF-8] Wed Jul  8 13:50:28 2015
@@ -16,8 +16,8 @@
  */
 package org.apache.sis.metadata.iso.maintenance;
 
-import org.apache.sis.metadata.iso.LoggingWatcher;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.TestCase;
 import org.junit.Rule;
 import org.junit.Test;
@@ -40,7 +40,7 @@ public final strictfp class DefaultScope
      * details (it should have been a private field).
      */
     @Rule
-    public final LoggingWatcher listener = new LoggingWatcher() {
+    public final LoggingWatcher listener = new LoggingWatcher(DefaultScopeDescription.LOGGER)
{
         /**
          * Ensures that the logging message contains the name of the exclusive properties.
          */

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java?rev=1689877&r1=1689876&r2=1689877&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
[UTF-8] Wed Jul  8 13:50:28 2015
@@ -18,7 +18,7 @@ package org.apache.sis.metadata.iso.spat
 
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.metadata.iso.LoggingWatcher;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.TestCase;
 import org.junit.Rule;
 import org.junit.Test;
@@ -41,7 +41,7 @@ public final strictfp class DefaultGeore
      * details (it should have been a private field).
      */
     @Rule
-    public final LoggingWatcher listener = new LoggingWatcher() {
+    public final LoggingWatcher listener = new LoggingWatcher(DefaultGeorectified.LOGGER)
{
         /**
          * Ensures that the logging message contains the name of the exclusive properties.
          */

Copied: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
(from r1689672, sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/LoggingWatcher.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java?p2=sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java&p1=sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/LoggingWatcher.java&r1=1689672&r2=1689877&rev=1689877&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/LoggingWatcher.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
[UTF-8] Wed Jul  8 13:50:28 2015
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.metadata.iso;
+package org.apache.sis.test;
 
 import java.util.logging.Filter;
+import java.util.logging.Logger;
 import java.util.logging.LogRecord;
 import java.util.logging.SimpleFormatter;
-import org.apache.sis.test.TestCase;
 import org.junit.rules.TestWatcher;
 import org.junit.runner.Description;
 
@@ -27,12 +27,12 @@ import static org.junit.Assert.*;
 
 
 /**
- * Watches the logs sent to {@link ISOMetadata#LOGGER}. Logs will be allowed only if the
test
- * was expected to cause some logging events to occur, otherwise a test failure will occurs.
+ * Watches the logs sent to the given logger. Logs will be allowed only if the test was
+ * expected to cause some logging events to occur, otherwise a test failure will occurs.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.3
- * @version 0.3
+ * @since   0.6
+ * @version 0.6
  * @module
  */
 public strictfp class LoggingWatcher extends TestWatcher implements Filter {
@@ -48,14 +48,22 @@ public strictfp class LoggingWatcher ext
     public int maximumLogCount;
 
     /**
+     * The logger to watch.
+     */
+    private final Logger logger;
+
+    /**
      * The formatter to use for formatting log messages.
      */
     private final SimpleFormatter formatter = new SimpleFormatter();
 
     /**
-     * Creates a new watcher.
+     * Creates a new watcher for the given logger.
+     *
+     * @param logger The logger to watch.
      */
-    public LoggingWatcher() {
+    public LoggingWatcher(final Logger logger) {
+        this.logger = logger;
     }
 
     /**
@@ -69,8 +77,8 @@ public strictfp class LoggingWatcher ext
      */
     @Override
     protected final void starting(final Description description) {
-        assertNull(ISOMetadata.LOGGER.getFilter());
-        ISOMetadata.LOGGER.setFilter(this);
+        assertNull(logger.getFilter());
+        logger.setFilter(this);
         maximumLogCount = 0;
     }
 
@@ -82,7 +90,7 @@ public strictfp class LoggingWatcher ext
      */
     @Override
     protected final void finished(final Description description) {
-        ISOMetadata.LOGGER.setFilter(null);
+        logger.setFilter(null);
     }
 
     /**



Mime
View raw message