geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r436912 - /geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java
Date Fri, 25 Aug 2006 19:23:10 GMT
Author: dain
Date: Fri Aug 25 12:23:07 2006
New Revision: 436912

URL: http://svn.apache.org/viewvc?rev=436912&view=rev
Log:
Added some more federation tests

Modified:
    geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java

Modified: geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java?rev=436912&r1=436911&r2=436912&view=diff
==============================================================================
--- geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java
(original)
+++ geronimo/xbean/branches/colossus/xbean-naming/src/test/java/org/apache/xbean/naming/context/FederationTest.java
Fri Aug 25 12:23:07 2006
@@ -19,6 +19,7 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.Name;
+import javax.naming.NameAlreadyBoundException;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -281,8 +282,83 @@
         rootBindings.remove("java:comp/writable/three");
         assertEq(rootBindings, rootContext);
 
+        // visible from writableContext
+        writableBindings.remove("three");
+        assertEq(writableBindings, writableContext);
+    }
+
+    public void testRenameInner() throws Exception {
+        //
+        // rename in inner context
+        rootContext.rename("java:comp/writable/three", "java:comp/writable/four");
+
+        // visible from root context
+        rootBindings.remove("java:comp/writable/three");
+        rootBindings.put("java:comp/writable/four", new Integer(3));
+        assertEq(rootBindings, rootContext);
+
         // visible from unmodifibleContext
         writableBindings.remove("three");
+        writableBindings.put("four", new Integer(3));
+        assertEq(writableBindings, writableContext);
+
+        //
+        // rename from inner to wrapper
+        rootContext.rename("java:comp/writable/two", "java:comp/unmodifible/four");
+
+        // visible from root context
+        rootBindings.remove("java:comp/writable/two");
+        rootBindings.put("java:comp/unmodifible/four", new Integer(2));
+        assertEq(rootBindings, rootContext);
+
+        // visible from writableContext
+        writableBindings.remove("two");
+        assertEq(writableBindings, writableContext);
+
+        // not visible from unmodifibleContext
+        assertEq(unmodifibleBindings, unmodifibleContext);
+
+        //
+        // rename from wrapper to inner
+        rootContext.rename("java:comp/unmodifible/four", "java:comp/writable/two");
+
+        // visible from root context
+        rootBindings.remove("java:comp/unmodifible/four");
+        rootBindings.put("java:comp/writable/two", new Integer(2));
+        assertEq(rootBindings, rootContext);
+
+        // visible from writableContext
+        writableBindings.put("two", new Integer(2));
+        assertEq(writableBindings, writableContext);
+
+        // not visible from unmodifibleContext
+        assertEq(unmodifibleBindings, unmodifibleContext);
+    }
+
+    public void testCreateSubcontextWrapper() throws Exception {
+        //
+        // createSubcontext in wrapper
+        rootContext.createSubcontext("java:comp/unmodifible/context");
+        rootContext.bind("java:comp/unmodifible/context/foo", "bar");
+
+        // visible from root context
+        rootBindings.put("java:comp/unmodifible/context/foo", "bar");
+        assertEq(rootBindings, rootContext);
+
+        // not-visible from unmodifibleContext
+        assertEq(unmodifibleBindings, unmodifibleContext);
+    }
+
+    public void testCreateSubcontextInner() throws Exception {
+        // bind into root context OVER the writable context
+        rootContext.bind("java:comp/writable/TEST", "TEST_VALUE");
+
+        // visible from root context
+        rootBindings.put("java:comp/writable/TEST", "TEST_VALUE");
+        assertEq(rootBindings, rootContext);
+
+        // visible from writableContext
+        writableBindings.put("TEST", "TEST_VALUE");
         assertEq(writableBindings, writableContext);
     }
 



Mime
View raw message