You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2007/03/06 06:30:21 UTC
svn commit: r514982 - in /incubator/openejb/trunk/openejb3/itests:
openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/
openejb-itests-beans/src/main/resources/META-INF/
openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/
Author: dain
Date: Mon Mar 5 21:30:19 2007
New Revision: 514982
URL: http://svn.apache.org/viewvc?view=rev&rev=514982
Log:
Added pojo MDB test
Added:
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbPojoBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbPojoContextLookupTests.java
Modified:
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/MdbInvoker.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbContextLookupTests.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbTestSuite.java
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbBean.java?view=diff&rev=514982&r1=514981&r2=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbBean.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbBean.java Mon Mar 5 21:30:19 2007
@@ -430,7 +430,7 @@
// lookup in enc
MessageDrivenContext sctx = (MessageDrivenContext)ctx.lookup("java:comp/env/mdbcontext");
- Assert.assertNotNull("The MessageDrivenContext got from java:comp/env/sessioncontext is null", sctx );
+ Assert.assertNotNull("The MessageDrivenContext got from java:comp/env/mdbcontext is null", sctx );
// lookup using global name
EJBContext ejbCtx = (EJBContext)ctx.lookup("java:comp/EJBContext");
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbPojoBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbPojoBean.java?view=auto&rev=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbPojoBean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/ContextLookupMdbPojoBean.java Mon Mar 5 21:30:19 2007
@@ -0,0 +1,461 @@
+/**
+ *
+ * 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.mdb;
+
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.entity.bmp.BasicBmpObject;
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import javax.sql.DataSource;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.MessageListener;
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.JMSException;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.MessageProducer;
+import java.rmi.RemoteException;
+
+public class ContextLookupMdbPojoBean implements MessageListener {
+ private MdbInvoker mdbInvoker;
+
+ public ContextLookupMdbPojoBean() {
+ try {
+ ConnectionFactory connectionFactory = (ConnectionFactory) new InitialContext().lookup("java:comp/env/jms");
+ mdbInvoker = new MdbInvoker(connectionFactory, this);
+ } catch (Exception e) {
+ throw new EJBException(e);
+ }
+ }
+
+ public void onMessage(Message message) {
+ try {
+// System.out.println("\n" +
+// "***************************************\n" +
+// "Got message: " + message + "\n" +
+// "***************************************\n\n");
+ try {
+ message.acknowledge();
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ mdbInvoker.onMessage(message);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ public void lookupEntityBean() throws TestFailureException {
+ try {
+ try {
+ BasicBmpHome home = (BasicBmpHome) getMessageDrivenContext().lookup("stateless/beanReferences/bmp_entity");
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicBmpObject object = home.createObject("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBean() throws TestFailureException {
+ try {
+ try {
+ BasicStatefulHome home = (BasicStatefulHome) getMessageDrivenContext().lookup("stateless/beanReferences/stateful");
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicStatefulObject object = home.createObject("Enc Bean");
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatelessBean() throws TestFailureException {
+ try {
+ try {
+ BasicStatelessHome home = (BasicStatelessHome) getMessageDrivenContext().lookup("stateless/beanReferences/stateless");
+ Assert.assertNotNull("The EJBHome looked up is null", home);
+
+ BasicStatelessObject object = home.createObject();
+ Assert.assertNotNull("The EJBObject is null", object);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatelessBusinessLocal() throws TestFailureException{
+ try{
+ try{
+ BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) getMessageDrivenContext().lookup("stateless/beanReferences/stateless-business-local");
+ Assert.assertNotNull("The EJB BusinessLocal is null", object );
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatelessBusinessRemote() throws TestFailureException{
+ try{
+ try{
+ BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) getMessageDrivenContext().lookup("stateless/beanReferences/stateless-business-remote");
+ Assert.assertNotNull("The EJB BusinessRemote is null", object );
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessLocal() throws TestFailureException{
+ try{
+ try{
+ BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) getMessageDrivenContext().lookup("stateless/beanReferences/stateful-business-local");
+ Assert.assertNotNull("The EJB BusinessLocal is null", object );
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupStatefulBusinessRemote() throws TestFailureException{
+ try{
+ try{
+ BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) getMessageDrivenContext().lookup("stateless/beanReferences/stateful-business-remote");
+ Assert.assertNotNull("The EJB BusinessRemote is null", object );
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+
+ public void lookupStringEntry() throws TestFailureException {
+ try {
+ try {
+ String expected = new String("1");
+ String actual = (String) getMessageDrivenContext().lookup("stateless/references/String");
+
+ Assert.assertNotNull("The String looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupDoubleEntry() throws TestFailureException {
+ try {
+ try {
+ Double expected = new Double(1.0D);
+ Double actual = (Double) getMessageDrivenContext().lookup("stateless/references/Double");
+
+ Assert.assertNotNull("The Double looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupLongEntry() throws TestFailureException {
+ try {
+ try {
+ Long expected = new Long(1L);
+ Long actual = (Long) getMessageDrivenContext().lookup("stateless/references/Long");
+
+ Assert.assertNotNull("The Long looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupFloatEntry() throws TestFailureException {
+ try {
+ try {
+ Float expected = new Float(1.0F);
+ Float actual = (Float) getMessageDrivenContext().lookup("stateless/references/Float");
+
+ Assert.assertNotNull("The Float looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupIntegerEntry() throws TestFailureException {
+ try {
+ try {
+ Integer expected = new Integer(1);
+ Integer actual = (Integer) getMessageDrivenContext().lookup("stateless/references/Integer");
+
+ Assert.assertNotNull("The Integer looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupShortEntry() throws TestFailureException {
+ try {
+ try {
+ Short expected = new Short((short) 1);
+ Short actual = (Short) getMessageDrivenContext().lookup("stateless/references/Short");
+
+ Assert.assertNotNull("The Short looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupBooleanEntry() throws TestFailureException {
+ try {
+ try {
+ Boolean expected = new Boolean(true);
+ Boolean actual = (Boolean) getMessageDrivenContext().lookup("stateless/references/Boolean");
+
+ Assert.assertNotNull("The Boolean looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupByteEntry() throws TestFailureException {
+ try {
+ try {
+ Byte expected = new Byte((byte) 1);
+ Byte actual = (Byte) getMessageDrivenContext().lookup("stateless/references/Byte");
+
+ Assert.assertNotNull("The Byte looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupCharacterEntry() throws TestFailureException {
+ try {
+ try {
+ Character expected = new Character('D');
+ Character actual = (Character) getMessageDrivenContext().lookup("stateless/references/Character");
+
+ Assert.assertNotNull("The Character looked up is null", actual);
+ Assert.assertEquals(expected, actual);
+
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupResource() throws TestFailureException {
+ try {
+ try {
+ Object obj = getMessageDrivenContext().lookup("datasource");
+ Assert.assertNotNull("The DataSource is null", obj);
+ Assert.assertTrue("Not an instance of DataSource", obj instanceof DataSource);
+ } catch (Exception e) {
+ Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+ }
+ } catch (AssertionFailedError afe) {
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupJMSConnectionFactory() throws TestFailureException{
+ try{
+ try{
+ Object obj = getMessageDrivenContext().lookup("jms");
+ Assert.assertNotNull("The JMS ConnectionFactory is null", obj);
+ Assert.assertTrue("Not an instance of ConnectionFactory", obj instanceof ConnectionFactory);
+ ConnectionFactory connectionFactory = (ConnectionFactory) obj;
+ testJmsConnection(connectionFactory.createConnection());
+
+ obj = getMessageDrivenContext().lookup("TopicCF");
+ Assert.assertNotNull("The JMS TopicConnectionFactory is null", obj);
+ Assert.assertTrue("Not an instance of TopicConnectionFactory", obj instanceof TopicConnectionFactory);
+ TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) obj;
+ testJmsConnection(topicConnectionFactory.createConnection());
+
+ obj = getMessageDrivenContext().lookup("QueueCF");
+ Assert.assertNotNull("The JMS QueueConnectionFactory is null", obj);
+ Assert.assertTrue("Not an instance of QueueConnectionFactory", obj instanceof QueueConnectionFactory);
+ QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) obj;
+ testJmsConnection(queueConnectionFactory.createConnection());
+ } catch (Exception e){
+ e.printStackTrace();
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ private void testJmsConnection(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{
+ try{
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+ EntityManagerFactory emf = (EntityManagerFactory)ctx.lookup("java:comp/env/persistence/TestUnit");
+ Assert.assertNotNull("The EntityManagerFactory is null", emf );
+
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+ }
+
+ public void lookupMessageDrivenContext() throws TestFailureException{
+ try{
+ try{
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+
+ // lookup in enc
+ MessageDrivenContext sctx = (MessageDrivenContext)ctx.lookup("java:comp/env/mdbcontext");
+ Assert.assertNotNull("The MessageDrivenContext got from java:comp/env/mdbcontext is null", sctx );
+
+ // lookup using global name
+ EJBContext ejbCtx = (EJBContext)ctx.lookup("java:comp/EJBContext");
+ Assert.assertNotNull("The MessageDrivenContext got from java:comp/EJBContext is null ", ejbCtx );
+ } catch (Exception e){
+ Assert.fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ } catch (AssertionFailedError afe){
+ throw new TestFailureException(afe);
+ }
+
+ }
+
+ public void lookupPersistenceContext() throws TestFailureException{
+ try{
+ try{
+ InitialContext ctx = new InitialContext();
+ Assert.assertNotNull("The InitialContext is null", ctx);
+ EntityManager em = (EntityManager)ctx.lookup("java:comp/env/persistence/TestContext");
+ Assert.assertNotNull("The EntityManager is null", em);
+
+ // 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);
+ }
+ }
+
+ /**
+ * Set the associated message driven context. The container calls this method
+ * after the instance creation.
+ */
+ public MessageDrivenContext getMessageDrivenContext() throws EJBException, RemoteException {
+ MessageDrivenContext ejbContext = null;
+ try {
+ ejbContext = (MessageDrivenContext) new InitialContext().lookup("java:comp/EJBContext");
+ } catch (NamingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return ejbContext;
+ }
+}
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/MdbInvoker.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/MdbInvoker.java?view=diff&rev=514982&r1=514981&r2=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/MdbInvoker.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/MdbInvoker.java Mon Mar 5 21:30:19 2007
@@ -81,7 +81,7 @@
String signature = (String) request.get("method");
if (signature == null) throw new NullPointerException("method property is null");
Method method = signatures.get(signature);
- if (method == null) throw new IllegalArgumentException("no such method " + method + "; known methods are " + signatures.keySet());
+ if (method == null) throw new IllegalArgumentException("no such method " + signature + "; known methods are " + signatures.keySet());
Object[] args = (Object[]) request.get("args");
boolean exception = false;
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml?view=diff&rev=514982&r1=514981&r2=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml Mon Mar 5 21:30:19 2007
@@ -3993,6 +3993,166 @@
</persistence-context-ref>
</message-driven>
+ <message-driven>
+ <description>
+ Pojo mdb bean for the JNDI ENC tests
+ </description>
+ <ejb-name>ContextLookupMdbPojoBean</ejb-name>
+ <ejb-class>org.apache.openejb.test.mdb.ContextLookupMdbPojoBean</ejb-class>
+ <messaging-type>javax.jms.MessageListener</messaging-type>
+ <transaction-type>Bean</transaction-type>
+
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-link>ContextLookupMdbPojoBean</message-destination-link>
+ <activation-config>
+ <activation-config-property>
+ <activation-config-property-name>destination</activation-config-property-name>
+ <activation-config-property-value>ContextLookupMdbPojoBean</activation-config-property-value>
+ </activation-config-property>
+ </activation-config>
+
+ <env-entry>
+ <env-entry-name>stateless/references/JNDI_access_to_java_comp_env</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>Success</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Boolean</env-entry-name>
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+ <env-entry-value>true</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/String</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Double</env-entry-name>
+ <env-entry-type>java.lang.Double</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Long</env-entry-name>
+ <env-entry-type>java.lang.Long</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Float</env-entry-name>
+ <env-entry-type>java.lang.Float</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Integer</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Short</env-entry-name>
+ <env-entry-type>java.lang.Short</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Byte</env-entry-name>
+ <env-entry-type>java.lang.Byte</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>stateless/references/Character</env-entry-name>
+ <env-entry-type>java.lang.Character</env-entry-type>
+ <env-entry-value>D</env-entry-value>
+ </env-entry>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/Enterprise_bean_access</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.apache.openejb.test.stateful.BasicStatefulHome</home>
+ <remote>org.apache.openejb.test.stateful.BasicStatefulObject</remote>
+ <ejb-link>BasicStatefulBean</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/bmp_entity</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>org.apache.openejb.test.entity.bmp.BasicBmpHome</home>
+ <remote>org.apache.openejb.test.entity.bmp.BasicBmpObject</remote>
+ <ejb-link>BasicBmpBean</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/stateful</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.apache.openejb.test.stateful.BasicStatefulHome</home>
+ <remote>org.apache.openejb.test.stateful.BasicStatefulObject</remote>
+ <ejb-link>BasicStatefulBean</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/stateless</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.apache.openejb.test.stateless.BasicStatelessHome</home>
+ <remote>org.apache.openejb.test.stateless.BasicStatelessObject</remote>
+ <ejb-link>BasicStatelessBean</ejb-link>
+ </ejb-ref>
+ <ejb-local-ref>
+ <ejb-ref-name>stateless/beanReferences/stateless-business-local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.apache.openejb.test.stateless.BasicStatelessBusinessLocal</local>
+ <ejb-link>BasicStatelessPojoBean</ejb-link>
+ </ejb-local-ref>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/stateless-business-remote</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <remote>org.apache.openejb.test.stateless.BasicStatelessBusinessRemote</remote>
+ <ejb-link>BasicStatelessPojoBean</ejb-link>
+ </ejb-ref>
+ <ejb-local-ref>
+ <ejb-ref-name>stateless/beanReferences/stateful-business-local</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.apache.openejb.test.stateful.BasicStatefulBusinessLocal</local>
+ <ejb-link>BasicStatefulPojoBean</ejb-link>
+ </ejb-local-ref>
+ <ejb-ref>
+ <ejb-ref-name>stateless/beanReferences/stateful-business-remote</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <remote>org.apache.openejb.test.stateful.BasicStatefulBusinessRemote</remote>
+ <ejb-link>BasicStatefulPojoBean</ejb-link>
+ </ejb-ref>
+ <resource-ref>
+ <res-ref-name>datasource</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>jms</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>QueueCF</res-ref-name>
+ <res-type>javax.jms.QueueConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>TopicCF</res-ref-name>
+ <res-type>javax.jms.TopicConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ <resource-env-ref>
+ <resource-env-ref-name>mdbcontext</resource-env-ref-name>
+ <resource-env-ref-type>javax.ejb.MessageDrivenContext</resource-env-ref-type>
+ </resource-env-ref>
+ <persistence-unit-ref>
+ <description>
+ Persistence unit for testing the functionality.
+ </description>
+ <persistence-unit-ref-name>persistence/TestUnit</persistence-unit-ref-name>
+ <persistence-unit-name>openjpa-test-unit</persistence-unit-name>
+ </persistence-unit-ref>
+ <persistence-context-ref>
+ <description>
+ Persistence context for testing the functionality.
+ </description>
+ <persistence-context-ref-name>persistence/TestContext</persistence-context-ref-name>
+ <persistence-unit-name>openjpa-test-unit</persistence-unit-name>
+ </persistence-context-ref>
+ </message-driven>
+
</enterprise-beans>
<relationships>
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbContextLookupTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbContextLookupTests.java?view=diff&rev=514982&r1=514981&r2=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbContextLookupTests.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbContextLookupTests.java Mon Mar 5 21:30:19 2007
@@ -35,7 +35,7 @@
protected void setUp() throws Exception {
super.setUp();
- ejbObject = MdbProxy.newProxyInstance(EncMdbObject.class, connectionFactory, "EncMdbBean");
+ ejbObject = MdbProxy.newProxyInstance(EncMdbObject.class, connectionFactory, "ContextLookupMdbBean");
TestManager.getDatabase().createEntityTable();
}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbPojoContextLookupTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbPojoContextLookupTests.java?view=auto&rev=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbPojoContextLookupTests.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbPojoContextLookupTests.java Mon Mar 5 21:30:19 2007
@@ -0,0 +1,221 @@
+/**
+ *
+ * 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.mdb;
+
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.TestManager;
+
+/**
+ * @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 MdbPojoContextLookupTests extends MdbTestClient {
+ protected EncMdbObject ejbObject;
+
+ public MdbPojoContextLookupTests(){
+ super("PojoContextLookup.");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ejbObject = MdbProxy.newProxyInstance(EncMdbObject.class, connectionFactory, "ContextLookupMdbPojoBean");
+ TestManager.getDatabase().createEntityTable();
+ }
+
+
+ protected void tearDown() throws Exception {
+ MdbProxy.destroyProxy(ejbObject);
+ try {
+ 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_lookupStatelessBean() {
+ try{
+ ejbObject.lookupStatelessBean();
+ } 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_lookupMessageDrivenContext() {
+ try{
+ ejbObject.lookupMessageDrivenContext();
+ } 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());
+ }
+ }
+}
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbTestSuite.java?view=diff&rev=514982&r1=514981&r2=514982
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbTestSuite.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/mdb/MdbTestSuite.java Mon Mar 5 21:30:19 2007
@@ -47,7 +47,7 @@
// Enterprise naming context tests
suite.addTest(new MdbJndiEncTests());
suite.addTest(new MdbContextLookupTests());
-// suite.addTest(new StatelessPojoContextLookupTests());
+ suite.addTest(new MdbPojoContextLookupTests());
// Injection tests
// suite.addTest(new StatelessFieldInjectionTests());