camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject git commit: First stab at fixing the camel-xmljson license compliance issue due to dependency to XOM (licensed at LGPL v2.1).
Date Thu, 25 Sep 2014 10:18:52 GMT
Repository: camel
Updated Branches:
  refs/heads/feature/camel-xmljson-legal-license-compliance [created] d3f669a8a


First stab at fixing the camel-xmljson license compliance issue due to dependency to XOM (licensed
at LGPL v2.1).


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d3f669a8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d3f669a8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d3f669a8

Branch: refs/heads/feature/camel-xmljson-legal-license-compliance
Commit: d3f669a8af55ed0a741f78b7a9f0cdb3d693c68e
Parents: 85fd23d
Author: Raul Kripalani <raulk@apache.org>
Authored: Thu Sep 25 11:18:33 2014 +0100
Committer: Raul Kripalani <raulk@apache.org>
Committed: Thu Sep 25 11:18:33 2014 +0100

----------------------------------------------------------------------
 components/camel-xmljson/pom.xml                | 24 ++++++++++---
 .../xmljson/AbstractJsonTestSupport.java        | 38 ++++++++++++++++++++
 .../xmljson/JsonToXmlAttributesTest.java        |  4 +--
 .../xmljson/SpringXmlJsonDataFormatTest.java    | 10 ++++++
 .../xmljson/XmlJsonDataFormatTest.java          |  5 +--
 .../xmljson/XmlJsonExceptionsTest.java          |  3 +-
 .../dataformat/xmljson/XmlJsonOptionsTest.java  |  5 +--
 .../dataformat/xmljson/XmlJsonStressTest.java   |  3 +-
 .../features/src/main/resources/features.xml    |  3 +-
 9 files changed, 79 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/pom.xml b/components/camel-xmljson/pom.xml
index 6626010..3e4b75b 100644
--- a/components/camel-xmljson/pom.xml
+++ b/components/camel-xmljson/pom.xml
@@ -46,11 +46,6 @@
       <version>${jsonlib-version}</version>
       <classifier>jdk15</classifier>
     </dependency>
-    <dependency>
-      <groupId>xom</groupId>
-      <artifactId>xom</artifactId>
-      <version>${xom-version}</version>
-    </dependency>
 
     <!-- testing -->
     <dependency>
@@ -71,4 +66,23 @@
 
   </dependencies>
 
+  <!-- NOTICE: The XOM runtime dependency cannot be made part of the classpath by default
due to legal issues. 
+       Therefore, it must be activated explicitly by the user through the build profile below.
+  -->
+  <profiles>
+    <profile>
+      <id>build-with-xom</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>xom</groupId>
+          <artifactId>xom</artifactId>
+          <version>${xom-version}</version>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/AbstractJsonTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/AbstractJsonTestSupport.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/AbstractJsonTestSupport.java
new file mode 100644
index 0000000..e1088d5
--- /dev/null
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/AbstractJsonTestSupport.java
@@ -0,0 +1,38 @@
+/**
+ * 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.camel.dataformat.xmljson;
+
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+
+public abstract class AbstractJsonTestSupport extends CamelTestSupport {
+
+    private static final String XOM_WARNING = "XOM must be in classpath for camel-xmljson
unit tests to execute; "
+            + "please enable the appropriate build profile.";
+    
+    @BeforeClass
+    public static void checkXomInClasspath() {
+        try {
+            Class.forName("nu.xom.Serializer");
+        } catch (Throwable t) {
+            System.out.println(XOM_WARNING);
+            Assume.assumeNoException(XOM_WARNING, t);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/JsonToXmlAttributesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/JsonToXmlAttributesTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/JsonToXmlAttributesTest.java
index 744f895..679e94e 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/JsonToXmlAttributesTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/JsonToXmlAttributesTest.java
@@ -29,10 +29,10 @@ import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+
 import org.junit.Test;
 
-public class JsonToXmlAttributesTest extends CamelTestSupport {
+public class JsonToXmlAttributesTest extends AbstractJsonTestSupport {
 
     @Test
     public void shouldCreateAttribute() {

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/SpringXmlJsonDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/SpringXmlJsonDataFormatTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/SpringXmlJsonDataFormatTest.java
index 6aaecb3..3c3a319 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/SpringXmlJsonDataFormatTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/SpringXmlJsonDataFormatTest.java
@@ -22,17 +22,27 @@ import org.w3c.dom.Document;
 
 import net.sf.json.JSONObject;
 import net.sf.json.JSONSerializer;
+
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
+
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+
 /**
  * Test the Spring DSL
  */
 public class SpringXmlJsonDataFormatTest extends CamelSpringTestSupport {
 
+    @BeforeClass
+    public static void checkXomInClasspath() {
+        AbstractJsonTestSupport.checkXomInClasspath();
+    }
+    
     @Test
     public void testMarshalAndUnmarshal() throws Exception {
         InputStream inStream = getClass().getResourceAsStream("testMessage1.xml");

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonDataFormatTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonDataFormatTest.java
index af8ade6..d2749e9 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonDataFormatTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonDataFormatTest.java
@@ -30,15 +30,16 @@ import net.sf.json.JSON;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONSerializer;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+
 import org.junit.Test;
 
 /**
  * Basic tests for the XML JSON data format
  */
-public class XmlJsonDataFormatTest extends CamelTestSupport {
+public class XmlJsonDataFormatTest extends AbstractJsonTestSupport {
 
     @Test
     public void testMarshalAndUnmarshal() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonExceptionsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonExceptionsTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonExceptionsTest.java
index 3b01fa0..f56439f 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonExceptionsTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonExceptionsTest.java
@@ -24,13 +24,12 @@ import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * Tests for exception cases in the XML JSON data format
  */
-public class XmlJsonExceptionsTest extends CamelTestSupport {
+public class XmlJsonExceptionsTest extends AbstractJsonTestSupport {
 
     @Test
     public void testMalformedXML() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonOptionsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonOptionsTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonOptionsTest.java
index 8c5b20a..bfa2b7b 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonOptionsTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonOptionsTest.java
@@ -25,15 +25,16 @@ import org.w3c.dom.Document;
 
 import net.sf.json.JSONObject;
 import net.sf.json.JSONSerializer;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+
 import org.junit.Test;
 
 /**
  * Testing options to the XML JSON data format
  */
-public class XmlJsonOptionsTest extends CamelTestSupport {
+public class XmlJsonOptionsTest extends AbstractJsonTestSupport {
 
     @Test
     public void testSomeOptionsToJSON() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonStressTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonStressTest.java
b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonStressTest.java
index 9dee587..69bb486 100644
--- a/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonStressTest.java
+++ b/components/camel-xmljson/src/test/java/org/apache/camel/dataformat/xmljson/XmlJsonStressTest.java
@@ -25,13 +25,12 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * Stress tests for the XML JSON data format: concurrency and large JSON and XML documents
  */
-public class XmlJsonStressTest extends CamelTestSupport {
+public class XmlJsonStressTest extends AbstractJsonTestSupport {
 
     @Test
     public void testNoConcurrentProducers() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/d3f669a8/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 11829ee..b643d20 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1381,7 +1381,8 @@
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-beanutils/${commons-beanutils-bundle-version}</bundle>
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.oro/${oro-bundle-version}</bundle>
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ezmorph/${ezmorph-bundle-version}</bundle>
-    <bundle dependency='true'>mvn:xom/xom/${xom-version}</bundle>
+    <!-- NOTICE: XOM cannot be included by default due to an incompatible license; please
review its license model and install the dependency manually if you agree. -->
+    <!--<bundle dependency='true'>mvn:xom/xom/${xom-version}</bundle>-->
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json-lib/${jsonlib-bundle-version}</bundle>
     <bundle dependency='true'>mvn:commons-lang/commons-lang/${commons-lang-version-xmljson}</bundle>
     <bundle dependency='true'>mvn:commons-collections/commons-collections/${commons-collections-version}</bundle>


Mime
View raw message