You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by bo...@apache.org on 2017/06/01 04:17:21 UTC

[tika] branch master updated: TIKA-2379 - Make logging in bundle optional. Fix test.

This is an automated email from the ASF dual-hosted git repository.

bob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

The following commit(s) were added to refs/heads/master by this push:
       new  fa1d411   TIKA-2379 - Make logging in bundle optional.  Fix test.
fa1d411 is described below

commit fa1d41101f839692cc997c8933eeb6045d7dc484
Author: Bob Paulin <bo...@bobpaulin.com>
AuthorDate: Wed May 31 23:15:52 2017 -0500

    TIKA-2379 - Make logging in bundle optional.  Fix test.
---
 tika-bundle/pom.xml                                | 32 ++++++++++++----------
 .../test/java/org/apache/tika/bundle/BundleIT.java | 29 ++++++++------------
 tika-bundle/src/test/resources/exam.properties     | 15 ----------
 3 files changed, 29 insertions(+), 47 deletions(-)

diff --git a/tika-bundle/pom.xml b/tika-bundle/pom.xml
index 0f952f2..03a8ddc 100644
--- a/tika-bundle/pom.xml
+++ b/tika-bundle/pom.xml
@@ -41,7 +41,7 @@
   <url>http://tika.apache.org/</url>
 
   <properties>
-    <pax.exam.version>4.10.0</pax.exam.version>
+    <pax.exam.version>4.11.0</pax.exam.version>
   </properties>
 
   <dependencies>
@@ -61,7 +61,6 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
@@ -78,7 +77,7 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>4.6.0</version>
+      <version>5.6.4</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -90,7 +89,7 @@
     <dependency>
       <groupId>org.ops4j.pax.url</groupId>
       <artifactId>pax-url-aether</artifactId>
-      <version>2.3.0</version>
+      <version>2.5.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -102,7 +101,7 @@
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
-      <version>5.0.0</version>
+      <version>6.0.0</version>
       <scope>test</scope>
     </dependency>
 
@@ -166,8 +165,7 @@
 	      !org.apache.solr.client.solrj.*,
 	      !org.apache.solr.common.*,
               *,
-              org.slf4j, org.slf4j.event, org.slf4j.helpers, org.slf4j.spi,
-	      org.apache.tika.mime,
+	          org.apache.tika.mime,
               org.apache.tika.fork,
               android.util;resolution:=optional,
               com.adobe.xmp;resolution:=optional,
@@ -263,6 +261,8 @@
               org.osgi.framework;resolution:=optional,
               org.quartz;resolution:=optional,
               org.quartz.impl;resolution:=optional,
+              org.slf4j;resolution:=optional,
+              org.slf4j.helpers;resolution:=optional,
               org.sqlite;resolution:=optional,
               org.w3c.dom;resolution:=optional,
               org.relaxng.datatype;resolution:=optional,
@@ -304,7 +304,7 @@
               ucar.unidata.util;resolution:=optional,
               com.jmatio.io;resolution:=optional,
               com.google.gson;resolution:=optional,
-	      com.google.gson.reflect;resolution:=optional,
+	          com.google.gson.reflect;resolution:=optional,
               visad;resolution:=optional,
               visad.data;resolution:=optional,
               visad.data.vis5d;resolution:=optional,
@@ -359,13 +359,10 @@
               org.apache.http.message;resolution:=optional,
               org.apache.http.params;resolution:=optional,
               org.apache.http.protocol;resolution:=optional,
-              org.apache.http.util;resolution:=optional
+              org.apache.http.util;resolution:=optional,
+              org.apache.commons.logging;resolution:=optional,
+              org.apache.log4j;resolution:=optional
             </Import-Package>
-            <DynamicImport-Package>
-              org.slf4j.impl, org.slf4j.bridge,
-              org.apache.log4j, org.apache.log4j.*,
-              org.apache.commons.logging, org.apache.commons.logging.*
-            </DynamicImport-Package>
           </instructions>
         </configuration>
       </plugin>
@@ -432,6 +429,13 @@
             </goals>
           </execution>
         </executions>
+        <configuration>
+          <systemPropertyVariables>
+            <org.ops4j.pax.logging.DefaultServiceLog.level>
+              INFO
+            </org.ops4j.pax.logging.DefaultServiceLog.level>
+          </systemPropertyVariables>
+        </configuration>
       </plugin>
     </plugins>
   </build>
diff --git a/tika-bundle/src/test/java/org/apache/tika/bundle/BundleIT.java b/tika-bundle/src/test/java/org/apache/tika/bundle/BundleIT.java
index d81cb90..52eeddd 100644
--- a/tika-bundle/src/test/java/org/apache/tika/bundle/BundleIT.java
+++ b/tika-bundle/src/test/java/org/apache/tika/bundle/BundleIT.java
@@ -24,9 +24,7 @@ import static org.ops4j.pax.exam.CoreOptions.bundle;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 
-import javax.inject.Inject;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -35,13 +33,14 @@ import java.io.InputStream;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URISyntaxException;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.jar.Attributes;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
+import javax.inject.Inject;
+
 import org.apache.tika.Tika;
 import org.apache.tika.detect.DefaultDetector;
 import org.apache.tika.detect.Detector;
@@ -62,7 +61,6 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.exam.util.PathUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -71,6 +69,9 @@ import org.xml.sax.ContentHandler;
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerMethod.class)
 public class BundleIT {
+	
+	private final File TARGET = new File("target");
+	
     @Inject
     private Parser defaultParser;
 
@@ -80,22 +81,15 @@ public class BundleIT {
     @Inject
     private BundleContext bc;
 
-    private String log4jConfigPath = "file:" + PathUtils.getBaseDir() + "/src/test/resources/log4j.properties";
-    private String testBundlesPath = "file:" + PathUtils.getBaseDir() + "/target/test-bundles/";
-
     @Configuration
     public Option[] configuration() throws IOException, URISyntaxException, ClassNotFoundException {
+    	File base = new File(TARGET, "test-bundles");
         return options(
-                bundle(testBundlesPath + "tika-core.jar"),
-                bundle(testBundlesPath + "tika-bundle.jar"),
-                junitBundles(),
-                mavenBundle("org.slf4j", "slf4j-api", "1.7.24"),
-                mavenBundle("org.slf4j", "slf4j-log4j12", "1.7.24").noStart(),
-                mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.24"),
-                mavenBundle("org.slf4j", "jul-to-slf4j", "1.7.24"),
-                mavenBundle("log4j", "log4j", "1.2.17"),
-                systemProperty("log4j.configuration").value(log4jConfigPath)
-        );
+        		bundle(new File(base, "tika-core.jar").toURI().toURL().toString()),
+        		mavenBundle("org.ops4j.pax.logging", "pax-logging-api", "1.8.5"),
+        		mavenBundle("org.ops4j.pax.logging", "pax-logging-service", "1.8.5"),
+        		junitBundles(),
+        		bundle(new File(base, "tika-bundle.jar").toURI().toURL().toString()));
     }
 
     @Test
@@ -149,7 +143,6 @@ public class BundleIT {
     @Test
     public void testForkParser() throws Exception {
         ForkParser parser = new ForkParser(Activator.class.getClassLoader(), defaultParser);
-        parser.setJavaCommand(Arrays.asList("java", "-Xmx32m", "-Dlog4j.configuration=" + log4jConfigPath));
         String data = "<!DOCTYPE html>\n<html><body><p>test <span>content</span></p></body></html>";
         InputStream stream = new ByteArrayInputStream(data.getBytes(UTF_8));
         Writer writer = new StringWriter();
diff --git a/tika-bundle/src/test/resources/exam.properties b/tika-bundle/src/test/resources/exam.properties
deleted file mode 100644
index 3b37d42..0000000
--- a/tika-bundle/src/test/resources/exam.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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.
-pax.exam.logging = none

-- 
To stop receiving notification emails like this one, please contact
['"commits@tika.apache.org" <co...@tika.apache.org>'].