[jboss-cvs] JBossAS SVN: r103276 - in projects/ejb3/components/instantiator/trunk: deployer and 21 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 30 16:37:04 EDT 2010


Author: ALRubinger
Date: 2010-03-30 16:37:01 -0400 (Tue, 30 Mar 2010)
New Revision: 103276

Added:
   projects/ejb3/components/instantiator/trunk/deployer/
   projects/ejb3/components/instantiator/trunk/deployer/pom.xml
   projects/ejb3/components/instantiator/trunk/deployer/src/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/deployer/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployer.java
   projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/META-INF/
   projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/META-INF/ejb3-instantiator-deployer-jboss-beans.xml
   projects/ejb3/components/instantiator/trunk/deployer/src/test/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployerUnitTest.java
   projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/TestBeanInstantiatorDeployer.java
   projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/
   projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/dummyDeployment
   projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/ejb3-instantiator-test-deployer-jboss-beans.xml
   projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/log4j.xml
   projects/ejb3/components/instantiator/trunk/impl/src/main/resources/META-INF/
   projects/ejb3/components/instantiator/trunk/impl/src/main/resources/META-INF/ejb3-bean-instantiator-jboss-beans.xml
Modified:
   projects/ejb3/components/instantiator/trunk/impl/
   projects/ejb3/components/instantiator/trunk/pom.xml
Log:
[EJBTHREE-2046] Add a deployer to attach the BeanInstantiator to the incoming DU


Property changes on: projects/ejb3/components/instantiator/trunk/deployer
___________________________________________________________________
Name: svn:ignore
   + target
eclipse-target
target-eclipse
bin
.classpath
.project
.settings


Added: projects/ejb3/components/instantiator/trunk/deployer/pom.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/pom.xml	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/pom.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,139 @@
+<!--
+  vi:ts=2:sw=2:expandtab
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <!-- Define Parent -->
+  <parent>
+    <groupId>org.jboss.ejb3.instantiator</groupId>
+    <artifactId>instantiator-build</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+
+  <!-- Maven POM Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- Artifact Information -->
+  <artifactId>instantiator-deployer</artifactId>
+  <packaging>jar</packaging>
+  <name>JBoss EJB 3.x Instantiator Deployer</name>
+  <description>Integration Deployers for JBoss EJB 3.x Bean Instance Creators</description>
+
+  <!-- Build Configuration -->
+  <build>
+  
+    
+  </build>
+  
+  <properties>
+  
+    <version.org.jboss.metadata_jboss.metadata>1.0.4</version.org.jboss.metadata_jboss.metadata>
+    <version.org.jboss.deployers.jboss_deployers_spi>2.2.0.Alpha4</version.org.jboss.deployers.jboss_deployers_spi>
+    <version.org.jboss.reloaded_jboss.reloaded.vdf.bootstrap.minimal>0.1.1</version.org.jboss.reloaded_jboss.reloaded.vdf.bootstrap.minimal>
+    <version.org.jboss.kernel>2.2.0.Alpha2</version.org.jboss.kernel>
+    <version.jboss.logging>2.2.0.CR1</version.jboss.logging>
+    <version.org.jboss.logmanager>1.2.0.CR1</version.org.jboss.logmanager>
+  
+  </properties>
+
+  <dependencies>
+  
+    <!-- 
+    Dependencies: org.jboss.ejb3.instantiator
+    -->
+   <dependency>
+     <groupId>org.jboss.ejb3.instantiator</groupId>
+     <artifactId>instantiator-spi</artifactId>
+     <version>${version}</version>
+   </dependency>
+    
+    
+    <!-- 
+    Dependencies: External to EJB3 
+    -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-spi</artifactId>
+      <version>${version.org.jboss.deployers.jboss_deployers_spi}</version>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <version>${version.org.jboss.kernel}</version>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.ejb3.instantiator</groupId>
+      <artifactId>instantiator-impl</artifactId>
+      <version>${version}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.metadata</groupId>
+      <artifactId>jboss-metadata</artifactId>
+      <version>${version.org.jboss.metadata_jboss.metadata}</version>
+      <scope>provided</scope>
+      <!-- Correct versions should come in through Reloaded or Deployers -->
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-vfs</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-mdr</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.reloaded</groupId>
+      <artifactId>jboss-reloaded-vdf-bootstrap-minimal</artifactId>
+      <version>${version.org.jboss.reloaded_jboss.reloaded.vdf.bootstrap.minimal}</version>
+      <scope>test</scope>
+    </dependency>
+    
+  </dependencies>
+  
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>${version.jboss.logging}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-log4j</artifactId>
+        <version>${version.jboss.logging}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-logmanager</artifactId>
+        <version>${version.jboss.logging}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.logmanager</groupId>
+        <artifactId>jboss-logmanager</artifactId>
+        <version>${version.org.jboss.logmanager}</version>
+        <scope>provided</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+</project>

Added: projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployer.java
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployer.java	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/main/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployer.java	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.instantiator.deployer;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.instantiator.spi.BeanInstantiator;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * VDF Deployer to attach a {@link BeanInstantiator} implementation
+ * (from autowiring) to the current EJB3 {@link DeploymentUnit}
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+
+public class BeanInstantiatorDeployer extends AbstractDeployer
+{
+
+   // ------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(BeanInstantiatorDeployer.class);
+
+   // ------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * {@link BeanInstantiator} implementation to attach to the {@link DeploymentUnit}
+    * if it's an EJB3 deployment
+    */
+   private final BeanInstantiator beanInstantiator;
+
+   // ------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public BeanInstantiatorDeployer(@Inject final BeanInstantiator beanInstantiator)
+   {
+      this.beanInstantiator = beanInstantiator;
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.deployers.spi.deployer.Deployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+    */
+   public void deploy(final DeploymentUnit unit) throws DeploymentException
+   {
+      // If not an EJB3 deployment, take no action
+      if (!this.isEjb3Deployment(unit))
+      {
+         return;
+      }
+
+      // Ensure the instantiator was injected
+      if (beanInstantiator == null)
+      {
+         throw new IllegalStateException("Bean instantiator implemenentation was not injected");
+      }
+
+      // Attach 
+      unit.addAttachment(BeanInstantiator.class, beanInstantiator);
+      if (log.isTraceEnabled())
+      {
+         log.trace("Using bean instantiator " + beanInstantiator + " for " + unit);
+      }
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Helper Methods --------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   /*
+    * These may be overridden for testing purposes
+    */
+
+   /**
+    * Returns whether this is an EJB3 Deployment, determining if we should take action
+    * @param unit
+    * @return
+    */
+   boolean isEjb3Deployment(final DeploymentUnit unit)
+   {
+      // Obtain the Merged Metadata
+      final JBossMetaData md = unit.getAttachment(JBossMetaData.class);
+
+      // If metadata's not present as an attachment, return
+      if (md == null)
+      {
+         return false;
+      }
+
+      // If this is not an EJB3 Deployment, return
+      if (!md.isEJB3x())
+      {
+         return false;
+      }
+
+      // Meets conditions
+      return true;
+   }
+
+}

Added: projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/META-INF/ejb3-instantiator-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/META-INF/ejb3-instantiator-deployer-jboss-beans.xml	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/main/resources/META-INF/ejb3-instantiator-deployer-jboss-beans.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+  <!--
+    EJB3 Bean Instantiator Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="org.jboss.ejb3.BeanInstantiatorDeployer"
+    class="org.jboss.ejb3.instantiator.deployer.BeanInstantiatorDeployer">
+    <!-- Assume we get the beanInstantiator autowired -->
+    <constructor>
+      <parameter name="beanInstantiator"><inject /></parameter>
+    </constructor>
+  </bean>
+
+</deployment>
\ No newline at end of file

Added: projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployerUnitTest.java
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployerUnitTest.java	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/BeanInstantiatorDeployerUnitTest.java	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,221 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.instantiator.deployer;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.bootstrap.api.descriptor.BootstrapDescriptor;
+import org.jboss.bootstrap.api.mc.server.MCServer;
+import org.jboss.bootstrap.api.mc.server.MCServerFactory;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.ejb3.instantiator.spi.BeanInstantiator;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.reloaded.api.ReloadedDescriptors;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Ensures the {@link BeanInstantiatorDeployer} is working as expected
+ * by attaching a {@link BeanInstantiator} implementation to the incoming
+ * {@link DeploymentUnit}.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class BeanInstantiatorDeployerUnitTest
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(BeanInstantiatorDeployerUnitTest.class);
+
+   /**
+    * The Server
+    */
+   private static MCServer server;
+
+   /**
+    * Name of the system property signaling JBossXB to ignore order
+    */
+   private static final String NAME_SYSPROP_JBOSSXB_IGNORE_ORDER = "xb.builder.useUnorderedSequence";
+
+   /**
+    * Value to set for JBossXB ordering
+    */
+   private static final String VALUE_SYSPROP_JBOSSXB_IGNORE_ORDER = "true";
+
+   /**
+    * MC bean name of the {@link MainDeployer}
+    */
+   protected static final String NAME_MC_MAIN_DEPLOYER = "MainDeployer";
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * {@link MainDeployer} implementation
+    */
+   private MainDeployer deployer;
+
+   /**
+    * Dummy deployment to run through the {@link BeanInstantiatorDeployer}
+    */
+   private VFSDeployment dummyDeployment;
+
+   //-------------------------------------------------------------------------------------||
+   // Lifecycle --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Setup JBossXB
+    * TODO @see comments below so that this step is not necessary
+    */
+   @BeforeClass
+   public static void setupJBossXb()
+   {
+      AccessController.doPrivileged(new PrivilegedAction<Void>()
+      {
+         public Void run()
+         {
+            // Must use unordered sequence else JBossXB will explode
+            //TODO Define a proper vfs.xml which is properly ordered
+            System.setProperty(NAME_SYSPROP_JBOSSXB_IGNORE_ORDER, VALUE_SYSPROP_JBOSSXB_IGNORE_ORDER);
+            return null;
+         }
+      });
+   }
+
+   /**
+    * Creates the server
+    */
+   @BeforeClass
+   public static void createAndConfigureServer()
+   {
+      // Create a server
+      final MCServer mcServer = MCServerFactory.createServer();
+
+      // Add the required bootstrap descriptors
+      final List<BootstrapDescriptor> descriptors = mcServer.getConfiguration().getBootstrapDescriptors();
+      descriptors.add(ReloadedDescriptors.getClassLoadingDescriptor());
+      descriptors.add(ReloadedDescriptors.getVdfDescriptor());
+
+      log.info("Using bootstrap descriptors:" + descriptors);
+
+      // Set
+      server = mcServer;
+   }
+
+   /**
+    * Starts the server before each test
+    * @throws Exception
+    */
+   @Before
+   public void startServerAndDeploy() throws Exception
+   {
+      // Start
+      server.start();
+
+      // Get the KernelController
+      final KernelController controller = server.getKernel().getController();
+
+      // Get the MainDeployer (should have been installed via the lifecycle)
+      final MainDeployer mainDeployer = (MainDeployer) controller.getInstalledContext(NAME_MC_MAIN_DEPLOYER)
+            .getTarget();
+      TestCase.assertNotNull(MainDeployer.class.getName() + " instance was not installed into MC", mainDeployer);
+      this.deployer = mainDeployer;
+
+      // Deploy the Bean Instantiator Deployer
+      final VirtualFile beanInstantiatorDeployerFile = VFS.getChild(this.getClass().getClassLoader().getResource(
+            "ejb3-instantiator-test-deployer-jboss-beans.xml").toURI());
+      deployer.deploy(VFSDeploymentFactory.getInstance().createVFSDeployment(beanInstantiatorDeployerFile));
+
+      // Deploy a dummy
+      final String deploymentName = "dummyDeployment";
+      final File deploymentFile = new File(this.getClass().getClassLoader().getResource(deploymentName).toURI());
+      TestCase.assertTrue(deploymentFile.exists());
+      final VirtualFile deploymentVf = VFS.getChild(this.getClass().getClassLoader().getResource(deploymentName)
+            .toURI());
+      final VFSDeployment dummyDeployment = VFSDeploymentFactory.getInstance().createVFSDeployment(deploymentVf);
+      deployer.addDeployment(dummyDeployment);
+      this.dummyDeployment = dummyDeployment;
+
+      // Run the pending deployments
+      deployer.process();
+      deployer.checkComplete();
+   }
+
+   /**
+    * Undeploys the dummy deployment
+    * @throws Exception
+    */
+   @After
+   public void undeploy() throws Exception
+   {
+      deployer.removeDeployment(dummyDeployment);
+      deployer.process();
+      deployer.checkComplete();
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Tests ------------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Ensures the {@link BeanInstantiatorDeployer} attaches the {@link BeanInstantiator} implementation
+    * to the deployment unit
+    */
+   @Test
+   public void beanInstantiatorDeployerCreatesAttachments() throws IOException, URISyntaxException, DeploymentException
+   {
+      // Get the last deployment
+      final DeploymentUnit unit = TestBeanInstantiatorDeployer.lastDeployment;
+      TestCase.assertNotNull("Could not obtain cached deployment unit to test", unit);
+
+      // Ensure the attachment is in place
+      final BeanInstantiator instantiator = unit.getAttachment(BeanInstantiator.class);
+      TestCase.assertNotNull(instantiator);
+
+   }
+
+}

Added: projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/TestBeanInstantiatorDeployer.java
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/TestBeanInstantiatorDeployer.java	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/test/java/org/jboss/ejb3/instantiator/deployer/TestBeanInstantiatorDeployer.java	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.instantiator.deployer;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.instantiator.spi.BeanInstantiator;
+
+/**
+ * Extension of the {@link BeanInstantiatorDeployer} used in testing.
+ * Caches statically the last deployment received.  Not thread-safe.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class TestBeanInstantiatorDeployer extends BeanInstantiatorDeployer
+{
+
+   /**
+    * The last deployment processed
+    */
+   static DeploymentUnit lastDeployment;
+
+   public TestBeanInstantiatorDeployer(@Inject final BeanInstantiator beanInstantiator)
+   {
+      super(beanInstantiator);
+   }
+
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.ejb3.instantiator.deployer.BeanInstantiatorDeployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+    */
+   @Override
+   public void deploy(final DeploymentUnit unit) throws DeploymentException
+   {
+      // Call business logic
+      super.deploy(unit);
+
+      // Cache the last deployment so the test can access it
+      lastDeployment = unit;
+   }
+
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.ejb3.instantiator.deployer.BeanInstantiatorDeployer#isEjb3Deployment(org.jboss.deployers.structure.spi.DeploymentUnit)
+    */
+   @Override
+   boolean isEjb3Deployment(final DeploymentUnit unit)
+   {
+      // Assume for testing we're an EJB3 deployment
+      return true;
+   }
+
+}

Added: projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/dummyDeployment
===================================================================

Added: projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/ejb3-instantiator-test-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/ejb3-instantiator-test-deployer-jboss-beans.xml	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/ejb3-instantiator-test-deployer-jboss-beans.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+  <!--
+    EJB3 Bean Instantiator Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="org.jboss.ejb3.BeanInstantiatorDeployer"
+    class="org.jboss.ejb3.instantiator.deployer.TestBeanInstantiatorDeployer">
+    <constructor>
+      <parameter name="beanInstantiator"><inject /></parameter>
+    </constructor>
+  </bean>
+  
+  <bean name="org.jboss.ejb3.BeanInstantiator"
+    class="org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator" />
+
+</deployment>
\ No newline at end of file

Added: projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/deployer/src/test/resources/log4j.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <!-- A time/date based rolling appender -->
+  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Threshold" value="INFO"/>
+    <param name="Append" value="false"/>
+
+    <!-- Rollover at midnight each day -->
+    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+    <!-- Rollover at the top of each hour
+    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+    -->
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+       -->
+    </layout>     
+  </appender>
+
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+    </layout>
+  </appender>
+
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+  
+  <category name="org.jboss">
+    <priority value="INFO"/>
+  </category>  
+  
+  <category name="org.jnp">
+    <priority value="INFO"/>
+  </category>
+  
+  <category name="org.jboss.ejb3.instantiator">
+    <priority value="ALL"/>
+  </category>
+  
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>


Property changes on: projects/ejb3/components/instantiator/trunk/impl
___________________________________________________________________
Name: svn:ignore
   + target
eclipse-target
target-eclipse
bin
.classpath
.project
.settings


Added: projects/ejb3/components/instantiator/trunk/impl/src/main/resources/META-INF/ejb3-bean-instantiator-jboss-beans.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/impl/src/main/resources/META-INF/ejb3-bean-instantiator-jboss-beans.xml	                        (rev 0)
+++ projects/ejb3/components/instantiator/trunk/impl/src/main/resources/META-INF/ejb3-bean-instantiator-jboss-beans.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+  <!--
+    Declares a EJB3 Bean Instantiator
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="org.jboss.ejb3.BeanInstantiator"
+    class="org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator" />
+
+</deployment>
\ No newline at end of file

Modified: projects/ejb3/components/instantiator/trunk/pom.xml
===================================================================
--- projects/ejb3/components/instantiator/trunk/pom.xml	2010-03-30 20:06:55 UTC (rev 103275)
+++ projects/ejb3/components/instantiator/trunk/pom.xml	2010-03-30 20:37:01 UTC (rev 103276)
@@ -45,6 +45,7 @@
   <modules>
     <module>spi</module>
     <module>build</module>
+    <module>deployer</module>
     <module>impl</module>
   </modules>
 




More information about the jboss-cvs-commits mailing list