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

tandraschko 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 b511cf0c4 workaround that payara doesnt pass cdicontainer.version to 
single tests
b511cf0c4 is described below

commit b511cf0c41ef01a8c4ea4809854b15f33b9c5b42
Author: Thomas Andraschko <[email protected]>
AuthorDate: Mon Mar 18 16:01:21 2024 +0100

    workaround that payara doesnt pass cdicontainer.version to single tests
---
 .../partialbean/uc007/MethodLevelInterceptorTest.java | 19 +++++++++++++++++++
 .../partialbean/uc008/ClassLevelInterceptorTest.java  | 17 +++++++++++++++--
 .../partialbean/uc013/MethodLevelInterceptorTest.java |  7 +++++++
 .../test-utils/src/main/resources/arquillian.xml      |  3 +--
 4 files changed, 42 insertions(+), 4 deletions(-)

diff --git 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/MethodLevelInterceptorTest.java
 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/MethodLevelInterceptorTest.java
index 3ceacc431..8d9b5d1ec 100644
--- 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/MethodLevelInterceptorTest.java
+++ 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/MethodLevelInterceptorTest.java
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.core.api.partialbean.uc007;
 
 import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.core.util.ClassUtils;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorState;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
@@ -77,6 +78,12 @@ public class MethodLevelInterceptorTest
         // this test is known to not work under weld-5.0.x
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));
 
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean")
 == null)
+        {
+            return;
+        }
+
         PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class);
         CustomInterceptorState state = 
BeanProvider.getContextualReference(CustomInterceptorState.class);
 
@@ -91,6 +98,12 @@ public class MethodLevelInterceptorTest
         // this test is known to not work under weld-5.0.x
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));
 
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean")
 == null)
+        {
+            return;
+        }
+
         PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class);
         CustomInterceptorState state = 
BeanProvider.getContextualReference(CustomInterceptorState.class);
 
@@ -105,6 +118,12 @@ public class MethodLevelInterceptorTest
         // this test is known to not work under weld-5.0.x
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));
 
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc007.PartialBean")
 == null)
+        {
+            return;
+        }
+
         PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class);
         CustomInterceptorState state = 
BeanProvider.getContextualReference(CustomInterceptorState.class);
 
diff --git 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/ClassLevelInterceptorTest.java
 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/ClassLevelInterceptorTest.java
index ba9dbca5c..cbcfdfec3 100644
--- 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/ClassLevelInterceptorTest.java
+++ 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc008/ClassLevelInterceptorTest.java
@@ -18,9 +18,10 @@
  */
 package org.apache.deltaspike.test.core.api.partialbean.uc008;
 
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.core.util.ClassUtils;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorState;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
 import org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;
 import org.apache.deltaspike.test.utils.CdiContainerUnderTest;
@@ -77,6 +78,12 @@ public class ClassLevelInterceptorTest
         // this test is known to not work under weld-5.0.x
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));
 
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc008.PartialBean")
 == null)
+        {
+            return;
+        }
+
         PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class);
         CustomInterceptorState state = 
BeanProvider.getContextualReference(CustomInterceptorState.class);
 
@@ -92,7 +99,13 @@ public class ClassLevelInterceptorTest
         // this test is known to not work under weld-5.0.x
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_5_0));
 
-        PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class);
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc008.PartialBean")
 == null)
+        {
+            return;
+        }
+
+        PartialBean partialBean = 
BeanProvider.getContextualReference(PartialBean.class, true);
         CustomInterceptorState state = 
BeanProvider.getContextualReference(CustomInterceptorState.class);
 
         Assert.assertNotNull(partialBean);
diff --git 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MethodLevelInterceptorTest.java
 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MethodLevelInterceptorTest.java
index 21aa42275..e7a1fc2d6 100644
--- 
a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MethodLevelInterceptorTest.java
+++ 
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc013/MethodLevelInterceptorTest.java
@@ -20,6 +20,7 @@ package org.apache.deltaspike.test.core.api.partialbean.uc013;
 
 import jakarta.enterprise.inject.spi.Extension;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.core.util.ClassUtils;
 import 
org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
 import org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;
 import org.apache.deltaspike.test.utils.CdiContainerUnderTest;
@@ -79,6 +80,12 @@ public class MethodLevelInterceptorTest
         // this test is known to not work under weld
         Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD));
 
+        // workaround as payara doesnt pass cdicontainer.version to the 
arquillian process
+        if 
(ClassUtils.tryToLoadClassForName("org.apache.deltaspike.test.core.api.partialbean.uc013.MyRepository")
 == null)
+        {
+            return;
+        }
+
         MyRepository myRepository = 
BeanProvider.getContextualReference(MyRepository.class);
 
         List<String> users = myRepository.getAllUsers();
diff --git a/deltaspike/test-utils/src/main/resources/arquillian.xml 
b/deltaspike/test-utils/src/main/resources/arquillian.xml
index 7219826d3..c2d04d225 100644
--- a/deltaspike/test-utils/src/main/resources/arquillian.xml
+++ b/deltaspike/test-utils/src/main/resources/arquillian.xml
@@ -66,7 +66,7 @@
             <property name="ajpPort">-1</property>
             <property name="stopPort">-1</property>
             <property 
name="appWorkingDir">target/arquillian-test-working-dir</property>
-            <property 
name="catalina_opts">-Dcdicontainer.version=tomee-${tomee.version}</property>
+            <property 
name="catalina_opts">-Dcdicontainer.version=${cdicontainer.version}</property>
             <property name="simpleLog">true</property>
             
             <!-- In-Memory database for the data module -->
@@ -94,5 +94,4 @@
         </configuration>
     </container>
 
-
 </arquillian>

Reply via email to