[jboss-cvs] JBossAS SVN: r64707 - branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 20 12:25:22 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-08-20 12:25:22 -0400 (Mon, 20 Aug 2007)
New Revision: 64707

Modified:
   branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
Log:
[JBAS-4574] Further cleanup in commit

Modified: branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	2007-08-20 12:51:31 UTC (rev 64706)
+++ branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	2007-08-20 16:25:22 UTC (rev 64707)
@@ -22,14 +22,13 @@
 
 package org.jboss.test.naming.restart;
 
-import java.rmi.Naming;
-import java.util.Properties;
-
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
 
 import org.jboss.logging.Logger;
 import org.jnp.interfaces.MarshalledValuePair;
+import org.jnp.interfaces.Naming;
 import org.jnp.interfaces.NamingParser;
 
 /**
@@ -45,13 +44,10 @@
    public static final String NAME = "NamingRestartBinding";
    public static final String VALUE = "VALUE";
    public static final String SUBCONTEXT_NAME = "LocalSubcontext";
-   private String providerURL;  
+//   private String providerURL;  
    private NamingParser parser = new NamingParser();
    private RestartNamingServiceMBean naming;
    
-   /* (non-Javadoc)
-    * @see org.jboss.test.naming.restart.ObjectBinderMBean#setNamingService(org.jboss.naming.NamingServiceMBean)
-    */
    public void setNamingService(RestartNamingServiceMBean naming)
    {
 //      this.providerURL = (naming == null) 
@@ -60,9 +56,6 @@
       this.naming = naming;
    }
    
-   /* (non-Javadoc)
-    * @see org.jboss.test.naming.restart.ObjectBinderMBean#start()
-    */
    public void start() throws Exception
    {      
       // Standard JNDI
@@ -80,11 +73,14 @@
 //    Context ctx = new InitialContext(env);
 //    ctx.bind(NAME, VALUE);
       
-      naming.getNamingInstance().bind(parser.parse(NAME), 
+      Naming namingServer = naming.getNamingInstance();
+      namingServer.bind(parser.parse(NAME), 
                                       new MarshalledValuePair(VALUE), 
-                                      VALUE.getClass().getName());log.info("Bound " + VALUE + " to " + naming.getNamingInstance() + " under " + NAME);
-      Context sub = naming.getNamingInstance().createSubcontext(parser.parse(SUBCONTEXT_NAME));
+                                      VALUE.getClass().getName());
+      log.info("Bound " + VALUE + " to " + namingServer + " under " + NAME);
+      Context sub = namingServer.createSubcontext(parser.parse(SUBCONTEXT_NAME));
       sub.bind(parser.parse(NAME), VALUE);
+      log.info("Bound " + VALUE + " to " + sub + " under " + NAME);
       
    }
    
@@ -108,7 +104,34 @@
 //    Context ctx = new InitialContext(env);
 //      ctx.unbind(NAME);
       
-      naming.getNamingInstance().unbind(parser.parse(NAME));
-      log.info("Unbound " + NAME + " from " + naming.getNamingInstance());
+      Naming namingServer = naming.getNamingInstance();
+      try
+      {
+         namingServer.unbind(parser.parse(SUBCONTEXT_NAME + "/" + NAME));
+         log.info("Unbound " + SUBCONTEXT_NAME + "/" + NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      try
+      {
+         namingServer.unbind(parser.parse(SUBCONTEXT_NAME));
+         log.info("Unbound " + SUBCONTEXT_NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      try
+      {
+         namingServer.unbind(parser.parse(NAME));
+         log.info("Unbound " + NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      
    }
 }




More information about the jboss-cvs-commits mailing list