OPENEJB-2119 test for OPENEJB-2119 (no cache)
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/23cc857a Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/23cc857a Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/23cc857a Branch: refs/heads/tomee-7.0.0-M1 Commit: 23cc857afd7163271209ccf83e1522ab42f40e33 Parents: c38e30d Author: Romain Manni-Bucau <[email protected]> Authored: Sun Oct 18 19:13:23 2015 +0200 Committer: Romain Manni-Bucau <[email protected]> Committed: Sun Oct 18 19:13:23 2015 +0200 ---------------------------------------------------------------------- .../org/apache/openejb/ivm/naming/IvmContextTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/23cc857a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java index 398dc27..47cef26 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java @@ -26,6 +26,7 @@ import javax.naming.NamingException; import java.lang.reflect.Field; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; public class IvmContextTest { @@ -40,12 +41,23 @@ public class IvmContextTest { assertEquals("test", root.lookup("global/App.EAR/foo")); assertEquals("test", last.lookup("foo")); + // even after cache clearance + last.unbind("missing"); // clear cache + assertEquals("test", root.lookup("global/App.EAR/foo")); + assertEquals("test", last.lookup("foo")); + // now rebound, shouldnt throw any exception final Context lastContext = Contexts.createSubcontexts(root, "global/App.EAR/foo"); lastContext.rebind("foo", "test2"); + assertSame(lastContext, last); root.rebind("global/App.EAR/foo", "test2"); assertEquals("test2", root.lookup("global/App.EAR/foo")); assertEquals("test2", last.lookup("foo")); + + // even after cache clearance + lastContext.unbind("missing"); + assertEquals("test2", root.lookup("global/App.EAR/foo")); + assertEquals("test2", last.lookup("foo")); } @Test
