User: hiram
Date: 01/02/20 21:07:46
Added: src/main/org/jboss/test/mdb/bean CustomMessage.java
ObjectMessageBean.java
Log:
Added a test to the MDB suite: Check to see if ObjectMessages are received correctly
(and the results were that they were not)
Revision Changes Path
1.1 jbosstest/src/main/org/jboss/test/mdb/bean/CustomMessage.java
Index: CustomMessage.java
===================================================================
/*
* Copyright (c) 2000 Hiram Chirino ([EMAIL PROTECTED])
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.jboss.test.mdb.bean;
/**
* CustomeMessage is used to test the ObjectMessageBean
*
*/
public class CustomMessage implements java.io.Serializable {
int data;
public CustomMessage(int d) {
data = d;
}
public String toString() {
return "CustomMessage:["+data+"]";
}
}
1.1
jbosstest/src/main/org/jboss/test/mdb/bean/ObjectMessageBean.java
Index: ObjectMessageBean.java
===================================================================
/*
* Copyright (c) 2000 Peter Antman DN <[EMAIL PROTECTED]>
* Copyright (c) 2000 Peter Hiram Chirino ([EMAIL PROTECTED])
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.jboss.test.mdb.bean;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
import javax.jms.ObjectMessage;
/**
* ObjectMessageBean.java
* This test the ability to send an ObjectMessage to a MDB
*
* Adapted from the QueueBean class
*
*/
public class ObjectMessageBean implements MessageDrivenBean, MessageListener{
private MessageDrivenContext ctx = null;
public ObjectMessageBean() {
}
public void setMessageDrivenContext(MessageDrivenContext ctx)
throws EJBException {
this.ctx = ctx;
}
public void ejbCreate() {}
public void ejbRemove() {ctx=null;}
public void onMessage(Message message) {
try {
ObjectMessage om = (ObjectMessage)message;
System.err.println("DEBUG: ObjectMessageBean got object: " +
om.getObject().toString() );
} catch ( Throwable e ) {
e.printStackTrace(System.err);
}
}
}