/** test that object is safely stored in root context */ public void testStorageInRoot() { reference = new JNDIObjectReference("glarch", ctx); String obj = new String("that's me"); reference.set(obj); assertSame(obj, reference.get()); }
/** * object shall be stored and returned back * * @throws NamingException */ public void testStorageAndRetrieval() throws NamingException { reference = new JNDIObjectReference("glee:/glum/glarch/blurge", ctx); String obj = new String("that's me"); reference.set(obj); // shall be the same object - from reference or from // context itself assertSame(obj, reference.get()); assertSame(obj, ctx.lookup("glee:/glum/glarch/blurge")); // try to rebind context Integer glum = new Integer(239); reference.set(glum); assertSame(glum, reference.get()); assertSame(glum, ctx.lookup("glee:/glum/glarch/blurge")); // and also unbind reference.set(null); assertNull(ctx.lookup("glee:/glum/glarch/blurge")); }