You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2008/06/28 20:48:33 UTC
svn commit: r672566 [4/9] - in /openejb/trunk/openejb3: ./ api/
api/ejb31-api-experimental/ api/ejb31-api-experimental/src/
api/ejb31-api-experimental/src/main/
api/ejb31-api-experimental/src/main/java/
api/ejb31-api-experimental/src/main/java/javax/ a...
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonHome.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonHome.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonHome.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonHome.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,29 @@
+/**
+ * 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;
+
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface EncSingletonHome extends javax.ejb.EJBHome {
+
+ public EncSingletonObject create()
+ throws javax.ejb.CreateException, java.rmi.RemoteException;
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonObject.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonObject.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonObject.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/EncSingletonObject.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,54 @@
+/**
+ * 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 java.rmi.RemoteException;
+
+import org.apache.openejb.test.TestFailureException;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface EncSingletonObject extends javax.ejb.EJBObject{
+
+ public void lookupEntityBean() throws TestFailureException, RemoteException;
+ public void lookupStatefulBean() throws TestFailureException, RemoteException;
+ public void lookupSingletonBean() throws TestFailureException, RemoteException;
+
+ public void lookupSingletonBusinessLocal() throws TestFailureException, RemoteException;
+ public void lookupSingletonBusinessRemote() throws TestFailureException, RemoteException;
+ public void lookupStatefulBusinessLocal() throws TestFailureException, RemoteException;
+ public void lookupStatefulBusinessRemote() throws TestFailureException, RemoteException;
+
+ public void lookupResource() throws TestFailureException, RemoteException;
+ public void lookupJMSConnectionFactory() throws TestFailureException, RemoteException;
+ public void lookupPersistenceUnit() throws TestFailureException, RemoteException;
+ public void lookupPersistenceContext() throws TestFailureException, RemoteException;
+ public void lookupSessionContext() throws TestFailureException, RemoteException;
+ public void lookupStringEntry() throws TestFailureException, RemoteException;
+ public void lookupDoubleEntry() throws TestFailureException, RemoteException;
+ public void lookupLongEntry() throws TestFailureException, RemoteException;
+ public void lookupFloatEntry() throws TestFailureException, RemoteException;
+ public void lookupIntegerEntry() throws TestFailureException, RemoteException;
+ public void lookupShortEntry() throws TestFailureException, RemoteException;
+ public void lookupBooleanEntry() throws TestFailureException, RemoteException;
+ public void lookupByteEntry() throws TestFailureException, RemoteException;
+ public void lookupCharacterEntry() throws TestFailureException, RemoteException;
+
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/FieldInjectionSingletonBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/FieldInjectionSingletonBean.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/FieldInjectionSingletonBean.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/FieldInjectionSingletonBean.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,316 @@
+/**
+ * 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.Assert;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.JMSException;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+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 FieldInjectionSingletonBean implements SessionBean {
+
+ private SessionContext ejbContext;
+ private BasicBmpHome bmpHome;
+ private BasicStatefulHome statefulHome;
+ private BasicSingletonHome singletonHome;
+ private String striing;
+ private Double doouble;
+ private Long loong;
+ private Float flooat;
+ private Integer inteeger;
+ private Short shoort;
+ private Boolean booolean;
+ private Byte byyte;
+ private Character chaaracter;
+ private DataSource daataSource;
+ private ConnectionFactory coonnectionFactory;
+ private QueueConnectionFactory queueCoonnectionFactory;
+ private TopicConnectionFactory topicCoonnectionFactory;
+ private EntityManagerFactory emf;
+ private EntityManager em;
+ private EntityManager eem;
+ private EntityManager pem;
+ private BasicSingletonBusinessLocal singletonBusinessLocal;
+ private BasicSingletonBusinessRemote singletonBusinessRemote;
+ private BasicStatefulBusinessLocal statefulBusinessLocal;
+ private BasicStatefulBusinessRemote statefulBusinessRemote;
+
+
+ public void ejbCreate() throws CreateException {
+ }
+
+ public void lookupEntityBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", bmpHome);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", statefulHome);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", singletonHome);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBusinessLocal() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessLocal is null", singletonBusinessLocal );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBusinessRemote() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessRemote is null", singletonBusinessRemote );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessLocal() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocal );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessRemote() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemote );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStringEntry() throws TestFailureException {
+ try {
+ String expected = new String("1");
+ Assert.assertNotNull("The String looked up is null", striing);
+ Assert.assertEquals(expected, striing);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupDoubleEntry() throws TestFailureException {
+ try {
+ Double expected = new Double(1.0D);
+
+ Assert.assertNotNull("The Double looked up is null", doouble);
+ Assert.assertEquals(expected, doouble);
+
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupLongEntry() throws TestFailureException {
+ try {
+ Long expected = new Long(1L);
+
+ Assert.assertNotNull("The Long looked up is null", loong);
+ Assert.assertEquals(expected, loong);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupFloatEntry() throws TestFailureException {
+ try {
+ Float expected = new Float(1.0F);
+
+ Assert.assertNotNull("The Float looked up is null", flooat);
+ Assert.assertEquals(expected, flooat);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupIntegerEntry() throws TestFailureException {
+ try {
+ Integer expected = new Integer(1);
+
+ Assert.assertNotNull("The Integer looked up is null", inteeger);
+ Assert.assertEquals(expected, inteeger);
+
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupShortEntry() throws TestFailureException {
+ try {
+ Short expected = new Short((short) 1);
+
+ Assert.assertNotNull("The Short looked up is null", shoort);
+ Assert.assertEquals(expected, shoort);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupBooleanEntry() throws TestFailureException {
+ try {
+ Boolean expected = new Boolean(true);
+
+ Assert.assertNotNull("The Boolean looked up is null", booolean);
+ Assert.assertEquals(expected, booolean);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupByteEntry() throws TestFailureException {
+ try {
+ Byte expected = new Byte((byte) 1);
+
+ Assert.assertNotNull("The Byte looked up is null", byyte);
+ Assert.assertEquals(expected, byyte);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupCharacterEntry() throws TestFailureException {
+ try {
+ Character expected = new Character('D');
+
+ Assert.assertNotNull("The Character looked up is null", chaaracter);
+ Assert.assertEquals(expected, chaaracter);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupResource() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The DataSource is null", daataSource);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupJMSConnectionFactory() throws TestFailureException{
+ try{
+ try{
+ testJmsConnection(coonnectionFactory.createConnection());
+ testJmsConnection(queueCoonnectionFactory.createConnection());
+ testJmsConnection(topicCoonnectionFactory.createConnection());
+ } catch (Exception e){
+ e.printStackTrace();
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ private void testJmsConnection(javax.jms.Connection connection) throws JMSException {
+ Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ Topic topic = session.createTopic("test");
+ MessageProducer producer = session.createProducer(topic);
+ producer.send(session.createMessage());
+ producer.close();
+ session.close();
+ connection.close();
+ }
+
+ public void lookupPersistenceUnit() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EntityManagerFactory is null", emf);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupPersistenceContext() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EntityManager is null", em);
+
+ try {
+ // call a do nothing method to assure entity manager actually exists
+ em.getFlushMode();
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSessionContext() throws TestFailureException {
+ try {
+// TODO: DMB: Can't seem to find where to make this work
+// Assert.assertNotNull("The SessionContext is null", ejbContext);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {
+ }
+
+ public String remove(String arg) {
+ return arg;
+ }
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonBean.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonBean.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonBean.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,478 @@
+/**
+ * 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 java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+
+import org.apache.openejb.test.object.ObjectGraph;
+
+/**
+ *
+ * @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 RmiIiopSingletonBean implements javax.ejb.SessionBean{
+
+ private String name;
+ private SessionContext ejbContext;
+
+
+ //=============================
+ // Home interface methods
+ //
+ //
+ // Home interface methods
+ //=============================
+
+
+ //=============================
+ // Remote interface methods
+ //
+ /*-------------------------------------------------*/
+ /* String */
+ /*-------------------------------------------------*/
+
+ public String returnStringObject(String data) {
+ return data;
+ }
+
+ public String[] returnStringObjectArray(String[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Character */
+ /*-------------------------------------------------*/
+
+ public Character returnCharacterObject(Character data) {
+ return data;
+ }
+
+ public char returnCharacterPrimitive(char data) {
+ return data;
+ }
+
+ public Character[] returnCharacterObjectArray(Character[] data) {
+ return data;
+ }
+
+ public char[] returnCharacterPrimitiveArray(char[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Boolean */
+ /*-------------------------------------------------*/
+
+ public Boolean returnBooleanObject(Boolean data) {
+ return data;
+ }
+
+ public boolean returnBooleanPrimitive(boolean data) {
+ return data;
+ }
+
+ public Boolean[] returnBooleanObjectArray(Boolean[] data) {
+ return data;
+ }
+
+ public boolean[] returnBooleanPrimitiveArray(boolean[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Byte */
+ /*-------------------------------------------------*/
+
+ public Byte returnByteObject(Byte data) {
+ return data;
+ }
+
+ public byte returnBytePrimitive(byte data) {
+ return data;
+ }
+
+ public Byte[] returnByteObjectArray(Byte[] data) {
+ return data;
+ }
+
+ public byte[] returnBytePrimitiveArray(byte[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Short */
+ /*-------------------------------------------------*/
+
+ public Short returnShortObject(Short data) {
+ return data;
+ }
+
+ public short returnShortPrimitive(short data) {
+ return data;
+ }
+
+ public Short[] returnShortObjectArray(Short[] data) {
+ return data;
+ }
+
+ public short[] returnShortPrimitiveArray(short[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Integer */
+ /*-------------------------------------------------*/
+
+ public Integer returnIntegerObject(Integer data) {
+ return data;
+ }
+
+ public int returnIntegerPrimitive(int data) {
+ return data;
+ }
+
+ public Integer[] returnIntegerObjectArray(Integer[] data) {
+ return data;
+ }
+
+ public int[] returnIntegerPrimitiveArray(int[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Long */
+ /*-------------------------------------------------*/
+
+ public Long returnLongObject(Long data) {
+ return data;
+ }
+
+ public long returnLongPrimitive(long data) {
+ return data;
+ }
+
+ public Long[] returnLongObjectArray(Long[] data) {
+ return data;
+ }
+
+ public long[] returnLongPrimitiveArray(long[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Float */
+ /*-------------------------------------------------*/
+
+ public Float returnFloatObject(Float data) {
+ return data;
+ }
+
+ public float returnFloatPrimitive(float data) {
+ return data;
+ }
+
+ public Float[] returnFloatObjectArray(Float[] data) {
+ return data;
+ }
+
+ public float[] returnFloatPrimitiveArray(float[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Double */
+ /*-------------------------------------------------*/
+
+ public Double returnDoubleObject(Double data) {
+ return data;
+ }
+
+ public double returnDoublePrimitive(double data) {
+ return data;
+ }
+
+ public Double[] returnDoubleObjectArray(Double[] data) {
+ return data;
+ }
+
+ public double[] returnDoublePrimitiveArray(double[] data) {
+ return data;
+ }
+
+
+ /*-------------------------------------------------*/
+ /* EJBHome */
+ /*-------------------------------------------------*/
+
+ public EJBHome returnEJBHome(EJBHome data) {
+ return data;
+ }
+
+ public EJBHome returnEJBHome() throws javax.ejb.EJBException{
+ EJBHome data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ data = (EJBHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+
+ } catch (Exception e){
+ e.printStackTrace();
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public ObjectGraph returnNestedEJBHome() throws javax.ejb.EJBException{
+ ObjectGraph data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ Object object = ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ data = new ObjectGraph(object);
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public EJBHome[] returnEJBHomeArray(EJBHome[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* EJBObject */
+ /*-------------------------------------------------*/
+
+ public EJBObject returnEJBObject(EJBObject data) {
+ return data;
+ }
+
+ public EJBObject returnEJBObject() throws javax.ejb.EJBException{
+ EncSingletonObject data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ data = home.create();
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public ObjectGraph returnNestedEJBObject() throws javax.ejb.EJBException{
+ ObjectGraph data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ EncSingletonObject object = home.create();
+ data = new ObjectGraph(object);
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public EJBObject[] returnEJBObjectArray(EJBObject[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* EJBMetaData */
+ /*-------------------------------------------------*/
+
+ public EJBMetaData returnEJBMetaData(EJBMetaData data) {
+ return data;
+ }
+
+ public EJBMetaData returnEJBMetaData() throws javax.ejb.EJBException{
+ EJBMetaData data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ data = home.getEJBMetaData();
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public ObjectGraph returnNestedEJBMetaData() throws javax.ejb.EJBException{
+ ObjectGraph data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ EJBMetaData object = home.getEJBMetaData();
+ data = new ObjectGraph(object);
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public EJBMetaData[] returnEJBMetaDataArray(EJBMetaData[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* Handle */
+ /*-------------------------------------------------*/
+
+ public Handle returnHandle(Handle data) {
+ return data;
+ }
+
+ public Handle returnHandle() throws javax.ejb.EJBException{
+ Handle data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ EncSingletonObject object = home.create();
+ data = object.getHandle();
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public ObjectGraph returnNestedHandle() throws javax.ejb.EJBException{
+ ObjectGraph data = null;
+
+ try{
+ InitialContext ctx = new InitialContext();
+
+ EncSingletonHome home = (EncSingletonHome)ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
+ EncSingletonObject object = home.create();
+ data = new ObjectGraph(object.getHandle());
+
+ } catch (Exception e){
+ throw new javax.ejb.EJBException(e);
+ }
+ return data;
+ }
+
+ public Handle[] returnHandleArray(Handle[] data) {
+ return data;
+ }
+
+
+ /*-------------------------------------------------*/
+ /* Class */
+ /*-------------------------------------------------*/
+
+ public Class returnClass(Class data) {
+ return data;
+ }
+
+ public Class[] returnClassArray(Class[] data) {
+ return data;
+ }
+
+ /*-------------------------------------------------*/
+ /* ObjectGraph */
+ /*-------------------------------------------------*/
+
+ public ObjectGraph returnObjectGraph(ObjectGraph data) {
+ return data;
+ }
+
+ public ObjectGraph[] returnObjectGraphArray(ObjectGraph[] data) {
+ return data;
+ }
+
+ public String remove(String arg) {
+ return arg;
+ }
+
+ //
+ // Remote interface methods
+ //=============================
+
+
+ //================================
+ // SessionBean interface methods
+ //
+ /**
+ * Set the associated session context. The container calls this method
+ * after the instance creation.
+ */
+ public void setSessionContext(SessionContext ctx) throws EJBException,RemoteException {
+ ejbContext = ctx;
+ }
+ /**
+ *
+ * @exception javax.ejb.CreateException
+ */
+ public void ejbCreate() throws javax.ejb.CreateException{
+ this.name = "nameless automaton";
+ }
+ /**
+ * A container invokes this method before it ends the life of the session
+ * object. This happens as a result of a client's invoking a remove
+ * operation, or when a container decides to terminate the session object
+ * after a timeout.
+ */
+ public void ejbRemove() throws EJBException,RemoteException {
+ }
+
+ /**
+ * The activate method is called when the instance is activated
+ * from its "passive" state. The instance should acquire any resource
+ * that it has released earlier in the ejbPassivate() method.
+ */
+ public void ejbActivate() throws EJBException,RemoteException {
+ // Should never called.
+ }
+ /**
+ * The passivate method is called before the instance enters
+ * the "passive" state. The instance should release any resources that
+ * it can re-acquire later in the ejbActivate() method.
+ */
+ public void ejbPassivate() throws EJBException,RemoteException {
+ // Should never called.
+ }
+
+ //
+ // SessionBean interface methods
+ //================================
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonHome.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonHome.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonHome.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonHome.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,29 @@
+/**
+ * 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;
+
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface RmiIiopSingletonHome extends javax.ejb.EJBHome {
+
+ public RmiIiopSingletonObject create()
+ throws javax.ejb.CreateException, java.rmi.RemoteException;
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonObject.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonObject.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonObject.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/RmiIiopSingletonObject.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,143 @@
+/**
+ * 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 java.rmi.RemoteException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+
+import org.apache.openejb.test.object.ObjectGraph;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface RmiIiopSingletonObject extends javax.ejb.EJBObject{
+
+ public String returnStringObject(String data) throws RemoteException;
+
+ public String[] returnStringObjectArray(String[] data) throws RemoteException;
+
+ public Character returnCharacterObject(Character data) throws RemoteException;
+
+ public char returnCharacterPrimitive(char data) throws RemoteException;
+
+ public Character[] returnCharacterObjectArray(Character[] data) throws RemoteException;
+
+ public char[] returnCharacterPrimitiveArray(char[] data) throws RemoteException;
+
+ public Boolean returnBooleanObject(Boolean data) throws RemoteException;
+
+ public boolean returnBooleanPrimitive(boolean data) throws RemoteException;
+
+ public Boolean[] returnBooleanObjectArray(Boolean[] data) throws RemoteException;
+
+ public boolean[] returnBooleanPrimitiveArray(boolean[] data) throws RemoteException;
+
+ public Byte returnByteObject(Byte data) throws RemoteException;
+
+ public byte returnBytePrimitive(byte data) throws RemoteException;
+
+ public Byte[] returnByteObjectArray(Byte[] data) throws RemoteException;
+
+ public byte[] returnBytePrimitiveArray(byte[] data) throws RemoteException;
+
+ public Short returnShortObject(Short data) throws RemoteException;
+
+ public short returnShortPrimitive(short data) throws RemoteException;
+
+ public Short[] returnShortObjectArray(Short[] data) throws RemoteException;
+
+ public short[] returnShortPrimitiveArray(short[] data) throws RemoteException;
+
+ public Integer returnIntegerObject(Integer data) throws RemoteException;
+
+ public int returnIntegerPrimitive(int data) throws RemoteException;
+
+ public Integer[] returnIntegerObjectArray(Integer[] data) throws RemoteException;
+
+ public int[] returnIntegerPrimitiveArray(int[] data) throws RemoteException;
+
+ public Long returnLongObject(Long data) throws RemoteException;
+
+ public long returnLongPrimitive(long data) throws RemoteException;
+
+ public Long[] returnLongObjectArray(Long[] data) throws RemoteException;
+
+ public long[] returnLongPrimitiveArray(long[] data) throws RemoteException;
+
+ public Float returnFloatObject(Float data) throws RemoteException;
+
+ public float returnFloatPrimitive(float data) throws RemoteException;
+
+ public Float[] returnFloatObjectArray(Float[] data) throws RemoteException;
+
+ public float[] returnFloatPrimitiveArray(float[] data) throws RemoteException;
+
+ public Double returnDoubleObject(Double data) throws RemoteException;
+
+ public double returnDoublePrimitive(double data) throws RemoteException;
+
+ public Double[] returnDoubleObjectArray(Double[] data) throws RemoteException;
+
+ public double[] returnDoublePrimitiveArray(double[] data) throws RemoteException;
+
+ public EJBHome returnEJBHome(EJBHome data) throws RemoteException;
+
+ public EJBHome returnEJBHome() throws RemoteException;
+
+ public ObjectGraph returnNestedEJBHome() throws RemoteException;
+
+ public EJBHome[] returnEJBHomeArray(EJBHome[] data) throws RemoteException;
+
+ public EJBObject returnEJBObject(EJBObject data) throws RemoteException;
+
+ public EJBObject returnEJBObject() throws RemoteException;
+
+ public ObjectGraph returnNestedEJBObject() throws RemoteException;
+
+ public EJBObject[] returnEJBObjectArray(EJBObject[] data) throws RemoteException;
+
+ public EJBMetaData returnEJBMetaData(EJBMetaData data) throws RemoteException;
+
+ public EJBMetaData returnEJBMetaData() throws RemoteException;
+
+ public ObjectGraph returnNestedEJBMetaData() throws RemoteException;
+
+ public EJBMetaData[] returnEJBMetaDataArray(EJBMetaData[] data) throws RemoteException;
+
+ public Handle returnHandle(Handle data) throws RemoteException;
+
+ public Handle returnHandle() throws RemoteException;
+
+ public ObjectGraph returnNestedHandle() throws RemoteException;
+
+ public Handle[] returnHandleArray(Handle[] data) throws RemoteException;
+
+ public ObjectGraph returnObjectGraph(ObjectGraph data) throws RemoteException;
+
+ public ObjectGraph[] returnObjectGraphArray(ObjectGraph[] data) throws RemoteException;
+
+ public Class returnClass(Class data) throws RemoteException;
+
+ public Class[] returnClassArray(Class[] data) throws RemoteException;
+
+}
Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/SetterInjectionSingletonBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/SetterInjectionSingletonBean.java?rev=672566&view=auto
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/SetterInjectionSingletonBean.java (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/SetterInjectionSingletonBean.java Sat Jun 28 11:48:28 2008
@@ -0,0 +1,514 @@
+/**
+ * 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.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.TestFailureException;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.sql.DataSource;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.JMSException;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+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 SetterInjectionSingletonBean implements SessionBean {
+
+ private SessionContext ejbContextField;
+ private BasicBmpHome bmpHomeField;
+ private BasicStatefulHome statefulHomeField;
+ private BasicSingletonHome singletonHomeField;
+ private String striingField;
+ private Double dooubleField;
+ private Long loongField;
+ private Float flooatField;
+ private Integer inteegerField;
+ private Short shoortField;
+ private Boolean boooleanField;
+ private Byte byyteField;
+ private Character chaaracterField;
+ private DataSource daataSourceField;
+ private ConnectionFactory coonnectionFactory;
+ private QueueConnectionFactory queueCoonnectionFactory;
+ private TopicConnectionFactory topicCoonnectionFactory;
+ private EntityManagerFactory emfField;
+ private EntityManager emField;
+ private EntityManager eemField;
+ private EntityManager pemField;
+ private BasicSingletonBusinessLocal singletonBusinessLocalField;
+ private BasicSingletonBusinessRemote singletonBusinessRemoteField;
+ private BasicStatefulBusinessLocal statefulBusinessLocalField;
+ private BasicStatefulBusinessRemote statefulBusinessRemoteField;
+
+ public BasicStatefulBusinessLocal getStatefulBusinessLocal() {
+ return statefulBusinessLocalField;
+ }
+
+ public void setStatefulBusinessLocal(BasicStatefulBusinessLocal statefulBusinessLocal) {
+ this.statefulBusinessLocalField = statefulBusinessLocal;
+ }
+
+ public BasicStatefulBusinessRemote getStatefulBusinessRemote() {
+ return statefulBusinessRemoteField;
+ }
+
+ public void setStatefulBusinessRemote(BasicStatefulBusinessRemote statefulBusinessRemote) {
+ this.statefulBusinessRemoteField = statefulBusinessRemote;
+ }
+
+ public BasicSingletonBusinessLocal getSingletonBusinessLocal() {
+ return singletonBusinessLocalField;
+ }
+
+ public void setSingletonBusinessLocal(BasicSingletonBusinessLocal singletonBusinessLocal) {
+ this.singletonBusinessLocalField = singletonBusinessLocal;
+ }
+
+ public BasicSingletonBusinessRemote getSingletonBusinessRemote() {
+ return singletonBusinessRemoteField;
+ }
+
+ public void setSingletonBusinessRemote(BasicSingletonBusinessRemote singletonBusinessRemote) {
+ this.singletonBusinessRemoteField = singletonBusinessRemote;
+ }
+
+ public BasicBmpHome getBmpHome() {
+ return bmpHomeField;
+ }
+
+ public void setBmpHome(BasicBmpHome bmpHome) {
+ this.bmpHomeField = bmpHome;
+ }
+
+ public Boolean getBooolean() {
+ return boooleanField;
+ }
+
+ public void setBooolean(Boolean booolean) {
+ this.boooleanField = booolean;
+ }
+
+ public Byte getByyte() {
+ return byyteField;
+ }
+
+ public void setByyte(Byte byyte) {
+ this.byyteField = byyte;
+ }
+
+ public Character getChaaracter() {
+ return chaaracterField;
+ }
+
+ public void setChaaracter(Character chaaracter) {
+ this.chaaracterField = chaaracter;
+ }
+
+ public DataSource getDaataSource() {
+ return daataSourceField;
+ }
+
+ public void setDaataSource(DataSource daataSource) {
+ this.daataSourceField = daataSource;
+ }
+
+ public ConnectionFactory getCoonnectionFactory() {
+ return coonnectionFactory;
+ }
+
+ public void setCoonnectionFactory(ConnectionFactory coonnectionFactory) {
+ this.coonnectionFactory = coonnectionFactory;
+ }
+
+ public QueueConnectionFactory getQueueCoonnectionFactory() {
+ return queueCoonnectionFactory;
+ }
+
+ public void setQueueCoonnectionFactory(QueueConnectionFactory queueCoonnectionFactory) {
+ this.queueCoonnectionFactory = queueCoonnectionFactory;
+ }
+
+ public TopicConnectionFactory getTopicCoonnectionFactory() {
+ return topicCoonnectionFactory;
+ }
+
+ public void setTopicCoonnectionFactory(TopicConnectionFactory topicCoonnectionFactory) {
+ this.topicCoonnectionFactory = topicCoonnectionFactory;
+ }
+
+ public Double getDoouble() {
+ return dooubleField;
+ }
+
+ public void setDoouble(Double doouble) {
+ this.dooubleField = doouble;
+ }
+
+ public EntityManager getEem() {
+ return eemField;
+ }
+
+ public void setEem(EntityManager eem) {
+ this.eemField = eem;
+ }
+
+ public SessionContext getEjbContext() {
+ return ejbContextField;
+ }
+
+ public void setEjbContext(SessionContext ejbContext) {
+ this.ejbContextField = ejbContext;
+ }
+
+ public EntityManager getEm() {
+ return emField;
+ }
+
+ public void setEm(EntityManager em) {
+ this.emField = em;
+ }
+
+ public EntityManagerFactory getEmf() {
+ return emfField;
+ }
+
+ public void setEmf(EntityManagerFactory emf) {
+ this.emfField = emf;
+ }
+
+ public Float getFlooat() {
+ return flooatField;
+ }
+
+ public void setFlooat(Float flooat) {
+ this.flooatField = flooat;
+ }
+
+ public Integer getInteeger() {
+ return inteegerField;
+ }
+
+ public void setInteeger(Integer inteeger) {
+ this.inteegerField = inteeger;
+ }
+
+ public Long getLoong() {
+ return loongField;
+ }
+
+ public void setLoong(Long loong) {
+ this.loongField = loong;
+ }
+
+ public EntityManager getPem() {
+ return pemField;
+ }
+
+ public void setPem(EntityManager pem) {
+ this.pemField = pem;
+ }
+
+ public Short getShoort() {
+ return shoortField;
+ }
+
+ public void setShoort(Short shoort) {
+ this.shoortField = shoort;
+ }
+
+ public BasicStatefulHome getStatefulHome() {
+ return statefulHomeField;
+ }
+
+ public void setStatefulHome(BasicStatefulHome statefulHome) {
+ this.statefulHomeField = statefulHome;
+ }
+
+ public BasicSingletonHome getSingletonHome() {
+ return singletonHomeField;
+ }
+
+ public void setSingletonHome(BasicSingletonHome singletonHome) {
+ this.singletonHomeField = singletonHome;
+ }
+
+ public String getStriing() {
+ return striingField;
+ }
+
+ public void setStriing(String striing) {
+ this.striingField = striing;
+ }
+
+ public void ejbCreate() throws CreateException {
+ }
+
+ public void lookupEntityBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", bmpHomeField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", statefulHomeField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBean() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EJBObject is null", singletonHomeField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBusinessLocal() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessLocal is null", singletonBusinessLocalField );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSingletonBusinessRemote() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessRemote is null", singletonBusinessRemoteField );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessLocal() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocalField );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessRemote() throws TestFailureException{
+ try{
+ Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemoteField );
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+
+ public void lookupStringEntry() throws TestFailureException {
+ try {
+ String expected = new String("1");
+ Assert.assertNotNull("The String looked up is null", striingField);
+ Assert.assertEquals(expected, striingField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupDoubleEntry() throws TestFailureException {
+ try {
+ Double expected = new Double(1.0D);
+
+ Assert.assertNotNull("The Double looked up is null", dooubleField);
+ Assert.assertEquals(expected, dooubleField);
+
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupLongEntry() throws TestFailureException {
+ try {
+ Long expected = new Long(1L);
+
+ Assert.assertNotNull("The Long looked up is null", loongField);
+ Assert.assertEquals(expected, loongField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupFloatEntry() throws TestFailureException {
+ try {
+ Float expected = new Float(1.0F);
+
+ Assert.assertNotNull("The Float looked up is null", flooatField);
+ Assert.assertEquals(expected, flooatField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupIntegerEntry() throws TestFailureException {
+ try {
+ Integer expected = new Integer(1);
+
+ Assert.assertNotNull("The Integer looked up is null", inteegerField);
+ Assert.assertEquals(expected, inteegerField);
+
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupShortEntry() throws TestFailureException {
+ try {
+ Short expected = new Short((short) 1);
+
+ Assert.assertNotNull("The Short looked up is null", shoortField);
+ Assert.assertEquals(expected, shoortField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupBooleanEntry() throws TestFailureException {
+ try {
+ Boolean expected = new Boolean(true);
+
+ Assert.assertNotNull("The Boolean looked up is null", boooleanField);
+ Assert.assertEquals(expected, boooleanField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupByteEntry() throws TestFailureException {
+ try {
+ Byte expected = new Byte((byte) 1);
+
+ Assert.assertNotNull("The Byte looked up is null", byyteField);
+ Assert.assertEquals(expected, byyteField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupCharacterEntry() throws TestFailureException {
+ try {
+ Character expected = new Character('D');
+
+ Assert.assertNotNull("The Character looked up is null", chaaracterField);
+ Assert.assertEquals(expected, chaaracterField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupResource() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The DataSource is null", daataSourceField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupJMSConnectionFactory() throws TestFailureException{
+ try{
+ try{
+ testJmsConnection(coonnectionFactory.createConnection());
+ testJmsConnection(queueCoonnectionFactory.createConnection());
+ testJmsConnection(topicCoonnectionFactory.createConnection());
+ } catch (Exception e){
+ e.printStackTrace();
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ private void testJmsConnection(javax.jms.Connection connection) throws JMSException {
+ Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ Topic topic = session.createTopic("test");
+ MessageProducer producer = session.createProducer(topic);
+ producer.send(session.createMessage());
+ producer.close();
+ session.close();
+ connection.close();
+ }
+
+ public void lookupPersistenceUnit() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EntityManagerFactory is null", emfField);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupPersistenceContext() throws TestFailureException {
+ try {
+ Assert.assertNotNull("The EntityManager is null", emField);
+
+ try {
+ // call a do nothing method to assure entity manager actually exists
+ emField.getFlushMode();
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupSessionContext() throws TestFailureException {
+ try {
+// TODO: DMB: Can't seem to find where to make this work
+// Assert.assertNotNull("The SessionContext is null", ejbContext);
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {
+ }
+}