[jboss-cvs] JBossAS SVN: r99289 - in projects/reloaded/tags: jboss-reloaded-naming-deployers-0.1.0-alpha-2 and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 12 10:40:49 EST 2010


Author: wolfc
Date: 2010-01-12 10:40:47 -0500 (Tue, 12 Jan 2010)
New Revision: 99289

Added:
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java
Removed:
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java
   projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java
Log:
[maven-release-plugin]  copy for tag jboss-reloaded-naming-deployers-0.1.0-alpha-2

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2 (from rev 99274, projects/reloaded/trunk/naming-deployers)

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml
===================================================================
--- projects/reloaded/trunk/naming-deployers/pom.xml	2010-01-12 08:26:12 UTC (rev 99274)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,46 +0,0 @@
-<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/xsd/maven-4.0.0.xsd">
-   <parent>
-      <artifactId>jboss-reloaded-build</artifactId>
-      <groupId>org.jboss.reloaded</groupId>
-      <version>0.1.0-alpha-1</version>
-      <relativePath>../build/pom.xml</relativePath>
-   </parent>
-   <modelVersion>4.0.0</modelVersion>
-
-   <artifactId>jboss-reloaded-naming-deployers</artifactId>
-   <version>0.1.0-SNAPSHOT</version>
-   <packaging>jar</packaging>
-   <name>JBoss Reloaded Naming Deployers</name>
-   <description>
-      The integration point between Naming and VDF.
-   </description>
-
-   <dependencies>
-      <dependency>
-         <groupId>org.jboss.deployers</groupId>
-         <artifactId>jboss-deployers-vfs</artifactId>
-         <version>2.0.9.GA</version>
-         <scope>test</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.deployers</groupId>
-         <artifactId>jboss-deployers-spi</artifactId>
-         <version>2.0.9.GA</version>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.metadata</groupId>
-         <artifactId>jboss-metadata-ear</artifactId>
-         <version>2.0.0.Alpha</version>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.microcontainer</groupId>
-         <artifactId>jboss-kernel</artifactId>
-         <version>2.0.9.GA</version>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.reloaded</groupId>
-         <artifactId>jboss-reloaded-naming</artifactId>
-         <version>0.1.0-alpha-2</version>
-      </dependency>
-   </dependencies>
-</project>
\ No newline at end of file

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml (from rev 99288, projects/reloaded/trunk/naming-deployers/pom.xml)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/pom.xml	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,52 @@
+<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/xsd/maven-4.0.0.xsd">
+   <parent>
+      <artifactId>jboss-reloaded-build</artifactId>
+      <groupId>org.jboss.reloaded</groupId>
+      <version>0.1.0-alpha-1</version>
+      <relativePath>../build/pom.xml</relativePath>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+
+   <artifactId>jboss-reloaded-naming-deployers</artifactId>
+   <version>0.1.0-alpha-2</version>
+   <packaging>jar</packaging>
+   <name>JBoss Reloaded Naming Deployers</name>
+   <description>
+      The integration point between Naming and VDF.
+   </description>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.deployers</groupId>
+         <artifactId>jboss-deployers-vfs</artifactId>
+         <version>2.0.9.GA</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.deployers</groupId>
+         <artifactId>jboss-deployers-spi</artifactId>
+         <version>2.0.9.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.metadata</groupId>
+         <artifactId>jboss-metadata-ear</artifactId>
+         <version>2.0.0.Alpha</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.microcontainer</groupId>
+         <artifactId>jboss-kernel</artifactId>
+         <version>2.0.9.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.reloaded</groupId>
+         <artifactId>jboss-reloaded-naming</artifactId>
+         <version>0.1.0-alpha-2</version>
+      </dependency>
+   </dependencies>
+
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2</developerConnection>
+    <url>http://anonsvn.jboss.org/repos/jbossas/projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2</url>
+  </scm>
+</project>
\ No newline at end of file

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src (from rev 99273, projects/reloaded/trunk/naming-deployers/src)

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java	2010-01-12 08:05:58 UTC (rev 99273)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (c) 2009, 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.reloaded.naming.deployers;
-
-import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.plugins.scope.ApplicationScope;
-import org.jboss.reloaded.naming.deployers.javaee.JavaEEApplicationInformer;
-import org.jboss.reloaded.naming.deployers.mc.MCJavaEEApplication;
-
-import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
-
-/**
- * The AppNamingDeployer installs a JavaEEApplication MC bean under the name of java:app
- * within an application scope with the JavaEE application name.
- *
- * The JavaEEApplication MC bean will take care of initiating the java:app name space.
- *
- * To work properly it needs a JavaEEApplicationInformer.
- * 
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class AppNamingDeployer extends AbstractRealDeployer
-{
-   private JavaEEApplicationInformer informer;
-
-   public AppNamingDeployer(JavaEEApplicationInformer informer)
-   {
-      if(informer == null)
-         throw new NullPointerException("informer is null");
-      this.informer = informer;
-      setInputs(informer.getRequiredAttachments());
-      setOutputs("java:app");
-      setOutput(BeanMetaData.class);
-   }
-
-   @Override
-   protected void internalDeploy(DeploymentUnit deploymentUnit) throws DeploymentException
-   {
-      if(!isJavaEEApplication(deploymentUnit))
-         return;
-
-      String appName = informer.getApplicationName(deploymentUnit);
-      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("java:app", MCJavaEEApplication.class.getName())
-         .addAnnotation(annotation(ApplicationScope.class, appName))
-         .addConstructorParameter(String.class.getName(), appName);
-      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));
-      deploymentUnit.addAttachment("java:app:" + BeanMetaData.class, builder.getBeanMetaData());
-   }
-
-   protected boolean isJavaEEApplication(DeploymentUnit deploymentUnit)
-   {
-      return informer.isJavaEEApplication(deploymentUnit);
-   }
-}

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java (from rev 99287, projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2009, 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.reloaded.naming.deployers;
+
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEApplicationInformer;
+import org.jboss.reloaded.naming.deployers.mc.MCJavaEEApplication;
+
+import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
+
+/**
+ * The AppNamingDeployer installs a JavaEEApplication MC bean under the name of java:app
+ * within an application scope with the JavaEE application name.
+ *
+ * The JavaEEApplication MC bean will take care of initiating the java:app name space.
+ *
+ * To work properly it needs a JavaEEApplicationInformer.
+ * 
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class AppNamingDeployer extends AbstractRealDeployer
+{
+   private JavaEEApplicationInformer informer;
+
+   public AppNamingDeployer(JavaEEApplicationInformer informer)
+   {
+      if(informer == null)
+         throw new NullPointerException("informer is null");
+      this.informer = informer;
+      setInputs(informer.getRequiredAttachments());
+      setOutputs("java:app");
+      setOutput(BeanMetaData.class);
+   }
+
+   @Override
+   protected void internalDeploy(DeploymentUnit deploymentUnit) throws DeploymentException
+   {
+      if(!isJavaEEApplication(deploymentUnit))
+         return;
+
+      String appName = informer.getApplicationName(deploymentUnit);
+      // because BeanMetaDataDeployer.undeploy needs an unique name
+      String name = "jboss.naming:application=" + appName;
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, MCJavaEEApplication.class.getName())
+         .addAnnotation(annotation(ApplicationScope.class, appName))
+         .addConstructorParameter(String.class.getName(), appName)
+         .addAlias("java:app");
+      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));
+      deploymentUnit.addAttachment("java:app:" + BeanMetaData.class, builder.getBeanMetaData());
+   }
+
+   protected boolean isJavaEEApplication(DeploymentUnit deploymentUnit)
+   {
+      return informer.isJavaEEApplication(deploymentUnit);
+   }
+}

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java	2010-01-12 08:05:58 UTC (rev 99273)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (c) 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.reloaded.naming.deployers;
-
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.plugins.scope.ApplicationScope;
-import org.jboss.metadata.plugins.scope.DeploymentScope;
-import org.jboss.metadata.plugins.scope.InstanceScope;
-import org.jboss.reloaded.naming.deployers.dependency.ParentsLookupStrategy;
-import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
-import org.jboss.reloaded.naming.deployers.mc.MCJavaEEComponent;
-import org.jboss.reloaded.naming.spi.JavaEEModule;
-
-import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
-
-/**
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class ComponentNamingDeployer extends AbstractRealDeployer
-{
-   private JavaEEComponentInformer informer;
-
-   public ComponentNamingDeployer(JavaEEComponentInformer informer)
-   {
-      this.informer = informer;
-      setInputs(informer.getRequiredAttachments());
-      addInput("java:module");
-      setOutput(BeanMetaData.class);
-      // if we don't work on components only you'll see a duplicate install of java:module
-      // because AbstractDeploymentUnit.getAttachments inherits attachments from the parent.
-      setComponentsOnly(true);
-   }
-
-   @Override
-   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if(!informer.isJavaEEComponent(unit))
-         return;
-
-      String appName = informer.getApplicationName(unit);
-      String moduleName = informer.getModulePath(unit);
-      String name = informer.getComponentName(unit);
-
-      // create JavaEEModule bean
-      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("java:comp", MCJavaEEComponent.class.getName())
-         .addAnnotation(annotation(DeploymentScope.class, moduleName))
-         .addAnnotation(annotation(InstanceScope.class, name))
-         .addConstructorParameter(String.class.getName(), name);
-      if(appName != null)
-         builder.addAnnotation(annotation(ApplicationScope.class, appName));
-      AbstractInjectionValueMetaData javaModule = new AbstractInjectionValueMetaData("java:module");
-      javaModule.setSearch(new ParentsLookupStrategy());
-      builder.addConstructorParameter(JavaEEModule.class.getName(), javaModule);
-      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));      
-
-      // VDF can't do component composition, so each BMD must be in a separate component
-      DeploymentUnit component = unit.getParent().addComponent(name + ".java:comp");
-      component.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
-   }
-
-   @Override
-   protected void internalUndeploy(DeploymentUnit unit)
-   {
-      if(!informer.isJavaEEComponent(unit))
-         return;
-      
-      String name = informer.getComponentName(unit);
-      unit.removeComponent(name + ".java:comp");
-   }
-}

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java (from rev 99287, projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 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.reloaded.naming.deployers;
+
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+import org.jboss.metadata.plugins.scope.InstanceScope;
+import org.jboss.reloaded.naming.deployers.dependency.ParentsLookupStrategy;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEComponentInformer;
+import org.jboss.reloaded.naming.deployers.mc.MCJavaEEComponent;
+import org.jboss.reloaded.naming.spi.JavaEEModule;
+
+import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class ComponentNamingDeployer extends AbstractRealDeployer
+{
+   private JavaEEComponentInformer informer;
+
+   public ComponentNamingDeployer(JavaEEComponentInformer informer)
+   {
+      this.informer = informer;
+      setInputs(informer.getRequiredAttachments());
+      addInput("java:module");
+      setOutput(BeanMetaData.class);
+      // if we don't work on components only you'll see a duplicate install of java:module
+      // because AbstractDeploymentUnit.getAttachments inherits attachments from the parent.
+      setComponentsOnly(true);
+   }
+
+   @Override
+   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
+   {
+      if(!informer.isJavaEEComponent(unit))
+         return;
+
+      String appName = informer.getApplicationName(unit);
+      String moduleName = informer.getModulePath(unit);
+      String componentName = informer.getComponentName(unit);
+
+      // create JavaEEModule bean
+      String name = "jboss.naming:";
+      if(appName != null)
+         name += "application=" + appName + ",";
+      name += "module=" + moduleName + ",component=" + componentName;
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, MCJavaEEComponent.class.getName())
+         .addAnnotation(annotation(DeploymentScope.class, moduleName))
+         .addAnnotation(annotation(InstanceScope.class, componentName))
+         .addConstructorParameter(String.class.getName(), componentName)
+         .addAlias("java:comp");
+      if(appName != null)
+         builder.addAnnotation(annotation(ApplicationScope.class, appName));
+      AbstractInjectionValueMetaData javaModule = new AbstractInjectionValueMetaData("java:module");
+      javaModule.setSearch(new ParentsLookupStrategy());
+      builder.addConstructorParameter(JavaEEModule.class.getName(), javaModule);
+      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));      
+
+      // VDF can't do component composition, so each BMD must be in a separate component
+      DeploymentUnit component = unit.getParent().addComponent(componentName + ".java:comp");
+      component.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
+   }
+
+   @Override
+   protected void internalUndeploy(DeploymentUnit unit)
+   {
+      if(!informer.isJavaEEComponent(unit))
+         return;
+      
+      String name = informer.getComponentName(unit);
+      unit.removeComponent(name + ".java:comp");
+   }
+}

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java	2010-01-12 08:05:58 UTC (rev 99273)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (c) 2009, 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.reloaded.naming.deployers;
-
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.plugins.scope.ApplicationScope;
-import org.jboss.metadata.plugins.scope.DeploymentScope;
-import org.jboss.reloaded.naming.deployers.dependency.ParentsLookupStrategy;
-import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
-import org.jboss.reloaded.naming.deployers.mc.MCJavaEEModule;
-import org.jboss.reloaded.naming.spi.JavaEEApplication;
-
-import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
-
-/**
- * The ModuleNamingDeployer installs a JavaEEModule MC bean under the name of java:module
- * within an application scope with the JavaEE application name and an deployment scope
- * with the JavaEE module name.
- *
- * The JavaEEApplication MC bean will take care of initiating the java:app name space.
- *
- * To work properly it needs a JavaEEApplicationInformer.
- *
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class ModuleNamingDeployer extends AbstractRealDeployer
-{
-   private JavaEEModuleInformer informer;
-
-   public ModuleNamingDeployer(JavaEEModuleInformer informer)
-   {
-      this.informer = informer;
-      setInputs(informer.getRequiredAttachments());
-      addInput("java:app");
-      setOutput(BeanMetaData.class);
-   }
-
-   @Override
-   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
-   {
-      if(!isJavaEEModule(unit))
-         return;
-      
-      // appName is either the name of the JavaEE application or null for a stand-alone JavaEE module
-      String appName = informer.getApplicationName(unit);
-      String name = informer.getModulePath(unit);
-
-      // create JavaEEModule bean
-      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("java:module", MCJavaEEModule.class.getName())
-         .addAnnotation(annotation(DeploymentScope.class, name))
-         .addConstructorParameter(String.class.getName(), name);
-      if(appName != null)
-      {
-         builder.addAnnotation(annotation(ApplicationScope.class, appName));
-         AbstractInjectionValueMetaData javaApp = new AbstractInjectionValueMetaData("java:app");
-         javaApp.setSearch(new ParentsLookupStrategy());
-         builder.addConstructorParameter(JavaEEApplication.class.getName(), javaApp);
-      }
-      else
-         builder.addConstructorParameter(JavaEEApplication.class.getName(), (Object) null);
-      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));
-
-      unit.addAttachment("java:module:" + BeanMetaData.class, builder.getBeanMetaData());
-   }
-
-   /**
-    * Determine whether the given deployment unit is a JavaEE module which needs
-    * a java:module name space.
-    * @param unit
-    * @return
-    */
-   protected boolean isJavaEEModule(DeploymentUnit unit)
-   {
-      // TODO: isn't this using too much inside information? It would be better to have the deployer execute explicitly on naming meta data.
-      JavaEEModuleInformer.ModuleType type = informer.getModuleType(unit);
-      return type != null && type != JavaEEModuleInformer.ModuleType.JAVA;
-   }
-}

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java (from rev 99287, projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2009, 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.reloaded.naming.deployers;
+
+import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+import org.jboss.reloaded.naming.deployers.dependency.ParentsLookupStrategy;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
+import org.jboss.reloaded.naming.deployers.mc.MCJavaEEModule;
+import org.jboss.reloaded.naming.spi.JavaEEApplication;
+
+import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
+
+/**
+ * The ModuleNamingDeployer installs a JavaEEModule MC bean under the name of java:module
+ * within an application scope with the JavaEE application name and an deployment scope
+ * with the JavaEE module name.
+ *
+ * The JavaEEApplication MC bean will take care of initiating the java:app name space.
+ *
+ * To work properly it needs a JavaEEApplicationInformer.
+ *
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class ModuleNamingDeployer extends AbstractRealDeployer
+{
+   private JavaEEModuleInformer informer;
+
+   public ModuleNamingDeployer(JavaEEModuleInformer informer)
+   {
+      this.informer = informer;
+      setInputs(informer.getRequiredAttachments());
+      addInput("java:app");
+      setOutput(BeanMetaData.class);
+   }
+
+   @Override
+   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
+   {
+      if(!isJavaEEModule(unit))
+         return;
+      
+      // appName is either the name of the JavaEE application or null for a stand-alone JavaEE module
+      String appName = informer.getApplicationName(unit);
+      String moduleName = informer.getModulePath(unit);
+
+      // create JavaEEModule bean
+      String name = "jboss.naming:";
+      if(appName != null)
+         name += "application=" + appName + ",";
+      name += "module=" + moduleName;
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, MCJavaEEModule.class.getName())
+         .addAnnotation(annotation(DeploymentScope.class, moduleName))
+         .addConstructorParameter(String.class.getName(), moduleName)
+         .addAlias("java:module");
+      if(appName != null)
+      {
+         builder.addAnnotation(annotation(ApplicationScope.class, appName));
+         AbstractInjectionValueMetaData javaApp = new AbstractInjectionValueMetaData("java:app");
+         javaApp.setSearch(new ParentsLookupStrategy());
+         builder.addConstructorParameter(JavaEEApplication.class.getName(), javaApp);
+      }
+      else
+         builder.addConstructorParameter(JavaEEApplication.class.getName(), (Object) null);
+      builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));
+
+      unit.addAttachment("java:module:" + BeanMetaData.class, builder.getBeanMetaData());
+   }
+
+   /**
+    * Determine whether the given deployment unit is a JavaEE module which needs
+    * a java:module name space.
+    * @param unit
+    * @return
+    */
+   protected boolean isJavaEEModule(DeploymentUnit unit)
+   {
+      // TODO: isn't this using too much inside information? It would be better to have the deployer execute explicitly on naming meta data.
+      JavaEEModuleInformer.ModuleType type = informer.getModuleType(unit);
+      return type != null && type != JavaEEModuleInformer.ModuleType.JAVA;
+   }
+}

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java	2010-01-12 08:05:58 UTC (rev 99273)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (c) 2009, 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.reloaded.naming.deployers.mc;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.naming.Util;
-import org.jboss.reloaded.naming.spi.JavaEEApplication;
-import org.jboss.reloaded.naming.spi.JavaEEModule;
-
-import javax.naming.Context;
-
-/**
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class MCJavaEEModule extends AbstractNameSpace implements JavaEEModule
-{
-   private static final Logger log = Logger.getLogger(MCJavaEEModule.class);
-   
-   private JavaEEApplication application;
-   private Context parentContext;
-
-   public MCJavaEEModule(String name, JavaEEApplication application)
-   {
-      super(name);
-      this.application = application;
-   }
-
-   public JavaEEApplication getApplication()
-   {
-      return application;
-   }
-
-   @Override
-   public void start() throws Exception
-   {
-      parentContext = (application != null ? application.getContext() : nameSpaces.getGlobalContext());
-      context = Util.createSubcontext(parentContext, name);
-      log.debug("Installed context " + context + " for JavaEE module " + name + ", parentContext = " + parentContext);
-   }
-
-   @Override
-   public void stop() throws Exception
-   {
-      Util.unbind(parentContext, name);
-      context = null;
-      parentContext = null;
-   }
-}

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java (from rev 99287, projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEModule.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2009, 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.reloaded.naming.deployers.mc;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+import org.jboss.reloaded.naming.spi.JavaEEApplication;
+import org.jboss.reloaded.naming.spi.JavaEEModule;
+
+import javax.naming.Context;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class MCJavaEEModule extends AbstractNameSpace implements JavaEEModule
+{
+   private static final Logger log = Logger.getLogger(MCJavaEEModule.class);
+   
+   private JavaEEApplication application;
+   private Context parentContext;
+
+   public MCJavaEEModule(String name, JavaEEApplication application)
+   {
+      super(name);
+      this.application = application;
+   }
+
+   public JavaEEApplication getApplication()
+   {
+      return application;
+   }
+
+   @Override
+   public void start() throws Exception
+   {
+      parentContext = (application != null ? application.getContext() : nameSpaces.getGlobalContext());
+      context = Util.createSubcontext(parentContext, name);
+      log.debug("Installed context " + context + " for JavaEE module " + name + ", application = " + application + ", parentContext = " + parentContext);
+   }
+
+   @Override
+   public void stop() throws Exception
+   {
+      Util.unbind(parentContext, name);
+      context = null;
+      parentContext = null;
+   }
+}

Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java	2010-01-12 08:05:58 UTC (rev 99273)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -1,262 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (c) 2009, 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.reloaded.naming.deployers.test.simple;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
-import org.jboss.deployers.vfs.plugins.client.AbstractVFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.bootstrap.AbstractBootstrap;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.metadata.ear.jboss.JBossAppMetaData;
-import org.jboss.reloaded.naming.deployers.test.common.DummiesMetaData;
-import org.jboss.reloaded.naming.deployers.test.common.DummyContainer;
-import org.jboss.reloaded.naming.service.NameSpaces;
-import org.jboss.util.naming.Util;
-import org.jboss.virtual.AssembledDirectory;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import java.net.URL;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-/**
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class SimpleTestCase
-{
-   private static Kernel kernel;
-   private static BasicXMLDeployer deployer;
-   private static MainDeployer mainDeployer;
-   private static InitialContext ctx;
-
-   protected static final void assertNameNotFound(String name) throws NamingException
-   {
-      try
-      {
-         ctx.lookup(name);
-         fail("Expected NameNotFoundException for " + name);
-      }
-      catch(NameNotFoundException e)
-      {
-         // good
-      }
-   }
-
-   @BeforeClass
-   public static void beforeClass() throws Exception
-   {
-      AbstractBootstrap bootstrap = new BasicBootstrap();
-      bootstrap.run();
-      kernel = bootstrap.getKernel();
-      deployer = new BasicXMLDeployer(kernel, ControllerMode.AUTOMATIC);
-
-      deploy(SimpleTestCase.class.getClassLoader(), "classloader.xml");
-      deploy(SimpleTestCase.class.getClassLoader(), "deployers.xml");
-
-      mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployer.class);
-
-      deploy(SimpleTestCase.class.getClassLoader(), "jndi-beans.xml");
-      deploy(SimpleTestCase.class.getClassLoader(), "reloaded-naming-deployers-beans.xml");
-
-      deploy(SimpleTestCase.class.getClassLoader(), "dummy-deployers-beans.xml");
-
-      ctx = new InitialContext();
-   }
-
-   protected static <T> T getBean(String name, ControllerState state, Class<T> expectedType)
-   {
-      ControllerContext context = kernel.getController().getContext(name, state);
-      return expectedType.cast(context.getTarget());
-   }
-   
-   protected static KernelDeployment deploy(URL url) throws Exception
-   {
-      try
-      {
-         return deployer.deploy(url);
-      }
-      catch(Throwable t)
-      {
-         if(t instanceof Error)
-            throw (Error) t;
-         if(t instanceof RuntimeException)
-            throw (RuntimeException) t;
-         throw (Exception) t;
-      }
-   }
-
-   public static KernelDeployment deploy(ClassLoader cl, String resource) throws Exception
-   {
-      URL url = cl.getResource(resource);
-      if(url == null)
-         throw new IllegalArgumentException("Can't find resource '" + resource + "'");
-      try
-      {
-         return deploy(url);
-      }
-      finally
-      {
-         validate();
-      }
-   }
-
-   @Test
-   public void test1() throws Exception
-   {
-      AssembledDirectory root1 = AssembledDirectory.createAssembledDirectory("test1", "test1.ear");
-      VFSDeployment deployment1 = new AbstractVFSDeployment(root1);
-      ((MutableAttachments) deployment1.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
-      mainDeployer.deploy(deployment1);
-
-      AssembledDirectory root2 = AssembledDirectory.createAssembledDirectory("test2", "test2.ear");
-      AssembledDirectory moduleA = root2.mkdir("moduleA.jar");
-      VFSDeployment deployment2 = new AbstractVFSDeployment(root2);
-      ((MutableAttachments) deployment2.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
-      mainDeployer.deploy(deployment2);
-
-      InitialContext ctx = new InitialContext();
-      NameSpaces nameSpaces = getBean("NameSpaces", ControllerState.INSTALLED, NameSpaces.class);
-      assertNotNull(nameSpaces.getGlobalContext());
-      // basically the lookup is what really checks the functionality, not null is a bonus
-      assertNotNull(ctx.lookup("java:global"));
-      assertNotNull(ctx.lookup("java:global/test1"));
-      assertNotNull(ctx.lookup("java:global/test2"));
-      assertNotNull(ctx.lookup("java:global/test2/moduleA"));
-
-      mainDeployer.undeploy(deployment1);
-      mainDeployer.undeploy(deployment2);
-
-      assertNameNotFound("java:global/test1");
-      assertNameNotFound("java:global/test2");
-   }
-
-   @Test
-   public void testComponents() throws Exception
-   {
-      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("components", "components.jar");
-      VFSDeployment deployment = new AbstractVFSDeployment(root);
-      //((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(DummiesMetaData.class, DummiesMetaData.create("A", "B"));
-      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(DummiesMetaData.class, DummiesMetaData.create("A", "B"));
-      mainDeployer.deploy(deployment);
-
-      // basically the lookup is what really checks the functionality, not null is a bonus
-      assertNotNull(ctx.lookup("java:global"));
-      Context c = (Context) ctx.lookup("java:global/components");
-      assertNotNull(c);
-
-      Util.bind(c, "test", "Hello world");
-
-      DummyContainer containerA = (DummyContainer) ctx.lookup("java:global/components/A");
-
-      String result = (String) containerA.getValue("java:module/test");
-      assertEquals("Hello world", result);
-
-      DummyContainer containerB = (DummyContainer) ctx.lookup("java:global/components/B");
-
-      containerA.setValue("java:comp/local", "a local value");
-      try
-      {
-         containerB.getValue("java:comp/local");
-      }
-      catch(RuntimeException e)
-      {
-         // good
-         // TODO: should be a NameNotFoundException
-      }
-
-      mainDeployer.undeploy(deployment);
-
-      assertNameNotFound("java:global/components");
-   }
-
-   @Test
-   public void testPath() throws Exception
-   {
-      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("testPath", "testPath.ear");
-      AssembledDirectory path = root.mkdir("path");
-      AssembledDirectory moduleA = path.mkdir("modulePath.jar");
-      VFSDeployment deployment = new AbstractVFSDeployment(root);
-      // so we don't need an EAR structure deployer
-      StructureMetaData smd = StructureMetaDataFactory.createStructureMetaData();
-      smd.addContext(StructureMetaDataFactory.createContextInfo("path/modulePath.jar"));
-      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(StructureMetaData.class, smd);
-      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
-      mainDeployer.deploy(deployment);
-
-      // basically the lookup is what really checks the functionality, not null is a bonus
-      assertNotNull(ctx.lookup("java:global"));
-      assertNotNull(ctx.lookup("java:global/testPath/path/modulePath"));
-
-      mainDeployer.undeploy(deployment);
-
-      assertNameNotFound("java:global/testPath/path/modulePath");
-   }
-
-   @Test
-   public void testStandaloneModule() throws Exception
-   {
-      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("standalone", "standalone.jar");
-      VFSDeployment deployment = new AbstractVFSDeployment(root);
-      mainDeployer.deploy(deployment);
-
-      // basically the lookup is what really checks the functionality, not null is a bonus
-      assertNotNull(ctx.lookup("java:global"));
-      assertNotNull(ctx.lookup("java:global/standalone"));
-
-      mainDeployer.undeploy(deployment);
-
-      assertNameNotFound("java:global/standalone");
-   }
-
-   protected static void validate() throws Exception
-   {
-      try
-      {
-         deployer.validate();
-      }
-      catch(Throwable t)
-      {
-         if(t instanceof Error)
-            throw (Error) t;
-         if(t instanceof RuntimeException)
-            throw (RuntimeException) t;
-         throw (Exception) t;
-      }
-   }
-}

Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java (from rev 99287, projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java	                        (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-2/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java	2010-01-12 15:40:47 UTC (rev 99289)
@@ -0,0 +1,292 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2009, 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.reloaded.naming.deployers.test.simple;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.deployers.vfs.plugins.client.AbstractVFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.AbstractBootstrap;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.reloaded.naming.deployers.test.common.DummiesMetaData;
+import org.jboss.reloaded.naming.deployers.test.common.DummyContainer;
+import org.jboss.reloaded.naming.service.NameSpaces;
+import org.jboss.util.naming.Util;
+import org.jboss.virtual.AssembledDirectory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class SimpleTestCase
+{
+   private static Kernel kernel;
+   private static BasicXMLDeployer deployer;
+   private static MainDeployer mainDeployer;
+   private static InitialContext ctx;
+
+   protected static final void assertNameNotFound(String name) throws NamingException
+   {
+      try
+      {
+         ctx.lookup(name);
+         fail("Expected NameNotFoundException for " + name);
+      }
+      catch(NameNotFoundException e)
+      {
+         // good
+      }
+   }
+
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractBootstrap bootstrap = new BasicBootstrap();
+      bootstrap.run();
+      kernel = bootstrap.getKernel();
+      deployer = new BasicXMLDeployer(kernel, ControllerMode.AUTOMATIC);
+
+      deploy(SimpleTestCase.class.getClassLoader(), "classloader.xml");
+      deploy(SimpleTestCase.class.getClassLoader(), "deployers.xml");
+
+      mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployer.class);
+
+      deploy(SimpleTestCase.class.getClassLoader(), "jndi-beans.xml");
+      deploy(SimpleTestCase.class.getClassLoader(), "reloaded-naming-deployers-beans.xml");
+
+      deploy(SimpleTestCase.class.getClassLoader(), "dummy-deployers-beans.xml");
+
+      ctx = new InitialContext();
+   }
+
+   protected static <T> T getBean(String name, ControllerState state, Class<T> expectedType)
+   {
+      ControllerContext context = kernel.getController().getContext(name, state);
+      return expectedType.cast(context.getTarget());
+   }
+   
+   protected static KernelDeployment deploy(URL url) throws Exception
+   {
+      try
+      {
+         return deployer.deploy(url);
+      }
+      catch(Throwable t)
+      {
+         if(t instanceof Error)
+            throw (Error) t;
+         if(t instanceof RuntimeException)
+            throw (RuntimeException) t;
+         throw (Exception) t;
+      }
+   }
+
+   public static KernelDeployment deploy(ClassLoader cl, String resource) throws Exception
+   {
+      URL url = cl.getResource(resource);
+      if(url == null)
+         throw new IllegalArgumentException("Can't find resource '" + resource + "'");
+      try
+      {
+         return deploy(url);
+      }
+      finally
+      {
+         validate();
+      }
+   }
+
+   @Test
+   public void test1() throws Exception
+   {
+      AssembledDirectory root1 = AssembledDirectory.createAssembledDirectory("test1", "test1.ear");
+      VFSDeployment deployment1 = new AbstractVFSDeployment(root1);
+      ((MutableAttachments) deployment1.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
+      mainDeployer.deploy(deployment1);
+
+      AssembledDirectory root2 = AssembledDirectory.createAssembledDirectory("test2", "test2.ear");
+      AssembledDirectory moduleA = root2.mkdir("moduleA.jar");
+      VFSDeployment deployment2 = new AbstractVFSDeployment(root2);
+      ((MutableAttachments) deployment2.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
+      mainDeployer.deploy(deployment2);
+
+      InitialContext ctx = new InitialContext();
+      NameSpaces nameSpaces = getBean("NameSpaces", ControllerState.INSTALLED, NameSpaces.class);
+      assertNotNull(nameSpaces.getGlobalContext());
+      // basically the lookup is what really checks the functionality, not null is a bonus
+      assertNotNull(ctx.lookup("java:global"));
+      assertNotNull(ctx.lookup("java:global/test1"));
+      assertNotNull(ctx.lookup("java:global/test2"));
+      assertNotNull(ctx.lookup("java:global/test2/moduleA"));
+
+      mainDeployer.undeploy(deployment1);
+      mainDeployer.undeploy(deployment2);
+
+      assertNameNotFound("java:global/test1");
+      assertNameNotFound("java:global/test2");
+   }
+
+   @Test
+   public void testComponents() throws Exception
+   {
+      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("components", "components.jar");
+      VFSDeployment deployment = new AbstractVFSDeployment(root);
+      //((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(DummiesMetaData.class, DummiesMetaData.create("A", "B"));
+      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(DummiesMetaData.class, DummiesMetaData.create("A", "B"));
+      mainDeployer.deploy(deployment);
+
+      // basically the lookup is what really checks the functionality, not null is a bonus
+      assertNotNull(ctx.lookup("java:global"));
+      Context c = (Context) ctx.lookup("java:global/components");
+      assertNotNull(c);
+
+      Util.bind(c, "test", "Hello world");
+
+      DummyContainer containerA = (DummyContainer) ctx.lookup("java:global/components/A");
+
+      String result = (String) containerA.getValue("java:module/test");
+      assertEquals("Hello world", result);
+
+      DummyContainer containerB = (DummyContainer) ctx.lookup("java:global/components/B");
+
+      containerA.setValue("java:comp/local", "a local value");
+      try
+      {
+         containerB.getValue("java:comp/local");
+      }
+      catch(RuntimeException e)
+      {
+         // good
+         // TODO: should be a NameNotFoundException
+      }
+
+      mainDeployer.undeploy(deployment);
+
+      assertNameNotFound("java:global/components");
+   }
+
+   @Test
+   public void testPath() throws Exception
+   {
+      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("testPath", "testPath.ear");
+      AssembledDirectory path = root.mkdir("path");
+      AssembledDirectory moduleA = path.mkdir("modulePath.jar");
+      VFSDeployment deployment = new AbstractVFSDeployment(root);
+      // so we don't need an EAR structure deployer
+      StructureMetaData smd = StructureMetaDataFactory.createStructureMetaData();
+      smd.addContext(StructureMetaDataFactory.createContextInfo("path/modulePath.jar"));
+      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(StructureMetaData.class, smd);
+      ((MutableAttachments) deployment.getPredeterminedManagedObjects()).addAttachment(JBossAppMetaData.class, new JBossAppMetaData());
+      mainDeployer.deploy(deployment);
+
+      // basically the lookup is what really checks the functionality, not null is a bonus
+      assertNotNull(ctx.lookup("java:global"));
+      assertNotNull(ctx.lookup("java:global/testPath/path/modulePath"));
+
+      mainDeployer.undeploy(deployment);
+
+      assertNameNotFound("java:global/testPath/path/modulePath");
+   }
+
+   @Test
+   public void testStandaloneModule() throws Exception
+   {
+      AssembledDirectory root = AssembledDirectory.createAssembledDirectory("standalone", "standalone.jar");
+      VFSDeployment deployment = new AbstractVFSDeployment(root);
+      mainDeployer.deploy(deployment);
+
+      // basically the lookup is what really checks the functionality, not null is a bonus
+      assertNotNull(ctx.lookup("java:global"));
+      assertNotNull(ctx.lookup("java:global/standalone"));
+
+      mainDeployer.undeploy(deployment);
+
+      assertNameNotFound("java:global/standalone");
+   }
+
+   // make sure we don't undeploy the wrong module (because of BeanMetaDataDeployer.undeploy ignoring scope)
+   @Test
+   public void testStandaloneModule2() throws Exception
+   {
+      AssembledDirectory root1 = AssembledDirectory.createAssembledDirectory("standalone1", "standalone1.jar");
+      VFSDeployment deployment1 = new AbstractVFSDeployment(root1);
+      mainDeployer.deploy(deployment1);
+
+      AssembledDirectory root2 = AssembledDirectory.createAssembledDirectory("standalone2", "standalone2.jar");
+      VFSDeployment deployment2 = new AbstractVFSDeployment(root2);
+      mainDeployer.deploy(deployment2);
+
+      // basically the lookup is what really checks the functionality, not null is a bonus
+      assertNotNull(ctx.lookup("java:global/standalone1"));
+      assertNotNull(ctx.lookup("java:global/standalone2"));
+
+      mainDeployer.undeploy(deployment2);
+
+//      assertNotNull(ctx.lookup("java:global/standalone1"));
+//      assertNameNotFound("java:global/standalone2");
+
+      mainDeployer.deploy(deployment2);
+
+      assertNotNull(ctx.lookup("java:global/standalone1"));
+      assertNotNull(ctx.lookup("java:global/standalone2"));
+      
+      mainDeployer.undeploy(deployment1);
+      mainDeployer.undeploy(deployment2);
+   }
+
+   protected static void validate() throws Exception
+   {
+      try
+      {
+         deployer.validate();
+      }
+      catch(Throwable t)
+      {
+         if(t instanceof Error)
+            throw (Error) t;
+         if(t instanceof RuntimeException)
+            throw (RuntimeException) t;
+         throw (Exception) t;
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list