[jboss-cvs] JBossAS SVN: r99233 - in projects/reloaded/tags: jboss-reloaded-naming-deployers-0.1.0-alpha-1 and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 11 13:33:28 EST 2010
Author: wolfc
Date: 2010-01-11 13:33:27 -0500 (Mon, 11 Jan 2010)
New Revision: 99233
Added:
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyContainer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml
Removed:
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java
projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml
Log:
[maven-release-plugin] copy for tag jboss-reloaded-naming-deployers-0.1.0-alpha-1
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1 (from rev 99103, projects/reloaded/trunk/naming-deployers)
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml
===================================================================
--- projects/reloaded/trunk/naming-deployers/pom.xml 2010-01-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml (from rev 99232, projects/reloaded/trunk/naming-deployers/pom.xml)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/pom.xml 2010-01-11 18:33:27 UTC (rev 99233)
@@ -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-1</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-1</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/jbossas/projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1</url>
+ </scm>
+</project>
\ No newline at end of file
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/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-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -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(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-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java (from rev 99104, 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-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/AppNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,78 @@
+/*
+ * 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);
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/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-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,79 +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);
- }
-
- @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);
- AbstractInjectionValueMetaData javaModule = new AbstractInjectionValueMetaData("java:module");
- javaModule.setSearch(new ParentsLookupStrategy());
- builder.addConstructorParameter(JavaEEModule.class.getName(), javaModule);
- if(appName != null)
- builder.addAnnotation(annotation(ApplicationScope.class, appName));
-
- unit.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
- }
-}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java (from rev 99104, 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-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ComponentNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,95 @@
+/*
+ * 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");
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/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-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,101 +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(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)
- {
- return informer.getModuleType(unit) != null;
- }
-}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java (from rev 99207, 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-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/ModuleNamingDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,103 @@
+/*
+ * 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;
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java 2010-01-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,59 +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.mc;
-
-import org.jboss.reloaded.naming.spi.JavaEEComponent;
-import org.jboss.reloaded.naming.spi.JavaEEModule;
-import org.jnp.interfaces.NamingContext;
-import org.jnp.server.NamingServer;
-
-/**
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class MCJavaEEComponent extends AbstractNameSpace implements JavaEEComponent
-{
- private JavaEEModule module;
-
- public MCJavaEEComponent(String name, JavaEEModule module)
- {
- super(name);
- this.module = module;
- }
-
- public JavaEEModule getModule()
- {
- return module;
- }
-
- @Override
- public void start() throws Exception
- {
- NamingServer srv = new NamingServer();
- context = new NamingContext(nameSpaces.getGlobalContext().getEnvironment(), null, srv);
- }
-
- @Override
- public void stop() throws Exception
- {
- context = null;
- }
-}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java (from rev 99104, projects/reloaded/trunk/naming-deployers/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/main/java/org/jboss/reloaded/naming/deployers/mc/MCJavaEEComponent.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,64 @@
+/*
+ * 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.mc;
+
+import org.jboss.logging.Logger;
+import org.jboss.reloaded.naming.spi.JavaEEComponent;
+import org.jboss.reloaded.naming.spi.JavaEEModule;
+import org.jnp.interfaces.NamingContext;
+import org.jnp.server.NamingServer;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class MCJavaEEComponent extends AbstractNameSpace implements JavaEEComponent
+{
+ private static final Logger log = Logger.getLogger(MCJavaEEComponent.class);
+
+ private JavaEEModule module;
+
+ public MCJavaEEComponent(String name, JavaEEModule module)
+ {
+ super(name);
+ this.module = module;
+ }
+
+ public JavaEEModule getModule()
+ {
+ return module;
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ NamingServer srv = new NamingServer();
+ context = new NamingContext(nameSpaces.getGlobalContext().getEnvironment(), null, srv);
+
+ log.debug("Installed context " + context + " for JavaEE component " + name + " in module " + module.getName());
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ context = null;
+ }
+}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyContainer.java (from rev 99104, projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyContainer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyContainer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyContainer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,106 @@
+/*
+ * 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.test.common;
+
+import org.jboss.logging.Logger;
+import org.jboss.reloaded.naming.CurrentComponent;
+import org.jboss.reloaded.naming.spi.JavaEEComponent;
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.util.naming.Util;
+
+import javax.naming.InitialContext;
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class DummyContainer
+{
+ private static Logger log = Logger.getLogger(DummyContainer.class);
+
+ private JavaEEComponent component;
+ private InitialContext ctx;
+
+ public DummyContainer(JavaEEComponent component)
+ {
+ this.component = component;
+ }
+
+ private <R> R around(Callable<R> callable)
+ {
+ CurrentComponent.push(component);
+ try
+ {
+ return callable.call();
+ }
+ catch(Exception e)
+ {
+ if(e instanceof RuntimeException)
+ throw (RuntimeException) e;
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ CurrentComponent.pop();
+ }
+ }
+
+ public Object getValue(final String name)
+ {
+ return around(new Callable<Object>() {
+ public Object call() throws Exception
+ {
+ return ctx.lookup(name);
+ }
+ });
+ }
+
+ public void setValue(final String name, final String value)
+ {
+ around(new Callable<Void>() {
+ public Void call() throws Exception
+ {
+ Util.bind(ctx, name, value);
+ return null;
+ }
+ });
+ }
+
+ public void start() throws Exception
+ {
+ ctx = new InitialContext();
+
+ // normally done somewhere else
+ NonSerializableFactory.rebind(component.getModule().getContext(), component.getName(), this);
+
+ log.info("Started container " + this + " with java:comp context " + component.getContext());
+ }
+
+ public void stop() throws Exception
+ {
+ Util.unbind(component.getModule().getContext(), component.getName());
+
+ if(ctx != null)
+ ctx.close();
+ ctx = null;
+ }
+}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyDeployer.java (from rev 99104, projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyDeployer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyDeployer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyDeployer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,79 @@
+/*
+ * 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.test.common;
+
+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.dependency.plugins.graph.Search;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+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.javaee.JavaEEComponentInformer;
+import org.jboss.reloaded.naming.spi.JavaEEComponent;
+
+import static org.jboss.reloaded.naming.deployers.util.AnnotationHelper.annotation;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class DummyDeployer extends AbstractSimpleRealDeployer<DummyMetaData>
+{
+ private JavaEEComponentInformer informer;
+
+ public DummyDeployer()
+ {
+ super(DummyMetaData.class);
+ setOutput(BeanMetaData.class);
+ setComponentsOnly(true);
+ //setUseUnitName(true);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, DummyMetaData deployment) throws DeploymentException
+ {
+ String appName = informer.getApplicationName(unit);
+ String moduleName = informer.getModulePath(unit);
+ String name = informer.getComponentName(unit);
+
+ // create JavaEEModule bean
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, DummyContainer.class.getName())
+ .addAnnotation(annotation(DeploymentScope.class, moduleName))
+ .addAnnotation(annotation(InstanceScope.class, name));
+ if(appName != null)
+ builder.addAnnotation(annotation(ApplicationScope.class, appName));
+ AbstractInjectionValueMetaData javaComponent = new AbstractInjectionValueMetaData("java:comp");
+ javaComponent.setSearch(Search.LOCAL);
+ builder.addConstructorParameter(JavaEEComponent.class.getName(), javaComponent);
+
+ unit.addAttachment(BeanMetaData.class, builder.getBeanMetaData());
+ }
+
+ public void setJavaEEComponentInformer(JavaEEComponentInformer informer)
+ {
+ this.informer = informer;
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java 2010-01-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,57 +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.test.common;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
-
-/**
- * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
- */
-public class DummyJavaEEModuleInformer extends DummyJavaEEApplicationInformer implements JavaEEModuleInformer
-{
- public String getApplicationName(DeploymentUnit deploymentUnit)
- {
- DeploymentUnit topLevel = deploymentUnit.getTopLevel();
- return super.getApplicationName(topLevel);
- }
-
- public String getModulePath(DeploymentUnit deploymentUnit)
- {
- String path = deploymentUnit.getRelativePath();
- if(path == null || path.length() == 0)
- path = deploymentUnit.getSimpleName();
- return path.substring(0, path.length() - 4);
- }
-
- public ModuleType getModuleType(DeploymentUnit deploymentUnit)
- {
- if(deploymentUnit.getSimpleName().endsWith(".jar"))
- return ModuleType.JAVA;
- return null;
- }
-
- public String[] getRequiredAttachments()
- {
- return super.getRequiredAttachments();
- }
-}
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java (from rev 99207, projects/reloaded/trunk/naming-deployers/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/common/DummyJavaEEModuleInformer.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,57 @@
+/*
+ * 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.test.common;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.reloaded.naming.deployers.javaee.JavaEEModuleInformer;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class DummyJavaEEModuleInformer extends DummyJavaEEApplicationInformer implements JavaEEModuleInformer
+{
+ public String getApplicationName(DeploymentUnit deploymentUnit)
+ {
+ DeploymentUnit topLevel = deploymentUnit.getTopLevel();
+ return super.getApplicationName(topLevel);
+ }
+
+ public String getModulePath(DeploymentUnit deploymentUnit)
+ {
+ String path = deploymentUnit.getRelativePath();
+ if(path == null || path.length() == 0)
+ path = deploymentUnit.getSimpleName();
+ return path.substring(0, path.length() - 4);
+ }
+
+ public ModuleType getModuleType(DeploymentUnit deploymentUnit)
+ {
+ if(deploymentUnit.getSimpleName().endsWith(".jar"))
+ return ModuleType.EJB;
+ return null;
+ }
+
+ public String[] getRequiredAttachments()
+ {
+ return super.getRequiredAttachments();
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/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-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,238 +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.service.NameSpaces;
-import org.jboss.virtual.AssembledDirectory;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import java.net.URL;
-
-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
- @Ignore
- 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"));
- 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/components"));
-
- 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-1/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java (from rev 99104, 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-1/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-1/src/test/java/org/jboss/reloaded/naming/deployers/test/simple/SimpleTestCase.java 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,262 @@
+/*
+ * 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;
+ }
+ }
+}
Deleted: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml
===================================================================
--- projects/reloaded/trunk/naming-deployers/src/test/resources/dummy-deployers-beans.xml 2010-01-07 07:51:30 UTC (rev 99103)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml 2010-01-11 18:33:27 UTC (rev 99233)
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="DummiesDeployer" class="org.jboss.reloaded.naming.deployers.test.common.DummiesDeployer"/>
-</deployment>
\ No newline at end of file
Copied: projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml (from rev 99104, projects/reloaded/trunk/naming-deployers/src/test/resources/dummy-deployers-beans.xml)
===================================================================
--- projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml (rev 0)
+++ projects/reloaded/tags/jboss-reloaded-naming-deployers-0.1.0-alpha-1/src/test/resources/dummy-deployers-beans.xml 2010-01-11 18:33:27 UTC (rev 99233)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="DummiesDeployer" class="org.jboss.reloaded.naming.deployers.test.common.DummiesDeployer"/>
+ <bean name="DummyDeployer" class="org.jboss.reloaded.naming.deployers.test.common.DummyDeployer">
+ <property name="javaEEComponentInformer"><inject bean="JavaEEComponentInformer"/></property>
+ </bean>
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list