[jboss-cvs] JBossAS SVN: r81229 - in projects/jboss-deployers/trunk/deployers-vfs/src/test: java/org/jboss/test/deployers/vfs/webbeans/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 18 11:10:07 EST 2008


Author: alesj
Date: 2008-11-18 11:10:07 -0500 (Tue, 18 Nov 2008)
New Revision: 81229

Added:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryImpl.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaData.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaDataDeployer.java
Modified:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscovery.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.xml
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/webbeans/simple/META-INF/application.properties
Log:
Add WB deployers.

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscovery.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscovery.java	2008-11-18 15:19:54 UTC (rev 81228)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscovery.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -28,8 +28,7 @@
  * discover the Web Beans to deploy
  *
  * @author Pete Muir
- * @author Ales Justin
- *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
 public interface WebBeanDiscovery
 {

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.deployers.vfs.webbeans.support;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployers.spi.DeploymentException;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryDeployer extends AbstractOptionalVFSRealDeployer<WebBeansMetaData>
+{
+   public WebBeanDiscoveryDeployer()
+   {
+      super(WebBeansMetaData.class);
+      addOutput(WebBeanDiscovery.class);
+   }
+
+   public void deploy(VFSDeploymentUnit unit, WebBeansMetaData deployment) throws DeploymentException
+   {
+      VFSDeploymentUnit topUnit = unit.getTopLevel();
+      WebBeanDiscoveryImpl wbdi = topUnit.getAttachment(WebBeanDiscovery.class.getName(), WebBeanDiscoveryImpl.class);
+      if (wbdi == null)
+      {
+         wbdi = new WebBeanDiscoveryImpl();
+         topUnit.addAttachment(WebBeanDiscovery.class.getName(), wbdi);
+      }
+
+      try
+      {
+         if (deployment != null)
+            wbdi.addWebBeansXmlURL(deployment.getURL());
+
+         // TODO - check classpath
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
+      }
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryImpl.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryImpl.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.deployers.vfs.webbeans.support;
+
+import java.net.URL;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * WBD impl.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryImpl implements WebBeanDiscovery
+{
+   private Set<Class<?>> classes = new HashSet<Class<?>>();
+   private Set<URL> urls = new HashSet<URL>();
+
+   public void addWebBeanClass(Class<?> clazz)
+   {
+      classes.add(clazz);
+   }
+
+   public void addWebBeansXmlURL(URL url)
+   {
+      urls.add(url);      
+   }
+
+   public Iterable<Class<?>> discoverWebBeanClasses()
+   {
+      return classes;
+   }
+
+   public Iterable<URL> discoverWebBeansXml()
+   {
+      return urls;
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaData.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaData.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaData.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.deployers.vfs.webbeans.support;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeansMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   private VirtualFile file;
+
+   public WebBeansMetaData(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      this.file = file;
+   }
+
+   public URL getURL() throws Exception
+   {
+      return file.toURL();
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaDataDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaDataDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeansMetaDataDeployer.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.deployers.vfs.webbeans.support;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeansMetaDataDeployer extends AbstractVFSParsingDeployer<WebBeansMetaData>  
+{
+   public WebBeansMetaDataDeployer()
+   {
+      super(WebBeansMetaData.class);
+      setName("web-beans.xml");
+   }
+
+   protected WebBeansMetaData parse(VFSDeploymentUnit unit, VirtualFile file, WebBeansMetaData root) throws Exception
+   {
+      return new WebBeansMetaData(file);
+   }
+}
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.java	2008-11-18 15:19:54 UTC (rev 81228)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.java	2008-11-18 16:10:07 UTC (rev 81229)
@@ -22,8 +22,9 @@
 package org.jboss.test.deployers.vfs.webbeans.test;
 
 import junit.framework.Test;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.vfs.webbeans.support.WebBeanDiscovery;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 
 /**
  * WebBeanDiscoveryTestCase.
@@ -48,7 +49,8 @@
       VFSDeploymentUnit topUnit = assertDeploy(ear);
       try
       {
-         getLog().debug(topUnit);
+         WebBeanDiscovery wbDiscovery = topUnit.getAttachment(WebBeanDiscovery.class);
+         assertNotNull(wbDiscovery);
       }
       finally
       {

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.xml	2008-11-18 15:19:54 UTC (rev 81228)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/webbeans/test/WebBeanDiscoveryTestCase.xml	2008-11-18 16:10:07 UTC (rev 81229)
@@ -3,4 +3,7 @@
   <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
   <bean name="WarStructure" class="org.jboss.deployers.vfs.plugins.structure.war.WARStructure"/>
 
+  <bean name="WBMDDeployer" class="org.jboss.test.deployers.vfs.webbeans.support.WebBeansMetaDataDeployer"/>
+  <bean name="WBDiscoveryDeployer" class="org.jboss.test.deployers.vfs.webbeans.support.WebBeanDiscoveryDeployer"/>
+
 </deployment>

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/webbeans/simple/META-INF/application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/webbeans/simple/META-INF/application.properties	2008-11-18 15:19:54 UTC (rev 81228)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/webbeans/simple/META-INF/application.properties	2008-11-18 16:10:07 UTC (rev 81229)
@@ -1,2 +1,3 @@
 jar-module=simple.jar
+ejb-module=ejbs.jar
 web-module=simple.war




More information about the jboss-cvs-commits mailing list