deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-493 WindowContextImpl#closeWindow fixed
Date Fri, 03 Jan 2014 11:59:55 GMT
Updated Branches:
  refs/heads/master b4aa7777f -> 68fbe33d8


DELTASPIKE-493 WindowContextImpl#closeWindow fixed


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

Branch: refs/heads/master
Commit: 68fbe33d8692978d2f5e78f3aaf06418097ca538
Parents: b4aa777
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Jan 3 12:52:10 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Jan 3 12:56:24 2014 +0100

----------------------------------------------------------------------
 .../impl/scope/window/WindowContextImpl.java    |  4 ++++
 .../ExplicitlyGroupedConversationsTest.java     | 23 ++++++++++++++++++++
 .../ImplicitlyGroupedConversationsTest.java     | 21 ++++++++++++++++++
 3 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/68fbe33d/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java
b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java
index 1f8795f..0ad8440 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowContextImpl.java
@@ -97,6 +97,10 @@ public class WindowContextImpl extends AbstractContext implements WindowContext
 
         if (windowStorage != null)
         {
+            if (windowId.equals(this.windowIdHolder.getWindowId()))
+            {
+                this.windowIdHolder.setWindowId(null);
+            }
             AbstractContext.destroyAllActive(windowStorage);
         }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/68fbe33d/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ExplicitlyGroupedConversationsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ExplicitlyGroupedConversationsTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ExplicitlyGroupedConversationsTest.java
index 223d31f..e7b45dd 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ExplicitlyGroupedConversationsTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ExplicitlyGroupedConversationsTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
+import javax.enterprise.context.ContextNotActiveException;
 import javax.inject.Inject;
 
 @RunWith(Arquillian.class)
@@ -155,4 +156,26 @@ public class ExplicitlyGroupedConversationsTest
         Assert.assertNull(explicitlyGroupedBeanX.getValue());
         Assert.assertNull(explicitlyGroupedBeanY.getValue());
     }
+
+    @Test(expected = ContextNotActiveException.class)
+    public void noWindowTest()
+    {
+        try
+        {
+            windowContext.activateWindow("w1");
+
+            explicitlyGroupedBeanX.setValue("x1");
+            explicitlyGroupedBeanY.setValue("x2");
+            Assert.assertEquals("x1", explicitlyGroupedBeanX.getValue());
+            Assert.assertEquals("x2", explicitlyGroupedBeanY.getValue());
+
+            this.windowContext.closeWindow("w1");
+        }
+        catch (ContextNotActiveException e)
+        {
+            Assert.fail();
+        }
+
+        explicitlyGroupedBeanX.getValue();
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/68fbe33d/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ImplicitlyGroupedConversationsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ImplicitlyGroupedConversationsTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ImplicitlyGroupedConversationsTest.java
index e727df6..e843595 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ImplicitlyGroupedConversationsTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/scope/conversation/ImplicitlyGroupedConversationsTest.java
@@ -33,6 +33,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
+import javax.enterprise.context.ContextNotActiveException;
 import javax.inject.Inject;
 
 @RunWith(Arquillian.class)
@@ -143,4 +144,24 @@ public class ImplicitlyGroupedConversationsTest
 
         Assert.assertNull(implicitlyGroupedBean.getValue());
     }
+
+    @Test(expected = ContextNotActiveException.class)
+    public void noWindowTest()
+    {
+        try
+        {
+            windowContext.activateWindow("w1");
+
+            implicitlyGroupedBean.setValue("x");
+            Assert.assertEquals("x", implicitlyGroupedBean.getValue());
+
+            this.windowContext.closeWindow("w1");
+        }
+        catch (ContextNotActiveException e)
+        {
+            Assert.fail();
+        }
+
+        implicitlyGroupedBean.getValue();
+    }
 }


Mime
View raw message