[jboss-cvs] JBossAS SVN: r79205 - in projects/ejb3/trunk/core/src/test: resources and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 7 06:08:06 EDT 2008


Author: wolfc
Date: 2008-10-07 06:08:06 -0400 (Tue, 07 Oct 2008)
New Revision: 79205

Added:
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/JavaCompInitializer.java
Modified:
   projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml
Log:
Cleanup java:comp after each run

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/JavaCompInitializer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/JavaCompInitializer.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/JavaCompInitializer.java	2008-10-07 10:08:06 UTC (rev 79205)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.common;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A JavaCompInitializer that can be stopped.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JavaCompInitializer extends org.jboss.naming.JavaCompInitializer
+{
+   private static final Logger log = Logger.getLogger(JavaCompInitializer.class);
+   
+   public void stop()
+   {
+      InitialContext ctx = getIniCtx();
+      if(ctx == null)
+         return;
+      
+      try
+      {
+         ctx.unbind("java:comp");
+      }
+      catch (NamingException e)
+      {
+         log.debug("Failed to unbind 'java:comp'", e);
+      }
+      
+      try
+      {
+         ctx.close();
+      }
+      catch (NamingException e)
+      {
+         log.debug("Failed to close InitialContext " + ctx, e);
+      }
+      
+      setIniCtx(null);
+   }
+}

Modified: projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml	2008-10-07 09:58:15 UTC (rev 79204)
+++ projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml	2008-10-07 10:08:06 UTC (rev 79205)
@@ -44,7 +44,7 @@
    <!-- JNDI -->
    <bean name="NameServer" class="org.jnp.server.SingletonNamingServer"/>
    
-   <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer"/>
+   <bean name="JavaCompInitializer" class="org.jboss.ejb3.core.test.common.JavaCompInitializer"/>
    
    <bean name="TransactionManager" class="org.jboss.ejb3.core.test.common.SimpleTransactionService">
       <depends>NameServer</depends>




More information about the jboss-cvs-commits mailing list