You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2020/08/25 19:08:58 UTC

[deltaspike] branch master updated: fix setup for Weld3 based containers.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 774d5e4  fix setup for Weld3 based containers.
774d5e4 is described below

commit 774d5e4a3933e2ed7e2fad537b891ed3dc9e8083
Author: Mark Struberg <st...@apache.org>
AuthorDate: Tue Aug 25 21:08:10 2020 +0200

    fix setup for Weld3 based containers.
    
    Weld seems to fire BeforeBeanDiscovery only once for the whole EAR, but
    with only the EAR jars on the classpath. So no config in the WAR file
    can be seen at this early point in the boot process in Wildfly
---
 .../test/core/impl/jmx/SimpleRegistrationEarFileTest.java        | 9 +++++++++
 .../impl/authorization/secured/SecuredAnnotationEarFileTest.java | 9 +++++++++
 deltaspike/test-utils/src/main/resources/arquillian-jboss.xml    | 2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationEarFileTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationEarFileTest.java
index 2221363..16f1989 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationEarFileTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/jmx/SimpleRegistrationEarFileTest.java
@@ -22,7 +22,9 @@ import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
@@ -30,6 +32,8 @@ import org.junit.runner.RunWith;
 @Category(EnterpriseArchiveProfileCategory.class)
 public class SimpleRegistrationEarFileTest extends SimpleRegistrationTest
 {
+    public static final String CONFIG = "deltaspike.bean-manager.delegate_lookup=false\n"; // Weld3 bug :(
+
     @Deployment
     public static EnterpriseArchive deployEar()
     {
@@ -37,7 +41,12 @@ public class SimpleRegistrationEarFileTest extends SimpleRegistrationTest
         String simpleName = SimpleRegistrationWarFileTest.class.getSimpleName();
         String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
 
+        JavaArchive configJar = ShrinkWrap.create(JavaArchive.class, "registrationConfig.jar")
+            .addAsManifestResource(new StringAsset(CONFIG),
+                "apache-deltaspike.properties");
+
         return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsLibrary(configJar)
                 .addAsModule(SimpleRegistrationWarFileTest.deploy());
     }
 }
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
index c97f1e7..ae7b700 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
@@ -22,7 +22,9 @@ import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
@@ -34,6 +36,8 @@ import org.junit.runner.RunWith;
 @Category(EnterpriseArchiveProfileCategory.class)
 public class SecuredAnnotationEarFileTest extends SecuredAnnotationTest
 {
+    public static final String CONFIG = "deltaspike.bean-manager.delegate_lookup=false\n"; // Weld3 bug :(
+
     @Deployment
     public static EnterpriseArchive deployEar()
     {
@@ -41,7 +45,12 @@ public class SecuredAnnotationEarFileTest extends SecuredAnnotationTest
         String simpleName = SecuredAnnotationWarFileTest.class.getSimpleName();
         String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
 
+        JavaArchive configJar = ShrinkWrap.create(JavaArchive.class, "dsConfig.jar")
+            .addAsManifestResource(new StringAsset(CONFIG),
+                "apache-deltaspike.properties");
+
         return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsLibrary(configJar)
                 .addAsModule(SecuredAnnotationWarFileTest.deploy());
     }
 }
diff --git a/deltaspike/test-utils/src/main/resources/arquillian-jboss.xml b/deltaspike/test-utils/src/main/resources/arquillian-jboss.xml
index 79729d9..ec9937a 100644
--- a/deltaspike/test-utils/src/main/resources/arquillian-jboss.xml
+++ b/deltaspike/test-utils/src/main/resources/arquillian-jboss.xml
@@ -21,10 +21,10 @@
     xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
 
     <!--Uncomment to have test archives exported to the file system for inspection -->
+    <!--
     <engine>
         <property name="deploymentExportPath">target/</property>
     </engine>
-    <!--
     -->
 
     <!-- We need to specify this because the default protocol for AS7 and Wildfly doesn't work very well -->