[jboss-cvs] JBossAS SVN: r91911 - in projects/ejb3/trunk/nointerface: src/main/java/org/jboss/ejb3/nointerface/deployers and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Aug 1 13:26:40 EDT 2009
Author: jaikiran
Date: 2009-08-01 13:26:40 -0400 (Sat, 01 Aug 2009)
New Revision: 91911
Added:
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockTimerServiceFactory.java
projects/ejb3/trunk/nointerface/src/test/resources/deploy/ejb-container-beans.xml
projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-beans.xml
Removed:
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatefulContainer.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatelessContainer.java
projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/MockContainerDeployer.java
Modified:
projects/ejb3/trunk/nointerface/pom.xml
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/factory/MCAwareStatefulNoInterfaceViewFactory.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/MCAwareNoInterfaceViewInvocationHandler.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewJNDIBinder.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatefulNoInterfaceJNDIBinder.java
projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatelessNoInterfaceJNDIBinder.java
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/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java
projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
projects/ejb3/trunk/nointerface/src/test/resources/log4j.xml
Log:
EJBTHREE-1727 Upgraded to use jboss-bootstrap 2.0 and other related changes
Modified: projects/ejb3/trunk/nointerface/pom.xml
===================================================================
--- projects/ejb3/trunk/nointerface/pom.xml 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/pom.xml 2009-08-01 17:26:40 UTC (rev 91911)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-build</artifactId>
- <version>1.0.0</version>
+ <version>1.0.4</version>
<relativePath>../build/pom.xml</relativePath>
</parent>
@@ -22,13 +22,16 @@
<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.org.jboss.deployers>2.0.8.GA</version.org.jboss.deployers>
+ <version.org.jboss.microcontainer>2.0.8.GA</version.org.jboss.microcontainer>
+ <version.org.jboss_jboss-vfs>2.1.2.GA</version.org.jboss_jboss-vfs>
+ <version.org.jboss_jbossxb>2.0.1.GA</version.org.jboss_jbossxb>
<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>
+ <version.org.jboss.ejb3_jboss-ejb3-deployers>1.0.1</version.org.jboss.ejb3_jboss-ejb3-deployers>
+ <version.org.jboss.ejb3_jboss-ejb3-endpoint-deployer>0.1.4</version.org.jboss.ejb3_jboss-ejb3-endpoint-deployer>
<version.org.jboss.bootstrap_jboss-bootstrap>1.0.0-Beta-1</version.org.jboss.bootstrap_jboss-bootstrap>
-
+ <version.org.jboss.bootstrap_jboss-bootstrap-impl-mc>2.0.0-alpha-1</version.org.jboss.bootstrap_jboss-bootstrap-impl-mc>
</properties>
<build>
@@ -80,7 +83,7 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -92,11 +95,11 @@
<!-- Use Java6 -->
<forkMode>once</forkMode>
<jvm>${JDK6_HOME}/bin/java</jvm>
-
+ <argLine>-Dxb.builder.useUnorderedSequence=true</argLine>
</configuration>
</plugin>
-
-
+
+
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -105,7 +108,7 @@
<executable>${JDK6_HOME}/bin/javac</executable>
</configuration>
</plugin>
-
+
<!-- Code coverage tool -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -114,12 +117,12 @@
seems to generate reports showing 0% coverage for all -->
<version>2.0</version>
</plugin>
-
+
</plugins>
</build>
-
+
<!-- Dependencies -->
<dependencies>
@@ -141,11 +144,19 @@
<!-- Bootstrap -->
<dependency>
<groupId>org.jboss.bootstrap</groupId>
- <artifactId>jboss-bootstrap</artifactId>
- <version>${version.org.jboss.bootstrap_jboss-bootstrap}</version>
+ <artifactId>jboss-bootstrap-impl-mc</artifactId>
+ <version>${version.org.jboss.bootstrap_jboss-bootstrap-impl-mc}</version>
<scope>test</scope>
</dependency>
+ <!-- MC -->
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.org.jboss.microcontainer}</version>
+ </dependency>
+
+
<!-- Javassist -->
<dependency>
<groupId>javassist</groupId>
@@ -168,6 +179,25 @@
<dependency>
<groupId>org.jboss.metadata</groupId>
<artifactId>jboss-metadata</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+
+ </exclusions>
</dependency>
<!-- JBoss deployers -->
@@ -192,6 +222,13 @@
<version>${version.org.jboss.deployers}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.org.jboss_jboss-vfs}</version>
+ <scope>test</scope>
+ </dependency>
+
<!-- EJB3 deployers only for test scope-->
<dependency>
<groupId>org.jboss.ejb3</groupId>
@@ -200,45 +237,86 @@
<scope>test</scope>
</dependency>
+ <!-- EJB3 Endpoint deployers for test scope -->
<dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-endpoint-deployer</artifactId>
+ <version>${version.org.jboss.ejb3_jboss-ejb3-endpoint-deployer}</version>
+ <scope>test</scope>
+ </dependency>
+<!--
+ <dependency>
<groupId>trove</groupId>
<artifactId>trove</artifactId>
<scope>runtime</scope>
</dependency>
-
+-->
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-endpoint</artifactId>
- <version>0.1.0-SNAPSHOT</version>
+ <version>0.1.0</version>
</dependency>
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-common</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>
+
+ <!-- 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>
+
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnp-client</artifactId>
+ <version>5.0.0.GA</version>
+ </dependency>
+
+
+ <!-- Support for deploying containers in test -->
+ <!-- FIXME: this must be ejb3-deployers, because else we get a recursive dependency -->
+ <!-- FIXME: this also implies the use of Java 6 -->
+ <dependency>
<groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-jta-profile</artifactId>
- <version>0.1.0-SNAPSHOT</version>
+ <artifactId>jboss-ejb3-embedded</artifactId>
+ <version>1.0.0-Alpha-2</version>
<scope>test</scope>
+ <exclusions>
+ <!-- comes in through org.jboss.aop:jboss-aop-asintegration-core -->
+ <exclusion>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop-deployer-jdk50</artifactId>
+ </exclusion>
+ <!-- Embedded uses new bootstrap impls; leaking makes collisions between legacy and new -->
+ <exclusion>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-impl-mc</artifactId>
+ </exclusion>
+ <!-- core is brought in separately instead of from embedded -->
+ <exclusion>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- <dependency>
- <groupId>org.jboss.naming</groupId>
- <artifactId>jnp-client</artifactId>
- <version>5.0.0.GA</version>
- </dependency>
-
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-core</artifactId>
+ <version>1.1.10</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified: 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 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -109,8 +109,8 @@
}
/**
- * Creates a {@link NoInterfaceViewMCBean} for the no-interface view represented by the
- * <code>sessionBeanMetaData</code>. The {@link NoInterfaceViewMCBean} is created only
+ * Creates a {@link NoInterfaceViewJNDIBinder} MC bean for the no-interface view represented by the
+ * <code>sessionBeanMetaData</code>. The {@link NoInterfaceViewJNDIBinder} is created only
* if the bean is eligible for a no-interface view as defined by the EJB3.1 spec
*
*
@@ -161,16 +161,8 @@
// 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("containerContext", injectMetaData);
-
- // for SFSB we also need to inject the StatefulSessionFactory (which at the moment is
- // available at the same containerMCBeanName and is infact the container)
- if (sessionBeanMetaData.isStateful())
- {
- // inject the KernelControllerContext of the StatefulSessionFactory (which at the moment is the container itself)
- builder.addPropertyMetaData("statefulSessionFactoryContext", injectMetaData);
- }
-
+ builder.addPropertyMetaData("endpointContext", injectMetaData);
+
// Add this as an attachment
unit.addAttachment(BeanMetaData.class + ":" + noInterfaceViewMCBeanName, builder.getBeanMetaData());
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/MCAwareStatefulNoInterfaceViewFactory.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/MCAwareStatefulNoInterfaceViewFactory.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/MCAwareStatefulNoInterfaceViewFactory.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -25,7 +25,7 @@
import java.lang.reflect.InvocationHandler;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.ejb3.endpoint.SessionFactory;
+import org.jboss.ejb3.endpoint.Endpoint;
import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
import org.jboss.ejb3.nointerface.invocationhandler.MCAwareNoInterfaceViewInvocationHandler;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
@@ -61,28 +61,18 @@
* for pushing it to INSTALLED state whenever necessary.
*
*/
- protected KernelControllerContext containerContext;
+ protected KernelControllerContext endpointContext;
/**
- * The KernelControllerContext corresponding StatefulSessionFactory. This context
- * may <i>not</i> be in INSTALLED state. This factory is responsible
- * for pushing it to INSTALLED state whenever necessary.
- *
- */
- protected KernelControllerContext statefulSessionFactoryContext;
-
- /**
* Constructor
* @param beanClass
* @param container
* @param statefulSessionFactory
*/
- public MCAwareStatefulNoInterfaceViewFactory(Class<?> beanClass, KernelControllerContext containerContext,
- KernelControllerContext statefulSessionFactoryContext)
+ public MCAwareStatefulNoInterfaceViewFactory(Class<?> beanClass, KernelControllerContext containerContext)
{
this.beanClass = beanClass;
- this.containerContext = containerContext;
- this.statefulSessionFactoryContext = statefulSessionFactoryContext;
+ this.endpointContext = containerContext;
}
/**
@@ -97,34 +87,38 @@
logger.debug("Creating no-interface view for " + this.beanClass);
try
{
- // first push the statefulSessionFactoryContext to INSTALLED
+ // first push the endpointContext to INSTALLED
if (logger.isTraceEnabled())
{
- logger.trace("Changing the context " + this.statefulSessionFactoryContext.getName() + " to state "
+ logger.trace("Changing the context " + this.endpointContext.getName() + " to state "
+ ControllerState.INSTALLED.getStateString() + " from current state "
- + this.statefulSessionFactoryContext.getState().getStateString());
+ + this.endpointContext.getState().getStateString());
}
- this.statefulSessionFactoryContext.getController().change(this.statefulSessionFactoryContext,
- ControllerState.INSTALLED);
+ this.endpointContext.getController().change(this.endpointContext, ControllerState.INSTALLED);
}
catch (Throwable t)
{
- throw new RuntimeException("Could not push the context " + this.statefulSessionFactoryContext.getName()
- + " from its current state " + this.statefulSessionFactoryContext.getState().getStateString()
- + " to INSTALLED", t);
+ throw new RuntimeException("Could not push the context " + this.endpointContext.getName()
+ + " from its current state " + this.endpointContext.getState().getStateString() + " to INSTALLED", t);
}
// now get hold of the StatefulSessionFactory from the context
- Object statefulSessionFactory = this.statefulSessionFactoryContext.getTarget();
- assert statefulSessionFactory instanceof SessionFactory : "Unexpected object type found "
- + statefulSessionFactory + " - expected a " + SessionFactory.class;
+ Object target = this.endpointContext.getTarget();
+ assert target instanceof Endpoint : "Unexpected object type found " + target + " - expected a " + Endpoint.class;
+ Endpoint endpoint = (Endpoint) target;
+ if (!endpoint.isSessionAware())
+ {
+ throw new IllegalStateException("Endpoint " + endpoint
+ + " is not session aware. Cannot be used for Stateful no-interface view(s)");
+ }
+
// create the session
- Serializable session = ((SessionFactory) statefulSessionFactory).createSession(null, null);
+ Serializable session = endpoint.getSessionFactory().createSession(null, null);
logger.debug("Created session " + session + " for " + this.beanClass);
// create an invocation handler
- InvocationHandler invocationHandler = new MCAwareNoInterfaceViewInvocationHandler(this.containerContext, session);
+ InvocationHandler invocationHandler = new MCAwareNoInterfaceViewInvocationHandler(this.endpointContext, session);
// Now create the view for this bean class and the newly created invocation handler
// TODO: Incorrect cardinality
NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/MCAwareNoInterfaceViewInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/MCAwareNoInterfaceViewInvocationHandler.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/MCAwareNoInterfaceViewInvocationHandler.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -80,7 +80,7 @@
private static Logger logger = Logger.getLogger(MCAwareNoInterfaceViewInvocationHandler.class);
/**
- * The KernelControllerContext corresponding to the container of a bean for which
+ * The KernelControllerContext corresponding to the endpoint for which
* the no-interface view is to be created by this factory. This context
* may <i>not</i> be in INSTALLED state. This factory is responsible
* for pushing it to INSTALLED state whenever necessary.
@@ -90,7 +90,7 @@
*
*
*/
- private KernelControllerContext containerContext;
+ private KernelControllerContext endpointContext;
/**
* The session used to interact with the {@link Endpoint}
@@ -101,10 +101,10 @@
* Constructor
* @param container
*/
- public MCAwareNoInterfaceViewInvocationHandler(KernelControllerContext containerContext, Serializable session)
+ public MCAwareNoInterfaceViewInvocationHandler(KernelControllerContext endpointContext, Serializable session)
{
- assert containerContext != null : "Container context is null for no-interface view invocation handler";
- this.containerContext = containerContext;
+ assert endpointContext != null : "Endpoint context is null for no-interface view invocation handler";
+ this.endpointContext = endpointContext;
this.session = session;
}
@@ -132,13 +132,13 @@
logger.trace("Cannot handle method: " + method.getName() + " in " + this.getClass().getName());
}
}
- // get the container (which will involve pushing it to INSTALLED state)
- Endpoint container = getInstalledContainer();
- assert container != null : "No container associated with context " + this.containerContext
+ // get the endpoint (which will involve pushing it to INSTALLED state)
+ Endpoint endpoint = getInstalledEndpoint();
+ assert endpoint != null : "No endpoint associated with context " + this.endpointContext
+ " - cannot invoke the method on bean";
- // finally pass-on the control to the container
- return container.invoke(this.session, null, method, args);
+ // finally pass-on the control to the endpoint
+ return endpoint.invoke(this.session, null, method, args);
}
/**
@@ -148,7 +148,7 @@
*/
public KernelControllerContext getContainerContext()
{
- return this.containerContext;
+ return this.endpointContext;
}
/**
@@ -158,25 +158,25 @@
*
* @return
*/
- public Endpoint getInstalledContainer()
+ public Endpoint getInstalledEndpoint()
{
if (logger.isTraceEnabled())
{
- logger.trace("Pushing the container context to INSTALLED state from its current state = "
- + this.containerContext.getState().getStateString());
+ logger.trace("Pushing the endpoint context to INSTALLED state from its current state = "
+ + this.endpointContext.getState().getStateString());
}
try
{
- // first push the context corresponding to the container to INSTALLED
- this.containerContext.getController().change(this.containerContext, ControllerState.INSTALLED);
- // get hold of the container from its context
- Endpoint container = (Endpoint) this.containerContext.getTarget();
- return container;
+ // first push the context corresponding to the endpoint to INSTALLED
+ this.endpointContext.getController().change(this.endpointContext, ControllerState.INSTALLED);
+ // get hold of the endpoint from its context
+ Endpoint endpoint = (Endpoint) this.endpointContext.getTarget();
+ return endpoint;
}
catch (Throwable t)
{
- throw new RuntimeException("Error getting container out of container KernelControllerContext "
- + this.containerContext, t);
+ throw new RuntimeException("Error getting endpoint out of container KernelControllerContext "
+ + this.endpointContext, t);
}
}
@@ -186,18 +186,18 @@
* {@link MCAwareNoInterfaceViewInvocationHandler}. Note that this method does NOT
* change the state of the KernelControllerContext of this Endpoint. As such,
* the Endpoint returned by this method is NOT guaranteed to be in INSTALLED state.
- * If the Endpoint with INSTALLED state is required, then use the {@link #getInstalledContainer()}
+ * If the Endpoint with INSTALLED state is required, then use the {@link #getInstalledEndpoint()}
* method.
*
* @return
- * @see #getInstalledContainer()
+ * @see #getInstalledEndpoint()
*/
- private Endpoint getContainer()
+ private Endpoint getEndpoint()
{
- Object container = this.containerContext.getTarget();
- assert container instanceof Endpoint : "Unexpected type " + container.getClass().getName() + " found in context "
- + this.containerContext + " Expected " + Endpoint.class.getName();
- return (Endpoint) container;
+ Object endpoint = this.endpointContext.getTarget();
+ assert endpoint instanceof Endpoint : "Unexpected type " + endpoint.getClass().getName() + " found in context "
+ + this.endpointContext + " Expected " + Endpoint.class.getName();
+ return (Endpoint) endpoint;
}
/**
@@ -230,7 +230,7 @@
// First check whether the Endpoints of both these InvocationHandlers are equal. If
// not, then no need for any further comparison, just return false
- if (!(this.getInstalledContainer().equals(otherNoInterfaceViewInvocationHandler.getInstalledContainer())))
+ if (!(this.getInstalledEndpoint().equals(otherNoInterfaceViewInvocationHandler.getInstalledEndpoint())))
{
return false;
}
@@ -251,7 +251,7 @@
@Override
public int hashCode()
{
- int hashCode = this.getInstalledContainer().hashCode();
+ int hashCode = this.getInstalledEndpoint().hashCode();
if (this.session != null)
{
hashCode += this.session.hashCode();
@@ -265,7 +265,7 @@
@Override
public String toString()
{
- StringBuilder sb = new StringBuilder("No-Interface view for endpoint [ " + this.getContainer() + " ]");
+ StringBuilder sb = new StringBuilder("No-Interface view for endpoint [ " + this.getEndpoint() + " ]");
if (this.session != null)
{
sb.append(" and session " + this.session);
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewJNDIBinder.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewJNDIBinder.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -51,7 +51,7 @@
private static Logger logger = Logger.getLogger(NoInterfaceViewJNDIBinder.class);
/**
- * The container for which this {@link NoInterfaceViewJNDIBinder} holds
+ * The endpoint for which this {@link NoInterfaceViewJNDIBinder} holds
* an no-interface view
*/
// Bean name will be added to this Inject by the deployer.
@@ -59,7 +59,7 @@
// dynamically. But having this here provides a better understanding about how
// this field is used
@Inject(dependentState = "Described", fromContext = FromContext.CONTEXT)
- protected KernelControllerContext containerContext;
+ protected KernelControllerContext endpointContext;
/**
* The bean class for which the no-interface view corresponds
@@ -103,7 +103,7 @@
* Will be called when the dependencies of this {@link NoInterfaceViewJNDIBinder} are
* resolved and this MC bean reaches the START state.
*
- * At this point, the {@link #containerContext} associated with this {@link NoInterfaceViewJNDIBinder}
+ * At this point, the {@link #endpointContext} associated with this {@link NoInterfaceViewJNDIBinder}
* 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
@@ -117,7 +117,7 @@
{
if (logger.isTraceEnabled())
{
- logger.trace("Creating no-interface view for container " + this.containerContext);
+ logger.trace("Creating no-interface view for endpoint " + this.endpointContext);
}
this.bindNoInterfaceView();
@@ -132,12 +132,12 @@
/**
*
- * @param containerContext The KernelControllerContext corresponding to the container
+ * @param endpointContext The KernelControllerContext corresponding to the endpoint
* @throws Exception
*/
- public void setContainerContext(KernelControllerContext containerContext) throws Exception
+ public void setEndpointContext(KernelControllerContext endpointContext) throws Exception
{
- this.containerContext = containerContext;
+ this.endpointContext = endpointContext;
}
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatefulNoInterfaceJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatefulNoInterfaceJNDIBinder.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatefulNoInterfaceJNDIBinder.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -27,12 +27,9 @@
import javax.naming.Reference;
import javax.naming.StringRefAddr;
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.ejb3.nointerface.deployers.EJB3NoInterfaceDeployer;
import org.jboss.ejb3.nointerface.factory.MCAwareStatefulNoInterfaceViewFactory;
import org.jboss.ejb3.nointerface.objectfactory.NoInterfaceViewProxyFactoryRefAddrTypes;
import org.jboss.ejb3.nointerface.objectfactory.StatefulNoInterfaceViewObjectFactory;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.util.naming.NonSerializableFactory;
@@ -56,15 +53,10 @@
private static Logger logger = Logger.getLogger(StatefulNoInterfaceJNDIBinder.class);
/**
- * {@link StatefulSessionFactory} will be used to
- * create session(s) for a SFSB
- * Note: The name of the correct MC bean to be injected will be
- * added programatically through BeanMetaData.
- * @see EJB3NoInterfaceDeployer#deploy(org.jboss.deployers.structure.spi.DeploymentUnit)
+ * Constructor
+ * @param beanClass The bean class
+ * @param sessionBeanMetadata Metadata of the bean
*/
- @Inject(dependentState = "Described")
- private KernelControllerContext statefulSessionFactoryContext;
-
protected StatefulNoInterfaceJNDIBinder(Class<?> beanClass, JBossSessionBeanMetaData sessionBeanMetadata)
{
super(beanClass, sessionBeanMetadata);
@@ -92,7 +84,7 @@
// This factory will be bound to JNDI and will be invoked (through an objectfactory) to create
// the no-interface view for a SFSB
MCAwareStatefulNoInterfaceViewFactory statefulNoInterfaceViewFactory = new MCAwareStatefulNoInterfaceViewFactory(
- this.beanClass, this.containerContext, this.statefulSessionFactoryContext);
+ this.beanClass, this.endpointContext);
// TODO - Needs to be a proper jndi name for the factory
String statefulProxyFactoryJndiName = sessionBeanMetadata.getEjbName() + "/no-interface-stateful-proxyfactory";
@@ -124,14 +116,4 @@
}
- public void setStatefulSessionFactoryContext(KernelControllerContext statefulSessFactoryContext)
- {
- this.statefulSessionFactoryContext = statefulSessFactoryContext;
- }
-
- public KernelControllerContext getStatefulSessionFactoryContext()
- {
- return this.statefulSessionFactoryContext;
- }
-
}
Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatelessNoInterfaceJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatelessNoInterfaceJNDIBinder.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/StatelessNoInterfaceJNDIBinder.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -69,7 +69,7 @@
// TODO: Incorrect cardinality
NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
- InvocationHandler invocationHandler = new MCAwareNoInterfaceViewInvocationHandler(this.containerContext, null);
+ InvocationHandler invocationHandler = new MCAwareNoInterfaceViewInvocationHandler(this.endpointContext, null);
Object noInterfaceView = noInterfaceViewCreator.createView(invocationHandler, beanClass);
// bind
Modified: 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/common/AbstractNoInterfaceTestCase.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -23,21 +23,20 @@
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.bootstrap.impl.mc.server.MCServerImpl;
+import org.jboss.bootstrap.spi.config.ServerConfig;
+import org.jboss.bootstrap.spi.mc.config.MCServerConfig;
+import org.jboss.bootstrap.spi.mc.config.MCServerConfigFactory;
+import org.jboss.bootstrap.spi.mc.server.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;
@@ -107,19 +106,19 @@
* tests. This is the place where we place our bootstrap.xml.
*
*/
- protected static final String SERVER_PROFILE_CONFIG_DIR_PATH = "src/test/resources/conf";
+ protected static final String SERVER_PROFILE_CONFIG_DIR_PATH = System.getProperty("basedir") + "/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";
+ protected static final String SERVER_PROFILE_DEPLOYERS_DIR_PATH = System.getProperty("basedir") + "/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";
+ protected static final String SERVER_PROFILE_DEPLOY_DIR_PATH = System.getProperty("basedir") + "/src/test/resources/deploy";
@@ -133,16 +132,18 @@
*/
public static void bootstrap() throws Exception
{
- server = new ServerImpl();
- Properties serverBootstrapProperties = createBootstrapEnv();
- server.init(serverBootstrapProperties);
- logger.trace("Inited the server");
- long start = System.currentTimeMillis();
+ MCServerConfig config = createServerConfig();
+ server = new MCServerImpl(config);
server.start();
- long end = System.currentTimeMillis();
- logger.info("no-interface ootstrap started in " + (end - start) + " milli sec.");
+ logger.trace("Started the server");
+ }
+ protected static MCServerConfig createServerConfig() throws Exception
+ {
+ MCServerConfig mcServerConfig = MCServerConfigFactory.createServerConfig();
+ mcServerConfig.bootstrapHome(findDir(SERVER_PROFILE_CONFIG_DIR_PATH));
+ return mcServerConfig;
}
/**
@@ -175,8 +176,8 @@
// 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");
+//
+// logger.debug("Deployers ready");
deployApplications();
logger.debug("no-interface server completely started");
}
@@ -201,13 +202,11 @@
{
deploy(new File(SERVER_PROFILE_DEPLOY_DIR_PATH).toURL());
- // We no longer use real containers in our unit tests. So no dependency on ejb3-core.
- // We rely on mock containers.
-// // 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);
+ // 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);
}
/**
@@ -235,11 +234,11 @@
mkdir(SERVER_PROFILE_TMP_NATIVE_DIR_PATH);
Properties serverBootstrapProperties = new Properties();
- serverBootstrapProperties.put(ServerConfig.HOME_DIR, serverHome.getPath());
- serverBootstrapProperties.put(ServerConfig.SERVER_HOME_DIR, serverProfileHome.getPath());
+ serverBootstrapProperties.put(ServerConfig.PROP_KEY_BOOTSTRAP_HOME_URL, serverHome);
+ //serverBootstrapProperties.put(ServerConfig., serverProfileHome.getPath());
URL configDir = findDir(SERVER_PROFILE_CONFIG_DIR_PATH);
- serverBootstrapProperties.put(ServerConfig.SERVER_CONFIG_URL, configDir.toString());
+ //serverBootstrapProperties.put(ServerConfig.SERVER_CONFIG_URL, configDir.toString());
if (logger.isTraceEnabled())
{
logger.trace("Config URL is " + configDir);
Deleted: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatefulContainer.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatefulContainer.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatefulContainer.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -1,119 +0,0 @@
-/*
- * 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.Serializable;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.ejb3.endpoint.Endpoint;
-import org.jboss.ejb3.endpoint.SessionFactory;
-import org.jboss.logging.Logger;
-
-/**
- * MockStatefulContainer
- *
- * A mock stateful container, used for testing. The functionality is very
- * minimal. It just creates bean instances for a session and uses those instances
- * to pass on the method invocation.
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class MockStatefulContainer implements Endpoint, SessionFactory
-
-{
- /**
- * Logger
- */
- private Logger logger = Logger.getLogger(MockStatefulContainer.class);
-
- /**
- * The bean class represented by this container
- */
- private Class<?> beanClass;
-
- /**
- * Maintain the sessions
- */
- private static Map<Serializable, Object> sessions = new HashMap<Serializable, Object>();
-
- /**
- * Each session is represented by an id
- */
- private static Long currentSessionId = new Long(0);
-
- /**
- * Constructor
- * @param beanClass
- */
- public MockStatefulContainer(Class<?> beanClass)
- {
- this.beanClass = beanClass;
- }
-
- @Override
- public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
- throws Throwable
- {
- // get the bean instance using the session
-
- Object beanInstance = sessions.get(session);
- if (beanInstance == null)
- {
- logger.error("No bean instance found for session " + session + " for bean class " + beanClass.getName());
- throw new RuntimeException("No bean instance found for session " + session);
- }
- return method.invoke(beanInstance, args);
- }
-
- @Override
- public Serializable createSession(Class<?>[] initTypes, Object[] initValues)
- {
- synchronized (currentSessionId)
- {
- currentSessionId++;
- try
- {
- sessions.put(currentSessionId, beanClass.newInstance());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not create a session for bean " + beanClass, e);
-
- }
- return currentSessionId;
- }
- }
-
- @Override
- public void destroySession(Serializable session)
- {
- synchronized (sessions)
- {
- sessions.remove(session);
- }
-
- }
-
-}
Deleted: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatelessContainer.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatelessContainer.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockStatelessContainer.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -1,67 +0,0 @@
-/*
- * 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.Serializable;
-import java.lang.reflect.Method;
-
-import org.jboss.ejb3.endpoint.Endpoint;
-
-/**
- * MockStatelessContainer
- *
- * A mock stateless container, used for testing. The functionality is very
- * minimal. It just creates bean instances of the beans and uses those instances
- * to pass on the method invocation.
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class MockStatelessContainer implements Endpoint
-{
-
- /**
- * The bean class represented by this container
- */
- private Class<?> beanClass;
-
- /**
- * Constructor
- * @param beanClass
- */
- public MockStatelessContainer(Class<?> beanClass)
- {
- this.beanClass = beanClass;
- }
-
- @Override
- public Object invoke(Serializable session, Class<?> invokedBusinessInterface, Method method, Object[] args)
- throws Throwable
- {
-
- // since this is for testing, creation of new bean instance on each invocation
- // should be manageable
- Object beanInstance = beanClass.newInstance();
- return method.invoke(beanInstance, args);
- }
-
-}
Copied: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockTimerServiceFactory.java (from rev 89162, projects/ejb3/trunk/endpoint-deployer/src/test/java/org/jboss/ejb3/endpoint/deployers/test/common/MockTimerServiceFactory.java)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockTimerServiceFactory.java (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockTimerServiceFactory.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.common;
+
+import javax.ejb.TimerService;
+
+import org.jboss.ejb3.timerservice.spi.TimedObjectInvoker;
+import org.jboss.ejb3.timerservice.spi.TimerServiceFactory;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MockTimerServiceFactory implements TimerServiceFactory
+{
+ private static final Logger log = Logger.getLogger(MockTimerServiceFactory.class);
+
+ public TimerService createTimerService(TimedObjectInvoker invoker)
+ {
+ log.info("not creating a timer service");
+ return null;
+ }
+
+ public void restoreTimerService(TimerService timerService)
+ {
+ log.info("ignoring timer service restore");
+ }
+
+ public void suspendTimerService(TimerService timerService)
+ {
+ log.info("ignoring timer service suspend");
+ }
+}
Property changes on: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/MockTimerServiceFactory.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/MockContainerDeployer.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/MockContainerDeployer.java 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/deployers/MockContainerDeployer.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -1,207 +0,0 @@
-/*
- * 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.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-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.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb3.endpoint.Endpoint;
-import org.jboss.ejb3.nointerface.test.common.MockStatefulContainer;
-import org.jboss.ejb3.nointerface.test.common.MockStatelessContainer;
-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;
-
-/**
- * MockContainerDeployer
- *
- * A deployer (to be used ONLY for testing) which creates mock containers
- * for session beans. The mock containers are installed into MC.
- *
- *
- * @see MockStatefulContainer
- * @see MockContainer
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class MockContainerDeployer extends AbstractDeployer
-{
-
- private static Logger logger = Logger.getLogger(MockContainerDeployer.class);
-
- public MockContainerDeployer()
- {
- setInput(JBossMetaData.class);
- // the Endpoint (container) will be installed as output
- 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 a container for each bean
- deploy(unit, (JBossSessionBeanMetaData) bean);
- }
- }
-
- }
-
- private void deploy(DeploymentUnit unit, JBossSessionBeanMetaData sessionBeanMetadata) throws DeploymentException
- {
- try
- {
- String beanClassName = sessionBeanMetadata.getEjbClass();
- Endpoint container = null;
- if (sessionBeanMetadata.isStateful())
- {
- container = new MockStatefulContainer(Class.forName(beanClassName, false, unit.getClassLoader()));
- }
- else if (sessionBeanMetadata.isStateless())
- {
- container = new MockStatelessContainer(Class.forName(beanClassName, false, unit.getClassLoader()));
- }
- else
- {
- logger.error("Bean " + beanClassName + " is neither stateful nor stateless, cannot create a container");
- throw new DeploymentException("Bean " + beanClassName + " is of unrecognized type");
- }
-
- // install the container in MC. Getting the container name is currently duplicated (copied from)
- // Ejb3NoInterfaceDeployer.
- String containerName = getContainerName(unit, sessionBeanMetadata);
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(containerName, container.getClass().getName());
- builder.setConstructorValue(container);
-
- unit.addAttachment(BeanMetaData.class + ":" + containerName, builder.getBeanMetaData());
-
- }
- catch (Exception e)
- {
- logger.error("Error in " + MockContainerDeployer.class + " while creating a container for unit " + unit, e);
- DeploymentException.rethrowAsDeploymentException("Could not create container for unit " + unit, e);
- }
- }
-
- /**
- *
- * Ultimately, the container name should come from the <code>sessionBeanMetadata</code>.
- * However because of the current behaviour where the container on its start sets the containername
- * in the metadata, its not possible to get this information even before the container is started.
- *
- * Hence let's for the time being create the container name from all the information that we have
- * in the <code>unit</code>
- *
- * @param unit The deployment unit
- * @param sessionBeanMetadata Session bean metadata
- * @return Returns the container name for the bean corresponding to the <code>sessionBeanMetadata</code> in the <code>unit</code>
- *
- * @throws MalformedObjectNameException
- */
- private String getContainerName(DeploymentUnit unit, JBossSessionBeanMetaData sessionBeanMetadata)
- throws MalformedObjectNameException
- {
- // TODO the base ejb3 jmx object name comes from Ejb3Module.BASE_EJB3_JMX_NAME, but
- // we don't need any reference to ejb3-core. Right now just hard code here, we need
- // a better way/place for this later
- StringBuilder containerName = new StringBuilder("jboss.j2ee:service=EJB3" + ",");
-
- // Get the top level unit for this unit (ex: the top level might be an ear and this unit might be the jar
- // in that ear
- DeploymentUnit toplevelUnit = unit.getTopLevel();
- if (toplevelUnit != null)
- {
- // if top level is an ear, then create the name with the ear reference
- if (isEar(toplevelUnit))
- {
- containerName.append("ear=");
- containerName.append(toplevelUnit.getSimpleName());
- containerName.append(",");
-
- }
- }
- // now work on the passed unit, to get the jar name
- if (unit.getSimpleName() == null)
- {
- containerName.append("*");
- }
- else
- {
- containerName.append("jar=");
- containerName.append(unit.getSimpleName());
- }
- // now the ejbname
- containerName.append(",name=");
- containerName.append(sessionBeanMetadata.getEjbName());
-
- if (logger.isTraceEnabled())
- {
- logger.trace("Container name generated for ejb = " + sessionBeanMetadata.getEjbName() + " in unit " + unit
- + " is " + containerName);
- }
- ObjectName containerJMXName = new ObjectName(containerName.toString());
- return containerJMXName.getCanonicalName();
- }
-
- /**
- * Returns true if this <code>unit</code> represents an .ear deployment
- *
- * @param unit
- * @return
- */
- private boolean isEar(DeploymentUnit unit)
- {
- return unit.getSimpleName().endsWith(".ear");
- }
-
-}
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-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java 2009-08-01 17:26:40 UTC (rev 91911)
@@ -212,10 +212,10 @@
}
/**
- * The spec says that if the bean has been marked as local bean using
+ * The spec says that if the bean has been marked as local bean using
* @LocalBean, then even if it implements any other interfaces, a no-interface view must
* be created. This test case ensures that this requirement is handled correctly
- *
+ *
* @throws Exception
*/
@Test
@@ -233,7 +233,7 @@
/**
* Test to ensure that a no-interface view is NOT created for session beans
* which implement an interface (and do not explicitly mark themselves @LocalBean)
- *
+ *
* @throws Exception
*/
@Test
@@ -293,7 +293,7 @@
/**
* Test that invocations on no-interface view of a SLSB work as expected
- *
+ *
* @throws Exception
*/
@Test
@@ -329,7 +329,7 @@
/**
* Test that invocations on no-interface view of SFSB work as expected
- *
+ *
* @throws Exception
*/
@Test
@@ -353,7 +353,7 @@
/**
* Test that sessions are created as expected for stateful session beans
- *
+ *
* @throws Exception
*/
@Test
@@ -407,7 +407,7 @@
/**
* Tests that the {@link Object#equals(Object)} method on a no-interface view of a SLSB, behaves
* as per the contract
- *
+ *
* @throws Exception
*/
@Test
@@ -444,7 +444,7 @@
StatelessLocalBeanWithInterfaces differentSLSB = (StatelessLocalBeanWithInterfaces) ctx
.lookup(oneMoreSLSBJndiName);
- // compare no-interface views of 2 different SLS beans
+ // compare no-interface views of 2 different SLS beans
assertFalse("no-interfaces views of different SLSB classes should not be equal", slsbOne.equals(differentSLSB));
// SFSB
@@ -464,7 +464,7 @@
/**
* Tests that the {@link Object#equals(Object)} method on a no-interface view of a SFSB, behaves
* as per the contract
- *
+ *
* @throws Exception
*/
@Test
@@ -500,7 +500,7 @@
// at this point we are sure we will get the no-interface view
StatefulLocalBeanWithInterfaces differentSFSB = (StatefulLocalBeanWithInterfaces) ctx.lookup(oneMoreSFSBJndiName);
- // compare no-interface views of 2 different SFS beans
+ // compare no-interface views of 2 different SFS beans
assertFalse("no-interfaces views of different SFSB classes should not be equal", sfsbOne.equals(differentSFSB));
// SLSB
@@ -520,11 +520,11 @@
/**
* Utility method for testing that the bean is bound at the <code>jndiName</code>
* and is of the <code>expectedType</code>
- *
- * @param ctx JNDI Context
+ *
+ * @param ctx JNDI Context
* @param jndiName The jndiname to lookup
* @param expectedType The object returned from the jndi will be expected to be of this type
- *
+ *
* @throws Exception
*/
private void assertBoundAndOfExpectedType(Context ctx, String jndiName, Class<?> expectedType) throws Exception
Added: projects/ejb3/trunk/nointerface/src/test/resources/deploy/ejb-container-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deploy/ejb-container-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deploy/ejb-container-beans.xml 2009-08-01 17:26:40 UTC (rev 91911)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EmbeddedCachedConnectionManagerBridge" class="org.jboss.ejb3.embedded.connectionmanager.EmbeddedCachedConnectionManager"/>
+
+ <bean name="TimerServiceFactory" class="org.jboss.ejb3.nointerface.test.common.MockTimerServiceFactory"/>
+
+</deployment>
Modified: projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml 2009-08-01 17:26:40 UTC (rev 91911)
@@ -5,8 +5,128 @@
<bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.deployers.EjbAnnotationMetaDataDeployer"/>
<bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossMetaDataDeployer"/>
- <!-- A deployer which creates mocked containers for tests -->
- <bean name="MockContainerDeployer" class="org.jboss.ejb3.nointerface.test.deployers.MockContainerDeployer"/>
+ <!-- A deployer which creates mocked containers for tests
+ <bean name="MockContainerDeployer" class="org.jboss.ejb3.nointerface.test.deployers.MockContainerDeployer"/> -->
+
+ <!-- Comes from ejb3-embedded. Will be moved later -->
+ <bean name="EjbModuleDeployer" class="org.jboss.ejb3.embedded.deployers.EjbModuleDeployer"/>
+ <bean name="EjbComponentDeployer" class="org.jboss.ejb3.embedded.deployers.EjbComponentDeployer">
+ <property name="additionalContainerDependencies">
+ <set elementClass="java.lang.String">
+ <!-- We need the registrar so proxy can bind/unbind -->
+ <value>Ejb3Registrar</value>
+ </set>
+ </property>
+ </bean>
+
+ <bean name="MessageDestinationReferenceResolver" class="org.jboss.ejb3.embedded.resolvers.EmbeddedMessageDestinationReferenceResolver"/>
+
+
+
+ <!-- The Ejb3Registrar provides static access to the kernel -->
+ <!-- It should actually not be used. -->
+ <bean name="Ejb3RegistrarService" class="org.jboss.ejb3.embedded.registrar.Ejb3RegistrarService"/>
+
+ <bean name="Ejb3Registrar">
+ <constructor factoryMethod="getRegistrar">
+ <factory bean="Ejb3RegistrarService"/>
+ </constructor>
+ </bean>
+
+ <!-- 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>
+
+ <!-- SFSB JNDI Registrar -->
+ <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
+ class="org.jboss.ejb3.proxy.impl.jndiregistrar.JndiStatefulSessionRegistrar">
+ <constructor>
+ <parameter>
+ org.jboss.ejb3.proxy.impl.objectfactory.session.stateful.StatefulSessionProxyObjectFactory
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- SLSB JNDI Registrar -->
+ <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
+ class="org.jboss.ejb3.proxy.impl.jndiregistrar.JndiStatelessSessionRegistrar">
+ <constructor>
+ <parameter>
+ org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- We could have directly used the org.jboss.ejb3.Ejb3Registry as a MC bean
+ and added the "register" and "unregister" methods as callbacks, but since
+ those methods are "static", MC complains and throws exception. So let's use
+ this indirection for the time being.
+
+ The Ejb3Registry is looked up by the IsLocalInterceptor for EJB containers.
+ -->
+
+ <bean name="EJB3ComponentRegistry" class="org.jboss.ejb3.embedded.Ejb3ComponentRegistry">
+ <!-- Accept any implementor of org.jboss.ejb3.EJBContainer -->
+ <incallback method="addContainer"/>
+ <uncallback method="removeContainer"/>
+ </bean>
+
+ <bean name="ScopedEjbReferenceResolver" class="org.jboss.ejb3.core.resolvers.ScopedEJBReferenceResolver"/>
+
</deployment>
\ No newline at end of file
Copied: projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-beans.xml (from rev 89162, projects/ejb3/trunk/endpoint-deployer/src/test/resources/deploy/jpa-deployers-beans.xml)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-beans.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-beans.xml 2009-08-01 17:26:40 UTC (rev 91911)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="DataSourceDependencyResolver" class="org.jboss.ejb3.embedded.resolvers.EmbeddedDataSourceDependencyResolver"/>
+
+ <bean name="JavaEEModuleInformer" class="org.jboss.ejb3.embedded.javaee.SimpleJavaEEModuleInformer"/>
+
+ <bean name="SpecCompliantSearchStrategy" class="org.jboss.jpa.resolvers.strategy.SpecCompliantSearchStrategy"/>
+
+ <!-- DefaultPersistenceUnitDependencyResolver for spec compliant resolving. Uses SpecCompliantSearchStrategy-->
+ <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
+
+ <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>
+
+ <bean name="PersistenceDeployer" class="org.jboss.jpa.deployers.PersistenceDeployer"/>
+ <bean name="PersistenceUnitDeployer" class="org.jboss.jpa.deployers.PersistenceUnitDeployer">
+ <property name="defaultPersistenceProperties">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+ <key>hibernate.transaction.manager_lookup_class</key>
+ <value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+</deployment>
\ No newline at end of file
Property changes on: projects/ejb3/trunk/nointerface/src/test/resources/deployers/jpa-deployers-beans.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/ejb3/trunk/nointerface/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/log4j.xml 2009-08-01 17:03:43 UTC (rev 91910)
+++ projects/ejb3/trunk/nointerface/src/test/resources/log4j.xml 2009-08-01 17:26:40 UTC (rev 91911)
@@ -62,7 +62,7 @@
<!-- ================ -->
<category name="org.jboss">
- <priority value="TRACE"/>
+ <priority value="DEBUG"/>
</category>
<category name="org.jnp">
More information about the jboss-cvs-commits
mailing list