[jboss-cvs] JBossAS SVN: r61062 - in branches/Branch_4_2/ejb3: src/main/org/jboss/ejb3 and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 2 19:51:52 EST 2007


Author: bdecoste
Date: 2007-03-02 19:51:52 -0500 (Fri, 02 Mar 2007)
New Revision: 61062

Added:
   branches/Branch_4_2/ejb3/src/resources/test-configs/libdeployment/
   branches/Branch_4_2/ejb3/src/resources/test-configs/libdeployment/lib/
   branches/Branch_4_2/ejb3/src/resources/test-configs/libdeployment/lib/libdeployment.jar
   branches/Branch_4_2/ejb3/src/resources/test/libdeployment/
   branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/
   branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/ejb-jar.xml
   branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/jboss.xml
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java
Modified:
   branches/Branch_4_2/ejb3/build-test.xml
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Handler.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
Log:
[EJBTHREE-903] beans can be deployed when the bean class file is not in the deployment, but rather in lib - the bean metadata is in ejb-jar.xml in the deployment

Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/build-test.xml	2007-03-03 00:51:52 UTC (rev 61062)
@@ -2578,6 +2578,34 @@
       </jar>
    </target>
 
+   <target name="libdeployment"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/libdeployment-test.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/libdeployment/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/libdeployment">
+            <include name="META-INF/*.xml"/>
+         </fileset>
+      </jar>
+
+      <jar jarfile="${build.lib}/libdeployment.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/libdeployment/Stateful*.class"/>
+         </fileset>
+      </jar>
+
+      <copy todir="${resources}/test-configs/libdeployment/lib">
+         <fileset dir="${build.lib}">
+            <include name="libdeployment.jar"/>
+         </fileset>
+      </copy>
+   </target>
+
    <target name="stateless"
       description="Builds all jar files."
       depends="compile-classes">
@@ -2984,7 +3012,7 @@
       </jar>
    </target>
    
-   <target name="jars" depends="homeinterface, timestampentity, servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
+   <target name="jars" depends="libdeployment, homeinterface, timestampentity, servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree751, ejbthree832,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
@@ -3262,6 +3290,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">
@@ -3653,6 +3682,27 @@
       <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" jboss.dist="${ejb3.dist}">
          <patternset>

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -72,19 +72,31 @@
    protected String defaultServiceDomain;
    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();
    }
@@ -116,7 +128,7 @@
       return false;
    }
 
-   public List getContainers(ClassFile cf, Ejb3Deployment deployment) throws Exception
+   public List getContainers(Ejb3Deployment deployment) throws Exception
    {
       List containers = new ArrayList();
 
@@ -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: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -30,6 +30,7 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import javassist.bytecode.ClassFile;
 
@@ -49,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;
 import org.jboss.util.file.ArchiveBrowser;
@@ -359,7 +363,7 @@
    {
       Ejb3HandlerFactory factory = Ejb3HandlerFactory.getInstance(this);
       if (unit.getUrl() != null) deployUrl(factory);
-
+      
       if (unit.getClasses() != null)
       {
          for (Class explicit : unit.getClasses())
@@ -373,6 +377,10 @@
             deployElement(stream, factory, initialContext);
          }
       }
+      else
+      {
+         deployBeansFromLib(initialContext);
+      }
    }
 
    protected void deployUrl(Ejb3HandlerFactory factory)
@@ -417,23 +425,55 @@
       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
    {
       Ejb3Handler handler = factory.createHandler(cf);
       handler.setCtxProperties(unit.getJndiProperties());
-
+      
       if (handler.isEjb() || handler.isJBossBeanType())
       {
-         List<Container> containers = handler.getContainers(cf, this);
+         List<Container> containers = handler.getContainers(this);
          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);
+            ejbContainers.put(con.getObjectName(), con);
             Ejb3Registry.register(con);
          }
       }

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -96,6 +96,7 @@
 import org.jboss.ejb.StatelessImpl;
 import org.jboss.ejb.TransactionAttributeImpl;
 import org.jboss.ejb.TransactionManagementImpl;
+import org.jboss.ejb3.Ejb3AnnotationHandler.EJB_TYPE;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
 import org.jboss.ejb3.mdb.ConsumerContainer;
 import org.jboss.ejb3.mdb.MDB;
@@ -161,6 +162,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 /**
@@ -177,14 +179,18 @@
 
    protected List<EnterpriseBean> ejbs = new ArrayList<EnterpriseBean>();
 
-   private static Class clazz;
-
    public Ejb3DescriptorHandler(Ejb3Deployment deployment, ClassFile cf,
          EjbJarDD dd)
    {
       super(deployment, cf);
       this.dd = dd;
    }
+   
+   public Ejb3DescriptorHandler(Ejb3Deployment deployment, EjbJarDD dd)
+   {
+      super(deployment);
+      this.dd = dd;
+   }
 
    public boolean isEjb()
    {
@@ -202,13 +208,17 @@
 
    protected void populateBaseInfo() throws Exception
    {
-      super.populateBaseInfo();
+      if (cf != null)
+         super.populateBaseInfo();
 
       EnterpriseBeans enterpriseBeans = (dd.getEnterpriseBeans() != null) ? dd
             .getEnterpriseBeans() : new EnterpriseBeans();
 
-      List<EnterpriseBean> ejbsByClass = enterpriseBeans.findEjbsByClass(cf
-            .getName());
+      List<EnterpriseBean> ejbsByClass;
+      if (cf == null)
+         ejbsByClass = enterpriseBeans.findEjbs();
+      else
+         ejbsByClass = enterpriseBeans.findEjbsByClass(cf.getName());
 
       for (int i = 0; i < ejbNames.size(); ++i)
       {
@@ -217,15 +227,13 @@
                .findEjbByEjbName(ejbNameFromAnnotation);
          ejbs.add(enterpriseBean);
 
-         boolean removed = false;
          int j = 0;
-         while (!removed && j < ejbsByClass.size())
+         while (j < ejbsByClass.size())
          {
             EnterpriseBean ejbByClass = ejbsByClass.get(j);
             if (ejbByClass.getEjbName().equals(ejbNameFromAnnotation))
-            {
                ejbsByClass.remove(j);
-            } else
+            else
                ++j;
          }
       }
@@ -237,21 +245,94 @@
          ejbs.add(enterpriseBean);
          ejbNames.add(ejbName);
 
-         if (enterpriseBean.isSessionBean())
+         ejbType = getEjbType(enterpriseBean);
+      }
+   }
+   
+   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)
          {
-            if (((SessionEnterpriseBean) enterpriseBean).isStateless())
-               ejbType = EJB_TYPE.STATELESS;
-            else
-               ejbType = EJB_TYPE.STATEFUL;
-         } else if (enterpriseBean.isEntityBean())
-            ejbType = EJB_TYPE.ENTITY;
-         else if (enterpriseBean.isMessageDrivenBean())
-            ejbType = EJB_TYPE.MESSAGE_DRIVEN;
-         else if (enterpriseBean.isService())
-            ejbType = EJB_TYPE.SERVICE;
-         else if (enterpriseBean.isConsumer())
-            ejbType = EJB_TYPE.CONSUMER;
+            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)

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Handler.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Handler.java	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Handler.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -23,7 +23,6 @@
 
 import java.util.Hashtable;
 import java.util.List;
-import javassist.bytecode.ClassFile;
 
 /**
  *
@@ -38,7 +37,7 @@
 
    boolean isJBossBeanType();
 
-   List<Container> getContainers(ClassFile cf, Ejb3Deployment deployment) throws Exception;
+   List<Container> getContainers(Ejb3Deployment deployment) throws Exception;
 
    void setCtxProperties(Hashtable ctxProperties);
 }

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java	2007-03-03 00:49:00 UTC (rev 61061)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -265,7 +265,19 @@
       }
       return result;
    }
+   
+   public List<EnterpriseBean> findEjbs()
+   {
+      ArrayList<EnterpriseBean> result = new ArrayList<EnterpriseBean>(enterpriseBeans.values().size());
 
+      Iterator<EnterpriseBean> ejbs = enterpriseBeans.values().iterator();
+      while (ejbs.hasNext())
+      {
+         result.add(ejbs.next());
+      }
+      return result;
+   }
+
    public EnterpriseBean findEjbByRemote(String remote)
    {
       Iterator ejbs = enterpriseBeans.values().iterator();

Added: branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/ejb-jar.xml	2007-03-03 00:51:52 UTC (rev 61062)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+   <enterprise-beans>
+      <session>
+         <ejb-name>StatefulBean</ejb-name>
+         <remote>org.jboss.ejb3.test.libdeployment.StatefulRemote</remote>
+         <ejb-class>org.jboss.ejb3.test.libdeployment.StatefulBean</ejb-class>
+         <session-type>Stateful</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+   </enterprise-beans>
+</ejb-jar>

Added: branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/jboss.xml
===================================================================
--- branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/resources/test/libdeployment/META-INF/jboss.xml	2007-03-03 00:51:52 UTC (rev 61062)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<jboss
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+        version="3.0">
+   <enterprise-beans>
+      <session>
+         <ejb-name>StatefulBean</ejb-name>
+         <jndi-name>StatefulRemote</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>

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


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

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulBean.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -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: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatefulRemote.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -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: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessBean.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -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: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/StatelessRemote.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -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: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/libdeployment/unit/LibTestCase.java	2007-03-03 00:51:52 UTC (rev 61062)
@@ -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