tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [03/50] tomee git commit: activating conversation with request to ensure transient mode works
Date Wed, 11 Mar 2015 11:56:19 GMT
activating conversation with request to ensure transient mode works


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

Branch: refs/heads/master
Commit: d2ee6239307e2e49509d8619c69e8b0a639a1950
Parents: 8d43e38
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Wed Mar 4 19:33:20 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Wed Mar 4 19:33:20 2015 +0100

----------------------------------------------------------------------
 .../apache/openejb/cdi/CdiAppContextsService.java    | 15 ++++++++++++---
 tck/cdi-embedded/src/test/resources/failing.xml      |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d2ee6239/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
index a32afb0..3870dfa 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
@@ -337,12 +337,13 @@ public class CdiAppContextsService extends AbstractContextsService implements
Co
                 //Re-initialize thread local for session
                 final HttpSession session = request.getSession(false);
 
+                String cid = null;
                 if (session != null) {
                     initSessionContext(session);
 
                     final ServletRequestContext rc  = getRequestContext(false);
                     if (rc != null && rc.getServletRequest() != null && conversationService
!= null && !isConversationSkipped(rc)) {
-                        final String cid = rc.getServletRequest().getParameter("cid");
+                        cid = rc.getServletRequest().getParameter("cid");
                         if (cid != null) {
                             final ConversationManager conversationManager = webBeansContext.getConversationManager();
                             final ConversationImpl c = conversationManager.getPropogatedConversation(cid,
session.getId());
@@ -351,6 +352,14 @@ public class CdiAppContextsService extends AbstractContextsService implements
Co
                             }
                         }
                     }
+                } else {
+                    cid = getConversationId();
+                }
+                if (cid == null && conversationContext.get() == null) {
+                    // transient but active
+                    final ConversationContext context = new ConversationContext();
+                    context.setActive(true);
+                    conversationContext.set(context);
                 }
             }
         } else if (event == EJB_REQUEST_EVENT) {
@@ -595,7 +604,7 @@ public class CdiAppContextsService extends AbstractContextsService implements
Co
                     destroyObject == null ? context : destroyObject, DestroyedLiteral.CONVERSATION);
         }
 
-        if (null != conversationContext) {
+        if (null != context) {
             conversationContext.remove();
         }
     }
@@ -672,7 +681,7 @@ public class CdiAppContextsService extends AbstractContextsService implements
Co
                 }
             }
         }
-        if (context != null && createIfPropagated) {
+        if (context != null && !context.isActive() && createIfPropagated)
{
             context.setActive(true);
         }
         return context;

http://git-wip-us.apache.org/repos/asf/tomee/blob/d2ee6239/tck/cdi-embedded/src/test/resources/failing.xml
----------------------------------------------------------------------
diff --git a/tck/cdi-embedded/src/test/resources/failing.xml b/tck/cdi-embedded/src/test/resources/failing.xml
index 550c902..81a4955 100644
--- a/tck/cdi-embedded/src/test/resources/failing.xml
+++ b/tck/cdi-embedded/src/test/resources/failing.xml
@@ -31,7 +31,7 @@
     -Dopenejb.embedded.try-jsp=true
     -->
     <classes>
-      <class name="org.jboss.cdi.tck.tests.deployment.packaging.installedLibrary.InstalledLibraryEarTest"
/>
+      <class name="org.jboss.cdi.tck.tests.deployment.initialization.ApplicationInitializationLifecycleTest"
/>
     </classes>
   </test>
 </suite>


Mime
View raw message