[jboss-cvs] JBossAS SVN: r84669 - in projects/ejb3/trunk/nointerface: src/main/java/org/jboss/ejb3/nointerface and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 24 07:43:51 EST 2009
Author: jaikiran
Date: 2009-02-24 07:43:51 -0500 (Tue, 24 Feb 2009)
New Revision: 84669
Added:
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceViewInvocationHandler.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java
projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/connectionmanager/
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/connectionmanager/MockCachedConnectionManager.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EJB3DeploymentUnit.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbComponentDeployer.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbDeployment.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbModuleDeployer.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/SimpleClassLoaderDeployer.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/javaee/
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/javaee/SimpleJavaEEModuleInformer.java
projects/ejb3/trunk/nointerface/src/test/resources/conf/
projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap.xml
projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/
projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/jmx.xml
projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/maindeployer.xml
projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/naming.xml
projects/ejb3/trunk/nointerface/src/test/resources/deploy/
projects/ejb3/trunk/nointerface/src/test/resources/deploy/aop-beans.xml
projects/ejb3/trunk/nointerface/src/test/resources/deployers/
projects/ejb3/trunk/nointerface/src/test/resources/deployers/aop-deployers-jboss-beans.xml
projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-jboss-beans.xml
Modified:
projects/ejb3/trunk/nointerface/pom.xml
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceEJBViewCreator.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSLSBWithoutInterface.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java
Log:
EJBTHREE-1727 No-interface view initial implementation
Modified: projects/ejb3/trunk/nointerface/pom.xml
===================================================================
--- projects/ejb3/trunk/nointerface/pom.xml 2009-02-24 07:54:12 UTC (rev 84668)
+++ projects/ejb3/trunk/nointerface/pom.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -22,13 +22,40 @@
<description>No-Interface implementation for EJB as defined by section 3.4.4 in EJB3.1 spec</description>
<properties>
+ <version.org.jboss.deployers>[2.0.0.CR5]</version.org.jboss.deployers>
<version.org.jboss_jboss-vfs>2.0.1.GA</version.org.jboss_jboss-vfs>
<version.javassist>3.7.1.GA</version.javassist>
+ <version.org.jboss.ejb3_jboss-ejb3-test>1.0.0</version.org.jboss.ejb3_jboss-ejb3-test>
+ <version.org.jboss.ejb3_jboss-ejb3-deployers>1.0.1-SNAPSHOT</version.org.jboss.ejb3_jboss-ejb3-deployers>
+
</properties>
+ <build>
+ <testResources>
+ <testResource>
+ <!-- Relative to tests-classes -->
+ <targetPath>../test-resources</targetPath>
+ <directory>${basedir}/src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/target/test-resources</additionalClasspathElement>
+ </additionalClasspathElements>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+
<dependencies>
@@ -39,12 +66,30 @@
<scope>test</scope>
</dependency>
+ <!-- Test support from jboss-ejb3-test -->
<dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-test</artifactId>
+ <version>${version.org.jboss.ejb3_jboss-ejb3-test}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Bootstrap -->
+ <dependency>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>${version.javassist}</version>
</dependency>
+ <!-- JBoss logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
@@ -55,6 +100,78 @@
<artifactId>jboss-ejb-api</artifactId>
</dependency>
+ <!-- JBoss Metadata -->
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ </dependency>
+ <!-- JBoss deployers -->
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.org.jboss.deployers}</version>
+ </dependency>
+
+ <!-- EJB3 deployers only for test scope-->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-deployers</artifactId>
+ <version>${version.org.jboss.ejb3_jboss-ejb3-deployers}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Note: Finally this dependency on core needs to go -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-core</artifactId>
+ <version>1.0.0</version>
+
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-transaction-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-proxy</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+
+
+ <!-- The EJB3.1 API support (ex: @LocalBean) -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ <!-- Transaction support for tests -->
+ <!-- This jboss-ejb3-jta-profile dependency provides a jboss-beans.xml through which the transaction manager gets deployed -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-jta-profile</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceEJBViewCreator.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceEJBViewCreator.java 2009-02-24 07:54:12 UTC (rev 84668)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceEJBViewCreator.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -21,9 +21,12 @@
*/
package org.jboss.ejb3.nointerface;
+import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javassist.ClassPool;
@@ -34,6 +37,7 @@
import javassist.Modifier;
import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
* NoInterfaceEJBViewCreator
@@ -102,8 +106,8 @@
beanCtClass);
// We need to maintain a reference of the container in the proxy, so that we can
- // forward the method calls to container.invoke. Create a new field in the sub-class (proxy)
- CtField containerField = CtField.make("private java.lang.reflect.InvocationHandler container;", proxyCtClass);
+ // forward the method calls to invocationHandler.invoke. Create a new field in the sub-class (proxy)
+ CtField containerField = CtField.make("private java.lang.reflect.InvocationHandler invocationHandler;", proxyCtClass);
proxyCtClass.addField(containerField);
// get all public methods from the bean class
@@ -130,19 +134,7 @@
// then it will be changed in the proxy to
// public String sayHi(String name) { java.lang.reflect.Method currentMethod = beanClass.getName() + ".class.getMethod(theMethodName,params);
// return container.invoke(this,currentMethod,args); }
- proxyPublicMethod.setBody("{"
- +
- // The proxy needs to call the container.invoke
- // the InvocationHandler.invoke accepts (Object proxy,Method method,Object[] args)
- // The proxy needs to create a java.lang.reflect.Method object based on the "current method"
- // that is invoked on the proxy. Note that we need to get the Method from the super class (i.e. the
- // bean class) of the proxy, since that's our "target" method
- // Note: All the '$' parameters used are javassist specific syntax
- "java.lang.reflect.Method currentMethod = " + beanClass.getName() + ".class.getMethod(\""
- + beanPublicMethod.getName() + "\",$sig);" +
- // At this point we have the container, the proxy, the Method to be invoked and the parameters to be passed
- // All we have to do is invoke the container
- "return ($r) container.invoke((java.lang.Object)this,currentMethod,$args);" + "}");
+ proxyPublicMethod = overridePublicMethod(container, beanClass, beanPublicMethod, proxyPublicMethod);
// We have now created the overriden method. We need to add it to the proxy
proxyCtClass.addMethod(proxyPublicMethod);
if (logger.isTraceEnabled())
@@ -151,13 +143,16 @@
+ proxyCtClass.getName() + " for bean " + beanClass.getName());
}
}
+ // Add java.io.Serializable as the interface for the proxy (since it goes into JNDI)
+ proxyCtClass.addInterface(pool.get(Serializable.class.getName()));
+
// We are almost done (except for setting the container field in the proxy)
// Let's first create a java.lang.Class (i.e. load) out of the javassist class
// using the classloader of the bean
Class<?> proxyClass = proxyCtClass.toClass(beanClass.getClassLoader());
// time to set the container field through normal java reflection
Object proxyInstance = proxyClass.newInstance();
- Field containerInProxy = proxyClass.getDeclaredField("container");
+ Field containerInProxy = proxyClass.getDeclaredField("invocationHandler");
containerInProxy.setAccessible(true);
containerInProxy.set(proxyInstance, container);
@@ -166,6 +161,25 @@
}
+ protected <T> CtMethod overridePublicMethod(InvocationHandler container, Class<T> beanClass,
+ CtMethod publicMethodOnBean, CtMethod publicMethodOnProxy) throws Exception
+ {
+ publicMethodOnProxy.setBody("{"
+ +
+ // The proxy needs to call the container.invoke
+ // the InvocationHandler.invoke accepts (Object proxy,Method method,Object[] args)
+ // This view needs to create a java.lang.reflect.Method object based on the "current method"
+ // that is invoked on the view. Note that we need to get the Method from the beanclass.
+ // Note: All the '$' parameters used are javassist specific syntax
+ "java.lang.reflect.Method currentMethod = " + beanClass.getName() + ".class.getMethod(\""
+ + publicMethodOnBean.getName() + "\",$sig);" +
+ // At this point we have the container, the Method to be invoked and the parameters to be passed
+ // All we have to do is invoke the container
+ "return ($r) invocationHandler.invoke(this,currentMethod,$args);" + "}");
+
+ return publicMethodOnProxy;
+ }
+
/**
* Returns all public, non-static and non-final methods for the class
*
@@ -173,7 +187,7 @@
* @return
* @throws Exception
*/
- private Set<CtMethod> getAllPublicNonStaticNonFinalMethods(CtClass ctClass) throws Exception
+ protected Set<CtMethod> getAllPublicNonStaticNonFinalMethods(CtClass ctClass) throws Exception
{
CtMethod[] allMethods = ctClass.getMethods();
Set<CtMethod> publicMethods = new HashSet<CtMethod>();
@@ -202,19 +216,18 @@
* @return
* @throws Exception
*/
- private boolean shouldMethodBeSkipped(CtClass beanCtClass, CtMethod ctMethod) throws Exception
+ protected boolean shouldMethodBeSkipped(CtClass beanCtClass, CtMethod ctMethod) throws Exception
{
- // List<CtMethod> declaredMethods = Arrays.asList(beanCtClass.getDeclaredMethods());
- // if (declaredMethods.contains(ctMethod))
- // {
- // return false;
- // }
- // CtClass objectCtClass = ClassPool.getDefault().get(Object.class.getName());
- // CtMethod[] methodsInObjectClass = objectCtClass.getMethods();
- // List<CtMethod> methodsToBeSkipped = Arrays.asList(methodsInObjectClass);
- // return methodsToBeSkipped.contains(ctMethod);
- return false;
+ List<CtMethod> declaredMethods = Arrays.asList(beanCtClass.getDeclaredMethods());
+ if (declaredMethods.contains(ctMethod))
+ {
+ return false;
+ }
+ CtClass objectCtClass = ClassPool.getDefault().get(Object.class.getName());
+ CtMethod[] methodsInObjectClass = objectCtClass.getMethods();
+ List<CtMethod> methodsToBeSkipped = Arrays.asList(methodsInObjectClass);
+ return methodsToBeSkipped.contains(ctMethod);
}
@@ -223,7 +236,7 @@
*
* @return
*/
- private long getNextUniqueNumber()
+ protected long getNextUniqueNumber()
{
synchronized (nextUniqueNumberLock)
{
Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceViewInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceViewInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/NoInterfaceViewInvocationHandler.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+
+/**
+ * NoInterfaceViewInvocationHandler
+ *
+ * An {@link InvocationHandler} which corresponds to the
+ * no-interface view of a {@link EJBContainer}. All calls on the no-interface
+ * view are routed through this {@link InvocationHandler} to the container.
+ *
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class NoInterfaceViewInvocationHandler implements InvocationHandler
+{
+
+ /**
+ * The container to which this invocation handler corresponds to.
+ * All calls to this invocation handler will be forwarded to this
+ * container.
+ *
+ */
+ private InvokableContext container;
+
+ /**
+ * Constructor
+ * @param container
+ */
+ public NoInterfaceViewInvocationHandler(InvokableContext container)
+ {
+ assert container != null : "Container is null for no-interface view invocation handler";
+ this.container = container;
+ }
+
+ /**
+ * The calls to the no-interface view of the {@link EJBContainer}
+ * are routed through this {@link InvocationHandler}
+ *
+ * @param proxy TODO: RIght now we pass null for the Stateless bean and sessionId for the stateful bean
+ * Needs more thought/work for this param
+ *
+ * @param method The invoked method
+ * @param args The arguments to the method
+ */
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ // TODO: Some methods like toString() can be handled locally.
+ // But as of now let's just pass it on to the container.
+ assert this.container != null : "Container not yet available to the no-interface view invocation handler";
+ SerializableMethod serializableMethod = new SerializableMethod(method);
+ return this.container.invoke(proxy, serializableMethod, args);
+
+ }
+
+ public InvokableContext getContainer()
+ {
+ return this.container;
+ }
+}
Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,281 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.deployers;
+
+import java.io.Externalizable;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.javaee.JavaEEComponentHelper;
+import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.javaee.SimpleJavaEEModule;
+import org.jboss.ejb3.nointerface.mc.NoInterfaceViewMCBean;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * EJB3NoInterfaceDeployer
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJB3NoInterfaceDeployer extends AbstractDeployer
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(EJB3NoInterfaceDeployer.class);
+
+ /**
+ * Constructor
+ */
+ public EJB3NoInterfaceDeployer()
+ {
+ setStage(DeploymentStages.POST_CLASSLOADER);
+ setInput(JBossMetaData.class);
+ addOutput(BeanMetaData.class);
+
+ }
+
+ /**
+ * Deploy the deployment unit
+ */
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Deploying unit " + unit.getName());
+ }
+ JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+ if (metaData == null)
+ {
+ if (logger.isTraceEnabled())
+ logger.trace("No JBossMetadata for unit : " + unit.getName());
+ return;
+ }
+ // work on the ejbs
+ JBossEnterpriseBeansMetaData beans = metaData.getEnterpriseBeans();
+ for (JBossEnterpriseBeanMetaData bean : beans)
+ {
+ if (bean.isSession())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Found bean of type session: " + bean.getEjbClass() + " in unit " + unit.getName());
+ }
+ // Create view for each bean
+ deploy(unit, (JBossSessionBeanMetaData) bean);
+ }
+ }
+
+ }
+
+ /**
+ * Creates a {@link NoInterfaceViewMCBean} for the no-interface view represented by the
+ * <code>sessionBeanMetaData</code>. The {@link NoInterfaceViewMCBean} is created only
+ * if the bean is eligible for a no-interface view as defined by the EJB3.1 spec
+ *
+ *
+ * @param unit
+ * @param sessionBeanMetaData
+ * @throws DeploymentException
+ */
+ private void deploy(DeploymentUnit unit, JBossSessionBeanMetaData sessionBeanMetaData) throws DeploymentException
+ {
+ try
+ {
+ if (!isEligibleForNoInterfaceView(unit, sessionBeanMetaData))
+ {
+ logger.debug("Bean " + sessionBeanMetaData.getEjbClass() + " is not eligible for no-interface view");
+ return;
+ }
+ Class<?> beanClass = Class.forName(sessionBeanMetaData.getEjbClass(), false, unit.getClassLoader());
+
+ // Doesn't work - returns null (in ejb3-test environment). So until then temporarily use a hack
+ //String containerMCBeanName = sessionBeanMetaData.getContainerName();
+ JavaEEModule module = new SimpleJavaEEModule(unit.getSimpleName());
+ String ejbName = sessionBeanMetaData.getEjbName();
+ String containerMCBeanName = JavaEEComponentHelper.createObjectName(module, ejbName);
+
+ // The no-interface view needs to be a MC bean so that it can "depend" on the container, so let's
+ // make the no-interface view a MC bean
+ NoInterfaceViewMCBean bean = new NoInterfaceViewMCBean(beanClass, sessionBeanMetaData);
+ String noInterfaceViewMCBeanName = sessionBeanMetaData.getEjbName() + "@" + ((Object) bean).toString();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(noInterfaceViewMCBeanName, bean.getClass()
+ .getName());
+ builder.setConstructorValue(bean);
+
+ ValueMetaData inject = builder.createInject(containerMCBeanName, null, null, ControllerState.DESCRIBED);
+ // Too bad we have to know the field name. Need to do more research on MC to see if we can
+ // add property metadata based on type instead of field name.
+ builder.addPropertyMetaData("container", inject);
+
+ logger.info("Added injection on " + bean + " for container " + containerMCBeanName + " cl set to "
+ + unit.getClassLoader());
+
+ // Add this as an attachment
+ unit.addAttachment(BeanMetaData.class + ":" + noInterfaceViewMCBeanName, builder.getBeanMetaData());
+
+ }
+ catch (Throwable t)
+ {
+ DeploymentException.rethrowAsDeploymentException("Could not create no-interface view for "
+ + sessionBeanMetaData.getEjbClass() + " in unit " + unit.getName(), t);
+ }
+ }
+
+ /**
+ * Undeploy
+ * @param unit
+ * @param deployment
+ */
+ public void undeploy(DeploymentUnit unit, JBossMetaData deployment)
+ {
+ // TODO Needs implementation
+
+ }
+
+ /**
+ * See section 4.9.8 (bullet 1) of the EJB3.1 spec for eligibility of
+ * a bean for no-interface view
+ *
+ * @param sessionBeanMetadata
+ * @return
+ */
+ protected boolean isEligibleForNoInterfaceView(DeploymentUnit unit, JBossSessionBeanMetaData sessionBeanMetadata)
+ throws Exception
+ {
+
+ // if the bean has a @LocalBean defined, then it qualifies for a no-interface view
+ // irrespective of the other rules.
+ //TODO: The JBMETA does not yet support @LocalBean so let's HACK it for now
+ String ejbClassName = sessionBeanMetadata.getEjbClass();
+ Class<?> beanClass = Class.forName(ejbClassName, false, unit.getClassLoader());
+ // if (beanClass.getAnnotation(LocalBean.class) != null) //sessionBeanMetadata.getLocalBean())
+ // {
+ // return true;
+ // }
+
+ // If there are any local business interfaces then its not eligible
+ if (sessionBeanMetadata.getBusinessLocals() != null && !sessionBeanMetadata.getBusinessLocals().isEmpty())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Bean " + sessionBeanMetadata.getEjbClass()
+ + " has business local, hence not eligible for no-interface view");
+ }
+ return false;
+ }
+
+ // If there are any remote business interfaces then its not eligible
+ if (sessionBeanMetadata.getBusinessRemotes() != null && !sessionBeanMetadata.getBusinessRemotes().isEmpty())
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Bean " + sessionBeanMetadata.getEjbClass()
+ + " has business remote, hence not eligible for no-interface view");
+ }
+
+ return false;
+ }
+
+ // If it has a 2.x home or local home view, then its not eligible
+ if (sessionBeanMetadata.getHome() != null || sessionBeanMetadata.getLocalHome() != null)
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Bean " + sessionBeanMetadata.getEjbClass()
+ + " has 2.x home/local-home, hence not eligible for no-interface view");
+ }
+
+ return false;
+ }
+
+ // Check if the bean implements any interfaces
+ if (doesBeanImplementAnyInterfaces(beanClass))
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger
+ .trace("Bean "
+ + sessionBeanMetadata.getEjbClass()
+ + " implements interfaces (other than the one's excluded as per section 4.9.8 of EJB3.1 spec), hence not eligible for no-interface view");
+ }
+ return false;
+ }
+ // The bean satisfies the pre-requisites of a no-interface view.
+ return true;
+
+ }
+
+ /**
+ * Checks whether the bean class implements any interfaces other than
+ * {@link Serializable} or {@link Externalizable} or anything from javax.ejb.* packages.
+ *
+ * @param beanClass
+ * @return Returns true if the bean implements any interface(s) other than {@link Serializable}
+ * or {@link Externalizable} or anything from javax.ejb.* packages.
+ * @throws DeploymentException
+ */
+ protected boolean doesBeanImplementAnyInterfaces(Class<?> beanClass) throws DeploymentException
+ {
+ Class<?>[] interfaces = beanClass.getInterfaces();
+ if (interfaces.length == 0)
+ {
+ return false;
+ }
+
+ // As per section 4.9.8 (bullet 1.3) of EJB3.1 spec
+ // java.io.Serializable; java.io.Externalizable; any of the interfaces defined by the javax.ejb
+ // are excluded from interface check
+ List<Class<?>> implementedInterfaces = Arrays.asList(interfaces);
+ Iterator<Class<?>> implementedInterfacesIterator = implementedInterfaces.iterator();
+ while (implementedInterfacesIterator.hasNext())
+ {
+ Class<?> implementedInterface = implementedInterfacesIterator.next();
+ if (implementedInterface.equals(java.io.Serializable.class)
+ || implementedInterface.equals(java.io.Externalizable.class)
+ || implementedInterface.getName().startsWith("javax.ejb."))
+ {
+ implementedInterfacesIterator.remove();
+ }
+ }
+ // Now that we have removed the interfaces that should be excluded from the check,
+ // if the implementedInterfaces collection is empty then this bean can be considered for no-interface view
+ return !implementedInterfaces.isEmpty();
+ }
+}
Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.mc;
+
+import javax.naming.InitialContext;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.InstallMethod;
+import org.jboss.beans.metadata.api.annotations.UninstallMethod;
+import org.jboss.ejb3.NonSerializableFactory;
+import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
+import org.jboss.ejb3.nointerface.NoInterfaceViewInvocationHandler;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * NoInterfaceViewMCBean
+ *
+ * A {@link NoInterfaceViewMCBean} corresponds to a EJB which is eligible
+ * for a no-interface view
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class NoInterfaceViewMCBean
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(NoInterfaceViewMCBean.class);
+
+ /**
+ * The container for which this {@link NoInterfaceViewMCBean} holds
+ * an no-interface view
+ */
+ private InvokableContext container;
+
+ /**
+ * The bean class for which the no-interface view corresponds
+ */
+ private Class<?> beanClass;
+
+ /**
+ * The bean metadata
+ */
+ private JBossSessionBeanMetaData sessionBeanMetadata;
+
+ /**
+ * Constructor
+ *
+ * @param beanClass
+ * @param sessionBeanMetadata
+ */
+ public NoInterfaceViewMCBean(Class<?> beanClass, JBossSessionBeanMetaData sessionBeanMetadata)
+ {
+ this.beanClass = beanClass;
+ this.sessionBeanMetadata = sessionBeanMetadata;
+ }
+
+ /**
+ * Will be called when the dependencies of this {@link NoInterfaceViewMCBean} are
+ * resolved and this MC bean reaches the INSTALL state.
+ *
+ * At this point, the <code>container</code> associated with this {@link NoInterfaceViewMCBean}
+ * is injected and is at a minimal of DESCRIBED state. We now create a no-interface view
+ * for the corresponding bean.
+ * Note: No validations (like whether the bean is eligible for no-interface view) is done at this
+ * stage. It's assumed that the presence of a {@link NoInterfaceViewMCBean} indicates that the
+ * corresponding bean is eligible for no-interface view.
+ *
+ * @throws Exception
+ */
+ @InstallMethod
+ public void onInstall() throws Exception
+ {
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Creating no-interface view for container " + this.container);
+ }
+
+ // create the view
+ // Don't probably need to create an instance of view creator everytime. Maybe the
+ // view creator can provide "static" methods for creating view, since the creators
+ // don't really require to store any state.
+ NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
+
+ Object noInterfaceView = noInterfaceViewCreator.createView(new NoInterfaceViewInvocationHandler(this.container),
+ this.beanClass);
+
+ // TODO: This does not belong here and the jndi binding part is still in discussion.
+ // This is just a temporary piece of code which binds the no-interface view to the ejbName
+ NonSerializableFactory.rebind(new InitialContext(), this.sessionBeanMetadata.getEjbName(), noInterfaceView);
+
+ }
+
+ @UninstallMethod
+ public void onUnInstall() throws Exception
+ {
+
+ //TODO need to unbind
+ }
+
+ // Bean name will be added to this Inject by the deployer.
+ // We need not use the annotation here at all, since the deployer adds this
+ // dynamically. But having this here provides a better understanding about how
+ // this field is used
+ @Inject(dependentState = "Described")
+ public void setContainer(InvokableContext container) throws Exception
+ {
+ this.container = container;
+
+ }
+}
Added: projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java (from rev 84607, projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/common/AbstractProfile3_1_TestCase.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,363 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.bootstrap.spi.microcontainer.MCServer;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * AbstractNoInterfaceTestCase
+ *
+ * This provides the necessary test support for the no-interface
+ * component
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class AbstractNoInterfaceTestCase
+{
+
+ /**
+ * The server
+ */
+ private static MCServer server;
+
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(AbstractNoInterfaceTestCase.class);
+
+ /**
+ * The home of our server runtime environment
+ */
+ protected static final String SERVER_HOME_DIR_PATH = "target/bootstrap";
+
+ /**
+ * The home of our server profile runtime environment
+ */
+ protected static final String SERVER_PROFILE_HOME_DIR_PATH = SERVER_HOME_DIR_PATH + "/server/default";
+
+ // The following are all mandated by the bootstrap server, so let's just have them even
+ // though they are not used in our tests
+ /**
+ * Data dir
+ */
+ protected static final String SERVER_PROFILE_DATA_DIR_PATH = SERVER_PROFILE_HOME_DIR_PATH + "/data";
+
+ /**
+ * log dir
+ */
+ protected static final String SERVER_PROFILE_LOG_DIR_PATH = SERVER_PROFILE_HOME_DIR_PATH + "/log";
+
+ /**
+ * tmp dir
+ */
+ protected static final String SERVER_PROFILE_TMP_DIR_PATH = SERVER_PROFILE_HOME_DIR_PATH + "/tmp";
+
+ /**
+ * tmp/deploy dir
+ */
+ protected static final String SERVER_PROFILE_TMP_DEPLOY_DIR_PATH = SERVER_PROFILE_TMP_DIR_PATH + "/deploy";
+
+ /**
+ * tmp/native dir
+ */
+ protected static final String SERVER_PROFILE_TMP_NATIVE_DIR_PATH = SERVER_PROFILE_TMP_DIR_PATH + "/native";
+
+ /**
+ * This is where we have our bootstrap configurations for our
+ * tests. This is the place where we place our bootstrap.xml.
+ *
+ */
+ protected static final String SERVER_PROFILE_CONFIG_DIR_PATH = "src/test/resources/conf";
+
+ /**
+ * This is where we place our configuration files which provide the runtime environment
+ * for our server. Ex: ejb3-deployer-jboss-beans.xml is placed here
+ */
+ protected static final String SERVER_PROFILE_DEPLOYERS_DIR_PATH = "src/test/resources/deployers";
+
+ /**
+ * This is where we place our applications to be deployed. The "applications" can also include
+ * EJB3 remoting connectors, interceptors etc...
+ */
+ protected static final String SERVER_PROFILE_DEPLOY_DIR_PATH = "src/test/resources/deploy";
+
+
+
+ /**
+ * Bootstrap the server.
+ * It first creates a server through the bootstrap.xml. This does not start the server profile
+ * (i.e. it does NOT deploy the deployers or the applications).
+ *
+ * @see #startServerConfiguration()
+ * @throws Exception
+ */
+ public static void bootstrap() throws Exception
+ {
+ server = new ServerImpl();
+ Properties serverBootstrapProperties = createBootstrapEnv();
+ server.init(serverBootstrapProperties);
+ logger.trace("Inited the server");
+ long start = System.currentTimeMillis();
+ server.start();
+ long end = System.currentTimeMillis();
+ logger.info("no-interface ootstrap started in " + (end - start) + " milli sec.");
+
+
+ }
+
+ /**
+ * Shutdown the server
+ * @throws Exception
+ */
+ public static void shutdown() throws Exception
+ {
+ if (server != null)
+ {
+ server.shutdown();
+ logger.info("no-interface server has been shutdown");
+ }
+ }
+
+ /**
+ * Deploys the deployers and the applications
+ * to start the server configuration
+ *
+ * @throws Exception
+ */
+ public static void startServerConfiguration() throws Exception
+ {
+ deployDeployers();
+
+ // Some of the deployers/mc beans come from the classpath jars (ex: For JTA support,
+ // jboss-jta-profile.jar/META-INF/jboss-beans.xml). We need to deploy those too.
+ // This approach of leniently deploying all META-INF/jboss-beans.xml from the
+ // classpath is OK as long as we know that those are non-conflicting and are infact
+ // required to be deployed.
+ deployClasspathJBossBeans();
+
+ logger.debug("Deployers ready");
+ deployApplications();
+ logger.debug("no-interface server completely started");
+ }
+
+ /**
+ * Deploys the deployers
+ *
+ * @throws Exception
+ */
+ public static void deployDeployers() throws Exception
+ {
+ // now deploy the deployers
+ deploy(new File(SERVER_PROFILE_DEPLOYERS_DIR_PATH).toURL());
+ }
+
+ /**
+ * Deploy the applications (in deploy folder)
+ * @throws Throwable
+ */
+ public static void deployApplications() throws Exception
+ {
+ deploy(new File(SERVER_PROFILE_DEPLOY_DIR_PATH).toURL());
+
+ // additionally we need the ejb3-interceptors-aop.xml which we pull in from our
+ // ejb3-core dependency jar (instead of duplicating that file in our test setup)
+ URL ejb3InterceptorsConfigFile = Thread.currentThread().getContextClassLoader().getResource("ejb3-interceptors-aop.xml");
+ logger.debug("ejb3-interceptors-aop.xml being picked up from " + ejb3InterceptorsConfigFile);
+ deploy(ejb3InterceptorsConfigFile);
+ }
+
+ /**
+ * Create the necessary infrastructure to boot the server. This includes, creating
+ * the necessary folder structure mandated by the {@link MCServer}. This furthermore
+ * sets the server home and profile home URLs for the bootstrap.
+ *
+ * @return
+ * @throws IOException
+ */
+ protected static Properties createBootstrapEnv() throws IOException
+ {
+ URL serverHome = mkdir(SERVER_HOME_DIR_PATH);
+ URL serverProfileHome = mkdir(SERVER_PROFILE_HOME_DIR_PATH);
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Server Home is " + serverHome);
+ logger.trace("Profile Home is " + serverProfileHome);
+ }
+
+ mkdir(SERVER_PROFILE_DATA_DIR_PATH);
+ mkdir(SERVER_PROFILE_LOG_DIR_PATH);
+ mkdir(SERVER_PROFILE_TMP_DIR_PATH);
+ mkdir(SERVER_PROFILE_TMP_DEPLOY_DIR_PATH);
+ mkdir(SERVER_PROFILE_TMP_NATIVE_DIR_PATH);
+
+ Properties serverBootstrapProperties = new Properties();
+ serverBootstrapProperties.put(ServerConfig.HOME_DIR, serverHome.toString());
+ serverBootstrapProperties.put(ServerConfig.SERVER_HOME_DIR, serverProfileHome.toString());
+
+ URL configDir = findDir(SERVER_PROFILE_CONFIG_DIR_PATH);
+ serverBootstrapProperties.put(ServerConfig.SERVER_CONFIG_URL, configDir.toString());
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Config dir is " + configDir);
+ }
+
+ return serverBootstrapProperties;
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected static URL getTestClassesURL() throws Exception
+ {
+ String noInterfaceTestPath = "org/jboss/ejb3/nointerface/test";
+ URL noInterfaceTestsURL = Thread.currentThread().getContextClassLoader().getResource(noInterfaceTestPath);
+ String entirePathToNoInterfaceTest = noInterfaceTestsURL.toString();
+ String testClassesRoot = entirePathToNoInterfaceTest.substring(0, entirePathToNoInterfaceTest.length() - noInterfaceTestPath.length());
+ URL testClassesRootURL = new URL(testClassesRoot);
+ logger.debug("Test classes URL = " + testClassesRootURL);
+ return testClassesRootURL;
+ }
+ /**
+ * Utility method to create a dir
+ *
+ * @param path
+ * @return
+ * @throws IOException
+ */
+ protected static URL mkdir(String path) throws IOException
+ {
+ File file = new File(path);
+ boolean success = file.mkdirs() || file.isDirectory();
+ if (!success)
+ throw new IOException("Could not create " + path);
+ return file.toURL();
+
+ }
+
+ /**
+ * Utility method to look for a dir
+ *
+ * @param path
+ * @return
+ * @throws IOException
+ */
+ protected static URL findDir(String path) throws IOException
+ {
+ File file = new File(path);
+ boolean success = file.isDirectory();
+ if (!success)
+ throw new IOException(path + " is either not present or is not a dir");
+ return file.toURL();
+
+ }
+
+ /**
+ * Deploys the URL.
+ *
+ * This uses the {@link MainDeployer} (configured during the bootstrap process) to deploy
+ * the URL. The {@link MainDeployer} internally will pass this deployment through all available
+ * deployers
+ *
+ * @param deployURL
+ * @throws Exception
+ */
+ protected static void deploy(URL deployURL) throws Exception
+ {
+ if (deployURL == null)
+ {
+ throw new IllegalArgumentException("Null URL passed to deploy");
+ }
+ logger.debug("Deploying " + deployURL);
+ MainDeployer mainDeployer = getMainDeployer();
+ VirtualFile root = VFS.getRoot(deployURL);
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+ mainDeployer.deploy(deployment);
+ mainDeployer.checkComplete(deployment);
+ logger.debug("Completely deployed " + deployURL);
+
+ }
+
+
+ /**
+ * Deploy a resource
+ */
+ protected static void deploy(String resourceName) throws Exception
+ {
+ if (resourceName == null)
+ {
+ throw new IllegalArgumentException("Null resourceName passed to deploy");
+ }
+ URL resourceURL = Thread.currentThread().getContextClassLoader().getResource(resourceName);
+ deploy(resourceURL);
+
+ }
+
+ /**
+ * Returns the {@link MainDeployer} installed during bootstrap
+ *
+ * @return
+ */
+ protected static MainDeployer getMainDeployer()
+ {
+ ControllerContext context = server.getKernel().getController().getContext("MainDeployer",
+ ControllerState.INSTALLED);
+ if (context == null)
+ {
+ throw new RuntimeException("No MainDeployer is available or MainDeployer is not in INSTALLED state");
+ }
+ return (MainDeployer) context.getTarget();
+
+ }
+
+ protected static void deployClasspathJBossBeans() throws Exception
+ {
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources("META-INF/jboss-beans.xml");
+ while(urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+ logger.debug("Deploying META-INF/jboss-beans.xml from classpath: " + url);
+ deploy(url);
+ }
+ }
+}
Added: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/connectionmanager/MockCachedConnectionManager.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/connectionmanager/MockCachedConnectionManager.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/connectionmanager/MockCachedConnectionManager.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.connectionmanager;
+
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.jca.spi.ComponentStack;
+
+/**
+ * MockCachedConnectionManager
+ *
+ * The {@link EJBContainer} requires a cached connection manager of type
+ * {@link ComponentStack} to be injected. This {@link MockCachedConnectionManager}
+ * is just for use in the no-interface tests, and does not provide any real
+ * functionality
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class MockCachedConnectionManager implements ComponentStack
+{
+
+ public void popMetaAwareObject(Set unsharableResources) throws ResourceException
+ {
+ // this is a mock - do nothing
+ }
+
+ public void pushMetaAwareObject(Object rawKey, Set unsharableResources) throws ResourceException
+ {
+ // this is a mock - do nothing
+
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EJB3DeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EJB3DeploymentUnit.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EJB3DeploymentUnit.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.deployers;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * EJB3DeploymentUnit
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJB3DeploymentUnit implements DeploymentUnit
+{
+
+ private org.jboss.deployers.structure.spi.DeploymentUnit unit;
+
+ public EJB3DeploymentUnit(org.jboss.deployers.structure.spi.DeploymentUnit unit)
+ {
+ this.unit = unit;
+ }
+
+ public Object addAttachment(String name, Object attachment)
+ {
+ return unit.addAttachment(name, attachment);
+ }
+
+ public Object getAttachment(String name)
+ {
+ return unit.getAttachment(name);
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return unit.getClassLoader();
+ }
+
+ public List<Class> getClasses()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public String getDefaultEntityManagerName()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public Map getDefaultPersistenceProperties()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public URL getEjbJarXml()
+ {
+ // TODO Is there a better way to do this? Maybe traverse through the deployment unit
+ return unit.getClassLoader().getResource("ejb-jar.xml");
+
+ }
+
+ public InterceptorInfoRepository getInterceptorInfoRepository()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public URL getJbossXml()
+ {
+ // TODO Is there a better way to do this? Maybe traverse through the deployment unit
+ return unit.getClassLoader().getResource("jboss.xml");
+ }
+
+ public Hashtable getJndiProperties()
+ {
+ return null;
+ }
+
+ public VirtualFile getMetaDataFile(String string)
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public URL getPersistenceXml()
+ {
+ // TODO Is there a better way to do this? Maybe traverse through the deployment unit
+ return unit.getClassLoader().getResource("persistence.xml");
+ }
+
+ public String getRelativePath()
+ {
+ return unit.getRelativePath();
+ }
+
+ public URL getRelativeURL(String path)
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public ClassLoader getResourceLoader()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public List<VirtualFile> getResources(VirtualFileFilter filter)
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public VirtualFile getRootFile()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public String getShortName()
+ {
+ return unit.getSimpleName();
+ }
+
+ public URL getUrl()
+ {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return unit.removeAttachment(name);
+ }
+
+}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbComponentDeployer.java (from rev 84243, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbComponentDeployer.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbComponentDeployer.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbComponentDeployer.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.deployers;
+
+import java.util.List;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3DescriptorHandler;
+import org.jboss.ejb3.MCDependencyPolicy;
+import org.jboss.ejb3.javaee.JavaEEComponentHelper;
+import org.jboss.ejb3.javaee.JavaEEModule;
+import org.jboss.ejb3.javaee.SimpleJavaEEModule;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbComponentDeployer extends AbstractSimpleRealDeployer<JBossEnterpriseBeanMetaData>
+{
+ public EjbComponentDeployer()
+ {
+ super(JBossEnterpriseBeanMetaData.class);
+
+ setComponentsOnly(true);
+
+ addOutput(BeanMetaData.class);
+ }
+
+ protected void addDependencies(BeanMetaDataBuilder builder, DeploymentUnit unit, EJBContainer component)
+ {
+ // TODO: ask something else for that name
+ builder.addDependency("org.jboss.ejb3.deployment:" + unit.getSimpleName());
+
+ // Hmm, should not cast, EjbDeployment knows the type
+ MCDependencyPolicy dependencyPolicy = (MCDependencyPolicy) component.getDependencyPolicy();
+
+ // Translating back and forth, could be done in 1 step.
+ for (DemandMetaData demand : dependencyPolicy.getDemands())
+ builder.addDemand(demand.getDemand());
+ for (DependencyMetaData dependency : dependencyPolicy.getDependencies())
+ builder.addDependency(dependency.getDependency());
+ for (SupplyMetaData supply : dependencyPolicy.getSupplies())
+ builder.addSupply(supply.getSupply());
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData metaData) throws DeploymentException
+ {
+ log.info("Found " + metaData + " in " + unit);
+
+ JavaEEModule module = new SimpleJavaEEModule(unit.getParent().getSimpleName());
+ //unit.getAttachment(JavaEEModule.class);
+
+ String ejbName = metaData.getEjbName();
+ String componentName = JavaEEComponentHelper.createObjectName(module, ejbName);
+
+ Ejb3Deployment deployment = unit.getAttachment(Ejb3Deployment.class);
+
+ EJBContainer component;
+ try
+ {
+ // We need javassist support to pass the class to the ejb3descriptor handler?
+ // The class name would have been better so that the descriptor handler could hide the (javassist) impl detail
+ ClassPool pool = ClassPool.getDefault();
+ CtClass beanCtClass = pool.get(metaData.getEjbClass());
+
+ Ejb3DescriptorHandler ejb3DescriptorHandler = new Ejb3DescriptorHandler(deployment,
+ beanCtClass.getClassFile(), metaData.getJBossMetaData());
+ List<EJBContainer> ejbContainers = ejb3DescriptorHandler.getContainers(beanCtClass.getClassFile(),deployment);
+ // Ideally only one container should be created
+ assert ejbContainers.size() == 1: "More than one container created for bean " + metaData.getEjbClass();
+ component = ejbContainers.get(0);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException(e);
+ }
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(componentName, component.getClass().getName());
+ builder.setConstructorValue(component);
+ addDependencies(builder, unit, component);
+
+ DeploymentUnit parent = unit.getParent();
+ assert parent != null : "parent should not be null of component " + unit;
+
+ // add the bean meta data to the parent, because else scope merging won't occur (whatever that is)
+ // (e.g. the bean won't get injected)
+ parent.addAttachment(BeanMetaData.class + ":" + componentName, builder.getBeanMetaData());
+ }
+}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbDeployment.java (from rev 84243, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployment/EjbDeployment.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbDeployment.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbDeployment.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.deployers;
+
+import javax.security.jacc.PolicyConfiguration;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.ejb3.DependencyPolicy;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.cache.CacheFactoryRegistry;
+import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
+import org.jboss.ejb3.deployers.JBoss5DependencyPolicy;
+import org.jboss.ejb3.javaee.JavaEEComponent;
+import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbDeployment extends Ejb3Deployment
+{
+ /**
+ * @param deploymentUnit
+ * @param unit
+ * @param deploymentScope
+ * @param metaData
+ */
+ public EjbDeployment(org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit, DeploymentUnit unit,
+ DeploymentScope deploymentScope, JBossMetaData metaData)
+ {
+ super(deploymentUnit, unit, deploymentScope, metaData);
+ }
+
+ @Override
+ public void create() throws Exception
+ {
+ // make sure we don't invoke legacy stuff
+ System.err.println("******************");
+ }
+
+ public DependencyPolicy createDependencyPolicy(JavaEEComponent component)
+ {
+ return new JBoss5DependencyPolicy(component);
+ }
+
+ protected PolicyConfiguration createPolicyConfiguration() throws Exception
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ @Override
+ public void destroy()
+ {
+ // make sure we don't invoke legacy stuff
+ }
+
+ protected void putJaccInService(PolicyConfiguration pc, DeploymentUnit unit)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ @Inject
+ @Override
+ public void setCacheFactoryRegistry(CacheFactoryRegistry registry)
+ {
+ super.setCacheFactoryRegistry(registry);
+ }
+
+ @Inject
+ @Override
+ public void setPoolFactoryRegistry(PoolFactoryRegistry poolFactoryRegistry)
+ {
+ super.setPoolFactoryRegistry(poolFactoryRegistry);
+ System.out.println("Set pool factory");
+ }
+
+ @Inject
+ @Override
+ public void setPersistenceManagerFactoryRegistry(PersistenceManagerFactoryRegistry registry)
+ {
+ super.setPersistenceManagerFactoryRegistry(registry);
+ }
+
+ @Override
+ public void start() throws Exception
+ {
+ // make sure we don't invoke legacy stuff
+ }
+
+ @Override
+ public void stop()
+ {
+ // make sure we don't invoke legacy stuff
+ }
+}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbModuleDeployer.java (from rev 84243, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/EjbModuleDeployer.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbModuleDeployer.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/EjbModuleDeployer.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.deployers;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.Start;
+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.AbstractRealDeployerWithInput;
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.DeploymentScope;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.kernel.Kernel;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbModuleDeployer extends AbstractRealDeployerWithInput<JBossMetaData>
+{
+ @Deprecated
+ private Kernel kernel;
+
+ public EjbModuleDeployer()
+ {
+ //addInput(EjbMetadataJndiPolicyDecoratorDeployer.EJB_DECORATED_FLAG);
+
+ setDeploymentVisitor(new EjbDeploymentVisitor());
+
+ addOutput(JBossEnterpriseBeanMetaData.class);
+ addOutput(BeanMetaData.class);
+ }
+
+ private static Ejb3Deployment createModule(DeploymentUnit unit, JBossMetaData metaData)
+ {
+ org.jboss.ejb3.DeploymentUnit ejb3Unit = new EJB3DeploymentUnit(unit);
+ DeploymentScope scope = null;
+ return new EjbDeployment(unit, ejb3Unit, scope, metaData);
+ }
+
+ private class EjbDeploymentVisitor implements DeploymentVisitor<JBossMetaData>
+ {
+ public void deploy(DeploymentUnit unit, JBossMetaData metaData) throws DeploymentException
+ {
+ log.info("Found " + metaData + " in " + unit);
+
+ // FIXME
+ if(metaData.getEnterpriseBeans() == null)
+ {
+ log.warn(unit + " contains no beans");
+ return;
+ }
+
+ Ejb3Deployment module = createModule(unit, metaData);
+ unit.addAttachment(Ejb3Deployment.class, module);
+
+ String name = "org.jboss.ejb3.deployment:" + unit.getSimpleName();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, module.getClass().getName());
+ builder.setConstructorValue(module);
+ unit.addAttachment(BeanMetaData.class + ":" + name, builder.getBeanMetaData());
+
+ for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+ {
+ DeploymentUnit component = unit.addComponent(bean.getEjbName());
+ component.addAttachment(JBossEnterpriseBeanMetaData.class, bean);
+ }
+ }
+
+ public Class<JBossMetaData> getVisitorType()
+ {
+ return JBossMetaData.class;
+ }
+
+ public void undeploy(DeploymentUnit unit, JBossMetaData metaData)
+ {
+ // FIXME
+ if(metaData.getEnterpriseBeans() == null)
+ {
+ return;
+ }
+
+ for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+ {
+ unit.removeComponent(bean.getEjbName());
+ }
+ unit.removeAttachment(Ejb3Deployment.class);
+ }
+ }
+
+ @Inject(bean="jboss.kernel:service=Kernel")
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ /**
+ * LifeCycle Start
+ *
+ * Responsible for Binding an MC-based EJB3 Registrar Object Store
+ *
+ * @author ALR
+ * @throws Throwable
+ */
+ @Start
+ public void start() throws Throwable
+ {
+ // FIXME: do all this stuff in beans.xml
+
+ // Bind an EJB3 Registrar Implementation if not already bound
+ if (!Ejb3RegistrarLocator.isRegistrarBound())
+ {
+ // Obtain the Kernel
+ Kernel sanders = this.kernel;
+ assert sanders != null : Kernel.class.getSimpleName() + " must be provided in order to bind "
+ + Ejb3Registrar.class.getSimpleName();
+
+ // Create an EJB3 Registrar
+ Ejb3Registrar registrar = new Ejb3McRegistrar(sanders);
+
+ // Bind Registrar to the Locator
+ Ejb3RegistrarLocator.bindRegistrar(registrar);
+
+ // Log
+ log.debug("Bound " + Ejb3Registrar.class.getSimpleName() + " to static "
+ + Ejb3RegistrarLocator.class.getSimpleName());
+ }
+ }
+}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/SimpleClassLoaderDeployer.java (from rev 84243, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/deployers/SimpleClassLoaderDeployer.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/SimpleClassLoaderDeployer.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/SimpleClassLoaderDeployer.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.deployers;
+
+import org.jboss.deployers.spi.deployer.helpers.AbstractTopLevelClassLoaderDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleClassLoaderDeployer extends AbstractTopLevelClassLoaderDeployer
+{
+ @Override
+ protected ClassLoader createTopLevelClassLoader(DeploymentUnit unit) throws Exception
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/javaee/SimpleJavaEEModuleInformer.java (from rev 84243, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/javaee/SimpleJavaEEModuleInformer.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/javaee/SimpleJavaEEModuleInformer.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/javaee/SimpleJavaEEModuleInformer.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.javaee;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.jpa.javaee.JavaEEModuleInformer;
+import org.jboss.metadata.client.jboss.JBossClientMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleJavaEEModuleInformer implements JavaEEModuleInformer
+{
+ public String getApplicationName(DeploymentUnit unit)
+ {
+ DeploymentUnit topLevel = unit.getTopLevel();
+ if(topLevel.isAttachmentPresent(JBossAppMetaData.class))
+ return topLevel.getSimpleName();
+ return null;
+ }
+
+ public String getModulePath(DeploymentUnit unit)
+ {
+ return unit.getRelativePath();
+ }
+
+ public ModuleType getModuleType(DeploymentUnit unit)
+ {
+ if(unit.isAttachmentPresent(JBossClientMetaData.class))
+ return ModuleType.APP_CLIENT;
+ if(unit.isAttachmentPresent(JBossMetaData.class) && isReallyAnEjbDeployment(unit))
+ return ModuleType.EJB;
+ if(unit.isAttachmentPresent(JBossWebMetaData.class))
+ return ModuleType.WEB;
+ return ModuleType.JAVA;
+ }
+
+ /*
+ * Some hacks to counter problems.
+ */
+ private boolean isReallyAnEjbDeployment(DeploymentUnit unit)
+ {
+ JBossMetaData metaData = unit.getAttachment(JBossMetaData.class);
+ // JBMETA-69
+ if(metaData.getEnterpriseBeans() == null || metaData.getEnterpriseBeans().size() == 0)
+ return false;
+ // JBMETA-70
+ // The chance of a persistence unit being defined with couple of EJB entity beans is
+ // pretty slim.
+ for(JBossEnterpriseBeanMetaData bean : metaData.getEnterpriseBeans())
+ {
+ if(!(bean instanceof JBossEntityBeanMetaData))
+ return true;
+ }
+ return false;
+ }
+}
Modified: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSLSBWithoutInterface.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSLSBWithoutInterface.java 2009-02-24 07:54:12 UTC (rev 84668)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSLSBWithoutInterface.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -32,6 +32,7 @@
* @version $Revision: $
*/
@Stateless
+//@LocalBean
public class SimpleSLSBWithoutInterface
{
@@ -63,11 +64,11 @@
return "Hi " + name;
}
- @Override
- public String toString()
- {
- return "Test - " + this.getClass().getName();
- }
+// @Override
+// public String toString()
+// {
+// return "Test - " + this.getClass().getName();
+// }
public final String someFinalMethod()
{
Modified: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java 2009-02-24 07:54:12 UTC (rev 84668)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java 2009-02-24 12:43:51 UTC (rev 84669)
@@ -21,16 +21,19 @@
*/
package org.jboss.ejb3.nointerface.test.viewcreator.unit;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingEnumeration;
+
import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
-import org.jboss.ejb3.nointerface.test.viewcreator.ChildBean;
-import org.jboss.ejb3.nointerface.test.viewcreator.MethodInvocationTrackingContainer;
+import org.jboss.ejb3.nointerface.test.common.AbstractNoInterfaceTestCase;
import org.jboss.ejb3.nointerface.test.viewcreator.SimpleSLSBWithoutInterface;
+import org.jboss.ejb3.test.common.MetaDataHelper;
import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -43,7 +46,7 @@
* @author Jaikiran Pai
* @version $Revision: $
*/
-public class NoInterfaceEJBViewCreatorTestCase
+public class NoInterfaceEJBViewCreatorTestCase extends AbstractNoInterfaceTestCase
{
/**
@@ -51,19 +54,18 @@
*/
private static Logger logger = Logger.getLogger(NoInterfaceEJBViewCreatorTestCase.class);
- private static NoInterfaceEJBViewCreator noInterfaceViewCreator;
-
@BeforeClass
public static void beforeClass() throws Exception
{
- noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
-
+ AbstractNoInterfaceTestCase.bootstrap();
+ AbstractNoInterfaceTestCase.startServerConfiguration();
+ deploy(getTestClassesURL());
}
@AfterClass
public static void afterClass() throws Exception
{
-
+ shutdown();
}
/**
@@ -75,134 +77,135 @@
@Test
public void testNoInterfaceViewCreator() throws Exception
{
- MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
- SimpleSLSBWithoutInterface.class);
- SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
- SimpleSLSBWithoutInterface.class);
- int numberOfMethodsInvokedOnBean = 0;
+ JBossSessionBeanMetaData sessionBeanMetadata = MetaDataHelper
+ .getMetadataFromBeanImplClass(SimpleSLSBWithoutInterface.class);
+ String ejbName = sessionBeanMetadata.getEjbName();
+ logger.debug("Looking up " + ejbName);
+ Context ctx = new InitialContext();
+ NamingEnumeration<Binding> bindings = ctx.listBindings("");
+ boolean isNoInterfaceViewBound = false;
+ while (bindings.hasMoreElements())
+ {
+ Binding binding = bindings.nextElement();
+ if (binding.getName().equals(ejbName))
+ {
+ isNoInterfaceViewBound = true;
+ break;
+ }
- String message = noInterfaceView.sayHi("jaikiran");
- numberOfMethodsInvokedOnBean++;
-
- logger.debug("Bean returned message : " + message);
-
- noInterfaceView.simplePublicMethod();
- numberOfMethodsInvokedOnBean++;
-
- logger.info("Number of methods invoked on bean = " + numberOfMethodsInvokedOnBean);
-
- assertNotNull("Methods on no-interface view were not tracked by container", mockContainer.getTrackedMethodNames());
- assertEquals("The container did not handle the expected number of calls on the bean",
- numberOfMethodsInvokedOnBean, mockContainer.getTrackedMethodNames().size());
-
+ }
+ assertTrue("No-interface view not bound at " + ejbName, isNoInterfaceViewBound);
}
- /**
- * Test to ensure that the no-interface view instance does NOT consider
- * a final method on the bean while creating the view
- *
- * @throws Exception
- */
- @Test
- public void testFinalMethodsAreNotConsideredInView() throws Exception
- {
- MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
- SimpleSLSBWithoutInterface.class);
- SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
- SimpleSLSBWithoutInterface.class);
- noInterfaceView.someFinalMethod();
+ // Other tests will be enabled once the component is more testable
- assertEquals("Final method of bean " + SimpleSLSBWithoutInterface.class.getName()
- + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
-
- }
-
- /**
- * Test to ensure that the no-interface view instance does NOT consider
- * a static method on the bean while creating the view
- *
- * @throws Exception
- */
- @Test
- public void testStaticMethodsAreNotConsideredInView() throws Exception
- {
- MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
- SimpleSLSBWithoutInterface.class);
- SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
- SimpleSLSBWithoutInterface.class);
-
- noInterfaceView.someStaticMethod();
-
- assertEquals("Static method of bean " + SimpleSLSBWithoutInterface.class.getName()
- + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
-
- noInterfaceView.someStaticFinalMethod(3);
- assertEquals("Static final method of bean " + SimpleSLSBWithoutInterface.class.getName()
- + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
-
- }
-
- /**
- * Test that multiple invocations to the {@link NoInterfaceEJBViewCreator#createView(java.lang.reflect.InvocationHandler, Class)}
- * returns different instances of the view with unique view-classnames
- *
- * @throws Exception
- */
- @Test
- public void testViewCreatorCreatesUniqueViewInstanceNames() throws Exception
- {
- MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
- SimpleSLSBWithoutInterface.class);
-
- SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
- SimpleSLSBWithoutInterface.class);
- logger.debug("No-interface view for first invocation is " + noInterfaceView);
-
- SimpleSLSBWithoutInterface anotherNoInterfaceViewOnSameBean = noInterfaceViewCreator.createView(mockContainer,
- SimpleSLSBWithoutInterface.class);
- logger.debug("No-interface view for second invocation is " + anotherNoInterfaceViewOnSameBean);
-
- assertNotSame("No-interface view returned same instance for two createView invocations", noInterfaceView,
- anotherNoInterfaceViewOnSameBean);
- assertTrue("No-interfave view class name is the same for two createView invocations", !noInterfaceView
- .equals(anotherNoInterfaceViewOnSameBean));
- }
-
- /**
- * Test that the no-interface view works as expected when the bean extends from some other class
- *
- * @throws Exception
- */
- @Test
- public void testNoInterfaceViewCreatorWithInheritedClasses() throws Exception
- {
- MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(ChildBean.class);
-
- ChildBean noInterfaceView = noInterfaceViewCreator.createView(mockContainer, ChildBean.class);
-
- int numberOfInvokedMethods = 0;
- noInterfaceView.sayHiFromBase("jaikiran");
- numberOfInvokedMethods++;
-
- noInterfaceView.sayHiFromChild("jaikiran");
- numberOfInvokedMethods++;
-
- noInterfaceView.somePublicMethod(4);
- numberOfInvokedMethods++;
-
- // Do NOT increment the counter, since we are calling the final method
- // which will NOT be covered by the no-interface view
- noInterfaceView.someFinalMethod();
-
- logger.debug("Number of methods invoked on bean = " + numberOfInvokedMethods);
-
- assertNotNull("Methods on no-interface view on inherited bean were not tracked by container", mockContainer.getTrackedMethodNames());
- assertEquals("The container did not handle the expected number of calls on the inherited bean",
- numberOfInvokedMethods, mockContainer.getTrackedMethodNames().size());
-
-
-
- }
+ // /**
+ // * Test to ensure that the no-interface view instance does NOT consider
+ // * a final method on the bean while creating the view
+ // *
+ // * @throws Exception
+ // */
+ // @Test
+ // public void testFinalMethodsAreNotConsideredInView() throws Exception
+ // {
+ // MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
+ // SimpleSLSBWithoutInterface.class);
+ // SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
+ // SimpleSLSBWithoutInterface.class);
+ //
+ // noInterfaceView.someFinalMethod();
+ //
+ // assertEquals("Final method of bean " + SimpleSLSBWithoutInterface.class.getName()
+ // + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
+ //
+ // }
+ //
+ // /**
+ // * Test to ensure that the no-interface view instance does NOT consider
+ // * a static method on the bean while creating the view
+ // *
+ // * @throws Exception
+ // */
+ // @Test
+ // public void testStaticMethodsAreNotConsideredInView() throws Exception
+ // {
+ // MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
+ // SimpleSLSBWithoutInterface.class);
+ // SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
+ // SimpleSLSBWithoutInterface.class);
+ //
+ // noInterfaceView.someStaticMethod();
+ //
+ // assertEquals("Static method of bean " + SimpleSLSBWithoutInterface.class.getName()
+ // + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
+ //
+ // noInterfaceView.someStaticFinalMethod(3);
+ // assertEquals("Static final method of bean " + SimpleSLSBWithoutInterface.class.getName()
+ // + " was included in no-inteface view", 0, mockContainer.getTrackedMethodNames().size());
+ //
+ // }
+ //
+ // /**
+ // * Test that multiple invocations to the {@link NoInterfaceEJBViewCreator#createView(java.lang.reflect.InvocationHandler, Class)}
+ // * returns different instances of the view with unique view-classnames
+ // *
+ // * @throws Exception
+ // */
+ // @Test
+ // public void testViewCreatorCreatesUniqueViewInstanceNames() throws Exception
+ // {
+ // MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(
+ // SimpleSLSBWithoutInterface.class);
+ //
+ // SimpleSLSBWithoutInterface noInterfaceView = noInterfaceViewCreator.createView(mockContainer,
+ // SimpleSLSBWithoutInterface.class);
+ // logger.debug("No-interface view for first invocation is " + noInterfaceView);
+ //
+ // SimpleSLSBWithoutInterface anotherNoInterfaceViewOnSameBean = noInterfaceViewCreator.createView(mockContainer,
+ // SimpleSLSBWithoutInterface.class);
+ // logger.debug("No-interface view for second invocation is " + anotherNoInterfaceViewOnSameBean);
+ //
+ // assertNotSame("No-interface view returned same instance for two createView invocations", noInterfaceView,
+ // anotherNoInterfaceViewOnSameBean);
+ // assertTrue("No-interfave view class name is the same for two createView invocations", !noInterfaceView
+ // .equals(anotherNoInterfaceViewOnSameBean));
+ // }
+ //
+ // /**
+ // * Test that the no-interface view works as expected when the bean extends from some other class
+ // *
+ // * @throws Exception
+ // */
+ // @Test
+ // public void testNoInterfaceViewCreatorWithInheritedClasses() throws Exception
+ // {
+ // MethodInvocationTrackingContainer mockContainer = new MethodInvocationTrackingContainer(ChildBean.class);
+ //
+ // ChildBean noInterfaceView = noInterfaceViewCreator.createView(mockContainer, ChildBean.class);
+ //
+ // int numberOfInvokedMethods = 0;
+ // noInterfaceView.sayHiFromBase("jaikiran");
+ // numberOfInvokedMethods++;
+ //
+ // noInterfaceView.sayHiFromChild("jaikiran");
+ // numberOfInvokedMethods++;
+ //
+ // noInterfaceView.somePublicMethod(4);
+ // numberOfInvokedMethods++;
+ //
+ // // Do NOT increment the counter, since we are calling the final method
+ // // which will NOT be covered by the no-interface view
+ // noInterfaceView.someFinalMethod();
+ //
+ // logger.debug("Number of methods invoked on bean = " + numberOfInvokedMethods);
+ //
+ // assertNotNull("Methods on no-interface view on inherited bean were not tracked by container", mockContainer.getTrackedMethodNames());
+ // assertEquals("The container did not handle the expected number of calls on the inherited bean",
+ // numberOfInvokedMethods, mockContainer.getTrackedMethodNames().size());
+ //
+ //
+ //
+ // }
}
Added: projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/jmx.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/jmx.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/jmx.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+<bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="newMBeanServer"/>
+ </bean>
+
+</deployment>
\ No newline at end of file
Copied: projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/maindeployer.xml (from rev 84243, projects/ejb3/trunk/profile3_1/src/test/resources/conf/bootstrap/maindeployer.xml)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/maindeployer.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/maindeployer.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+
+ <bean name="SimpleClassLoaderDeployer" class="org.jboss.ejb3.nointerface.test.deployers.SimpleClassLoaderDeployer"/>
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+ <property name="deployers"><inject bean="Deployers"/></property>
+ <!--property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property-->
+ </bean>
+
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- File Structure -->
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure"/>
+
+ <!-- File Structure -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure"/>
+
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
+ </bean>
+
+
+
+
+</deployment>
Property changes on: projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/maindeployer.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Added: projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/naming.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/naming.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap/naming.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+<!-- JNDI -->
+ <bean name="NamingServer" class="org.jnp.server.SingletonNamingServer"/>
+
+ <bean name="JavaCompInitializer" class="org.jboss.naming.JavaCompInitializer">
+ <depends>NamingServer</depends>
+ </bean>
+</deployment>
\ No newline at end of file
Added: projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/conf/bootstrap.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bootstrap xmlns="urn:jboss:bootstrap:1.0">
+
+ <url>bootstrap/naming.xml</url>
+ <url>bootstrap/jmx.xml</url>
+ <url>bootstrap/maindeployer.xml</url>
+
+</bootstrap>
\ No newline at end of file
Added: projects/ejb3/trunk/nointerface/src/test/resources/deploy/aop-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deploy/aop-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deploy/aop-beans.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Added: projects/ejb3/trunk/nointerface/src/test/resources/deployers/aop-deployers-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/aop-deployers-jboss-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/aop-deployers-jboss-beans.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+
+<bean name="AOPXMLMetaDataParserDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.aop.microcontainer.beans.metadata.AOPDeployment</parameter>
+ </constructor>
+ <property name="suffix">-aop.xml</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Copied: projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml (from rev 84243, projects/ejb3/trunk/embedded/src/main/resources/META-INF/ejb-deployers-beans.xml)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.deployers.EjbAnnotationMetaDataDeployer"/>
+ <bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossMetaDataDeployer"/>
+
+ <!-- No-interface view deployer - works on JBossMetadata and creates a NoInterfaceMCBean -->
+ <bean name="Ejb3NoInterfaceViewDeployer" class="org.jboss.ejb3.nointerface.deployers.EJB3NoInterfaceDeployer"/>
+
+<!-- To create the containers -->
+ <bean name="EjbModuleDeployer" class="org.jboss.ejb3.nointerface.test.deployers.EjbModuleDeployer"/>
+ <bean name="EjbComponentDeployer" class="org.jboss.ejb3.nointerface.test.deployers.EjbComponentDeployer"/>
+
+ <bean name="MessageDestinationReferenceResolver" class="org.jboss.ejb3.resolvers.DefaultMessageDestinationReferenceResolver"/>
+
+ <!-- EJB containers need this cached connection manager -->
+ <bean name="EmbeddedCachedConnectionManagerBridge" class="org.jboss.ejb3.nointerface.test.connectionmanager.MockCachedConnectionManager"/>
+
+ <!-- EJB3 Cache Factory Registry -->
+ <bean name="EJB3CacheFactoryRegistry" class="org.jboss.ejb3.cache.CacheFactoryRegistry">
+ <property name="factories">
+ <!-- Define each of the registered factories -->
+ <map class="java.util.HashMap" keyClass="java.lang.String"
+ valueClass="java.lang.Class">
+ <!-- NoPassivationCache -->
+ <entry>
+ <key>NoPassivationCache</key>
+ <value>org.jboss.ejb3.cache.NoPassivationCacheFactory</value>
+ </entry>
+ <!-- SimpleStatefulCache -->
+ <entry>
+ <key>SimpleStatefulCache</key>
+ <value>org.jboss.ejb3.cache.simple.SimpleStatefulCacheFactory</value>
+ </entry>
+ <!-- StatefulTreeCache -->
+ <entry>
+ <key>StatefulTreeCache</key>
+ <value>org.jboss.ejb3.cache.tree.StatefulTreeCacheFactory</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- EJB3 Persistence Manager Factory Registry -->
+ <bean name="EJB3PersistenceManagerFactoryRegistry" class="org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry">
+ <property name="factories">
+ <!-- Define each of the registered factories -->
+ <map class="java.util.HashMap" keyClass="java.lang.String"
+ valueClass="java.lang.Class">
+ <!-- StatefulSessionFilePersistenceManager -->
+ <entry>
+ <key>StatefulSessionFilePersistenceManager</key>
+ <value>org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManagerFactory</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- EJB3 Pool Factory Registry -->
+ <bean name="EJB3PoolFactoryRegistry" class="org.jboss.ejb3.pool.PoolFactoryRegistry">
+ <property name="factories">
+ <!-- Define each of the registered factories -->
+ <map class="java.util.HashMap" keyClass="java.lang.String"
+ valueClass="java.lang.Class">
+ <!-- ThreadlocalPool -->
+ <entry>
+ <key>ThreadlocalPool</key>
+ <value>org.jboss.ejb3.pool.ThreadlocalPoolFactory</value>
+ </entry>
+ <!-- StrictMaxPool -->
+ <entry>
+ <key>StrictMaxPool</key>
+ <value>org.jboss.ejb3.pool.StrictMaxPoolFactory</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Property changes on: projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Added: projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-jboss-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-jboss-beans.xml 2009-02-24 12:43:51 UTC (rev 84669)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+<!-- Probably needs to come from a jpa-profile -->
+ <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
+ <bean name="SpecCompliantSearchStrategy" class="org.jboss.jpa.resolvers.strategy.SpecCompliantSearchStrategy"/>
+ <bean name="JavaEEModuleInformer" class="org.jboss.ejb3.nointerface.test.javaee.SimpleJavaEEModuleInformer"/>
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list