[jboss-cvs] JBossAS SVN: r73610 - in projects/ejb3/trunk/proxy/src: main/java/org/jboss/ejb3/proxy/factory/session and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 23 02:02:17 EDT 2008
Author: ALRubinger
Date: 2008-05-23 02:02:17 -0400 (Fri, 23 May 2008)
New Revision: 73610
Added:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Local.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Remote.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulBean.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulLocalBusiness.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteBusiness.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteHome.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatelfulLocalHome.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java
projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/
projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/
projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml
Modified:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionProxyFactoryBase.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java
Log:
[EJBTHREE-1345] Expanded equality tests to account for SFSB
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryBase.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/ProxyFactoryBase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -95,18 +95,23 @@
}
return proxyConstructor;
}
-
+
// --------------------------------------------------------------------------------||
// Contracts ----------------------------------------------------------------------||
// --------------------------------------------------------------------------------||
-
+
/**
* Return the name of the interceptor stack to apply to
- * proxies created by this proxy factory
+ * proxies created by this proxy factory, or null
+ * if no interceptors should be applied
*
* @return
*/
- protected abstract String getInterceptorStackName();
+ protected String getInterceptorStackName()
+ {
+ // Apply no interceptors by default
+ return null;
+ }
// --------------------------------------------------------------------------------||
// Lifecycle Methods --------------------------------------------------------------||
Added: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionLocalProxyFactory.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,100 @@
+/*
+ * 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.proxy.factory.session.stateful;
+
+import java.util.Set;
+
+import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatefulSessionLocalProxyFactory
+ *
+ * A SFSB Proxy Factory for Local Views
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StatefulSessionLocalProxyFactory extends StatefulSessionProxyFactoryBase implements SessionProxyFactory
+{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final Logger logger = Logger.getLogger(StatefulSessionLocalProxyFactory.class);
+
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * @param metadata The metadata representing this SLSB
+ * @param classloader The ClassLoader associated with the StatelessContainer
+ * for which this ProxyFactory is to generate Proxies
+ * @param containerName The name under which the target container is registered
+ */
+ public StatefulSessionLocalProxyFactory(final JBossSessionBeanMetaData metadata, final ClassLoader classloader,
+ final String containerName)
+ {
+ // Call Super
+ super(metadata, classloader, containerName);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Functional Methods -------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Returns the a Set of String representations of the Business Interface Types
+ *
+ * @return
+ */
+ @Override
+ protected final Set<String> getBusinessInterfaceTypes()
+ {
+ return this.getMetadata().getBusinessLocals();
+ }
+
+ /**
+ * Returns the String representation of the Home Interface Type
+ * @return
+ */
+ @Override
+ protected final String getHomeType()
+ {
+ return this.getMetadata().getLocalHome();
+ }
+
+ /**
+ * Returns the String representation of the EJB.2x Interface Type
+ *
+ * @return
+ */
+ @Override
+ protected final String getEjb2xInterfaceType()
+ {
+ return this.getMetadata().getLocal();
+ }
+}
Added: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionProxyFactoryBase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,99 @@
+/*
+ * 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.proxy.factory.session.stateful;
+
+import java.lang.reflect.Constructor;
+import java.util.Set;
+
+import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase;
+import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandler;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatefulSessionProxyFactoryBase
+ *
+ * Base upon which SFSB Proxy Factories may build
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class StatefulSessionProxyFactoryBase extends SessionProxyFactoryBase implements SessionProxyFactory
+{
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * @param metadata The metadata representing this SFSB
+ * @param classloader The ClassLoader associated with the StatelessContainer
+ * for which this ProxyFactory is to generate Proxies
+ * @param containerName The name under which the target container is registered
+ */
+ public StatefulSessionProxyFactoryBase(final JBossSessionBeanMetaData metadata, final ClassLoader classloader,
+ final String containerName)
+ {
+ // Call Super
+ super(metadata, classloader, containerName);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Functional Methods -------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the return types declared by the "create" methods for the specified home interface.
+ *
+ * @param homeInterface
+ * @return
+ * @deprecated http://jira.jboss.com/jira/browse/JBMETA-41
+ */
+ @Deprecated
+ @Override
+ protected Set<Class<?>> getReturnTypesFromCreateMethods(Class<?> homeInterface)
+ {
+ return this.getReturnTypesFromCreateMethods(homeInterface, true);
+ }
+
+ /**
+ * Returns the Constructor of the SessionProxyInvocationHandler to be used in
+ * instanciating new handlers to specify in Proxy Creation
+ *
+ * @return
+ */
+ @Override
+ protected final Constructor<StatefulProxyInvocationHandler> getInvocationHandlerConstructor()
+ {
+ try
+ {
+ return StatefulProxyInvocationHandler.class.getConstructor(new Class[]
+ {String.class, String.class});
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException("Could not find Constructor with two String arguments for "
+ + StatefulProxyInvocationHandler.class.getName(), e);
+ }
+ }
+}
Added: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateful/StatefulSessionRemoteProxyFactory.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,114 @@
+/*
+ * 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.proxy.factory.session.stateful;
+
+import java.util.Set;
+
+import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatefulSessionRemoteProxyFactory
+ *
+ * A SFSB Proxy Factory for Remote Views
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StatefulSessionRemoteProxyFactory extends StatefulSessionProxyFactoryBase implements SessionProxyFactory
+{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final Logger logger = Logger.getLogger(StatefulSessionRemoteProxyFactory.class);
+
+ private static final String STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS = "StatefulSessionClientInterceptors";
+
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * @param metadata The metadata representing this SFSB
+ * @param classloader The ClassLoader associated with the StatelessContainer
+ * for which this ProxyFactory is to generate Proxies
+ * @param containerName The name under which the target container is registered
+ */
+ public StatefulSessionRemoteProxyFactory(final JBossSessionBeanMetaData metadata, final ClassLoader classloader,
+ final String containerName)
+ {
+ // Call Super
+ super(metadata, classloader, containerName);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Functional Methods -------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Returns the a Set of String representations of the Business Interface Types
+ *
+ * @return
+ */
+ @Override
+ protected final Set<String> getBusinessInterfaceTypes()
+ {
+ return this.getMetadata().getBusinessRemotes();
+ }
+
+ /**
+ * Returns the String representation of the Home Interface Type
+ * @return
+ */
+ @Override
+ protected final String getHomeType()
+ {
+ return this.getMetadata().getHome();
+ }
+
+ /**
+ * Returns the String representation of the EJB2.x Interface Type
+ *
+ * @return
+ */
+ @Override
+ protected final String getEjb2xInterfaceType()
+ {
+ return this.getMetadata().getRemote();
+ }
+
+ /**
+ * Return the name of the interceptor stack to apply to
+ * proxies created by this proxy factory
+ *
+ * @return
+ */
+ @Override
+ protected String getInterceptorStackName()
+ {
+ return StatefulSessionRemoteProxyFactory.STACK_NAME_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
+ }
+}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionLocalProxyFactory.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -21,12 +21,9 @@
*/
package org.jboss.ejb3.proxy.factory.session.stateless;
-import java.lang.reflect.Constructor;
import java.util.Set;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
-import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.session.stateless.StatelessProxyInvocationHandler;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -75,7 +72,7 @@
* @return
*/
@Override
- protected Set<String> getBusinessInterfaceTypes()
+ protected final Set<String> getBusinessInterfaceTypes()
{
return this.getMetadata().getBusinessLocals();
}
@@ -85,7 +82,7 @@
* @return
*/
@Override
- protected String getHomeType()
+ protected final String getHomeType()
{
return this.getMetadata().getLocalHome();
}
@@ -96,74 +93,8 @@
* @return
*/
@Override
- protected String getEjb2xInterfaceType()
+ protected final String getEjb2xInterfaceType()
{
return this.getMetadata().getLocal();
}
-
- /**
- * Returns the Constructor of the SessionProxyInvocationHandler to be used in
- * instanciating new handlers to specify in Proxy Creation
- *
- * @return
- */
- @Override
- protected Constructor<? extends SessionProxyInvocationHandler> getInvocationHandlerConstructor()
- {
- try
- {
- return StatelessProxyInvocationHandler.class.getConstructor(new Class[]
- {String.class, String.class});
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException("Could not find Constructor with two String arguments for "
- + StatelessProxyInvocationHandler.class.getName(), e);
- }
- }
-
- /**
- * Return the name of the interceptor stack to apply to
- * proxies created by this proxy factory
- *
- * @return
- */
- @Override
- protected String getInterceptorStackName()
- {
- // No client-side interceptors for remote
- return null;
- }
-
- // --------------------------------------------------------------------------------||
- // Lifecycle Methods --------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- /**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is able to service requests
- *
- * @throws Exception
- */
- @Override
- public void start() throws Exception
- {
- super.start();
- //TODO
- }
-
- /**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is taken out of service,
- * possibly GC'd
- *
- * @throws Exception
- */
- @Override
- public void stop() throws Exception
- {
- super.stop();
- //TODO
- }
-
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionProxyFactoryBase.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionProxyFactoryBase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -21,10 +21,12 @@
*/
package org.jboss.ejb3.proxy.factory.session.stateless;
+import java.lang.reflect.Constructor;
import java.util.Set;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase;
+import org.jboss.ejb3.proxy.handler.session.stateless.StatelessProxyInvocationHandler;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
@@ -74,34 +76,24 @@
return this.getReturnTypesFromCreateMethods(homeInterface, true);
}
- // --------------------------------------------------------------------------------||
- // Lifecycle Methods --------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
/**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is able to service requests
+ * Returns the Constructor of the SessionProxyInvocationHandler to be used in
+ * instanciating new handlers to specify in Proxy Creation
*
- * @throws Exception
+ * @return
*/
@Override
- public void start() throws Exception
+ protected final Constructor<StatelessProxyInvocationHandler> getInvocationHandlerConstructor()
{
- super.start();
- //TODO
+ try
+ {
+ return StatelessProxyInvocationHandler.class.getConstructor(new Class[]
+ {String.class, String.class});
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException("Could not find Constructor with two String arguments for "
+ + StatelessProxyInvocationHandler.class.getName(), e);
+ }
}
-
- /**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is taken out of service,
- * possibly GC'd
- *
- * @throws Exception
- */
- @Override
- public void stop() throws Exception
- {
- super.stop();
- //TODO
- }
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/stateless/StatelessSessionRemoteProxyFactory.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -21,12 +21,9 @@
*/
package org.jboss.ejb3.proxy.factory.session.stateless;
-import java.lang.reflect.Constructor;
import java.util.Set;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
-import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.session.stateless.StatelessProxyInvocationHandler;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -77,7 +74,7 @@
* @return
*/
@Override
- protected Set<String> getBusinessInterfaceTypes()
+ protected final Set<String> getBusinessInterfaceTypes()
{
return this.getMetadata().getBusinessRemotes();
}
@@ -87,7 +84,7 @@
* @return
*/
@Override
- protected String getHomeType()
+ protected final String getHomeType()
{
return this.getMetadata().getHome();
}
@@ -98,33 +95,12 @@
* @return
*/
@Override
- protected String getEjb2xInterfaceType()
+ protected final String getEjb2xInterfaceType()
{
return this.getMetadata().getRemote();
}
/**
- * Returns the Constructor of the SessionProxyInvocationHandler to be used in
- * instanciating new handlers to specify in Proxy Creation
- *
- * @return
- */
- @Override
- protected Constructor<? extends SessionProxyInvocationHandler> getInvocationHandlerConstructor()
- {
- try
- {
- return StatelessProxyInvocationHandler.class.getConstructor(new Class[]
- {String.class, String.class});
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException("Could not find Constructor with two String arguments for "
- + StatelessProxyInvocationHandler.class.getName(), e);
- }
- }
-
- /**
* Return the name of the interceptor stack to apply to
* proxies created by this proxy factory
*
@@ -135,36 +111,4 @@
{
return StatelessSessionRemoteProxyFactory.STACK_NAME_STATELESS_SESSION_CLIENT_INTERCEPTORS;
}
-
- // --------------------------------------------------------------------------------||
- // Lifecycle Methods --------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- /**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is able to service requests
- *
- * @throws Exception
- */
- @Override
- public void start() throws Exception
- {
- super.start();
- //TODO
- }
-
- /**
- * Lifecycle callback to be invoked by the ProxyFactoryDeployer
- * before the ProxyFactory is taken out of service,
- * possibly GC'd
- *
- * @throws Exception
- */
- @Override
- public void stop() throws Exception
- {
- super.stop();
- //TODO
- }
-
}
Added: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,149 @@
+/*
+ * 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.proxy.handler.session.stateful;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ejb3.common.string.StringUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.hack.Hack;
+import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
+import org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase;
+import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.kernel.spi.registry.KernelBus;
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * StatefulProxyInvocationHandler
+ *
+ * Implementation of a SFSB Proxy Invocation Handler
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StatefulProxyInvocationHandler extends SessionSpecProxyInvocationHandlerBase
+{
+
+ // ------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(StatefulProxyInvocationHandler.class);
+
+ // ------------------------------------------------------------------------------||
+ // Constructors -----------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * @param containerName The name under which the target container is registered
+ */
+ public StatefulProxyInvocationHandler(String containerName)
+ {
+ this(containerName, null);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param containerName The name under which the target container is registered
+ * @param businessInterfaceType The possibly null businessInterfaceType
+ * marking this invocation hander as specific to a given
+ * EJB3 Business Interface
+ */
+ public StatefulProxyInvocationHandler(String containerName, String businessInterfaceType)
+ {
+ super(containerName, businessInterfaceType);
+ }
+
+ // ------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ //TODO
+ /*
+ * THE FOLLOWING IS A COPY OF THE SLSB IMPLEMENTATION, MUST IMPLEMENT FOR SFSB
+ */
+ log.warn(StatefulProxyInvocationHandler.class.getSimpleName() + " is using SLSB Implementation Copy.");
+
+ // Set the invoked method
+ SerializableMethod invokedMethod = new SerializableMethod(method);
+ this.setInvokedMethod(invokedMethod);
+
+ // Attempt to handle directly
+ try
+ {
+ return this.handleInvocationDirectly(proxy, args);
+ }
+ // Ignore this, we just couldn't handle here
+ catch (NotEligibleForDirectInvocationException nefdie)
+ {
+ log.debug("Couldn't handle invocation directly within Proxy " + InvocationHandler.class.getName() + ": "
+ + nefdie.getMessage());
+ }
+
+ // Obtain the correct container from MC
+ //TODO This won't fly for remote, MC would be on another Process
+ KernelBus bus = Hack.BOOTSTRAP.getKernel().getBus();
+
+ // Obtain container name
+ String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
+ assert containerName != null : "Container name for invocation must be specified";
+
+ // Assemble arguments for invocation
+ List<Object> invocationArguments = new ArrayList<Object>();
+ // Add proxy as argument
+ invocationArguments.add(proxy);
+ // Add invoked method as argument
+ invocationArguments.add(invokedMethod);
+ // Add rest of arguments
+ invocationArguments.add(args);
+
+ // Invoke
+ log.debug("Invoking on MC Bean with name \"" + this.getContainerName() + "\" method \""
+ + InvokableContext.METHOD_NAME_INVOKE + "\" with arguments : " + invocationArguments);
+ return bus.invoke(this.getContainerName(), InvokableContext.METHOD_NAME_INVOKE, invocationArguments
+ .toArray(new Object[]
+ {}), InvokableContext.METHOD_SIGNATURE_INVOKE);
+
+ }
+
+ // ------------------------------------------------------------------------------||
+ // TO BE IMPLEMENTED ------------------------------------------------------------||
+ // ------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.proxy.handler.ProxyInvocationHandler#getAsynchronousProxy(java.lang.Object)
+ */
+ public Object getAsynchronousProxy(Object proxy)
+ {
+ throw new NotImplementedException("ALR");
+ }
+
+}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -61,6 +61,16 @@
* Constructor
*
* @param containerName The name under which the target container is registered
+ */
+ public StatelessProxyInvocationHandler(String containerName)
+ {
+ this(containerName, null);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param containerName The name under which the target container is registered
* @param businessInterfaceType The possibly null businessInterfaceType
* marking this invocation hander as specific to a given
* EJB3 Business Interface
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -59,17 +59,17 @@
/**
* Namespace for SLSB Containers
*/
- String MC_NAMESPACE_CONTAINER_STATELESS = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "StatelessSession.";
+ String MC_NAMESPACE_EJBCONTAINER_STATELESS = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "StatelessSession.";
/**
* Namespace for @Service Containers
*/
- String MC_NAMESPACE_CONTAINER_SERVICE = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "Service.";
+ String MC_NAMESPACE_EJBCONTAINER_SERVICE = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "Service.";
/**
* Namespace for MDB Containers
*/
- String MC_NAMESPACE_CONTAINER_MDB = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "MDB.";
+ String MC_NAMESPACE_EJBCONTAINER_MDB = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "MDB.";
/*
* The following are Bindings used as MC Bean Names
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -25,8 +25,8 @@
import java.util.Collection;
import java.util.HashSet;
+import org.jboss.ejb3.test.proxy.common.container.StatefulContainer;
import org.jboss.ejb3.test.proxy.common.container.StatelessContainer;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessBean;
import org.jboss.logging.Logger;
import org.jboss.metadata.annotation.creator.ejb.EjbJar30Creator;
import org.jboss.metadata.annotation.finder.AnnotationFinder;
@@ -65,10 +65,49 @@
*/
public static StatelessContainer createSlsb(Class<?> slsbImplementationClass) throws Throwable
{
+ // Get Metadata
+ JBossSessionBeanMetaData beanMetaData = Utils.getMetadataFromBeanImplClass(slsbImplementationClass);
+
+ // Make a Container
+ StatelessContainer container = new StatelessContainer(beanMetaData, Thread.currentThread()
+ .getContextClassLoader());
+
+ // Return
+ return container;
+ }
+
+ /**
+ * Creates and returns a SLSB Container for the SLSB Implementation Class specified
+ *
+ * @param sfsbImplementationClass
+ * @return
+ * @throws Throwable
+ */
+ public static StatefulContainer createSfsb(Class<?> sfsbImplementationClass) throws Throwable
+ {
+ // Get Metadata
+ JBossSessionBeanMetaData beanMetaData = Utils.getMetadataFromBeanImplClass(sfsbImplementationClass);
+
+ // Make a Container
+ StatefulContainer container = new StatefulContainer(beanMetaData, Thread.currentThread().getContextClassLoader());
+
+ // Return
+ return container;
+ }
+
+ /**
+ * Mock the appropriate deployers and populate metadata for the EJB with the
+ * specified implementation class
+ *
+ * @param beanImplClass
+ * @return
+ */
+ private static JBossSessionBeanMetaData getMetadataFromBeanImplClass(Class<?> beanImplClass)
+ {
// emulate annotation deployer
AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
Collection<Class<?>> classes = new HashSet<Class<?>>();
- classes.add(MyStatelessBean.class);
+ classes.add(beanImplClass);
EjbJar30MetaData metaData = new EjbJar30Creator(finder).create(classes);
// emulate merge deployer
@@ -76,19 +115,19 @@
mergedMetaData.merge(null, metaData);
JBossSessionBeanMetaData beanMetaDataDelegate = (JBossSessionBeanMetaData) mergedMetaData
- .getEnterpriseBean(MyStatelessBean.class.getSimpleName());
+ .getEnterpriseBean(beanImplClass.getSimpleName());
// Use a Session JNDI Binding Policy for the metadata
JBossSessionPolicyDecorator beanMetaData = new JBossSessionPolicyDecorator(beanMetaDataDelegate);
// Log out JNDI Names
- log.info("Business Remote JNDI Name: " + beanMetaData.determineJndiName()); // MyStatelessBean/remote
+ log.info("Business Remote JNDI Name: " + beanMetaData.determineJndiName()); // MyStatefulBean/remote
for (String businessInterface : beanMetaData.getBusinessRemotes())
{
log.info("Business Remote JNDI Name for " + businessInterface + ": "
+ beanMetaData.determineResolvedJndiName(businessInterface));
}
- log.info("Local JNDI Name: " + beanMetaData.determineLocalJndiName()); // MyStatelessBean/local
+ log.info("Local JNDI Name: " + beanMetaData.determineLocalJndiName()); // MyStatefulBean/local
for (String businessInterface : beanMetaData.getBusinessLocals())
{
log.info("Business Local JNDI Name for " + businessInterface + ": "
@@ -97,11 +136,7 @@
log.info("Local Home JNDI Name: " + beanMetaData.determineResolvedJndiName(beanMetaData.getLocalHome()));
log.info("Home JNDI Name: " + beanMetaData.determineResolvedJndiName(beanMetaData.getHome()));
- // Make a Container
- StatelessContainer container = new StatelessContainer(beanMetaData, Thread.currentThread()
- .getContextClassLoader());
+ return beanMetaData;
+ }
- // Return
- return container;
- }
}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,49 @@
+/*
+ * 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.test.proxy.common.container;
+
+import org.jboss.ejb3.interceptors.container.ContainerMethodInvocation;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatefulContainer
+ *
+ * A Mock SFSB Container for use in Testing
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StatefulContainer extends SessionSpecContainer implements InvokableContext<ContainerMethodInvocation>
+{
+ public StatefulContainer(JBossSessionBeanMetaData metaData, ClassLoader classLoader) throws ClassNotFoundException
+ {
+ super(metaData, classLoader);
+
+ // Create and set Container Name
+ String containerName = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER_STATEFUL + metaData.getEjbName();
+ this.setName(containerName);
+
+ }
+
+}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -39,7 +39,7 @@
super(metaData, classLoader);
// Create and set Container Name
- String containerName = MicrocontainerBindings.MC_NAMESPACE_CONTAINER_STATELESS + metaData.getEjbName();
+ String containerName = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER_STATELESS + metaData.getEjbName();
this.setName(containerName);
}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,40 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+/**
+ * MyStateful
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface MyStateful
+{
+ /**
+ * Returns the next number in the counter. The first
+ * invocation will return 0, and every subsequent invocation
+ * will increment the internal counter by 1.
+ *
+ * @return
+ */
+ int getNextCounter();
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Local.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Local.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Local.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.EJBLocalObject;
+
+
+/**
+ * MyStateful21Local
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21Local extends EJBLocalObject, MyStateful
+{
+
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Remote.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Remote.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStateful21Remote.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.EJBObject;
+
+
+/**
+ * MyStateful21Remote
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21Remote extends EJBObject, MyStateful
+{
+
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulBean.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulBean.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulBean.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,65 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.LocalHome;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateful;
+
+/**
+ * MyStatefulBean
+ *
+ * A Mock SFSB
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at LocalHome(MyStatelfulLocalHome.class)
+ at RemoteHome(MyStatefulRemoteHome.class)
+public class MyStatefulBean implements MyStatefulLocalBusiness, MyStatefulRemoteBusiness
+{
+ // --------------------------------------------------------------------------------||
+ // Instance Members ---------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * The internal counter
+ */
+ private int counter = 0;
+
+ // --------------------------------------------------------------------------------||
+ // Required Implementations -------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Returns the next number in the counter. The first
+ * invocation will return 0, and every subsequent invocation
+ * will increment the internal counter by 1.
+ *
+ * @return
+ */
+ public int getNextCounter()
+ {
+ return this.counter++;
+ }
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulLocalBusiness.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulLocalBusiness.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulLocalBusiness.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.Local;
+
+/**
+ * MyStatefulLocalBusiness
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Local
+public interface MyStatefulLocalBusiness extends MyStateful
+{
+
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteBusiness.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteBusiness.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteBusiness.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.Remote;
+
+
+/**
+ * MyStatefulRemoteBusiness
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface MyStatefulRemoteBusiness extends MyStateful
+{
+
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteHome.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteHome.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatefulRemoteHome.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,36 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.EJBHome;
+
+
+/**
+ * MyStatefulRemoteHome
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface MyStatefulRemoteHome extends EJBHome
+{
+ MyStateful21Remote create();
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatelfulLocalHome.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatelfulLocalHome.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/ejb/sfsb/MyStatelfulLocalHome.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.proxy.common.ejb.sfsb;
+
+import javax.ejb.EJBLocalHome;
+
+/**
+ * MyStatelfulLocalHome
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface MyStatelfulLocalHome extends EJBLocalHome
+{
+ MyStateful21Local create();
+}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -53,7 +53,7 @@
/**
* Name of the SLSB Container for these tests
*/
- private static String slsbContainerName;
+ private static String containerName;
// --------------------------------------------------------------------------------||
// Tests --------------------------------------------------------------------------||
@@ -67,12 +67,8 @@
@Test
public void testSameLocalProxyEqual() throws Throwable
{
- // Get the Container
- SessionContainer container = this.getContainer();
-
// Make a Local Proxy Factory
- SessionProxyFactory factory = this.createSessionLocalProxyFactory(container);
- factory.start();
+ SessionProxyFactory factory = this.createSessionLocalProxyFactory();
// Create Proxy
Object proxy = factory.createProxyDefault();
@@ -92,12 +88,8 @@
@Test
public void testSameRemoteProxyEqual() throws Throwable
{
- // Get the Session Container
- SessionContainer container = this.getContainer();
-
// Make a Local Proxy Factory
- SessionProxyFactory factory = this.createSessionLocalProxyFactory(container);
- factory.start();
+ SessionProxyFactory factory = this.createSessionLocalProxyFactory();
// Create Proxy
Object proxy = factory.createProxyDefault();
@@ -148,18 +140,18 @@
/**
* Creates a Proxy Factory for local Proxies
*
- * @param container
* @return
+ * @throws Throwable
*/
- protected abstract SessionProxyFactory createSessionLocalProxyFactory(SessionContainer container);
+ protected abstract SessionProxyFactory createSessionLocalProxyFactory() throws Throwable;
/**
* Creates a Proxy Factory for remote Proxies
*
- * @param container
* @return
+ * @throws Throwable
*/
- protected abstract SessionProxyFactory createSessionRemoteProxyFactory(SessionContainer container);
+ protected abstract SessionProxyFactory createSessionRemoteProxyFactory() throws Throwable;
// --------------------------------------------------------------------------------||
// Accessors / Mutators -----------------------------------------------------------||
@@ -175,13 +167,13 @@
ProxyEqualityTestCaseBase.bootstrap = bootstrap;
}
- protected static String getSlsbContainerName()
+ protected static String getContainerName()
{
- return slsbContainerName;
+ return containerName;
}
- protected static void setSlsbContainerName(String slsbContainerName)
+ protected static void setContainerName(String containerName)
{
- ProxyEqualityTestCaseBase.slsbContainerName = slsbContainerName;
+ ProxyEqualityTestCaseBase.containerName = containerName;
}
}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SfsbProxyEqualityTestCase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,201 @@
+/*
+ * 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.test.proxy.spec_3_4_5.unit;
+
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionLocalProxyFactory;
+import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionRemoteProxyFactory;
+import org.jboss.ejb3.test.proxy.common.Utils;
+import org.jboss.ejb3.test.proxy.common.container.StatefulContainer;
+import org.jboss.ejb3.test.proxy.common.ejb.sfsb.MyStatefulBean;
+import org.jboss.ejb3.test.proxy.spec_3_4_5.ProxyEqualityTestCaseBase;
+import org.jboss.logging.Logger;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SfsbProxyEqualityTestCase
+ *
+ * Test Cases to ensure that SFSB Proxies properly implement
+ * the notion of object equality described by
+ * EJB3 Core Specification 3.4.5.1
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class SfsbProxyEqualityTestCase extends ProxyEqualityTestCaseBase
+{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(SfsbProxyEqualityTestCase.class);
+
+ // --------------------------------------------------------------------------------||
+ // Tests --------------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * EJB 3.0 Core Specification 3.4.5.1
+ *
+ * Tests that two local proxies to the same SFSB are not equal by value
+ */
+ @Test
+ public void testDifferentSlsbLocalProxiesNotEqual() throws Throwable
+ {
+ // Make a Local Proxy Factory
+ StatefulSessionLocalProxyFactory factory = this.createSessionLocalProxyFactory();
+
+ // Create 2 Proxies
+ Object proxy1 = factory.createProxyDefault();
+ Object proxy2 = factory.createProxyDefault();
+
+ // Ensure they're not equal to one another
+ TestCase
+ .assertTrue(
+ "EJB 3.0 Core Specification 3.4.5.1 Violation: Different local proxies to same SFSB should not be equal by value",
+ !proxy1.equals(proxy2));
+ TestCase.assertTrue("Hash Codes for unequal Proxies should (most likely) not be equal",
+ proxy1.hashCode() != proxy2.hashCode());
+ }
+
+ /**
+ * EJB 3.0 Core Specification 3.4.5.1
+ *
+ * Tests that two remote proxies to the same SFSB are not equal by value
+ */
+ @Test
+ public void testDifferentSlsbRemoteProxiesNotEqual() throws Throwable
+ {
+ // Make a Remote Proxy Factory
+ StatefulSessionRemoteProxyFactory factory = this.createSessionRemoteProxyFactory();
+
+ // Create 2 Proxies
+ Object proxy1 = factory.createProxyDefault();
+ Object proxy2 = factory.createProxyDefault();
+
+ // Ensure they're not equal to one another
+ TestCase
+ .assertTrue(
+ "EJB 3.0 Core Specification 3.4.5.1 Violation: Different remote proxies to same SFSB should not be equal by value",
+ !proxy1.equals(proxy2));
+ TestCase.assertTrue("Hash Codes for unequal Proxies should (most likely) not be equal",
+ proxy1.hashCode() != proxy2.hashCode());
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Lifecycle Methods --------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Call Super
+ ProxyEqualityTestCaseBase.beforeClass();
+
+ // Create a SFSB Container
+ StatefulContainer container = Utils.createSfsb(MyStatefulBean.class);
+ log.info("Created SFSB Container: " + container.getName());
+ SfsbProxyEqualityTestCase.setContainerName(container.getName());
+
+ // Install into MC
+ SfsbProxyEqualityTestCase.getBootstrap().installInstance(container.getName(), container);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Required Implementations -------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the Container for use in this TestCase
+ *
+ * @return
+ */
+ @Override
+ protected StatefulContainer getContainer()
+ {
+ return this.getSfsb();
+ }
+
+ /**
+ * Creates a Proxy Factory for local Proxies
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected StatefulSessionLocalProxyFactory createSessionLocalProxyFactory() throws Throwable
+ {
+ // Get the SFSB Container
+ StatefulContainer sfsb = this.getContainer();
+
+ // Make a Local Proxy Factory
+ StatefulSessionLocalProxyFactory factory = new StatefulSessionLocalProxyFactory(sfsb.getMetaData(), sfsb
+ .getClassLoader(), sfsb.getName());
+
+ // Start
+ factory.start();
+
+ // Return
+ return factory;
+ }
+
+ /**
+ * Creates a Proxy Factory for remote Proxies
+ *
+ * @param container
+ * @return
+ */
+ @Override
+ protected StatefulSessionRemoteProxyFactory createSessionRemoteProxyFactory() throws Throwable
+ {
+ // Get the SFSB Container
+ StatefulContainer sfsb = this.getContainer();
+
+ // Make a Remote Proxy Factory
+ StatefulSessionRemoteProxyFactory factory = new StatefulSessionRemoteProxyFactory(sfsb.getMetaData(), sfsb
+ .getClassLoader(), sfsb.getName());
+
+ // Start
+ factory.start();
+
+ // Return
+ return factory;
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Helper Methods -----------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the SLSB Container from MC
+ *
+ * @return
+ */
+ protected StatefulContainer getSfsb()
+ {
+ return (StatefulContainer) SfsbProxyEqualityTestCase.getBootstrap().getKernel().getController()
+ .getInstalledContext(SfsbProxyEqualityTestCase.getContainerName()).getTarget();
+ }
+
+}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java 2008-05-23 05:48:45 UTC (rev 73609)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/unit/SlsbProxyEqualityTestCase.java 2008-05-23 06:02:17 UTC (rev 73610)
@@ -23,7 +23,6 @@
import junit.framework.TestCase;
-import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionLocalProxyFactory;
import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory;
import org.jboss.ejb3.test.proxy.common.Utils;
@@ -65,13 +64,8 @@
@Test
public void testDifferentSlsbLocalProxiesEqual() throws Throwable
{
- // Get the SLSB Container
- StatelessContainer slsb = this.getSlsb();
-
// Make a Local Proxy Factory
- StatelessSessionLocalProxyFactory factory = new StatelessSessionLocalProxyFactory(slsb.getMetaData(), slsb
- .getClassLoader(), slsb.getName());
- factory.start();
+ StatelessSessionLocalProxyFactory factory = this.createSessionLocalProxyFactory();
// Create 2 Proxies
Object proxy1 = factory.createProxyDefault();
@@ -93,12 +87,8 @@
@Test
public void testDifferentSlsbRemoteProxiesEqual() throws Throwable
{
- // Get the SLSB Container
- StatelessContainer slsb = this.getSlsb();
-
// Make a Remote Proxy Factory
- StatelessSessionRemoteProxyFactory factory = new StatelessSessionRemoteProxyFactory(slsb.getMetaData(), slsb
- .getClassLoader(), slsb.getName());
+ StatelessSessionRemoteProxyFactory factory = this.createSessionRemoteProxyFactory();
factory.start();
// Create 2 Proxies
@@ -126,7 +116,7 @@
// Create a SLSB Container
StatelessContainer container = Utils.createSlsb(MyStatelessBean.class);
log.info("Created SLSB Container: " + container.getName());
- SlsbProxyEqualityTestCase.setSlsbContainerName(container.getName());
+ SlsbProxyEqualityTestCase.setContainerName(container.getName());
// Install into MC
SlsbProxyEqualityTestCase.getBootstrap().installInstance(container.getName(), container);
@@ -150,27 +140,47 @@
/**
* Creates a Proxy Factory for local Proxies
*
- * @param container
* @return
+ * @throws Throwable
*/
@Override
- protected SessionProxyFactory createSessionLocalProxyFactory(SessionContainer container)
+ protected StatelessSessionLocalProxyFactory createSessionLocalProxyFactory() throws Throwable
{
- return new StatelessSessionLocalProxyFactory(container.getMetaData(), container.getClassLoader(), container
- .getName());
+ // Get Container
+ SessionContainer container = this.getContainer();
+
+ // Create the Factory
+ StatelessSessionLocalProxyFactory factory = new StatelessSessionLocalProxyFactory(container.getMetaData(),
+ container.getClassLoader(), container.getName());
+
+ // Start
+ factory.start();
+
+ // Return
+ return factory;
}
/**
* Creates a Proxy Factory for remote Proxies
*
- * @param container
* @return
+ * @throws Throwable
*/
@Override
- protected SessionProxyFactory createSessionRemoteProxyFactory(SessionContainer container)
+ protected StatelessSessionRemoteProxyFactory createSessionRemoteProxyFactory() throws Throwable
{
- return new StatelessSessionRemoteProxyFactory(container.getMetaData(), container.getClassLoader(), container
- .getName());
+ // Get Container
+ SessionContainer container = this.getContainer();
+
+ // Create the Factory
+ StatelessSessionRemoteProxyFactory factory = new StatelessSessionRemoteProxyFactory(container.getMetaData(),
+ container.getClassLoader(), container.getName());
+
+ // Start
+ factory.start();
+
+ // Return
+ return factory;
}
// --------------------------------------------------------------------------------||
@@ -185,7 +195,7 @@
protected StatelessContainer getSlsb()
{
return (StatelessContainer) SlsbProxyEqualityTestCase.getBootstrap().getKernel().getController()
- .getInstalledContext(SlsbProxyEqualityTestCase.getSlsbContainerName()).getTarget();
+ .getInstalledContext(SlsbProxyEqualityTestCase.getContainerName()).getTarget();
}
}
Added: projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml
===================================================================
--- projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml 2008-05-23 06:02:17 UTC (rev 73610)
@@ -0,0 +1,42 @@
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- JNDI -->
+ <bean name="NameServer" class="org.jnp.server.SingletonNamingServer" />
+
+ <!--
+
+
+ JNDI Registrar
+
+ The JNDI Registrar is responsible for all JNDI Bindings for
+ an EJB. Its constructor takes the following arguments, in order:
+
+ javax.naming.Context (JNDI Context into which to bind objects)
+ org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry (Implementation of ProxyFactoryRegistry)
+ String statelessSessionProxyObjectFactoryType The JNDI ObjectFactory implementation to use for SLSB
+ ...more later when SFSB, @Service, MDB Implemented
+
+
+ -->
+ <bean name="org.jboss.ejb3.JndiRegistrar"
+ class="org.jboss.ejb3.proxy.jndiregistrar.JndiRegistrar">
+ <constructor>
+ <parameter>
+ <inject bean="org.jboss.ejb3.JndiContext" />
+ </parameter>
+ <parameter>
+ <inject bean="org.jboss.ejb3.ProxyFactoryRegistry" />
+ </parameter>
+ <parameter>
+ org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
+ </parameter>
+ </constructor>
+ <depends>NameServer</depends>
+ </bean>
+
+ <bean name="org.jboss.ejb3.JndiContext" class="javax.naming.InitialContext" />
+ <bean name="org.jboss.ejb3.ProxyFactoryRegistry" class="org.jboss.ejb3.proxy.plugin.inmemory.registry.InMemoryProxyFactoryRegistry" />
+
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list