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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 1 20:17:32 EST 2007


Author: bdecoste
Date: 2007-03-01 20:17:31 -0500 (Thu, 01 Mar 2007)
New Revision: 61039

Added:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/unit/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/unit/DeployerUnitTestCase.java
Modified:
   branches/Branch_4_2/ejb3/build-test.xml
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJB3Deployer.java
   branches/Branch_4_2/ejb3/src/resources/META-INF/jboss-service.xml
Log:
switch and test for only deploying .ejb3 files or .jar files with 3.0 versions of ejb-jar.xml (i.e. skip checking for annotations)

Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml	2007-03-02 00:17:17 UTC (rev 61038)
+++ branches/Branch_4_2/ejb3/build-test.xml	2007-03-02 01:17:31 UTC (rev 61039)
@@ -3402,6 +3402,9 @@
          <param name="test" value="homeinterface"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="deployer"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="container"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJB3Deployer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJB3Deployer.java	2007-03-02 00:17:17 UTC (rev 61038)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJB3Deployer.java	2007-03-02 01:17:31 UTC (rev 61039)
@@ -83,6 +83,8 @@
    private SubDeployer thisProxy;
 
    private Properties DefaultProperties;
+   
+   private boolean deployEjb3ExtensionOnly;
 
    private HashSet ignoredJarsSet;
    private HashMap<DeploymentInfo, String> jmxNames = new HashMap();
@@ -248,6 +250,7 @@
       {
          return true;
       }
+      
       // To be accepted the deployment's root name must end in jar
       if (!urlStr.endsWith(".jar") && !urlStr.endsWith(".jar/"))
       {
@@ -258,11 +261,15 @@
       {
          return false;
       }
-
-      if (hasPersistenceXml(di)) return true;
-      if (hasOnlyJbossXml(di)) return true;
+      
       if (has30EjbJarXml(di)) return true;
-      if (hasEjbAnnotation(di)) return true;
+         
+      if (!deployEjb3ExtensionOnly)
+      {
+         if (hasPersistenceXml(di)) return true;
+         if (hasOnlyJbossXml(di)) return true;
+         if (hasEjbAnnotation(di)) return true;
+      }
 
 
       return false;
@@ -277,6 +284,16 @@
    {
       ignoredJarsSet = mbean.getIgnoredJarsSet();
    }
+   
+   public boolean getDeployEjb3ExtensionOnly()
+   {
+      return deployEjb3ExtensionOnly;
+   }
+   
+   public void setDeployEjb3ExtensionOnly(boolean deployEjb3ExtensionOnly)
+   {
+      this.deployEjb3ExtensionOnly = deployEjb3ExtensionOnly;
+   }
 
    /**
     * Overriden to set the hibernate.bytecode.provider from the

Modified: branches/Branch_4_2/ejb3/src/resources/META-INF/jboss-service.xml
===================================================================
--- branches/Branch_4_2/ejb3/src/resources/META-INF/jboss-service.xml	2007-03-02 00:17:17 UTC (rev 61038)
+++ branches/Branch_4_2/ejb3/src/resources/META-INF/jboss-service.xml	2007-03-02 01:17:31 UTC (rev 61039)
@@ -102,6 +102,8 @@
 
    <mbean code="org.jboss.ejb3.EJB3Deployer" name="jboss.ejb3:service=EJB3Deployer" xmbean-dd="">
 
+      <attribute name="DeployEjb3ExtensionOnly">false</attribute>
+
       <!-- Inline XMBean Descriptor BEGIN -->
       <xmbean>
          <description>The EJB3Deployer responsible for ejb3 deployment</description>
@@ -157,6 +159,12 @@
             <type>java.util.Properties</type>
          </attribute>
 
+         <attribute access="read-write" getMethod="getDeployEjb3ExtensionOnly" setMethod="setDeployEjb3ExtensionOnly">
+            <description>If true, .jars will not be examined for annotations, 3.0 descriptors</description>
+            <name>DeployEjb3ExtensionOnly</name>
+            <type>boolean</type>
+         </attribute>
+
          <attribute access="write-only" setMethod="setJarsIgnoredForScanning">
             <description>mbean that has list of jars to ignore</description>
             <name>JarsIgnoredForScanning</name>

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/unit/DeployerUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/unit/DeployerUnitTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/deployer/unit/DeployerUnitTestCase.java	2007-03-02 01:17:31 UTC (rev 61039)
@@ -0,0 +1,78 @@
+/*
+ * 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.deployer.unit;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.test.stateless.RunAsStateless;
+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 DeployerUnitTestCase
+extends JBossTestCase
+{
+   private static final Logger log = Logger.getLogger(DeployerUnitTestCase.class);
+
+   public DeployerUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testDeployEjb3ExtensionOnly() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName on = new ObjectName("jboss.ejb3:service=EJB3Deployer");
+      server.setAttribute(on, new Attribute("DeployEjb3ExtensionOnly", new Boolean(true)));
+      Boolean value = (Boolean)server.getAttribute(on, "DeployEjb3ExtensionOnly");
+      assertTrue(value.booleanValue());
+      
+      this.deploy("stateless-test.jar");
+      try
+      {
+         RunAsStateless runAs = (RunAsStateless) getInitialContext().lookup("RunAsStatelessEjbName/remote");
+         fail(".jar should not have deployed");
+      } catch (javax.naming.NameNotFoundException e)
+      {
+      }
+      this.undeploy("stateless-test.jar");
+      
+      server.setAttribute(on, new Attribute("DeployEjb3ExtensionOnly", new Boolean(false)));
+      value = (Boolean)server.getAttribute(on, "DeployEjb3ExtensionOnly");
+      assertFalse(value.booleanValue());
+      
+      this.deploy("stateless-test.jar");
+      RunAsStateless runAs = (RunAsStateless) getInitialContext().lookup("RunAsStatelessEjbName/remote");
+      this.undeploy("stateless-test.jar");
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(DeployerUnitTestCase.class, "");
+   }
+
+}




More information about the jboss-cvs-commits mailing list