[prev in list] [next in list] [prev in thread] [next in thread]
List: openejb-cvs
Subject: svn commit: r672566 [9/9] - in /openejb/trunk/openejb3: ./ api/
From: dblevins () apache ! org
Date: 2008-06-28 18:48:33
Message-ID: 20080628184840.8760A2388ABA () eris ! apache ! org
[Download RAW message or body]
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonRmiIiopTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/ \
src/main/java/org/apache/openejb/test/singleton/SingletonRmiIiopTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonRmiIiopTests.java \
(added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonRmiIiopTests.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,955 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.openejb.test.object.ObjectGraph;
+
+import java.rmi.RemoteException;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonRmiIiopTests extends SingletonTestClient{
+
+ protected RmiIiopSingletonHome ejbHome;
+ protected RmiIiopSingletonObject ejbObject;
+
+ public SingletonRmiIiopTests(){
+ super("RMI_IIOP.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = \
initialContext.lookup("client/tests/singleton/RMI-over-IIOP/EJBHome"); + \
ejbHome = (RmiIiopSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
RmiIiopSingletonHome.class); + ejbObject = ejbHome.create();
+ }
+
+/*-------------------------------------------------*/
+/* String */
+/*-------------------------------------------------*/
+
+ public void test01_returnStringObject() {
+ try{
+ String expected = new String("1");
+ String actual = ejbObject.returnStringObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_returnStringObjectArray() {
+ try{
+ String[] expected = {"1","2","3"};
+ String[] actual = ejbObject.returnStringObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Character */
+/*-------------------------------------------------*/
+ public void test03_returnCharacterObject() {
+ try{
+ Character expected = new Character('1');
+ Character actual = ejbObject.returnCharacterObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_returnCharacterPrimitive() {
+ try{
+ char expected = '1';
+ char actual = ejbObject.returnCharacterPrimitive(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_returnCharacterObjectArray() {
+ try{
+ Character[] expected = {new Character('1'),new Character('2'),new \
Character('3')}; + Character[] actual = \
ejbObject.returnCharacterObjectArray(expected); +
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_returnCharacterPrimitiveArray() {
+ try{
+ char[] expected = {'1','2','3'};
+ char[] actual = ejbObject.returnCharacterPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Boolean */
+/*-------------------------------------------------*/
+
+ public void test07_returnBooleanObject() {
+ try{
+ Boolean expected = new Boolean(true);
+ Boolean actual = ejbObject.returnBooleanObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_returnBooleanPrimitive() {
+ try{
+ boolean expected = true;
+ boolean actual = ejbObject.returnBooleanPrimitive(expected);
+ assertEquals(""+expected, ""+actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_returnBooleanObjectArray() {
+ try{
+ Boolean[] expected = {new Boolean(true),new Boolean(false),new \
Boolean(true)}; + Boolean[] actual = \
ejbObject.returnBooleanObjectArray(expected); +
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_returnBooleanPrimitiveArray() {
+ try{
+ boolean[] expected = {false,true,true};
+ boolean[] actual = ejbObject.returnBooleanPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Byte */
+/*-------------------------------------------------*/
+
+ public void test11_returnByteObject() {
+ try{
+ Byte expected = new Byte("1");
+ Byte actual = ejbObject.returnByteObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_returnBytePrimitive() {
+ try{
+ byte expected = (byte)1;
+ byte actual = ejbObject.returnBytePrimitive(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test13_returnByteObjectArray() {
+ try{
+ Byte[] expected = {new Byte("1"),new Byte("2"),new Byte("3")};
+ Byte[] actual = ejbObject.returnByteObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test14_returnBytePrimitiveArray() {
+ try{
+ byte[] expected = {(byte)1,(byte)2,(byte)3};
+ byte[] actual = ejbObject.returnBytePrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Short */
+/*-------------------------------------------------*/
+
+ public void test15_returnShortObject() {
+ try{
+ Short expected = new Short("1");
+ Short actual = ejbObject.returnShortObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test16_returnShortPrimitive() {
+ try{
+ short expected = (short)1;
+ short actual = ejbObject.returnShortPrimitive(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test17_returnShortObjectArray() {
+ try{
+ Short[] expected = {new Short("1"),new Short("2"),new Short("3")};
+ Short[] actual = ejbObject.returnShortObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test18_returnShortPrimitiveArray() {
+ try{
+ short[] expected = {(short)1,(short)2,(short)3};
+ short[] actual = ejbObject.returnShortPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Integer */
+/*-------------------------------------------------*/
+
+ public void test19_returnIntegerObject() {
+ try{
+ Integer expected = new Integer(1);
+ Integer actual = ejbObject.returnIntegerObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test20_returnIntegerPrimitive() {
+ try{
+ int expected = 1;
+ int actual = ejbObject.returnIntegerPrimitive(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test21_returnIntegerObjectArray() {
+ try{
+ Integer[] expected = {new Integer(1),new Integer(2),new Integer(3)};
+ Integer[] actual = ejbObject.returnIntegerObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test22_returnIntegerPrimitiveArray() {
+ try{
+ int[] expected = {1,2,3};
+ int[] actual = ejbObject.returnIntegerPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Long */
+/*-------------------------------------------------*/
+
+ public void test23_returnLongObject() {
+ try{
+ Long expected = new Long("1");
+ Long actual = ejbObject.returnLongObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test24_returnLongPrimitive() {
+ try{
+ long expected = 1;
+ long actual = ejbObject.returnLongPrimitive(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test25_returnLongObjectArray() {
+ try{
+ Long[] expected = {new Long("1"),new Long("2"),new Long("3")};
+ Long[] actual = ejbObject.returnLongObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test26_returnLongPrimitiveArray() {
+ try{
+ long[] expected = {1,2,3};
+ long[] actual = ejbObject.returnLongPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Float */
+/*-------------------------------------------------*/
+
+ public void test27_returnFloatObject() {
+ try{
+ Float expected = new Float("1.3");
+ Float actual = ejbObject.returnFloatObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test28_returnFloatPrimitive() {
+ try{
+ float expected = 1.2F;
+ float actual = ejbObject.returnFloatPrimitive(expected);
+ assertEquals(expected, actual, 0.00D);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test29_returnFloatObjectArray() {
+ try{
+ Float[] expected = {new Float("1.1"),new Float("2.2"),new Float("3.3")};
+ Float[] actual = ejbObject.returnFloatObjectArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test30_returnFloatPrimitiveArray() {
+ try{
+ float[] expected = {1.2F,2.3F,3.4F};
+ float[] actual = ejbObject.returnFloatPrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i , expected[i], \
actual[i], 0.0D); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Double */
+/*-------------------------------------------------*/
+
+ public void test31_returnDoubleObject() {
+ try{
+ Double expected = new Double("1.1");
+ Double actual = ejbObject.returnDoubleObject(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test32_returnDoublePrimitive() {
+ try{
+ double expected = 1.2;
+ double actual = ejbObject.returnDoublePrimitive(expected);
+ assertEquals(expected, actual, 0.0D);
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test33_returnDoubleObjectArray() {
+ try{
+ Double[] expected = {new Double("1.3"),new Double("2.4"),new \
Double("3.5")}; + Double[] actual = \
ejbObject.returnDoubleObjectArray(expected); +
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i]); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test34_returnDoublePrimitiveArray() {
+ try{
+ double[] expected = {1.4,2.5,3.6};
+ double[] actual = ejbObject.returnDoublePrimitiveArray(expected);
+
+ assertNotNull("The array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+ for (int i=0; i < actual.length; i++){
+ assertEquals("Array values are not equal at index "+i ,expected[i], \
actual[i],0.0D); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* EJBHome */
+/*-------------------------------------------------*/
+
+ public void test35_returnEJBHome() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome expected = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", expected); +
+ EncSingletonHome actual = (EncSingletonHome)PortableRemoteObject.narrow( \
ejbObject.returnEJBHome(expected), EncSingletonHome.class); + \
assertNotNull("The EJBHome returned is null", actual); +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test36_returnEJBHome2() {
+ try{
+ EncSingletonHome actual = \
(EncSingletonHome)PortableRemoteObject.narrow(ejbObject.returnEJBHome(), \
EncSingletonHome.class); + assertNotNull("The EJBHome returned is null", \
actual); +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test37_returnNestedEJBHome() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome expected = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", expected); +
+ ObjectGraph graph = ejbObject.returnObjectGraph(new \
ObjectGraph(expected)); + assertNotNull("The ObjectGraph is null", graph);
+
+ EncSingletonHome actual = \
(EncSingletonHome)PortableRemoteObject.narrow(graph.getObject(), \
EncSingletonHome.class); + assertNotNull("The EJBHome returned is null", \
actual); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test38_returnNestedEJBHome2() {
+ try{
+ ObjectGraph graph = ejbObject.returnNestedEJBHome();
+ assertNotNull("The ObjectGraph is null", graph);
+
+ EncSingletonHome actual = \
(EncSingletonHome)PortableRemoteObject.narrow(graph.getObject(), \
EncSingletonHome.class); + assertNotNull("The EJBHome returned is null", \
actual); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test39_returnEJBHomeArray() {
+ try{
+
+ EncSingletonHome expected[] = new EncSingletonHome[3];
+ for (int i=0; i < expected.length; i++){
+ Object obj = \
initialContext.lookup("client/tests/singleton/EncBean"); + expected[i] \
= (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from \
JNDI is null", expected[i]); + }
+
+ EJBHome[] actual = ejbObject.returnEJBHomeArray(expected);
+ assertNotNull("The EJBHome array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* EJBObject */
+/*-------------------------------------------------*/
+
+ public void test40_returnEJBObject() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject expected = home.create();
+ assertNotNull("The EJBObject created is null", expected);
+
+ EncSingletonObject actual = \
(EncSingletonObject)PortableRemoteObject.narrow(ejbObject.returnEJBObject(expected), \
EncSingletonObject.class); + assertNotNull("The EJBObject returned is \
null", actual); +
+ assertTrue("The EJBObejcts are not identical", \
expected.isIdentical(actual)); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test41_returnEJBObject2() {
+ try{
+ EncSingletonObject actual = \
(EncSingletonObject)PortableRemoteObject.narrow(ejbObject.returnEJBObject(), \
EncSingletonObject.class); + assertNotNull("The EJBObject returned is \
null", actual); +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test42_returnNestedEJBObject() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject expected = home.create();
+ assertNotNull("The EJBObject created is null", expected);
+
+ ObjectGraph graph = ejbObject.returnObjectGraph(new \
ObjectGraph(expected)); + assertNotNull("The ObjectGraph is null", graph);
+
+ EncSingletonObject actual = \
(EncSingletonObject)PortableRemoteObject.narrow(graph.getObject(), \
EncSingletonObject.class); + assertNotNull("The EJBObject returned is \
null", actual); +
+ assertTrue("The EJBObejcts are not identical", \
expected.isIdentical(actual)); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test43_returnNestedEJBObject2() {
+ try{
+ ObjectGraph graph = ejbObject.returnNestedEJBObject();
+ assertNotNull("The ObjectGraph is null", graph);
+
+ EncSingletonObject actual = \
(EncSingletonObject)PortableRemoteObject.narrow(graph.getObject(), \
EncSingletonObject.class); + assertNotNull("The EJBHome returned is null", \
actual); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test44_returnEJBObjectArray() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject expected[] = new EncSingletonObject[3];
+ for (int i=0; i < expected.length; i++){
+ expected[i] = home.create();
+ assertNotNull("The EJBObject created is null", expected[i]);
+ }
+
+ EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
+ assertNotNull("The EJBObject array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+
+ for (int i=0; i < actual.length; i++){
+ assertTrue("The EJBObejcts are not identical", \
expected[i].isIdentical(actual[i])); + }
+
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+/*-------------------------------------------------*/
+/* EJBMetaData */
+/*-------------------------------------------------*/
+
+ public void test45_returnEJBMetaData() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EJBMetaData expected = home.getEJBMetaData();
+ assertNotNull("The EJBMetaData returned is null", expected);
+
+ EJBMetaData actual = ejbObject.returnEJBMetaData(expected);
+ assertNotNull("The EJBMetaData returned is null", actual);
+ assertEquals(expected.getHomeInterfaceClass(), \
actual.getHomeInterfaceClass()); + \
assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); + \
} catch (Exception e){ + fail("Received Exception "+e.getClass()+ " : \
"+e.getMessage()); + }
+ }
+
+ public void test46_returnEJBMetaData() {
+ try{
+ EJBMetaData actual = ejbObject.returnEJBMetaData();
+ assertNotNull("The EJBMetaData returned is null", actual);
+ assertEquals(actual.getHomeInterfaceClass(), \
actual.getHomeInterfaceClass()); + \
assertEquals(actual.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); + \
} catch (Exception e){ + fail("Received Exception "+e.getClass()+ " : \
"+e.getMessage()); + }
+ }
+
+ public void test47_returnNestedEJBMetaData() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EJBMetaData expected = home.getEJBMetaData();
+ assertNotNull("The EJBMetaData returned is null", expected);
+
+ ObjectGraph graph = ejbObject.returnObjectGraph(new \
ObjectGraph(expected)); + assertNotNull("The ObjectGraph is null", graph);
+
+ EJBMetaData actual = (EJBMetaData)graph.getObject();
+ assertNotNull("The EJBMetaData returned is null", actual);
+ assertEquals(expected.getHomeInterfaceClass(), \
actual.getHomeInterfaceClass()); + \
assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); + \
} catch (Exception e){ + fail("Received Exception "+e.getClass()+ " : \
"+e.getMessage()); + }
+ }
+
+ public void test48_returnNestedEJBMetaData2() {
+ try{
+ ObjectGraph graph = ejbObject.returnNestedEJBMetaData();
+ assertNotNull("The ObjectGraph is null", graph);
+
+ EJBMetaData actual = (EJBMetaData)graph.getObject();
+ assertNotNull("The EJBMetaData returned is null", actual);
+ assertNotNull("The home interface class of the EJBMetaData is null", \
actual.getHomeInterfaceClass()); + assertNotNull("The remote interface \
class of the EJBMetaData is null", actual.getRemoteInterfaceClass()); + } \
catch (Exception e){ + fail("Received Exception "+e.getClass()+ " : \
"+e.getMessage()); + }
+ }
+
+ public void test49_returnEJBMetaDataArray() {
+ try{
+
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EJBMetaData expected[] = new EJBMetaData[3];
+ for (int i=0; i < expected.length; i++){
+ expected[i] = home.getEJBMetaData();
+ assertNotNull("The EJBMetaData returned is null", expected[i]);
+ }
+
+ EJBMetaData[] actual = \
(EJBMetaData[])ejbObject.returnEJBMetaDataArray(expected); + \
assertNotNull("The EJBMetaData array returned is null", actual); + \
assertEquals(expected.length, actual.length); +
+ for (int i=0; i < actual.length; i++){
+ assertNotNull("The EJBMetaData returned is null", actual[i]);
+ assertEquals(expected[i].getHomeInterfaceClass(), \
actual[i].getHomeInterfaceClass()); + \
assertEquals(expected[i].getRemoteInterfaceClass(), \
actual[i].getRemoteInterfaceClass()); + }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Handle */
+/*-------------------------------------------------*/
+
+ public void test50_returnHandle() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject object = home.create();
+ assertNotNull("The EJBObject created is null", object);
+
+ Handle expected = object.getHandle();
+ assertNotNull("The EJBObject Handle returned is null", expected);
+ assertNotNull("The EJBObject in the Handle is null", \
expected.getEJBObject()); +
+ Handle actual = ejbObject.returnHandle(expected);
+ assertNotNull("The EJBObject Handle returned is null", actual);
+ assertNotNull("The EJBObject in the Handle is null", \
actual.getEJBObject()); +
+ EJBObject exp = expected.getEJBObject();
+ EJBObject act = actual.getEJBObject();
+
+ assertTrue("The EJBObjects in the Handles are not identical", \
exp.isIdentical(act)); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test51_returnHandle() {
+ try{
+ Handle actual = ejbObject.returnHandle();
+ assertNotNull("The EJBObject Handle returned is null", actual);
+ assertNotNull("The EJBObject in the Handle is null", \
actual.getEJBObject()); +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test52_returnNestedHandle() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject object = home.create();
+ assertNotNull("The EJBObject created is null", object);
+
+ Handle expected = object.getHandle();
+ assertNotNull("The EJBObject Handle returned is null", expected);
+ assertNotNull("The EJBObject in the Handle is null", \
expected.getEJBObject()); +
+ ObjectGraph graph = ejbObject.returnObjectGraph(new \
ObjectGraph(expected)); + assertNotNull("The ObjectGraph is null", graph);
+
+ Handle actual = (Handle)graph.getObject();
+ assertNotNull("The EJBObject Handle returned is null", actual);
+ assertNotNull("The EJBObject in the Handle is null", \
actual.getEJBObject()); +
+ EJBObject exp = expected.getEJBObject();
+ EJBObject act = actual.getEJBObject();
+
+ assertTrue("The EJBObjects in the Handles are not identical", \
exp.isIdentical(act)); +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test53_returnNestedHandle2() {
+ try{
+ ObjectGraph graph = ejbObject.returnNestedHandle();
+ assertNotNull("The ObjectGraph is null", graph);
+
+ Handle actual = (Handle)graph.getObject();
+ assertNotNull("The EJBObject Handle returned is null", actual);
+ assertNotNull("The EJBObject in the Handle is null", \
actual.getEJBObject()); + } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test54_returnHandleArray() {
+ try{
+ Object obj = initialContext.lookup("client/tests/singleton/EncBean");
+ EncSingletonHome home = \
(EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + assertNotNull("The EJBHome returned from JNDI \
is null", home); +
+ EncSingletonObject object = home.create();
+ assertNotNull("The EJBObject created is null", object);
+
+ Handle expected[] = new Handle[3];
+ for (int i=0; i < expected.length; i++){
+ expected[i] = object.getHandle();
+ assertNotNull("The EJBObject Handle returned is null", expected[i]);
+ }
+
+ Handle[] actual = (Handle[])ejbObject.returnHandleArray(expected);
+ assertNotNull("The Handle array returned is null", actual);
+ assertEquals(expected.length, actual.length);
+
+ for (int i=0; i < expected.length; i++){
+ assertNotNull("The EJBObject Handle returned is null", actual[i]);
+ assertNotNull("The EJBObject in the Handle is null", \
actual[i].getEJBObject()); + assertTrue("The EJBObjects in the Handles \
are not equal", expected[i].getEJBObject().isIdentical(actual[i].getEJBObject())); + \
} +
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+
+/*-------------------------------------------------*/
+/* Foo */
+/*-------------------------------------------------*/
+
+ public void test55_returnObjectGraph() {
+ }
+ public void test56_returnObjectGraphArray() {
+ }
+
+/*-------------------------------------------------*/
+/* Class */
+/*-------------------------------------------------*/
+
+ public void test57_returnClass() {
+ Class[] primitives = {boolean.class, byte.class, char.class, short.class, \
int.class, long.class, float.class, double.class}; + for (Class expected : \
primitives) { + try {
+ Class actual = ejbObject.returnClass(expected);
+ assertEquals(expected, actual);
+ } catch (Exception e) {
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ }
+
+ public void test58_returnClassArray() {
+ try {
+ Class[] expected = {boolean.class, byte.class, char.class, short.class, \
int.class, long.class, float.class, double.class}; + Class[] actual = \
ejbObject.returnClassArray(expected); +
+ assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], actual[i]);
+ }
+ } catch (RemoteException e) {
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test59_returnClassObjectGraph() {
+ try {
+ Class[] primitives = {boolean.class, byte.class, char.class, \
short.class, int.class, long.class, float.class, double.class}; + \
ObjectGraph expectedGraph = new ObjectGraph(primitives); +
+ ObjectGraph actualGraph = ejbObject.returnObjectGraph(expectedGraph);
+
+ Class[] expected = (Class[]) expectedGraph.getObject();
+ Class[] actual = (Class[]) actualGraph.getObject();
+
+ assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], actual[i]);
+ }
+ } catch (RemoteException e) {
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+}
+
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonSetterInjectionTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/ \
src/main/java/org/apache/openejb/test/singleton/SingletonSetterInjectionTests.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonSetterInjectionTests.java \
(added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonSetterInjectionTests.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,272 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import org.apache.openejb.test.stateful.StatefulTestClient;
+import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.TestFailureException;
+
+/**
+ * [4] Should be run as the fourth test suite of the StatefulTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class SingletonSetterInjectionTests extends StatefulTestClient {
+
+ protected EncSingletonHome ejbHome;
+ protected EncSingletonObject ejbObject;
+
+ public SingletonSetterInjectionTests(){
+ super("SetterInjection.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = \
initialContext.lookup("client/tests/singleton/SetterInjectionSingletonBean"); + \
ejbHome = (EncSingletonHome)javax.rmi.PortableRemoteObject.narrow( obj, \
EncSingletonHome.class); + ejbObject = ejbHome.create();
+
+ /*[2] Create database table */
+ TestManager.getDatabase().createEntityTable();
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ */
+ protected void tearDown() throws Exception {
+ try {
+ /*[1] Drop database table */
+ TestManager.getDatabase().dropEntityTable();
+ } catch (Exception e){
+ throw e;
+ } finally {
+ super.tearDown();
+ }
+ }
+
+ public void test01_lookupStringEntry() {
+ try{
+ ejbObject.lookupStringEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test02_lookupDoubleEntry() {
+ try{
+ ejbObject.lookupDoubleEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test03_lookupLongEntry() {
+ try{
+ ejbObject.lookupLongEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test04_lookupFloatEntry() {
+ try{
+ ejbObject.lookupFloatEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test05_lookupIntegerEntry() {
+ try{
+ ejbObject.lookupIntegerEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test06_lookupShortEntry() {
+ try{
+ ejbObject.lookupShortEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test07_lookupBooleanEntry() {
+ try{
+ ejbObject.lookupBooleanEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test08_lookupByteEntry() {
+ try{
+ ejbObject.lookupByteEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test09_lookupCharacterEntry() {
+ try{
+ ejbObject.lookupCharacterEntry();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test10_lookupEntityBean() {
+ try{
+ ejbObject.lookupEntityBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test11_lookupStatefulBean() {
+ try{
+ ejbObject.lookupStatefulBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test12_lookupSingletonBean() {
+ try{
+ ejbObject.lookupSingletonBean();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test13_lookupResource() {
+ try{
+ ejbObject.lookupResource();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test14_lookupPersistenceUnit() {
+ try{
+ ejbObject.lookupPersistenceUnit();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test15_lookupPersistenceContext() {
+ try{
+ ejbObject.lookupPersistenceContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test18_lookupSessionContext() {
+ try{
+ ejbObject.lookupSessionContext();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test19_lookupSingletonBusinessLocal() {
+ try{
+ ejbObject.lookupSingletonBusinessLocal();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test20_lookupSingletonBusinessRemote() {
+ try{
+ ejbObject.lookupSingletonBusinessRemote();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test21_lookupStatefulBusinessLocal() {
+ try{
+ ejbObject.lookupStatefulBusinessLocal();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test22_lookupStatefulBusinessRemote() {
+ try{
+ ejbObject.lookupStatefulBusinessRemote();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ public void test23_lookupJMSConnectionFactory() {
+ try{
+ ejbObject.lookupJMSConnectionFactory();
+ } catch (TestFailureException e){
+ throw e.error;
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/ \
src/main/java/org/apache/openejb/test/singleton/SingletonTestClient.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestClient.java \
(added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestClient.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import org.apache.openejb.test.TestClient;
+import org.apache.openejb.test.TestManager;
+
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public abstract class SingletonTestClient extends TestClient {
+
+ public SingletonTestClient(String name) {
+ super("Singleton." + name);
+ }
+
+ /**
+ * Sets up the fixture, for example, open a network connection.
+ * This method is called before a test is executed.
+ */
+ protected void setUp() throws Exception {
+
+ Properties properties = TestManager.getServer().getContextEnvironment();
+ //properties.put(Context.SECURITY_PRINCIPAL, "SINGLETON_test00_CLIENT");
+ //properties.put(Context.SECURITY_CREDENTIALS, toString() );
+ initialContext = new InitialContext(properties);
+ }
+
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestSuite.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/ \
src/main/java/org/apache/openejb/test/singleton/SingletonTestSuite.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestSuite.java \
(added)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/singleton/SingletonTestSuite.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import junit.framework.TestSuite;
+import org.apache.openejb.test.FilteredTestSuite;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ * @version $Rev: 606348 $ $Date: 2007-12-21 15:57:58 -0800 (Fri, 21 Dec 2007) $
+ */
+public class SingletonTestSuite extends junit.framework.TestCase {
+
+ public SingletonTestSuite(String name) {
+ super(name);
+ }
+
+
+ public static junit.framework.Test suite() {
+ TestSuite suite = new FilteredTestSuite();
+ suite.addTest(new SingletonJndiTests());
+ suite.addTest(new SingletonPojoRemoteJndiTests());
+
+ // Test home interfaces
+ suite.addTest(new SingletonHomeIntfcTests());
+ suite.addTest(new SingletonPojoHomeIntfcTests());
+
+ // EJBHome tests
+ suite.addTest(new SingletonEjbHomeTests());
+ suite.addTest(new SingletonPojoEjbHomeTests());
+
+ // EJBObject tests
+ suite.addTest(new SingletonEjbObjectTests());
+ suite.addTest(new SingletonPojoEjbObjectTests());
+
+ // Remote/business interface tests
+ suite.addTest(new SingletonRemoteIntfcTests());
+ suite.addTest(new SingletonPojoRemoteIntrfcTests());
+ suite.addTest(new SingletonRemoteBusinessIntfcTests());
+
+ // Home handle tests
+ suite.addTest(new SingletonHomeHandleTests());
+ suite.addTest(new SingletonPojoHomeHandleTests());
+
+ // Handle tests
+ suite.addTest(new SingletonHandleTests());
+ suite.addTest(new SingletonPojoHandleTests());
+
+ // EJBMetaData tests
+ suite.addTest(new SingletonEjbMetaDataTests());
+ suite.addTest(new SingletonPojoEjbMetaDataTests());
+
+ // Allowed operations
+ suite.addTest(new SingletonAllowedOperationsTests());
+ suite.addTest(new BMTSingletonAllowedOperationsTests());
+
+ suite.addTest(new SingletonBeanTxTests());
+
+ // ENC and Injection
+ suite.addTest(new SingletonJndiEncTests());
+ suite.addTest(new SingletonContextLookupTests());
+ suite.addTest(new SingletonPojoContextLookupTests());
+ suite.addTest(new SingletonFieldInjectionTests());
+ suite.addTest(new SingletonSetterInjectionTests());
+ suite.addTest(new SingletonAnnotatedFieldInjectionTests());
+
+ suite.addTest(new SingletonRmiIiopTests());
+
+ suite.addTest(new MiscEjbTests());
+
+ /*///////////////////////////
+ * Annotated test clients
+ *///////////////////////////
+
+ // Annotated field injection test clients
+ suite.addTest(new AnnotatedFieldInjectionSingletonPojoHomeIntfcTests());
+
+ // Annotated setter injection test clients
+ suite.addTest(new AnnotatedSetterInjectionSingletonPojoHomeIntfcTests());
+
+ /* TO DO
+ suite.addTest(new SingletonEjbContextTests());
+ suite.addTest(new BMTSingletonEjbContextTests());
+ suite.addTest(new BMTSingletonEncTests());
+ suite.addTest(new SingletonContainerManagedTransactionTests());
+ */
+ return suite;
+ }
+}
Modified: openejb/trunk/openejb3/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/pom.xml?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/pom.xml (original)
+++ openejb/trunk/openejb3/pom.xml Sat Jun 28 11:48:28 2008
@@ -253,6 +253,7 @@
<modules>
<!--<module>deps</module>-->
+ <module>api</module>
<module>itests</module>
<module>container</module>
<module>server</module>
Modified: openejb/trunk/openejb3/server/openejb-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/pom.xml?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/pom.xml (original)
+++ openejb/trunk/openejb3/server/openejb-client/pom.xml Sat Jun 28 11:48:28 2008
@@ -91,6 +91,11 @@
<version>5.0-1</version>
</dependency>
<dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>ejb31-api-experimental</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.javamail</groupId>
<artifactId>geronimo-javamail_1.4_mail</artifactId>
<optional>true</optional>
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/EJBHomeHandler.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java \
Sat Jun 28 11:48:28 2008 @@ -45,7 +45,6 @@
}
public static EJBHomeHandler createEJBHomeHandler(EJBMetaDataImpl ejb, \
ServerMetaData server, ClientMetaData client) {
-
switch (ejb.type) {
case EJBMetaDataImpl.BMP_ENTITY:
case EJBMetaDataImpl.CMP_ENTITY:
@@ -59,8 +58,13 @@
case EJBMetaDataImpl.STATELESS:
return new StatelessEJBHomeHandler(ejb, server, client);
+
+ case EJBMetaDataImpl.SINGLETON:
+
+ return new SingletonEJBHomeHandler(ejb, server, client);
}
- return null;
+
+ throw new IllegalStateException("Uknown bean type code '"+ejb.type +"' : \
"+ejb.toString());
}
@@ -74,10 +78,8 @@
Class[] interfaces = new Class[]{ejb.homeClass, EJBHomeProxy.class};
return (EJBHomeProxy) ProxyManager.newProxyInstance(interfaces, this);
} catch (IllegalAccessException e) {
-
- e.printStackTrace();
+ throw new RuntimeException("Unable to create proxy for "+ ejb.homeClass, \
e); }
- return null;
}
protected Object _invoke(Object proxy, Method method, Object[] args) throws \
Throwable {
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/EJBInvocationHandler.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java \
Sat Jun 28 11:48:28 2008 @@ -99,9 +99,9 @@
try {
return c.getMethod(method, params);
} catch (NoSuchMethodException nse) {
+ throw new IllegalStateException("Cannot find method: \
"+c.getName()+"."+method, nse);
}
- return null;
}
public Object invoke(Object proxy, Method method, Object[] args) throws \
Throwable {
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/EJBMetaDataImpl.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java \
Sat Jun 28 11:48:28 2008 @@ -34,6 +34,8 @@
public static final byte CMP_ENTITY = (byte) 9;
+ public static final byte SINGLETON = (byte) 10;
+
protected transient byte type;
protected transient String deploymentID;
@@ -61,6 +63,8 @@
this.type = STATEFUL;
} else if ("STATELESS".equalsIgnoreCase(typeOfBean)){
this.type = STATELESS;
+ } else if ("SINGLETON".equalsIgnoreCase(typeOfBean)){
+ this.type = SINGLETON;
} else if ("BMP_ENTITY".equalsIgnoreCase(typeOfBean)){
this.type = BMP_ENTITY;
} else if ("CMP_ENTITY".equalsIgnoreCase(typeOfBean)){
@@ -110,12 +114,20 @@
return type == STATELESS;
}
+ public boolean isStatefulSession() {
+ return type == STATEFUL;
+ }
+
+ public boolean isSingletonSession() {
+ return type == SINGLETON;
+ }
+
public Class getRemoteInterfaceClass() {
return remoteClass;
}
public boolean isSession() {
- return (type == STATEFUL || type == STATELESS);
+ return (type == STATEFUL || type == STATELESS || type == SINGLETON);
}
protected void setEJBHomeProxy(EJBHomeProxy home) {
@@ -186,6 +198,7 @@
switch(type){
case STATEFUL: sb.append("STATEFUL:"); break;
case STATELESS: sb.append("STATELESS:");break;
+ case SINGLETON: sb.append("SINGLETON:");break;
case CMP_ENTITY: sb.append("CMP_ENTITY:");break;
case BMP_ENTITY: sb.append("BMP_ENTITY:");break;
}
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/EJBObjectHandler.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java \
Sat Jun 28 11:48:28 2008 @@ -78,8 +78,13 @@
case EJBMetaDataImpl.STATELESS:
return new StatelessEJBObjectHandler(ejb, server, client, \
primaryKey); +
+ case EJBMetaDataImpl.SINGLETON:
+
+ return new SingletonEJBObjectHandler(ejb, server, client, \
primaryKey); }
- return null;
+
+ throw new IllegalStateException("Uknown bean type code '"+ejb.type +"' : \
"+ejb.toString()); }
public abstract Object getRegistryId();
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/JNDIContext.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java \
Sat Jun 28 11:48:28 2008 @@ -190,7 +190,6 @@
}
public EJBHomeProxy createEJBHomeProxy(EJBMetaDataImpl ejbData) {
-
EJBHomeHandler handler = EJBHomeHandler.createEJBHomeHandler(ejbData, \
server, client); EJBHomeProxy proxy = handler.createEJBHomeProxy();
handler.ejb.ejbHomeProxy = proxy;
@@ -240,6 +239,7 @@
throw (NamingException) new NamingException("Cannot lookup '" + name + \
"'.").initCause(e); }
+ System.out.println(res.toString());
switch (res.getResponseCode()) {
case ResponseCodes.JNDI_EJBHOME:
return createEJBHomeProxy((EJBMetaDataImpl) res.getResult());
Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/SingletonEJBHomeHandler.java?rev=672566&view=auto \
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBHomeHandler.java \
(added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBHomeHandler.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.client;
+
+import javax.ejb.RemoveException;
+import java.lang.reflect.Method;
+
+public class SingletonEJBHomeHandler extends EJBHomeHandler {
+
+ public SingletonEJBHomeHandler() {
+ }
+
+ public SingletonEJBHomeHandler(EJBMetaDataImpl ejb, ServerMetaData server, \
ClientMetaData client) { + super(ejb, server, client);
+ }
+
+ protected Object findX(Method method, Object[] args, Object proxy) throws \
Throwable { + throw new SystemException(new \
UnsupportedOperationException("Session beans may not have find methods")); + }
+
+ protected Object removeByPrimaryKey(Method method, Object[] args, Object proxy) \
throws Throwable { + throw new ApplicationException(new \
RemoveException("Session objects are private resources and do not have primary \
keys")); + }
+
+ protected Object removeWithHandle(Method method, Object[] args, Object proxy) \
throws Throwable { + // you can't really remove a singleton handle
+ return null;
+ }
+
+ protected EJBObjectHandler newEJBObjectHandler() {
+ return new SingletonEJBObjectHandler();
+ }
+
+}
Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/SingletonEJBObjectHandler.java?rev=672566&view=auto \
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBObjectHandler.java \
(added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/SingletonEJBObjectHandler.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.client;
+
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+
+public class SingletonEJBObjectHandler extends EJBObjectHandler {
+
+ public Object registryId;
+
+ public SingletonEJBObjectHandler() {
+ }
+
+ public SingletonEJBObjectHandler(EJBMetaDataImpl ejb, ServerMetaData server, \
ClientMetaData client) { + super(ejb, server, client);
+ }
+
+ public SingletonEJBObjectHandler(EJBMetaDataImpl ejb, ServerMetaData server, \
ClientMetaData client, Object primaryKey) { + super(ejb, server, client, \
primaryKey); + }
+
+ public static Object createRegistryId(Object primKey, Object deployId, String \
containerID) { + return "" + deployId + containerID;
+ }
+
+ public Object getRegistryId() {
+ return this.ejb.deploymentID;
+ }
+
+ protected Object getPrimaryKey(Method method, Object[] args, Object proxy) \
throws Throwable { + throw new RemoteException("Session objects are private \
resources and do not have primary keys"); + }
+
+ protected Object isIdentical(Method method, Object[] args, Object proxy) throws \
Throwable { +
+ Object arg = (args.length == 1) ? args[0] : null;
+
+ if (arg == null || !(arg instanceof EJBObjectProxy)) return Boolean.FALSE;
+ EJBObjectProxy proxy2 = (EJBObjectProxy) arg;
+ EJBObjectHandler that = proxy2.getEJBObjectHandler();
+ return this.ejb.deploymentID.equals(that.ejb.deploymentID);
+ }
+
+ protected Object equals(Method method, Object[] args, Object proxy) throws \
Throwable { + return isIdentical(method, args, proxy);
+ }
+
+ protected void invalidateReference() {
+ }
+
+ protected Object remove(Method method, Object[] args, Object proxy) throws \
Throwable { + // you can't really remove a singleton handle
+ return null;
+ }
+
+}
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatefulEJBHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/StatefulEJBHomeHandler.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatefulEJBHomeHandler.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatefulEJBHomeHandler.java \
Sat Jun 28 11:48:28 2008 @@ -31,7 +31,7 @@
}
protected Object findX(Method method, Object[] args, Object proxy) throws \
Throwable {
- throw new SystemException(new UnsupportedOperationException("Stateful beans \
may not have find methods")); + throw new SystemException(new \
UnsupportedOperationException("Session beans may not have find methods")); }
protected Object removeByPrimaryKey(Method method, Object[] args, Object proxy) \
throws Throwable {
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatelessEJBHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/mai \
n/java/org/apache/openejb/client/StatelessEJBHomeHandler.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatelessEJBHomeHandler.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/StatelessEJBHomeHandler.java \
Sat Jun 28 11:48:28 2008 @@ -30,7 +30,7 @@
}
protected Object findX(Method method, Object[] args, Object proxy) throws \
Throwable {
- throw new SystemException(new UnsupportedOperationException("Stateful beans \
may not have find methods")); + throw new SystemException(new \
UnsupportedOperationException("Session beans may not have find methods")); }
protected Object removeByPrimaryKey(Method method, Object[] args, Object proxy) \
throws Throwable {
Modified: openejb/trunk/openejb3/server/openejb-ejbd/src/test/java/org/apache/openejb/RemoteiTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-ejbd/src/test/ \
java/org/apache/openejb/RemoteiTest.java?rev=672566&r1=672565&r2=672566&view=diff \
==============================================================================
--- openejb/trunk/openejb3/server/openejb-ejbd/src/test/java/org/apache/openejb/RemoteiTest.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-ejbd/src/test/java/org/apache/openejb/RemoteiTest.java \
Sat Jun 28 11:48:28 2008 @@ -24,6 +24,7 @@
import org.apache.openejb.server.ServiceException;
import org.apache.openejb.server.ejbd.EjbServer;
import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.singleton.SingletonTestSuite;
import org.apache.openejb.test.entity.bmp.BmpTestSuite;
import org.apache.openejb.test.entity.cmp.CmpTestSuite;
import org.apache.openejb.test.stateful.StatefulTestSuite;
@@ -57,6 +58,7 @@
public static Test suite() {
TestSuite suite = new RemoteiTest();
+ suite.addTest(SingletonTestSuite.suite());
suite.addTest(StatelessTestSuite.suite());
suite.addTest(StatefulTestSuite.suite());
suite.addTest(BmpTestSuite.suite());
@@ -78,6 +80,7 @@
props.put("openejb.deployments.classpath.include", \
".*openejb-itests-beans.*");
// ...and have the openejb-itests-beans included in the deployments \
(it's a system app)
props.put("openejb.deployments.classpath.filter.systemapps", \
"false"); +// props.put("openejb.debuggable-vm-hackery", "true");
OpenEJB.init(props, new ServerFederation());
ejbServer.init(props);
Modified: openejb/trunk/openejb3/server/openejb-http/src/test/java/org/apache/openejb/server/httpd/HttpEjbServerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-http/src/test/ \
java/org/apache/openejb/server/httpd/HttpEjbServerTest.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-http/src/test/java/org/apache/openejb/server/httpd/HttpEjbServerTest.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-http/src/test/java/org/apache/openejb/server/httpd/HttpEjbServerTest.java \
Sat Jun 28 11:48:28 2008 @@ -28,6 +28,7 @@
import org.apache.openejb.server.ServiceDaemon;
import org.apache.openejb.server.ejbd.EjbServer;
import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.singleton.SingletonTestSuite;
import org.apache.openejb.test.entity.bmp.BmpTestSuite;
import org.apache.openejb.test.entity.cmp.CmpTestSuite;
import org.apache.openejb.test.stateful.StatefulTestSuite;
@@ -63,6 +64,7 @@
public static Test suite() {
TestSuite suite = new HttpEjbServerTest();
+ suite.addTest(SingletonTestSuite.suite());
suite.addTest(StatelessTestSuite.suite());
suite.addTest(StatefulTestSuite.suite());
suite.addTest(BmpTestSuite.suite());
Modified: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/clienttools/ViewEjbBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/m \
ain/java/org/apache/openejb/webadmin/clienttools/ViewEjbBean.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/clienttools/ViewEjbBean.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/clienttools/ViewEjbBean.java \
Sat Jun 28 11:48:28 2008 @@ -124,6 +124,9 @@
case STATELESS :
type = "Stateless SessionBean";
break;
+ case SINGLETON:
+ type = "Singleton SessionBean";
+ break;
default :
type = "Unkown Bean Type";
break;
Modified: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/DeploymentListBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/m \
ain/java/org/apache/openejb/webadmin/main/DeploymentListBean.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/DeploymentListBean.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/DeploymentListBean.java \
Sat Jun 28 11:48:28 2008 @@ -156,6 +156,9 @@
case STATELESS :
type = "Stateless SessionBean";
break;
+ case SINGLETON:
+ type = "Singleton SessionBean";
+ break;
default :
type = "Unkown Bean Type";
break;
Modified: openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webservices/sr \
c/main/java/org/apache/openejb/server/webservices/WsService.java?rev=672566&r1=672565&r2=672566&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java \
(original)
+++ openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java \
Sat Jun 28 11:48:28 2008 @@ -32,6 +32,7 @@
import org.apache.openejb.assembler.classic.WsBuilder;
import org.apache.openejb.assembler.classic.WebAppInfo;
import org.apache.openejb.assembler.classic.ServletInfo;
+import org.apache.openejb.assembler.classic.SingletonBeanInfo;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.core.webservices.PortAddressRegistryImpl;
import org.apache.openejb.core.webservices.PortAddressRegistry;
@@ -218,13 +219,12 @@
contextData.put("ejbJarId", ejbJar.moduleId);
for (EnterpriseBeanInfo bean : ejbJar.enterpriseBeans) {
- if (bean instanceof StatelessBeanInfo) {
- StatelessBeanInfo statelessBeanInfo = (StatelessBeanInfo) \
bean; + if (bean instanceof StatelessBeanInfo || bean instanceof \
SingletonBeanInfo) {
- DeploymentInfo deploymentInfo = \
containerSystem.getDeploymentInfo(statelessBeanInfo.ejbDeploymentId); + \
DeploymentInfo deploymentInfo = \
containerSystem.getDeploymentInfo(bean.ejbDeploymentId); if (deploymentInfo == null) \
continue;
- PortInfo portInfo = ports.get(statelessBeanInfo.ejbName);
+ PortInfo portInfo = ports.get(bean.ejbName);
if (portInfo == null) continue;
try {
@@ -238,7 +238,7 @@
location = autoAssignWsLocation(bean, port, \
contextData, deploymentIdTemplate); }
if (!location.startsWith("/")) location = "/" + \
location;
- ejbLocations.put(statelessBeanInfo.ejbDeploymentId, \
location); + ejbLocations.put(bean.ejbDeploymentId, \
location);
ClassLoader classLoader = \
deploymentInfo.getClassLoader(); if (wsRegistry != null) {
@@ -327,10 +327,9 @@
}
for (EnterpriseBeanInfo enterpriseBean : ejbJar.enterpriseBeans) {
- if (enterpriseBean instanceof StatelessBeanInfo) {
- StatelessBeanInfo statelessBeanInfo = (StatelessBeanInfo) \
enterpriseBean; + if (enterpriseBean instanceof StatelessBeanInfo \
|| enterpriseBean instanceof SingletonBeanInfo) {
- PortInfo portInfo = ports.get(statelessBeanInfo.ejbName);
+ PortInfo portInfo = ports.get(enterpriseBean.ejbName);
if (portInfo == null) continue;
// remove wsdl addresses from global registry
@@ -340,13 +339,13 @@
}
// remove container from web server
- String location = \
ejbLocations.get(statelessBeanInfo.ejbDeploymentId); + String \
location = ejbLocations.get(enterpriseBean.ejbDeploymentId);
if (this.wsRegistry != null && location != null) {
this.wsRegistry.removeWsContainer(location);
}
// destroy webservice container
- destroyEjbWsContainer(statelessBeanInfo.ejbDeploymentId);
+ destroyEjbWsContainer(enterpriseBean.ejbDeploymentId);
}
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic