[jboss-svn-commits] JBL Code SVN: r24141 - in labs/jbossesb/workspace/skeagh/container/microcontainer/src: test/java/org/jboss/esb/microcontainer/deployers and 4 other directories.

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


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

Added:
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.xml
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/test_esb_archives/
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/test_esb_archives/esb1.jar/
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/test_esb_archives/esb1.jar/META-INF/
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/test_esb_archives/esb1.jar/META-INF/jboss-esb.xml
Removed:
   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
Modified:
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java
Log:
Added a test for the parser deployer


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 16:25:57 UTC (rev 24140)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java	2008-11-28 16:26:00 UTC (rev 24141)
@@ -78,7 +78,7 @@
     protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metaData)
     {
         final EsbMetaData esbMetaData = new EsbMetaData(file, deploymentUnit.getSimpleName());
-        log.debug("Created EsbMetaData " + esbMetaData);
+        log.info("Created EsbMetaData " + esbMetaData);
         return esbMetaData;
     }
 

Deleted: 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 16:25:57 UTC (rev 24140)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java	2008-11-28 16:26:00 UTC (rev 24141)
@@ -1,61 +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.File;
-
-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;
-
-/**
- * Test for {@link EsbRuntimeDeployer}.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class EsbDeployerTest extends MicrocontainerTest
-{
-    private File esbConfigFile;
-    private VirtualFile esbConfigVF;
-
-    public EsbDeployerTest(final String name)
-    {
-        super(name);
-    }
-
-    //TODO : add tests. Sort of been prototyping with out being test driven
-    public void testEsbDeployer() throws Throwable
-    {
-        final MainDeployerImpl mainDeployer = (MainDeployerImpl) getBean("MainDeployer");
-        Deployers deployers = mainDeployer.getDeployers();
-    }
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        esbConfigFile = TestUtil.createEsbConfigFile("jboss-esb.xml");
-        esbConfigVF = TestUtil.getMockVF(esbConfigFile);
-    }
-
-}

Deleted: 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 16:25:57 UTC (rev 24140)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml	2008-11-28 16:26:00 UTC (rev 24141)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer">
-   </bean>
-   
-   <bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
-   
-   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
-      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
-      <property name="deployers"><inject bean="Deployers"/></property>
-   </bean>
-
-   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
-      <property name="structureBuilder">
-         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
-      </property>
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-
-   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
-      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
-      <incallback method="addDeployer"/>
-      <uncallback method="removeDeployer"/>
-   </bean>
-   
-</deployment>

Copied: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.java (from rev 24139, 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/EsbParserDeployerTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.java	2008-11-28 16:26:00 UTC (rev 24141)
@@ -0,0 +1,103 @@
+/*
+ * 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.net.URL;
+
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentUnit;
+import org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl;
+import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.deployers.vfs.spi.structure.StructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.esb.microcontainer.metadata.EsbMetaData;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Test for {@link EsbRuntimeDeployer}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class EsbParserDeployerTest extends MicrocontainerTest
+{
+    private EsbParserDeployer parserDeployer;
+    private String testArchivesDir = "/test_esb_archives";
+
+    public EsbParserDeployerTest(final String name)
+    {
+        super(name);
+    }
+
+    public void testEsbDeployer() throws Throwable
+    {
+        final String archiveName = "esb1.jar";
+
+        VirtualFile virtualFile = getVirtualFile(testArchivesDir, archiveName);
+        VFSDeploymentUnit deploymentUnit = getDeploymentUnit(virtualFile);
+        parserDeployer.parse(deploymentUnit, virtualFile, (EsbMetaData)null);
+    }
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        parserDeployer = (EsbParserDeployer) getBean("EsbParserDeployer");
+    }
+
+    private VFSDeploymentUnit getDeploymentUnit(final VirtualFile esbArchive) throws Exception
+    {
+        VFSDeploymentContext deploymentContext = getDeploymentContext(esbArchive);
+        return getDeploymentUnit(deploymentContext);
+    }
+
+    private VFSDeploymentUnit getDeploymentUnit(final VFSDeploymentContext deploymentContext)
+    {
+        return new AbstractVFSDeploymentUnit(deploymentContext);
+    }
+
+    private VFSDeploymentContext getDeploymentContext(final VirtualFile esbArchive) throws Exception
+    {
+        VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(esbArchive);
+        VFSStructuralDeployersImpl structuralDeployers = new VFSStructuralDeployersImpl();
+        VFSStructureBuilder builder = new VFSStructureBuilder();
+        structuralDeployers.setStructureBuilder(builder);
+        StructureDeployer[] deployers = new StructureDeployer[]{new JARStructure()};
+        for (StructureDeployer deployer : deployers)
+        {
+            structuralDeployers.addDeployer(deployer);
+        }
+        return (VFSDeploymentContext) structuralDeployers.determineStructure(deployment);
+    }
+
+
+    private VirtualFile getVirtualFile(String directory, String fileName) throws Exception
+    {
+        URL url = getResource(directory);
+        return VFS.getVirtualFile(url, fileName);
+    }
+
+}


Property changes on: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.xml (from rev 24139, 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/EsbParserDeployerTest.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.xml	2008-11-28 16:26:00 UTC (rev 24141)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer">
+   </bean>
+   
+   <bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
+   
+   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+      <property name="deployers"><inject bean="Deployers"/></property>
+   </bean>
+
+   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+      <property name="structureBuilder">
+         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+      </property>
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+
+   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+   
+</deployment>


Property changes on: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployerTest.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/test_esb_archives/esb1.jar/META-INF/jboss-esb.xml
===================================================================




More information about the jboss-svn-commits mailing list