You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2015/03/25 11:35:23 UTC
tomee git commit: TOMEE-1530 try to guess app ctx if not found from
class
Repository: tomee
Updated Branches:
refs/heads/tomee-1.7.x 8a44b3afb -> 98aacf6a7
TOMEE-1530 try to guess app ctx if not found from class
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/98aacf6a
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/98aacf6a
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/98aacf6a
Branch: refs/heads/tomee-1.7.x
Commit: 98aacf6a7349c1d09c7c506f9aff09fdbc13ef04
Parents: 8a44b3a
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Wed Mar 25 11:35:16 2015 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Wed Mar 25 11:35:16 2015 +0100
----------------------------------------------------------------------
.../arquillian/common/enrichment/OpenEJBEnricher.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/98aacf6a/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java b/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java
index 7c5a12a..c606858 100644
--- a/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java
+++ b/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java
@@ -26,6 +26,7 @@ import org.apache.openejb.core.Operation;
import org.apache.openejb.core.ThreadContext;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.util.AppFinder;
import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
@@ -51,11 +52,15 @@ public final class OpenEJBEnricher {
// no-op
}
- public static void enrich(final Object testInstance, final AppContext ctx) {
+ public static void enrich(final Object testInstance, final AppContext appCtx) {
// don't rely on arquillian since this enrichment should absolutely be done before the following ones
new MockitoEnricher().enrich(testInstance);
+ AppContext ctx = appCtx;
if (ctx == null) {
- return;
+ ctx = AppFinder.findAppContextOrWeb(Thread.currentThread().getContextClassLoader(), AppFinder.AppContextTransformer.INSTANCE);
+ if (ctx == null) {
+ return;
+ }
}
final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext(ctx.getId() + "_" + testInstance.getClass().getName());