From 9785103a61d4e6e441f3909d0577c1fed881c57c Mon Sep 17 00:00:00 2001
From: Thomas Diesler <thomas.diesler@jboss.com>
Date: Fri, 17 Apr 2015 10:03:18 +0200
Subject: [PATCH] [resolves #540] jboss-modules does not respect path excludes

---
 .../test/spring/SpringExcludedPathsTest.java  |  4 +-
 .../classloading/exported-path-patterns.txt   | 35 +-------------
 modules/etc/baseline/exported-paths.txt       | 46 -------------------
 .../camel/component/cxf/main/module.xml       | 12 ++++-
 modules/etc/smartics/camel-modules.xml        | 12 ++++-
 5 files changed, 22 insertions(+), 87 deletions(-)

diff --git a/itests/standalone/src/test/java/org/wildfly/camel/test/spring/SpringExcludedPathsTest.java b/itests/standalone/src/test/java/org/wildfly/camel/test/spring/SpringExcludedPathsTest.java
index 7ed15421f5..49378d6c3b 100644
--- a/itests/standalone/src/test/java/org/wildfly/camel/test/spring/SpringExcludedPathsTest.java
+++ b/itests/standalone/src/test/java/org/wildfly/camel/test/spring/SpringExcludedPathsTest.java
@@ -1,4 +1,3 @@
-package org.wildfly.camel.test.spring;
 /*
  * #%L
  * Wildfly Camel :: Testsuite
@@ -18,6 +17,7 @@
  * limitations under the License.
  * #L%
  */
+package org.wildfly.camel.test.spring;
 
 
 import org.jboss.arquillian.container.test.api.Deployment;
@@ -29,7 +29,6 @@
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -39,7 +38,6 @@
  * https://github.com/wildfly-extras/wildfly-camel/issues/540
  */
 @RunWith(Arquillian.class)
-@Ignore("[FIXME #540] jboss-modules does not respect path excludes")
 public class SpringExcludedPathsTest {
 
     @Deployment
diff --git a/itests/standalone/src/test/resources/classloading/exported-path-patterns.txt b/itests/standalone/src/test/resources/classloading/exported-path-patterns.txt
index 38676e4cba..9f38843da6 100644
--- a/itests/standalone/src/test/resources/classloading/exported-path-patterns.txt
+++ b/itests/standalone/src/test/resources/classloading/exported-path-patterns.txt
@@ -21,38 +21,5 @@
 	^META-INF/cxf(.*)
 	^META-INF/services(.*)
 	
-# [FIXME #536] Remove OSGi-INF/blueprint from exported paths
-	^OSGI-INF/blueprint
-	^OSGI-INF/metatype
-
-# [FIXME #540] jboss-modules does not respect path excludes
-	^ca/uhn
-	^com/google
-	^com/mchange(.*)
-	^com/sun(.*)
-	^com/thoughtworks(.*)
-	^net/oauth(.*)
-	^net/sf(.*)
-	^org/apache/cxf/clustering(.*)
-	^org/apache/cxf/jaxrs(.*)
-	^org/apache/cxf/rs(.*)
-	^org/apache/xmlbeans/impl(.*)
-	^org/apache/xmlbeans/soap
-	^org/apache/xmlbeans/xml(.*)
-	^org/castor(.*)
-	^org/ccil(.*)
-	^org/exolab(.*)
-	^org/fusesource(.*)
-	^org/quartz(.*)
-	^org/terracotta(.*)
-	^org/w3(.*)
-	^org/xmlpull(.*)
-	^schema/blueprint
-	^schema/configuration
-	^schemaorg_apache_xmlbeans(.*)
-	^schemas/blueprint
-	^w3c(.*)
-	
 [excludes]
-# [FIXME #540] jboss-modules does not respect path excludes
-#	(.*)/internal
+	(.*)/internal
diff --git a/modules/etc/baseline/exported-paths.txt b/modules/etc/baseline/exported-paths.txt
index 2d77b03975..a76f0ede0c 100644
--- a/modules/etc/baseline/exported-paths.txt
+++ b/modules/etc/baseline/exported-paths.txt
@@ -184,8 +184,6 @@ META-INF/services/org/apache/camel/component
 META-INF/services/org/apache/camel/dataformat
 META-INF/services/org/apache/camel/language
 META-INF/services/org/apache/camel/language/resolver
-OSGI-INF/blueprint
-OSGI-INF/metatype
 ca/uhn/hl7v2
 ca/uhn/hl7v2/app
 ca/uhn/hl7v2/concurrent
@@ -238,15 +236,6 @@ ca/uhn/hl7v2/validation/builder/support
 ca/uhn/hl7v2/validation/impl
 ca/uhn/hl7v2/view
 com/google/protobuf
-com/sun
-com/sun/tools
-com/sun/tools/xjc
-com/sun/tools/xjc/addon
-com/sun/tools/xjc/addon/apache_cxf
-com/sun/tools/xjc/addon/apache_cxf/bg
-com/sun/tools/xjc/addon/apache_cxf/bgi
-com/sun/tools/xjc/addon/apache_cxf/dv
-com/sun/tools/xjc/addon/apache_cxf/ts
 org/apache/abdera
 org/apache/abdera/factory
 org/apache/abdera/filter
@@ -382,44 +371,9 @@ org/apache/cxf/bus/osgi
 org/apache/cxf/bus/resource
 org/apache/cxf/bus/spring
 org/apache/cxf/buslifecycle
-org/apache/cxf/clustering
-org/apache/cxf/clustering/blueprint
-org/apache/cxf/clustering/spring
 org/apache/cxf/interceptor
 org/apache/cxf/interceptor/security
 org/apache/cxf/interceptor/transform
-org/apache/cxf/jaxrs
-org/apache/cxf/jaxrs/blueprint
-org/apache/cxf/jaxrs/client
-org/apache/cxf/jaxrs/client/blueprint
-org/apache/cxf/jaxrs/client/cache
-org/apache/cxf/jaxrs/client/spec
-org/apache/cxf/jaxrs/client/spring
-org/apache/cxf/jaxrs/ext
-org/apache/cxf/jaxrs/ext/multipart
-org/apache/cxf/jaxrs/ext/xml
-org/apache/cxf/jaxrs/impl
-org/apache/cxf/jaxrs/impl/tl
-org/apache/cxf/jaxrs/interceptor
-org/apache/cxf/jaxrs/lifecycle
-org/apache/cxf/jaxrs/model
-org/apache/cxf/jaxrs/provider
-org/apache/cxf/jaxrs/security
-org/apache/cxf/jaxrs/servlet
-org/apache/cxf/jaxrs/spring
-org/apache/cxf/jaxrs/utils
-org/apache/cxf/jaxrs/utils/multipart
-org/apache/cxf/jaxrs/utils/schemas
-org/apache/cxf/jaxrs/validation
-org/apache/cxf/rs
-org/apache/cxf/rs/security
-org/apache/cxf/rs/security/oauth
-org/apache/cxf/rs/security/oauth/client
-org/apache/cxf/rs/security/oauth/data
-org/apache/cxf/rs/security/oauth/filters
-org/apache/cxf/rs/security/oauth/provider
-org/apache/cxf/rs/security/oauth/services
-org/apache/cxf/rs/security/oauth/utils
 org/apache/cxf/sts
 org/apache/cxf/transport/http
 org/apache/cxf/transport/http/asyncclient
diff --git a/modules/etc/generated/wildfly/modules/system/layers/fuse/org/apache/camel/component/cxf/main/module.xml b/modules/etc/generated/wildfly/modules/system/layers/fuse/org/apache/camel/component/cxf/main/module.xml
index 5bdfde348c..9bfa0f8db2 100644
--- a/modules/etc/generated/wildfly/modules/system/layers/fuse/org/apache/camel/component/cxf/main/module.xml
+++ b/modules/etc/generated/wildfly/modules/system/layers/fuse/org/apache/camel/component/cxf/main/module.xml
@@ -9,7 +9,13 @@
     <module name="javax.jws.api" />
     <module name="javax.ws.rs.api" />
     <module name="javax.xml.ws.api" />
-    <module name="org.apache.cxf.ext" export="true" />
+    <module name="org.apache.cxf.ext" export="true">
+      <exports>
+        <exclude path="org/apache/cxf/clustering**" />
+        <exclude path="org/apache/cxf/jaxrs**" />
+        <exclude path="org/apache/cxf/rs**" />
+      </exports>
+    </module>
     <module name="org.apache.cxf.impl" export="true">
       <imports>
         <include path="META-INF/cxf**" />
@@ -23,7 +29,9 @@
         <include path="org/apache/cxf/ws/security/**" />
         <include path="org/apache/cxf/sts" />
         <exclude path="org/apache/cxf/**" />
-        <exclude path="org/objectweb/asm**" />
+        <exclude path="OSGI-INF/blueprint" />
+        <exclude path="OSGI-INF/metatype" />
+        <exclude path="com/sun**" />
         <exclude path="schemas**" />
       </exports>
     </module>
diff --git a/modules/etc/smartics/camel-modules.xml b/modules/etc/smartics/camel-modules.xml
index 688435b21b..745ff07d06 100644
--- a/modules/etc/smartics/camel-modules.xml
+++ b/modules/etc/smartics/camel-modules.xml
@@ -189,7 +189,13 @@
             <module name="javax.jws.api" />
             <module name="javax.ws.rs.api" />
             <module name="javax.xml.ws.api" />
-            <module name="org.apache.cxf.ext" export="true" />
+            <module name="org.apache.cxf.ext" export="true">
+              <exports>
+                <exclude path="org/apache/cxf/clustering**" />
+                <exclude path="org/apache/cxf/jaxrs**" />
+                <exclude path="org/apache/cxf/rs**" />
+              </exports>
+            </module>
             <module name="org.apache.cxf.impl" export="true" >
                 <imports>
                     <include path="META-INF/cxf**" />
@@ -203,7 +209,9 @@
                     <include path="org/apache/cxf/ws/security/**" />
                     <include path="org/apache/cxf/sts" />
                     <exclude path="org/apache/cxf/**" />
-                    <exclude path="org/objectweb/asm**" />
+                    <exclude path="OSGI-INF/blueprint" />
+                    <exclude path="OSGI-INF/metatype" />
+                    <exclude path="com/sun**" />
                     <exclude path="schemas**" />
                 </exports>
             </module>