[jboss-cvs] JBossAS SVN: r61226 - in trunk/ejb3: src/main/org/jboss/ejb3 and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 8 12:34:08 EST 2007


Author: bdecoste
Date: 2007-03-08 12:34:08 -0500 (Thu, 08 Mar 2007)
New Revision: 61226

Added:
   trunk/ejb3/src/resources/test-configs/libdeployment/
   trunk/ejb3/src/resources/test-configs/libdeployment/lib/
   trunk/ejb3/src/resources/test-configs/libdeployment/lib/libdeployment.jar
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java
Modified:
   trunk/ejb3/build-test.xml
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
Log:
[EJBTHREE-903] merged from Branch_4_2

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-03-08 16:55:13 UTC (rev 61225)
+++ trunk/ejb3/build-test.xml	2007-03-08 17:34:08 UTC (rev 61226)
@@ -2678,7 +2678,7 @@
 
       <jar jarfile="${build.lib}/libdeployment-test.jar">
          <fileset dir="${build.classes}">
-            <include name="org/jboss/ejb3/test/libdeployment/*.class"/>
+            <include name="org/jboss/ejb3/test/libdeployment/Stateless*.class"/>
          </fileset>
          <fileset dir="${resources}/test/libdeployment">
             <include name="META-INF/*.xml"/>
@@ -3659,6 +3659,7 @@
       <antcall target="invoker-test"  inheritRefs="true"/>
       <antcall target="iiop-tests"  inheritRefs="true"/>
       <antcall target="arjuna-test"  inheritRefs="true"/>
+      <antcall target="libdeployment-test"  inheritRefs="true"/>
    </target>
 
    <target name="no-start-jboss-tests" depends="init" description="Execute all tests">
@@ -4067,6 +4068,26 @@
       <stop-jboss/>
       <wait-on-shutdown conf="arjuna"/>
    </target>
+   
+   <target name="libdeployment-test" depends="init">
+      <create-config baseconf="all" newconf="libdeployment" jboss.dist="${ejb3.dist}">
+         <patternset>
+            <include name="conf/**"/>
+            <include name="deploy*/**"/>
+            <include name="lib/**"/>
+         </patternset>
+      </create-config>
+     
+      <start-jboss conf="libdeployment" host="${node0}" jboss.dist="${ejb3.dist}" jvmargs="${ejb3.jboss.jvmargs}"/>
+      <wait-on-host/>
+      
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="libdeployment"/>
+      </antcall>
+      
+      <stop-jboss jboss.dist="${ejb3.dist}"/>
+      <wait-on-shutdown conf="libdeployment"/>
+   </target>
 
    <target name="ssl-simple-test" depends="init">
      <create-config baseconf="all" newconf="ejb3-ssl">

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2007-03-08 16:55:13 UTC (rev 61225)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -73,18 +73,30 @@
    protected String defaultConsumerDomain;
    protected Ejb3Deployment deployment;
 
+   public Ejb3AnnotationHandler(Ejb3Deployment deployment)
+   {
+      this.deployment = deployment;
+      this.di = deployment.getDeploymentUnit();
+      defaultSLSBDomain = deployment.getDefaultSLSBDomain();
+      defaultSFSBDomain = deployment.getDefaultSFSBDomain();
+      defaultMDBDomain = deployment.getDefaultMDBDomain();
+      defaultServiceDomain = deployment.getDefaultServiceDomain();
+      defaultConsumerDomain = deployment.getDefaultConsumerDomain();
+   }
+
    public Ejb3AnnotationHandler(Ejb3Deployment deployment, ClassFile cf)
    {
       this.deployment = deployment;
       this.di = deployment.getDeploymentUnit();
-      this.cf = cf;
-      className = cf.getName();
-      visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
       defaultSLSBDomain = deployment.getDefaultSLSBDomain();
       defaultSFSBDomain = deployment.getDefaultSFSBDomain();
       defaultMDBDomain = deployment.getDefaultMDBDomain();
       defaultServiceDomain = deployment.getDefaultServiceDomain();
       defaultConsumerDomain = deployment.getDefaultConsumerDomain();
+      
+      this.cf = cf;
+      className = cf.getName();
+      visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
    }
 
    public void setCtxProperties(Hashtable ctxProperties)
@@ -92,7 +104,7 @@
       this.ctxProperties = ctxProperties;
    }
 
-   private String getJaccContextId()
+   protected String getJaccContextId()
    {
       return di.getShortName();
    }
@@ -175,7 +187,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new ServiceContainer(deployment.getMbeanServer(), di.getClassLoader(), cf.getName(),
+      return new ServiceContainer(deployment.getMbeanServer(), di.getClassLoader(), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
@@ -191,7 +203,7 @@
                  + containerName + "''");
 
       return new ConsumerContainer(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(),
-              di.getClassLoader(), cf.getName(), ctxProperties,
+              di.getClassLoader(), className, ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
    }
@@ -205,7 +217,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new StatefulContainer(di.getClassLoader(), cf.getName(),
+      return new StatefulContainer(di.getClassLoader(), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
@@ -221,7 +233,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new StatelessContainer(di.getClassLoader(), cf.getName(),
+      return new StatelessContainer(di.getClassLoader(), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(),
               ctxProperties, di.getInterceptorInfoRepository(),
               deployment);
@@ -253,7 +265,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      MDB container = new MDB(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), di.getClassLoader(), cf.getName(),
+      MDB container = new MDB(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), di.getClassLoader(), className,
               ctxProperties, di.getInterceptorInfoRepository(), deployment);
 
       return container;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-03-08 16:55:13 UTC (rev 61225)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -27,8 +27,10 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import javassist.bytecode.ClassFile;
 
@@ -48,6 +50,9 @@
 import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
 import org.jboss.ejb3.entity.PersistenceUnitDeployment;
 import org.jboss.ejb3.entity.PersistenceXmlLoader;
+import org.jboss.ejb3.metamodel.EjbJarDD;
+import org.jboss.ejb3.metamodel.EjbJarDDObjectFactory;
+import org.jboss.ejb3.metamodel.JBossDDObjectFactory;
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VirtualFile;
 
@@ -370,6 +375,8 @@
             deployElement(stream, factory, initialContext);
          }
       }
+      
+      deployBeansFromLib(initialContext);
    }
 
    protected void deployUrl(Ejb3HandlerFactory factory)
@@ -404,6 +411,38 @@
       deployElement(factory, cf, ctx);
 
    }
+   
+   protected void deployBeansFromLib(InitialContext ctx)
+   throws Exception
+   {
+      EjbJarDD dd = EjbJarDDObjectFactory.parse(getDeploymentUnit().getEjbJarXml());
+      dd = JBossDDObjectFactory.parse(this.getDeploymentUnit().getJbossXml(), dd);
+      
+      if (dd != null)
+      {
+         Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(this, dd);
+         handler.setCtxProperties(unit.getJndiProperties());
+         
+         Map<String, Container> localContainers = new HashMap<String, Container>();
+         Iterator<Container> containerIterator = ejbContainers.values().iterator();
+         while (containerIterator.hasNext())
+         {
+            Container container = containerIterator.next();
+            localContainers.put(container.getEjbName(), container);
+         }
+          
+         List<Container> containers = handler.getContainers(this, localContainers);
+         for (Container con : containers)
+         {
+            // EJBContainer has finished with all metadata initialization from XML files and such.
+            // this is really a hook to do some processing after XML has been set up and before
+            // and processing of dependencies and such.
+            ((EJBContainer) con).instantiated();
+            this.ejbContainers.put(con.getObjectName(), con);
+            Ejb3Registry.register(con);
+         }
+      }
+   }
 
    protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx)
            throws Exception

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-03-08 16:55:13 UTC (rev 61225)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -161,6 +161,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 /**
@@ -185,6 +186,12 @@
       super(deployment, cf);
       this.dd = dd;
    }
+   
+   public Ejb3DescriptorHandler(Ejb3Deployment deployment, EjbJarDD dd)
+   {
+      super(deployment);
+      this.dd = dd;
+   }
 
    public boolean isEjb()
    {
@@ -253,7 +260,93 @@
             ejbType = EJB_TYPE.CONSUMER;
       }
    }
+   
+   protected EJB_TYPE getEjbType(EnterpriseBean enterpriseBean)
+   {
+      if (enterpriseBean.isSessionBean())
+      {
+         if (((SessionEnterpriseBean) enterpriseBean).isStateless())
+            return EJB_TYPE.STATELESS;
+         else
+            return EJB_TYPE.STATEFUL;
+      } else if (enterpriseBean.isEntityBean())
+         return EJB_TYPE.ENTITY;
+      else if (enterpriseBean.isMessageDrivenBean())
+         return EJB_TYPE.MESSAGE_DRIVEN;
+      else if (enterpriseBean.isService())
+         return EJB_TYPE.SERVICE;
+      else //if (enterpriseBean.isConsumer())
+         return EJB_TYPE.CONSUMER;
+   }
+   
+   public List getContainers(Ejb3Deployment deployment, Map<String, Container> preexistingContainers) throws Exception
+   {     
+      List containers = new ArrayList();
 
+      EnterpriseBeans enterpriseBeans = (dd.getEnterpriseBeans() != null) ? dd
+            .getEnterpriseBeans() : new EnterpriseBeans();
+
+      Collection<EnterpriseBean> allXmlEjbs = enterpriseBeans.getEnterpriseBeans();
+      ejbNames = new ArrayList<String>();
+      for (EnterpriseBean ejb : allXmlEjbs)
+      {
+         String ejbName = ejb.getEjbName();
+         if (preexistingContainers.get(ejbName) == null)
+         {
+            ejbNames.add(ejbName);
+            ejbs.add(ejb);
+         }
+      }
+      
+      for (int ejbIndex = 0; ejbIndex < ejbNames.size(); ++ejbIndex)
+      {
+         String ejbName = ejbNames.get(ejbIndex);
+         EnterpriseBean enterpriseBean = ejbs.get(ejbIndex);
+         ejbType = getEjbType(enterpriseBean);
+         className = enterpriseBean.getEjbClass();
+         
+         if (className == null)
+            log.warn("Descriptor based bean has no ejb-class defined: " + ejbName);
+         else
+         {
+            ejbClass = di.getClassLoader().loadClass(className);
+            if (ejbType == EJB_TYPE.STATELESS)
+            {
+               EJBContainer container = getStatelessContainer(ejbIndex);
+               container.setJaccContextId(getJaccContextId());
+               containers.add(container);
+            }
+            else if (ejbType == EJB_TYPE.STATEFUL)
+            {
+               StatefulContainer container = getStatefulContainer(ejbIndex);
+               container.setJaccContextId(getJaccContextId());
+               containers.add(container);
+            }
+            else if (ejbType == EJB_TYPE.MESSAGE_DRIVEN)
+            {
+               MDB container = getMDB(ejbIndex);
+               container.setJaccContextId(getJaccContextId());
+               containers.add(container);
+            }
+            else if (ejbType == EJB_TYPE.SERVICE)
+            {
+               ServiceContainer container = getServiceContainer(ejbIndex);
+               container.setJaccContextId(getJaccContextId());
+               containers.add(container);
+            }
+            else if (ejbType == EJB_TYPE.CONSUMER)
+            {
+               ConsumerContainer container = getConsumerContainer(ejbIndex);
+               container.setJaccContextId(getJaccContextId());
+               containers.add(container);
+            }
+            log.debug("found EJB3: ejbName=" + ejbName + ", class=" + className + ", type=" + ejbType);
+         }
+      }
+      
+      return containers;
+   }
+
    protected StatefulContainer getStatefulContainer(int ejbIndex)
          throws Exception
    {

Added: trunk/ejb3/src/resources/test-configs/libdeployment/lib/libdeployment.jar
===================================================================
(Binary files differ)


Property changes on: trunk/ejb3/src/resources/test-configs/libdeployment/lib/libdeployment.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.libdeployment;
+
+import javax.ejb.Remove;
+
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class StatefulBean implements StatefulRemote
+{
+   private static final Logger log = Logger.getLogger(StatefulBean.class);
+   
+   public void test() 
+   {
+   }
+   
+   @Remove
+   public void remove()
+   {
+      
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.libdeployment;
+
+/**
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatefulRemote
+{
+   void test();
+   void remove();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.libdeployment;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateless
+ at Remote(StatelessRemote.class)
+public class StatelessBean implements StatelessRemote
+{
+   private static final Logger log = Logger.getLogger(StatelessBean.class);
+   
+   public void test() 
+   {
+    
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.libdeployment;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatelessRemote
+{
+   void test();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java	2007-03-08 17:34:08 UTC (rev 61226)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.libdeployment.unit;
+
+import javax.ejb.NoSuchEJBException;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.test.libdeployment.StatefulRemote;
+import org.jboss.ejb3.test.libdeployment.StatelessRemote;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+
+public class LibTestCase
+extends JBossTestCase
+{
+   private static final Logger log = Logger.getLogger(LibTestCase.class);
+
+   public LibTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testLibDeployment() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      StatefulRemote sfsb = (StatefulRemote)jndiContext.lookup("StatefulRemote");
+      sfsb.test();
+      sfsb.remove();
+      
+      try
+      {
+         sfsb.test();
+         fail("Bean should have been removed");
+      } catch (NoSuchEJBException e)
+      {
+      }
+      
+      StatelessRemote slsb = (StatelessRemote)jndiContext.lookup("StatelessBean/remote");
+      slsb.test();
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(LibTestCase.class, "libdeployment-test.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list