[jboss-svn-commits] JBL Code SVN: r24139 - in labs/jbossesb/workspace/skeagh/container/microcontainer: src/main/java/org/jboss/esb/microcontainer and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 28 11:00:01 EST 2008


Author: beve
Date: 2008-11-28 11:00:01 -0500 (Fri, 28 Nov 2008)
New Revision: 24139

Added:
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/EsbMetaData.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/TestUtil.java
Removed:
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml
Modified:
   labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml
Log:
Updates to the Deployers. Still a work in progress as I'm learning as I go.


Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml	2008-11-28 16:00:01 UTC (rev 24139)
@@ -151,10 +151,10 @@
                 <excludes>
                     <!-- Excluding the deployers as they are not intended to go inte to generated jar. -->
                     <exclude>esb-deployers-jboss-beans.xml</exclude>
-                    <exclude>deployers.xml</exclude>
                 </excludes>
             </resource>
         </resources>
+        <!--
         <testResources>
             <testResource>
                 <directory>${basedir}/src/test/java</directory>
@@ -163,6 +163,7 @@
                     </excludes>
             </testResource>
         </testResources>
+        -->
 	    
 		<plugins>
 			<plugin>
@@ -198,6 +199,16 @@
 	           </file>
 	       </activation>
 	       <build>
+        	    <resources>
+                    <resource>
+                        <directory>${basedir}/src/main/resources/META-INF</directory>
+                        <filtering>false</filtering>
+                        <excludes>
+                            <!-- Excluding the deployers as they are not intended to go inte to generated jar. -->
+                            <exclude>esb-deployers-jboss-beans.xml</exclude>
+                        </excludes>
+                    </resource>
+                </resources>
 	           <plugins>
 	               <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
@@ -213,13 +224,11 @@
                                 <configuration>
                                     <tasks>
                                         <mkdir dir="${jboss.esb.deployer.dir}/META-INF"/>
+                                        
                                         <copy todir="${jboss.esb.deployer.dir}" overwrite="true">
                                             <fileset dir="${project.build.directory}/dependencies"  includes="*.jar" />
                                         </copy>
                                         <copy todir="${jboss.esb.deployer.dir}" overwrite="true" file="${project.build.directory}/${project.build.finalName}.jar" />
-                                        <copy todir="${jboss.as.conf.dir}" overwrite="true">
-                                            <fileset dir="${basedir}/src/main/resources"  includes="deployers.xml" />
-                                        </copy>
                                         <copy todir="${jboss.esb.deployer.dir}/META-INF" overwrite="true">
                                             <fileset dir="${basedir}/src/main/resources/META-INF"  includes="esb-deployers-jboss-beans.xml" />
                                         </copy>

Deleted: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * 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.esb.microcontainer.deployers;
-
-import java.io.Serializable;
-import java.net.URL;
-
-/**
- * Metadata for an ESB deployment.
- * </p>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * @since 5.0
- */
-public class EsbMetaData implements Serializable
-{
-    private static final long serialVersionUID = 0L;
-
-    private URL fileURL;
-    private String defaultName;
-    private String name;
-
-    public EsbMetaData()
-    {
-    }
-
-    public EsbMetaData(final URL fileURL, final String defaultName)
-    {
-        this.fileURL = fileURL;
-        this.defaultName = defaultName;
-    }
-
-    public URL getFileURL()
-    {
-        return fileURL;
-    }
-
-    public void setFileURL(final URL fileURL)
-    {
-        this.fileURL = fileURL;
-    }
-
-    public String getDefaultName()
-    {
-        return defaultName;
-    }
-
-    public String getName()
-    {
-        return name != null ? name : defaultName;
-    }
-
-    public void setName(final String name)
-    {
-        this.name = name;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder builder = new StringBuilder();
-        builder.append("fileURL=").append(fileURL);
-        builder.append(", defaultName=").append(defaultName);
-        return builder.toString();
-    }
-}

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -23,17 +23,15 @@
 import org.apache.log4j.Logger;
 import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.esb.microcontainer.metadata.EsbMetaData;
 import org.jboss.virtual.VirtualFile;
 
 /**
- * Esb deployer that picks up jboss-esb.xml files and .esb archives.
+ * EsbParserDeployer picks up jboss-esb.xml files and .esb archives.
  *
  * Sample configuration:
  * <pre>{@code
- *  <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer">
- *    <property name="esbFileSuffix">-esb.xml</property>
- *    <property name="esbArchiveSuffix">.esb</property>
- * </bean>
+ *  <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer"/>
  * }
  * </pre>
  *
@@ -51,66 +49,37 @@
     /**
      * The default suffix of JBossESB configuration files that should be picked up.
      */
-    private static final String DEFAULT_ESB_FILE_SUFFIX = "-esb.xml";
+    private static final String ESB_FILE_SUFFIX = "-esb.xml";
 
     /**
      * The default suffix of JBossESB archives that should be accepted.
      */
-    private static final String DEFAULT_ESB_JAR_SUFFIX = ".esb";
+    private static final String ESB_JAR_SUFFIX = ".esb";
 
     /**
-     * Configurable esb file suffix.
+     * Sole constructor.
      */
-    private String esbFileSuffix = DEFAULT_ESB_FILE_SUFFIX;
-
-    /**
-     * Configurable esb file suffix.
-     */
-    private String esbArchiveSuffix = DEFAULT_ESB_JAR_SUFFIX;
-
     public EsbParserDeployer()
     {
         super(EsbMetaData.class);
-        setSuffix(esbFileSuffix);
-        setJarExtension(esbArchiveSuffix);
+        setSuffix(ESB_FILE_SUFFIX);
+        setJarExtension(ESB_JAR_SUFFIX);
     }
 
     /**
+     * Parses a ESB deployment.
      *
-     * @param deploymentUnit
-     * @param file
-     * @param metaData
+     * @param deploymentUnit    The deployment unit to parse
+     * @param file              The virtual file of the deployment
+     * @param metaData          A possible pre-existing EsbMetaData
+     * @return EsbMetaData      {@link EsbMetaData} created with the virtual file of the deployment and the archive name.
      */
     @Override
-    protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metaData) throws Exception
+    protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metaData)
     {
-        log.info("Found ESB File '" + file.toURL() + "'");
-        return new EsbMetaData(file.toURL(), getDefaultName(file));
+        final EsbMetaData esbMetaData = new EsbMetaData(file, deploymentUnit.getSimpleName());
+        log.debug("Created EsbMetaData " + esbMetaData);
+        return esbMetaData;
     }
 
-    protected String getDefaultName(final VirtualFile file)
-    {
-        final String shortName = file.getName();
-        return shortName.substring(0, shortName.indexOf(esbFileSuffix));
-    }
-
-    public String getEsbFileSuffix()
-    {
-        return esbFileSuffix;
-    }
-
-    public void setEsbFileSuffix(String esbFileSuffix)
-    {
-        this.esbFileSuffix = esbFileSuffix;
-    }
-
-    public String getEsbArchiveSuffix()
-    {
-        return esbArchiveSuffix;
-    }
-
-    public void setEsbArchiveSuffix(String esbArchiveSuffix)
-    {
-        this.esbArchiveSuffix = esbArchiveSuffix;
-    }
 }

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -20,6 +20,8 @@
  */
 package org.jboss.esb.microcontainer.deployers;
 
+import java.io.IOException;
+
 import org.apache.log4j.Logger;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
@@ -28,11 +30,9 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.microcontainer.config.DeploymentUnitResourceLocator;
+import org.jboss.esb.microcontainer.metadata.EsbMetaData;
+import org.jboss.virtual.VirtualFile;
 
-import java.io.IOException;
-import java.net.URL;
-import java.util.concurrent.ConcurrentHashMap;
-
 /**
  * EsbDeployer takes care of the deployment of an esb archive or a single jboss-esb.xml
  * configuration file.
@@ -49,11 +49,6 @@
     private Logger log = Logger.getLogger(EsbRuntimeDeployer.class);
 
     /**
-     * Holds the deployment runtimes.
-     */
-    private ConcurrentHashMap<String, DeploymentRuntime> runtimes = new ConcurrentHashMap<String, DeploymentRuntime>();
-
-    /**
      * No args constructor.
      */
     public EsbRuntimeDeployer()
@@ -68,19 +63,19 @@
      *
      * @param deploymentUnit    The deployment unit to deploy.
      * @param esbMetaData       The ESB MetaData that is associated with the deployment unit.
+     *
+     * TODO: Remove the actual deployment from here. Instead create BeanMetaData for the DeploymentRuntime or
+     * as wrapper that has a start and stop method. Those lifecycle methods will be called then by MC./Daniel
      */
     @Override
     public void deploy(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData) throws DeploymentException
     {
         final String deploymentName = deploymentUnit.getName();
-
         try
         {
-            log.info("Deploying DeploymentName '" + deploymentName + "'");
-
             final DeploymentRuntime runtime = createRuntime(deploymentUnit, esbMetaData, deploymentName);
             runtime.deploy();
-            runtimes.putIfAbsent(deploymentName, runtime);
+            deploymentUnit.addAttachment(DeploymentRuntime.class, runtime);
         }
         catch (org.jboss.esb.api.exception.DeploymentException e)
         {
@@ -101,31 +96,26 @@
     @Override
     public void undeploy(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData)
     {
-        final String deploymentName = deploymentUnit.getName();
-        final DeploymentRuntime runtime = runtimes.get(deploymentName);
+        // Retrieve the runtime to undeploy from the deployment unit.
+        final DeploymentRuntime runtime = deploymentUnit.getAttachment(DeploymentRuntime.class);
         if (runtime != null)
         {
             try
             {
-                log.info("Undeploying '" + deploymentName + "'");
                 runtime.undeploy();
             }
             catch (final org.jboss.esb.api.exception.DeploymentException e)
             {
-                log.error("DeploymentException while trying to undeploy '" + deploymentName + "' : ", e);
+                log.error("DeploymentException while trying to undeploy '" + deploymentUnit.getName() + "' : ", e);
             }
-            finally
-            {
-                runtimes.remove(deploymentName);
-            }
         }
     }
 
     private DeploymentRuntime createRuntime(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData, final String deploymentName) throws org.jboss.esb.api.exception.DeploymentException, IOException
     {
         final ResourceLocator resourceLocator = new DeploymentUnitResourceLocator(deploymentUnit.getClassLoader());
-        final URL esbConfigURL = esbMetaData.getFileURL();
-        final DeploymentRuntime runtime = DeploymentUtil.createRuntime(esbConfigURL.openStream(), resourceLocator);
+        final VirtualFile esbConfig = esbMetaData.getEsbConfig();
+        final DeploymentRuntime runtime = DeploymentUtil.createRuntime(esbConfig.openStream(), resourceLocator);
         runtime.setDeploymentName(deploymentName);
         return runtime;
     }

Copied: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/EsbMetaData.java (from rev 24107, labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/EsbMetaData.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/EsbMetaData.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * 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.esb.microcontainer.metadata;
+
+import java.io.Serializable;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Metadata for an ESB deployment.
+ * The metadata consists of the deployment archive name(.esb or .jar) and a virtual
+ * file that provides access to the jboss-esb.xml configuration file.
+ * </p>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 5.0
+ */
+public class EsbMetaData implements Serializable
+{
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * VirtualFile to the jboss-esb.xml.
+     */
+    private VirtualFile esbConfig;
+
+    /**
+     * The name of the .esb archive.
+     */
+    private String archiveName;
+
+    /**
+     * Creates a EsbMetaData with the jboss-esb.xml as a VirtualFile and
+     * the name of the .esb archive.
+     *
+     * @param fileURL       The VirtualFile object to jboss-esb.xml.
+     * @param archiveName   The name of the .esb archive.
+     */
+    public EsbMetaData(final VirtualFile fileURL, final String archiveName)
+    {
+        this.esbConfig = fileURL;
+        this.archiveName = archiveName;
+    }
+
+    public VirtualFile getEsbConfig()
+    {
+        return esbConfig;
+    }
+
+    public String getAchiveName()
+    {
+        return archiveName;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("EsbMetaData[esbConfig='").append(esbConfig);
+        builder.append("', archiveName='").append(archiveName).append("']");
+        return builder.toString();
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/metadata/EsbMetaData.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml	2008-11-28 16:00:01 UTC (rev 24139)
@@ -4,9 +4,10 @@
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-	<!-- ESB deployer -->
 	<bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer"/>
 
 	<bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
+	
+	
 
 </deployment>

Deleted: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml	2008-11-28 16:00:01 UTC (rev 24139)
@@ -1,207 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-   The base deployers
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <classloader><inject bean="deployers-classloader:0.0.0"/></classloader>
-
-   <classloader name="deployers-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
-      <!-- FIXME
-      <root>${jboss.lib.url}/jboss-deployers-core-spi.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-core.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-client-spi.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-client.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-structure-spi.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-spi.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-impl.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-vfs-spi.jar</root>
-      <root>${jboss.lib.url}/jboss-deployers-vfs.jar</root>
-      -->
-   </classloader>
-
-  <!-- use legacy ordering -->
-   <bean name="topContextComparator">
-     <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
-   </bean>
-
-   <!-- The MainDeployer -->
-   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
-      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
-      <property name="deployers"><inject bean="Deployers"/></property>
-      <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
-      <property name="comparator"><inject bean="topContextComparator"/></property>
-   </bean>
-
-   <!-- The ManagedDeploymentCreator implementation that supports mapping
-      attachment types to ManagedDeployment#getTypes
-   -->
-   <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.TypedManagedDeploymentCreator" />
-
-   <!-- The holder for deployers that determine structure -->
-   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
-      <property name="structureBuilder">
-         <!-- The consolidator of the structure information -->
-         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
-      </property>
-      <!-- Accept any implementor of structure deployer -->
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-
-   <!-- The holder for deployers that do real deployment -->
-   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
-      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
-      <!-- Accept any implementor of deployer -->
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-
-   <!-- A declared structure descriptor deployer -->
-   <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
-
-    <!-- JAR Structure -->
-    <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
-       <!-- Unless specified the default list of suffixes is .zip, .ear, .jar, ,.rar, .war, .sar, .har, .aop -->
-       <constructor>
-          <parameter>
-             <set elementClass="java.lang.String">
-                <value>.zip</value>
-                <value>.ear</value>
-                <value>.jar</value>
-                <value>.rar</value>
-                <value>.war</value>
-                <value>.sar</value>
-                <value>.har</value>
-                <value>.aop</value>
-                <value>.deployer</value>
-                <value>.beans</value>
-                <value>.esb</value>
-             </set>
-          </parameter>
-       </constructor>
-       <property name="candidateStructureVisitorFactory">
-          <!-- Any file that is not an ordinary directory is a candidate -->
-          <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
-             <!-- A filter to exclude some obvious non-subdeployments -->
-             <property name="filter">
-                <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
-                   <constructor><parameter>
-                      <list elementClass="java.lang.String">
-                         <!-- Exclude class files as subdeployments -->
-                         <value>.class</value>
-                      </list>
-                   </parameter></constructor>
-                </bean>
-             </property>
-          </bean>
-       </property>
-    </bean>
-
-    <!-- File Structure -->
-    <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
-       <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
-       <constructor>
-          <parameter>
-             <set elementClass="java.lang.String">
-                <value>-service.xml</value>
-                <value>-beans.xml</value>
-                <value>-ds.xml</value>
-                <value>-aop.xml</value>
-             </set>
-          </parameter>
-       </constructor>
-    </bean>
-
-    <!-- AOP deployment -->
-    <bean name="AspectAppParsingDeployer" class="org.jboss.aop.asintegration.jboss5.AspectAppParsingDeployer"/>
-    <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
-       <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
-   </bean>
-
-   <!-- Use these instead of AspectDeployer
-   <bean name="AOPXMLMetaDataParserDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
-      <constructor>
-         <parameter>org.jboss.aop.microcontainer.beans.metadata.AOPDeployment</parameter>
-      </constructor>
-      <property name="suffix">-aop.xml</property>
-   </bean>
-   <bean name="AOPAnnotationMetaDataParserDeployer" class="org.jboss.aop.asintegration.jboss5.AOPAnnotationMetaDataParserDeployer">
-      <constructor>
-         <parameter><inject bean="AOPXMLMetaDataParserDeployer" property="relativeOrder"/></parameter>
-      </constructor>
-   </bean>
-   <bean name="AOPClassLoaderDeployer" class="org.jboss.aop.asintegration.jboss5.AOPClassLoaderDeployer">
-      <constructor>
-         <parameter><inject bean="ClassLoaderDeployer" property="relativeOrder"/></parameter>
-      </constructor>
-      <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
-   </bean>
-   <bean name="AOPDeploymentAopMetaDataDeployer" class="org.jboss.aop.asintegration.jboss5.AOPDeploymentAopMetaDataDeployer">
-      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
-      <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
-   </bean>
-   -->
-
-   <!-- POJO Deployment -->
-   <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer">
-      <property name="suffix">jboss-beans.xml</property>
-   </bean>
-   <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer">
-      <install bean="ManagedDeploymentCreator" method="addAttachmentType">
-         <parameter>
-            <value>org.jboss.kernel.spi.deployment.KernelDeployment</value>
-         </parameter>
-         <parameter>
-            <value>beans</value>
-         </parameter>
-      </install>
-      <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
-         <parameter>
-            <value>org.jboss.kernel.spi.deployment.KernelDeployment</value>
-         </parameter>        
-      </uninstall>
-   </bean>
-   <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
-      <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
-   </bean>
-
-   <!-- JMX Deployment -->
-   <bean name="ServiceMetaDataICF" class="org.jboss.system.deployers.managed.ServiceMetaDataICF">
-      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
-   </bean>
-   <bean name="SARDeployer" class="org.jboss.system.deployers.SARDeployer">
-      <property name="icf"><inject bean="ServiceMetaDataICF"/></property>
-   </bean>
-   <bean name="ServiceDeploymentDeployer" class="org.jboss.system.deployers.ServiceDeploymentDeployer">
-   </bean>
-   <bean name="ServiceDeployer" class="org.jboss.system.deployers.ServiceDeployer">
-       <constructor><parameter><inject bean="JMXKernel" property="serviceController"/></parameter></constructor>
-   </bean>
-
-   <!-- FIXME Remove this -->
-   <bean name="HackClassLoaderMetaDataDeployer" class="org.jboss.system.deployers.HackClassloaderMetaDataDeployer"/>
-   <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
-      <constructor>
-         <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
-      </constructor>
-      <property name="name">jboss-classloading.xml</property>
-      <property name="buildManagedObject">true</property>
-   </bean>
-   <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
-      <property name="defaultMetaData">
-         <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
-      </property>
-   </bean>
-   <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
-   <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
-   <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
-      <property name="classLoading"><inject bean="ClassLoading"/></property>
-   </bean>
-   <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
-      <property name="classLoading"><inject bean="ClassLoading"/></property>
-      <property name="system"><inject bean="ClassLoaderSystem"/></property>
-   </bean>
-   
-</deployment>

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -21,20 +21,11 @@
 package org.jboss.esb.microcontainer.deployers;
 
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
 
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.deployer.Deployers;
 import org.jboss.test.kernel.junit.MicrocontainerTest;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
 
 /**
  * Test for {@link EsbRuntimeDeployer}.
@@ -44,7 +35,6 @@
  */
 public class EsbDeployerTest extends MicrocontainerTest
 {
-    private DeploymentUnit deploymentUnit;
     private File esbConfigFile;
     private VirtualFile esbConfigVF;
 
@@ -53,175 +43,19 @@
         super(name);
     }
 
-    public void testParserDeployer() throws Throwable
-    {
-        final Object bean = assertDeployed("EsbParserDeployer");
-        assertTrue(bean instanceof EsbParserDeployer);
-
-        EsbParserDeployer esbParserDeployer = (EsbParserDeployer)bean;
-        esbParserDeployer.deploy(deploymentUnit);
-    }
-
+    //TODO : add tests. Sort of been prototyping with out being test driven
     public void testEsbDeployer() throws Throwable
     {
-        final Object bean = assertDeployed("EsbRuntimeDeployer");
-        assertTrue(bean instanceof EsbRuntimeDeployer);
-
-        EsbRuntimeDeployer deployer = (EsbRuntimeDeployer)bean;
-        deployer.deploy(deploymentUnit, new EsbMetaData(esbConfigFile.toURL(), "jbossesb"));
+        final MainDeployerImpl mainDeployer = (MainDeployerImpl) getBean("MainDeployer");
+        Deployers deployers = mainDeployer.getDeployers();
     }
 
     @Override
     public void setUp() throws Exception
     {
         super.setUp();
-        esbConfigFile = createEsbConfigFile("jboss-esb.xml");
-        esbConfigVF = getMockVF(esbConfigFile);
-        deploymentUnit = createDeploymentUnit(esbConfigVF);
+        esbConfigFile = TestUtil.createEsbConfigFile("jboss-esb.xml");
+        esbConfigVF = TestUtil.getMockVF(esbConfigFile);
     }
 
-    private Object assertDeployed(final String beanName)
-    {
-        final Object bean = getBean(beanName);
-        assertNotNull(bean);
-        return bean;
-    }
-
-    private DeploymentUnit createDeploymentUnit(final VirtualFile esbConfigVF)
-    {
-        AbstractVFSDeploymentContext context = new AbstractVFSDeploymentContext("esbTest", "esbTest", esbConfigVF, esbConfigVF.getPathName());
-        context.setClassLoader(getClass().getClassLoader());
-        DeploymentUnit unit = context.getDeploymentUnit();
-        unit.addAttachment(EsbMetaData.class.getName() + ".altDD", esbConfigVF);
-        return unit;
-    }
-
-    private File createEsbConfigFile(final String fileName)
-    {
-        return new File(getClass().getResource(fileName).getFile());
-    }
-
-    private static VirtualFile getMockVF(final File esbFile)
-    {
-        VirtualFile file = new VirtualFile(new VirtualFileHandler()
-        {
-            private static final long serialVersionUID = 1L;
-
-            public void close()
-            {
-            }
-
-            public boolean exists() throws IOException
-            {
-                return false;
-            }
-
-            public VirtualFileHandler getChild(String arg0) throws IOException
-            {
-                return null;
-            }
-
-            public List<VirtualFileHandler> getChildren(boolean arg0) throws IOException
-            {
-                return null;
-            }
-
-            public long getLastModified() throws IOException
-            {
-                return 0;
-            }
-
-            public String getName()
-            {
-                return esbFile.getName();
-            }
-
-            public VirtualFileHandler getParent() throws IOException
-            {
-                return null;
-            }
-
-            public String getPathName()
-            {
-                return esbFile.getAbsolutePath();
-            }
-
-            public long getSize() throws IOException
-            {
-                return 0;
-            }
-
-            public VFSContext getVFSContext()
-            {
-                return null;
-            }
-
-            public VirtualFile getVirtualFile()
-            {
-                return null;
-            }
-
-            public boolean hasBeenModified() throws IOException
-            {
-                return false;
-            }
-
-            public boolean isHidden() throws IOException
-            {
-                return false;
-            }
-
-            public boolean isLeaf() throws IOException
-            {
-                return false;
-            }
-
-            public String getLocalPathName()
-            {
-                return null;
-            }
-
-            public boolean isNested() throws IOException
-            {
-                return false;
-            }
-
-            public InputStream openStream() throws IOException
-            {
-                return null;
-            }
-
-            public URI toURI() throws URISyntaxException
-            {
-                return null;
-            }
-
-            public URL toURL() throws MalformedURLException, URISyntaxException
-            {
-                return null;
-            }
-
-            public URL toVfsUrl() throws MalformedURLException, URISyntaxException
-            {
-                return null;
-            }
-
-            public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
-            {
-            }
-
-            public boolean removeChild(String name) throws IOException
-            {
-                return false;
-            }
-
-            public boolean delete(int gracePeriod) throws IOException
-            {
-                return false;
-            }
-        });
-
-        return file;
-    }
-
 }

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml	2008-11-28 16:00:01 UTC (rev 24139)
@@ -2,9 +2,8 @@
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
    <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer">
-      <property name="esbFileSuffix">-esb.xml</property>
-      <property name="esbArchiveSuffix">.esb</property>
    </bean>
+   
    <bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
    
    <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">

Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/TestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/TestUtil.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/TestUtil.java	2008-11-28 16:00:01 UTC (rev 24139)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * 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.esb.microcontainer.deployers;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
+import org.jboss.esb.microcontainer.metadata.EsbMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Util methods used with tests.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class TestUtil
+{
+    private TestUtil()
+    {
+    }
+
+    public static DeploymentUnit createDeploymentUnit(final VirtualFile esbConfigVF)
+    {
+        AbstractVFSDeploymentContext context = new AbstractVFSDeploymentContext("esbTest", "esbTest", esbConfigVF, esbConfigVF.getPathName());
+        context.setClassLoader(TestUtil.class.getClassLoader());
+        DeploymentUnit unit = context.getDeploymentUnit();
+        unit.addAttachment(EsbMetaData.class.getName() + ".altDD", esbConfigVF);
+        return unit;
+    }
+
+    public static File createEsbConfigFile(final String fileName)
+    {
+        return new File(TestUtil.class.getResource(fileName).getFile());
+    }
+
+    public static VirtualFile getMockVF(final File esbFile)
+    {
+        VirtualFile file = new VirtualFile(new VirtualFileHandler()
+        {
+            private static final long serialVersionUID = 1L;
+
+            public void close()
+            {
+            }
+
+            public boolean exists() throws IOException
+            {
+                return false;
+            }
+
+            public VirtualFileHandler getChild(String arg0) throws IOException
+            {
+                return null;
+            }
+
+            public List<VirtualFileHandler> getChildren(boolean arg0) throws IOException
+            {
+                return null;
+            }
+
+            public long getLastModified() throws IOException
+            {
+                return 0;
+            }
+
+            public String getName()
+            {
+                return esbFile.getName();
+            }
+
+            public VirtualFileHandler getParent() throws IOException
+            {
+                return null;
+            }
+
+            public String getPathName()
+            {
+                return esbFile.getAbsolutePath();
+            }
+
+            public long getSize() throws IOException
+            {
+                return 0;
+            }
+
+            public VFSContext getVFSContext()
+            {
+                return null;
+            }
+
+            public VirtualFile getVirtualFile()
+            {
+                return null;
+            }
+
+            public boolean hasBeenModified() throws IOException
+            {
+                return false;
+            }
+
+            public boolean isHidden() throws IOException
+            {
+                return false;
+            }
+
+            public boolean isLeaf() throws IOException
+            {
+                return false;
+            }
+
+            public String getLocalPathName()
+            {
+                return null;
+            }
+
+            public boolean isNested() throws IOException
+            {
+                return false;
+            }
+
+            public InputStream openStream() throws IOException
+            {
+                return null;
+            }
+
+            public URI toURI() throws URISyntaxException
+            {
+                return null;
+            }
+
+            public URL toURL() throws MalformedURLException, URISyntaxException
+            {
+                return null;
+            }
+
+            public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+            {
+                return null;
+            }
+
+            public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
+            {
+            }
+
+            public boolean removeChild(String name) throws IOException
+            {
+                return false;
+            }
+
+            public boolean delete(int gracePeriod) throws IOException
+            {
+                return false;
+            }
+        });
+        return file;
+    }
+}

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml	2008-11-28 15:53:23 UTC (rev 24138)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml	2008-11-28 16:00:01 UTC (rev 24139)
@@ -31,9 +31,13 @@
    <!-- Limit categories -->
 
    <category name="org.jboss">
-      <priority value="debug"/>
+      <priority value="error"/>
    </category>
 
+   <category name="org.jboss.esb">
+      <priority value="info"/>
+   </category>
+
    <!-- ======================= -->
    <!-- Setup the Root category -->
    <!-- ======================= -->




More information about the jboss-svn-commits mailing list