[jboss-cvs] JBossAS SVN: r73673 - in projects/ejb3/trunk/proxy/src/test: java/org/jboss/ejb3/test/proxy/session/unit and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun May 25 20:36:11 EDT 2008
Author: ALRubinger
Date: 2008-05-25 20:36:10 -0400 (Sun, 25 May 2008)
New Revision: 73673
Added:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCaseBase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase.java
projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase-beans.xml
Removed:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java
projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml
Modified:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java
Log:
[EJBTHREE-1345] Refcatoring of ProxySession Tests to centralize and make way for SFSB Tests
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-26 00:26:25 UTC (rev 73672)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/Utils.java 2008-05-26 00:36:10 UTC (rev 73673)
@@ -121,13 +121,13 @@
JBossSessionPolicyDecorator beanMetaData = new JBossSessionPolicyDecorator(beanMetaDataDelegate);
// Log out JNDI Names
- log.info("Business Remote JNDI Name: " + beanMetaData.determineJndiName()); // MyStatefulBean/remote
+ log.info("Business Remote JNDI Name: " + beanMetaData.determineJndiName()); // [beanName]/remote
for (String businessInterface : beanMetaData.getBusinessRemotes())
{
log.info("Business Remote JNDI Name for " + businessInterface + ": "
+ beanMetaData.determineResolvedJndiName(businessInterface));
}
- log.info("Local JNDI Name: " + beanMetaData.determineLocalJndiName()); // MyStatefulBean/local
+ log.info("Local JNDI Name: " + beanMetaData.determineLocalJndiName()); // [beanName]/local
for (String businessInterface : beanMetaData.getBusinessLocals())
{
log.info("Business Local JNDI Name for " + businessInterface + ": "
Deleted: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java 2008-05-26 00:26:25 UTC (rev 73672)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java 2008-05-26 00:36:10 UTC (rev 73673)
@@ -1,124 +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.test.proxy.session.unit;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import javax.naming.InitialContext;
-
-import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
-import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
-import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
-import org.jboss.ejb3.test.proxy.common.Utils;
-import org.jboss.ejb3.test.proxy.common.container.StatelessContainer;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessBean;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessLocal;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessLocalHome;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote;
-import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemoteHome;
-import org.jboss.logging.Logger;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class ProxySessionTestCase
-{
- private static EmbeddedTestMcBootstrap bootstrap;
-
- private static final Logger log = Logger.getLogger(ProxySessionTestCase.class);
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Throwable
- {
- bootstrap = new EmbeddedTestMcBootstrap();
- bootstrap.run();
-
- // Bind the Registrar
- Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
-
- bootstrap.deploy(ProxySessionTestCase.class);
-
- // Create a SLSB
- StatelessContainer container = Utils.createSlsb(MyStatelessBean.class);
-
- // Install into MC
- bootstrap.installInstance(container.getName(), container);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception
- {
- if (bootstrap != null)
- bootstrap.shutdown();
- bootstrap = null;
- }
-
- @Test
- public void testLocal() throws Exception
- {
- InitialContext ctx = new InitialContext();
-
- Object bean = ctx.lookup("MyStatelessBean/local");
- assertTrue(bean instanceof MyStatelessLocal);
-
- String result = ((MyStatelessLocal) bean).sayHi("testLocal");
- assertEquals("Hi testLocal", result);
- }
-
- @Test
- public void testLocalHome() throws Exception
- {
- InitialContext ctx = new InitialContext();
-
- Object bean = ctx.lookup("MyStatelessBean/localHome");
- assertTrue(bean instanceof MyStatelessLocalHome);
- }
-
- @Test
- public void testRemote() throws Exception
- {
- InitialContext ctx = new InitialContext();
-
- Object bean = ctx.lookup("MyStatelessBean/remote");
- assertTrue(bean instanceof MyStatelessRemote);
- }
-
- @Test
- public void testRemoteHome() throws Exception
- {
- InitialContext ctx = new InitialContext();
-
- Object bean = ctx.lookup("MyStatelessBean/home");
- assertTrue(bean instanceof MyStatelessRemoteHome);
- }
-}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCaseBase.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCaseBase.java 2008-05-26 00:36:10 UTC (rev 73673)
@@ -0,0 +1,96 @@
+/*
+ * 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.session.unit;
+
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.ejb3.test.proxy.common.Utils;
+import org.jboss.ejb3.test.proxy.common.container.SessionContainer;
+import org.jboss.ejb3.test.proxy.common.container.StatelessContainer;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessBean;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * ProxySessionTestCaseBase
+ *
+ * Operations common to Proxy Session Test Cases
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class ProxySessionTestCaseBase
+{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static EmbeddedTestMcBootstrap bootstrap;
+
+ // --------------------------------------------------------------------------------||
+ // Lifecycle Methods --------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Throwable
+ {
+ bootstrap = new EmbeddedTestMcBootstrap();
+ bootstrap.run();
+
+ // Bind the Registrar
+ Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
+
+ bootstrap.deploy(ProxyStatelessSessionTestCase.class);
+
+ // Create a SLSB
+ StatelessContainer container = Utils.createSlsb(MyStatelessBean.class);
+
+ // Install into MC
+ bootstrap.installInstance(container.getName(), container);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception
+ {
+ if (bootstrap != null)
+ bootstrap.shutdown();
+ bootstrap = null;
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Contracts ----------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Creates and returns a new Session Container
+ */
+ protected abstract SessionContainer createContainer() throws Throwable;
+
+}
Copied: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase.java (from rev 73670, projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java)
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase.java 2008-05-26 00:36:10 UTC (rev 73673)
@@ -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.test.proxy.session.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.test.proxy.common.Utils;
+import org.jboss.ejb3.test.proxy.common.container.SessionContainer;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessBean;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessLocal;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessLocalHome;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote;
+import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemoteHome;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ProxyStatelessSessionTestCase extends ProxySessionTestCaseBase
+{
+
+ // --------------------------------------------------------------------------------||
+ // Tests --------------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ @Test
+ public void testLocal() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ Object bean = ctx.lookup("MyStatelessBean/local");
+ assertTrue(bean instanceof MyStatelessLocal);
+
+ String result = ((MyStatelessLocal) bean).sayHi("testLocal");
+ assertEquals("Hi testLocal", result);
+ }
+
+ @Test
+ public void testLocalHome() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ Object bean = ctx.lookup("MyStatelessBean/localHome");
+ assertTrue(bean instanceof MyStatelessLocalHome);
+ }
+
+ @Test
+ public void testRemote() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ Object bean = ctx.lookup("MyStatelessBean/remote");
+ assertTrue(bean instanceof MyStatelessRemote);
+ }
+
+ @Test
+ public void testRemoteHome() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ Object bean = ctx.lookup("MyStatelessBean/home");
+ assertTrue(bean instanceof MyStatelessRemoteHome);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Required Implementations -------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * Creates and returns a new Session Container
+ */
+ protected SessionContainer createContainer() throws Throwable
+ {
+ return Utils.createSlsb(MyStatelessBean.class);
+ }
+}
Deleted: 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 2008-05-26 00:26:25 UTC (rev 73672)
+++ projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase-beans.xml 2008-05-26 00:36:10 UTC (rev 73673)
@@ -1,61 +0,0 @@
-<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
-
- The requisite Naming Server
-
- -->
- <bean name="NameServer" class="org.jnp.server.SingletonNamingServer" />
-
- <!--
-
- JNDI Registrars
-
-
- 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
-
- -->
-
- <!-- SLSB JNDI Registrar -->
- <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
- class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
- <constructor>
- <parameter>
- <inject bean="org.jboss.ejb3.JndiContext" />
- </parameter>
- <parameter>
- org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
- </parameter>
- </constructor>
- <depends>NameServer</depends>
- </bean>
-
- <!-- SFSB JNDI Registrar -->
- <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
- class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
- <constructor>
- <parameter>
- <inject bean="org.jboss.ejb3.JndiContext" />
- </parameter>
- <parameter>
- org.jboss.ejb3.proxy.objectfactory.session.stateless.StatefulSessionProxyObjectFactory
- </parameter>
- </constructor>
- <depends>NameServer</depends>
- </bean>
-
- <!-- JNDI Registrar Configuration -->
- <bean name="org.jboss.ejb3.JndiContext"
- class="javax.naming.InitialContext" />
-
-</deployment>
\ No newline at end of file
Copied: projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase-beans.xml (from rev 73671, 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/ProxyStatelessSessionTestCase-beans.xml (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/session/unit/ProxyStatelessSessionTestCase-beans.xml 2008-05-26 00:36:10 UTC (rev 73673)
@@ -0,0 +1,61 @@
+<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
+
+ The requisite Naming Server
+
+ -->
+ <bean name="NameServer" class="org.jnp.server.SingletonNamingServer" />
+
+ <!--
+
+ JNDI Registrars
+
+
+ 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
+
+ -->
+
+ <!-- SLSB JNDI Registrar -->
+ <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
+ class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
+ <constructor>
+ <parameter>
+ <inject bean="org.jboss.ejb3.JndiContext" />
+ </parameter>
+ <parameter>
+ org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
+ </parameter>
+ </constructor>
+ <depends>NameServer</depends>
+ </bean>
+
+ <!-- SFSB JNDI Registrar -->
+ <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
+ class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
+ <constructor>
+ <parameter>
+ <inject bean="org.jboss.ejb3.JndiContext" />
+ </parameter>
+ <parameter>
+ org.jboss.ejb3.proxy.objectfactory.session.stateless.StatefulSessionProxyObjectFactory
+ </parameter>
+ </constructor>
+ <depends>NameServer</depends>
+ </bean>
+
+ <!-- JNDI Registrar Configuration -->
+ <bean name="org.jboss.ejb3.JndiContext"
+ class="javax.naming.InitialContext" />
+
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list