[jboss-cvs] JBossAS SVN: r64419 - in branches/Branch_4_4/testsuite/src/main/org/jboss/test: jmsra/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 1 19:47:24 EDT 2007
Author: clebert.suconic at jboss.com
Date: 2007-08-01 19:47:24 -0400 (Wed, 01 Aug 2007)
New Revision: 64419
Removed:
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java
Modified:
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
Log:
Fixing test - making MDB/MQ tests more generic
Deleted: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jbossmessaging.ra;
-
-import javax.jms.*;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.JBossTestSetup;
-import org.jboss.test.client.test.AppClientUnitTestCase;
-
-import org.jboss.test.jmsra.bean.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test for jmsra.
- *
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:Adrian at jboss.org">Adrian Brock</a>
- * @version $Revision$
- */
-
-public class RaJMSSessionUnitTestCase extends JMSTestCase
-{
- public RaJMSSessionUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testSendToQueueAndTopic()
- throws Exception
- {
- JMSSessionHome home = (JMSSessionHome) getInitialContext().lookup("JMSSession");
- JMSSession session = home.create();
- session.sendToQueueAndTopic();
- }
-
- public static Test suite() throws Exception
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest(new JBossTestSetup(new TestSuite(RaJMSSessionUnitTestCase.class))
- {
- protected void setUp() throws Exception
- {
- super.setUp();
- deploy ("jmsra.jar");
- }
- protected void tearDown() throws Exception
- {
- undeploy ("jmsra.jar");
- super.tearDown();
- }
- });
-
- return suite;
- }
-}
-
-
-
-
-
Deleted: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jbossmessaging.ra;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-
-import javax.management.ObjectName;
-
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestSetup;
-
-/**
- * Test cases for JMS Resource Adapter use a <em>Queue</em> . <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version $Revision$
- */
-public class RaQueueUnitTestCase
- extends RaTest
-{
- private final static String QUEUE_FACTORY = "ConnectionFactory";
- private final static String QUEUE = "queue/testQueue";
- private final static String JNDI = "TxPublisher";
-
- /**
- * Constructor for the RaQueueUnitTestCase object
- *
- * @param name Description of Parameter
- * @exception Exception Description of Exception
- */
- public RaQueueUnitTestCase(String name) throws Exception
- {
- super(name, JNDI);
- }
-
- /**
- * #Description of the Method
- *
- * @param context Description of Parameter
- * @exception Exception Description of Exception
- */
- protected void init(final Context context) throws Exception
- {
- QueueConnectionFactory factory =
- (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-
- connection = factory.createQueueConnection();
-
- session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Queue queue = (Queue)context.lookup(QUEUE);
-
- consumer = ((QueueSession)session).createReceiver(queue);
- }
-
- public static Test suite() throws Exception
- {
- return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
- }
-
-
-}
Deleted: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -1,193 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jbossmessaging.ra;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Queue;
-import javax.naming.Context;
-
-import javax.management.ObjectName;
-
-import javax.naming.InitialContext;
-import junit.framework.Assert;
-
-import junit.framework.Test;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.JBossTestSetup;
-
-import org.jboss.test.jmsra.bean.*;
-
-/**
- *
- * <p>Test sync receive.
- *
- * <p>Created: Sat Sep 22 13:31:54 2001.
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @version $Revision$
- */
-
-public class RaSyncRecUnitTestCase extends JMSTestCase {
-
- private final static String BEAN_JNDI = "QueueRec";
- private final static String QUEUE_FACTORY = "ConnectionFactory";
- private final static String QUEUE = "queue/A";
- private final static int MESSAGE_NR = 10;
-
- /**
- * JMS connection
- */
- protected QueueConnection connection;
- /**
- * JMS session
- */
- protected QueueSession session;
- /**
- * JMS sender
- */
- protected QueueSender sender;
-
- /**
- * Receiving bean
- */
- protected QueueRec rec;
-
- /**
- *
- * Constructor for the RaSyncRecUnitTestCase object
- *
- * @param name Description of Parameter
- * @exception Exception Description of Exception
- */
- public RaSyncRecUnitTestCase(String name) {
- super(name);
- }
-
- /**
- * The JUnit setup method
- *
- * @exception Exception Description of Exception
- */
- protected void setUp() throws Exception
- {
- // call setUp() in super class
- super.setUp() ;
-
- // Create a receiver
- Context context = getInitialContext();
- try
- {
- QueueRecHome home = (QueueRecHome)context.lookup(BEAN_JNDI);
- rec = home.create();
-
- init(context);
- }
- finally
- {
- context.close();
- }
-
- // start up the session
- connection.start();
-
- }
-
- /**
- * #Description of the Method
- *
- * @param context Description of Parameter
- * @exception Exception Description of Exception
- */
- protected void init(final Context context) throws Exception
- {
- QueueConnectionFactory factory =
- (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-
- connection = factory.createQueueConnection();
-
- session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Queue queue = (Queue)context.lookup(QUEUE);
-
- sender = ((QueueSession)session).createSender(queue);
- }
-
- /**
- * The teardown method for JUnit
- *
- * @exception Exception Description of Exception
- */
- protected void tearDown() throws Exception
- {
- if (sender != null)
- {
- sender.close();
- }
- if (session != null) {
- session.close();
- }
- if (connection != null)
- {
- connection.close();
- }
-
- // call tearDown() in superclass
- super.tearDown() ;
- }
-
- /**
- * Test sync receive of message with jms ra.
- */
- public void testSyncRec() throws Exception {
- // Send a message to queue
- TextMessage message = session.createTextMessage();
- message.setText(String.valueOf(MESSAGE_NR));
- message.setIntProperty(Publisher.JMS_MESSAGE_NR, MESSAGE_NR);
- sender.send(message);
- getLog().debug("sent message with nr = " + MESSAGE_NR);
-
- // Let bean fetch it sync
- int res = rec.getMessage();
- Assert.assertEquals(MESSAGE_NR, res);
- getLog().debug("testSyncRec() OK");
- }
-
- public static Test suite() throws Exception
- {
- return getDeploySetup(RaSyncRecUnitTestCase.class, "jmsra.jar");
- }
-} // RaSyncRecUnitTestCase
-
-
-
-
-
Deleted: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -1,294 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jbossmessaging.ra;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.naming.Context;
-
-import javax.naming.InitialContext;
-import junit.framework.Assert;
-
-import junit.framework.TestCase;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-import org.jboss.test.jmsra.bean.*;
-
-/**
- * Abstract test cases for JMS Resource Adapter. <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version $Revision$
- */
-public abstract class RaTest extends JMSTestCase
-{
- /**
- * Description of the Field
- */
- public final static long DEFAULT_TIMEOUT = 500L;
- /**
- * Description of the Field
- */
- public final static long FLUSH_TIMEOUT = 500L;
-
- /**
- * Description of the Field
- */
- protected String beanJNDI;
- /**
- * Description of the Field
- */
- protected MessageConsumer consumer;
- /**
- * Description of the Field
- */
- protected Publisher publisher;
- /**
- * Description of the Field
- */
- protected Connection connection;
- /**
- * Description of the Field
- */
- protected Session session;
-
- /**
- * Constructor for the RaTest object
- *
- * @param name Description of Parameter
- * @param beanJNDI Description of Parameter
- * @exception Exception Description of Exception
- */
- protected RaTest(final String name, final String beanJNDI)
- throws Exception
- {
- super(name);
- this.beanJNDI = beanJNDI;
- }
-
- /**
- * A unit test for JUnit
- *
- * @exception Exception Description of Exception
- */
- public void testSimple() throws Exception
- {
- printHeader();
- getLog().debug("Verify simple send of message");
- publisher.simple(1);
-
- Assert.assertEquals(1, getJmsMessage());
- printOK();
- }
-
- /**
- * A unit test for JUnit
- *
- * @exception Exception Description of Exception
- */
- public void testSimpleFail() throws Exception
- {
- printHeader();
- getLog().debug("Verify simple failed transaction");
- publisher.simpleFail(2);
-
- Assert.assertEquals(-1, getJmsMessage());
- printOK();
- }
-
- /**
- * A unit test for JUnit
- *
- * @exception Exception Description of Exception
- */
- public void testBeanOk() throws Exception
- {
- printHeader();
- getLog().debug("Verify bean ok");
- publisher.beanOk(3);
-
- Assert.assertEquals(3, getJmsMessage());
- printOK();
- }
-
- /**
- * A unit test for JUnit
- *
- * @exception Exception Description of Exception
- */
- public void testBeanError() throws Exception
- {
- printHeader();
- getLog().debug("Verify bean eroor failed transaction");
-
- try
- {
- publisher.beanError(4);
- }
- catch (Exception ignore)
- {
- }
-
- Assert.assertEquals(-1, getJmsMessage());
- printOK();
- }
-
- /**
- * The JUnit setup method
- *
- * @exception Exception Description of Exception
- */
- protected void setUp() throws Exception
- {
- // call setUp() in superclass
- super.setUp() ;
-
- // Create a publisher
- Context context = getInitialContext();
- PublisherHome home = (PublisherHome)context.lookup(beanJNDI);
- publisher = home.create();
-
- init(context);
-
- // start up the session
- connection.start();
-
- // flush the destination
- flush();
- }
-
- /**
- * Check if we got a message.
- *
- * @return Publisher.JMS_MESSAGE_NR int property or -1 if no
- * message was received.
- * @exception Exception Description of Exception
- */
- protected int getJmsMessage() throws Exception
- {
- return getJmsMessage(DEFAULT_TIMEOUT);
- }
-
- /**
- * Check if we got a message.
- *
- * @param timeout The time to wait for a message.
- * @return Publisher.JMS_MESSAGE_NR int property or -1 if no
- * message was received.
- * @exception Exception Description of Exception
- */
- protected int getJmsMessage(long timeout) throws Exception
- {
- Message msg = consumer.receive(timeout);
- if (msg != null)
- {
- getLog().debug("Recived message: " + msg);
- int nr = msg.getIntProperty(Publisher.JMS_MESSAGE_NR);
- getLog().debug("nr: " + nr);
- return nr;
- }
- else
- {
- getLog().debug("NO message recived");
- return -1;
- }
- }
-
- /**
- * #Description of the Method
- *
- * @param context Description of Parameter
- * @exception Exception Description of Exception
- */
- protected abstract void init(final Context context) throws Exception;
-
- /**
- * The teardown method for JUnit
- *
- * @exception Exception Description of Exception
- */
- protected void tearDown() throws Exception
- {
- if (consumer != null)
- {
- consumer.close();
- }
- if (connection != null)
- {
- connection.close();
- }
-
- //call tearDown() in superclass
- super.tearDown() ;
- }
-
- /**
- * #Description of the Method
- */
- protected void printHeader()
- {
- getLog().debug("\n---- Testing method " + getName() +
- " for bean " + beanJNDI);
- }
-
- /**
- * #Description of the Method
- */
- protected void printOK()
- {
- getLog().debug("---- Test OK\n");
- }
-
- /**
- * Flush the destiniation so we know that it contains no messages which might
- * mess up the test.
- *
- * @exception Exception Description of Exception
- */
- protected void flush() throws Exception
- {
- // getLog().debug(" > Flushing Destination");
-
- int nr = 0;
- do
- {
- try
- {
- nr = getJmsMessage(FLUSH_TIMEOUT);
- }
- catch (Exception ignore)
- {
- }
- } while (nr != -1);
- // getLog().debug(" > Flushed");
- }
-
-
-}
Deleted: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jbossmessaging.ra;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-
-import javax.management.ObjectName;
-
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestSetup;
-
-/**
- * Test cases for JMS Resource Adapter using a <em>Topic</em> . <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version $Revision$
- */
-public class RaTopicUnitTestCase
- extends RaTest
-{
- private final static String TOPIC_FACTORY = "ConnectionFactory";
- private final static String TOPIC = "topic/testTopic";
- private final static String JNDI = "TxTopicPublisher";
-
- /**
- * Constructor for the RaTopicUnitTestCase object
- *
- * @param name Description of Parameter
- * @exception Exception Description of Exception
- */
- public RaTopicUnitTestCase(String name) throws Exception
- {
- super(name, JNDI);
- }
-
- /**
- * #Description of the Method
- *
- * @param context Description of Parameter
- * @exception Exception Description of Exception
- */
- protected void init(final Context context) throws Exception
- {
- TopicConnectionFactory factory =
- (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-
- connection = factory.createTopicConnection();
-
- session = ((TopicConnection)connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Topic topic = (Topic)context.lookup(TOPIC);
-
- consumer = ((TopicSession)session).createSubscriber(topic);
- }
-
- public static Test suite() throws Exception
- {
- return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
- }
-
-
-}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -48,6 +48,26 @@
public class RaQueueUnitTestCase
extends RaTest
{
+ private static final ObjectName obj;
+ static
+ {
+ try
+ {
+ if (System.getProperty("jbosstest.useJBM")!=null)
+ {
+ obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+ }
+ else
+ {
+ obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+ }
+ }
+ catch (Exception e)
+ {
+
+ throw new RuntimeException(e.toString(), e);
+ }
+ }
private final static String QUEUE_FACTORY = "ConnectionFactory";
private final static String QUEUE = "queue/testQueue";
private final static String JNDI = "TxPublisher";
@@ -94,7 +114,7 @@
// Remove the messages
getServer().invoke
(
- new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+ obj,
"removeAllMessages",
new Object[0],
new String[0]
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -55,6 +55,28 @@
*/
public class RaSyncRecUnitTestCase extends JBossTestCase {
+ private static final ObjectName obj;
+ static
+ {
+ try
+ {
+ if (System.getProperty("jbosstest.useJBM")!=null)
+ {
+ obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+ }
+ else
+ {
+ obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+ }
+ }
+ catch (Exception e)
+ {
+
+ throw new RuntimeException(e.toString(), e);
+ }
+ }
+
+
private final static String BEAN_JNDI = "QueueRec";
private final static String QUEUE_FACTORY = "ConnectionFactory";
private final static String QUEUE = "queue/A";
@@ -183,7 +205,7 @@
// Remove the messages
getServer().invoke
(
- new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+ obj,
"removeAllMessages",
new Object[0],
new String[0]
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -48,6 +48,30 @@
public class RaTopicUnitTestCase
extends RaTest
{
+
+ private static final ObjectName obj;
+ static
+ {
+ try
+ {
+ if (System.getProperty("jbosstest.useJBM")!=null)
+ {
+ obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+ }
+ else
+ {
+ obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+ }
+ }
+ catch (Exception e)
+ {
+
+ throw new RuntimeException(e.toString(), e);
+ }
+ }
+
+
+
private final static String TOPIC_FACTORY = "ConnectionFactory";
private final static String TOPIC = "topic/testTopic";
private final static String JNDI = "TxTopicPublisher";
@@ -94,7 +118,7 @@
// Remove the messages
getServer().invoke
(
- new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+ obj,
"removeAllMessages",
new Object[0],
new String[0]
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -35,14 +35,12 @@
{
protected int msgNo;
protected Destination destination;
- String expectedValue;
- public CheckJMSDestinationOperation(BasicMessageDrivenUnitTest test, int msgNo, Destination destination, String expectedValue)
+ public CheckJMSDestinationOperation(BasicMessageDrivenUnitTest test, int msgNo, Destination destination)
{
super(test);
this.msgNo = msgNo;
this.destination = destination;
- this.expectedValue = expectedValue;
}
public void run() throws Exception
@@ -53,9 +51,5 @@
if (message == null || !msgdest.equals(destination))
throw new Exception("**** For msgNo=" + msgNo + " destination=" + destination.toString() + " received=" + msgdest.toString());
- if (!message.getText().equals(expectedValue))
- {
- throw new Exception(expectedValue + " != " + message.getText());
- }
}
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -70,7 +70,7 @@
{
new SendMessageOperation(this, "1"),
new CheckMessageSizeOperation(this, 1, 0),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
new CheckMessageIDOperation(this, 0, "1"),
};
}
@@ -81,13 +81,13 @@
{
new SendMessageOperation(this, "1"),
new CheckMessageSizeOperation(this, 7, 500),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 1, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 2, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 3, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 4, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 5, getDestination(), "1"),
- new CheckJMSDestinationOperation(this, 6, getDLQDestination(), "1"),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
+ new CheckJMSDestinationOperation(this, 1, getDestination()),
+ new CheckJMSDestinationOperation(this, 2, getDestination()),
+ new CheckJMSDestinationOperation(this, 3, getDestination()),
+ new CheckJMSDestinationOperation(this, 4, getDestination()),
+ new CheckJMSDestinationOperation(this, 5, getDestination()),
+ new CheckJMSDestinationOperation(this, 6, getDLQDestination()),
new CheckMessageIDOperation(this, 0, "1"),
new CheckMessageIDOperation(this, 1, "1"),
new CheckMessageIDOperation(this, 2, "1"),
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -57,14 +57,14 @@
new ActivateOperation(this, mdbInvoker),
new SendMessageOperation(this, "2"),
new CheckMessageSizeOperation(this, 1, 0),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
new CheckMessageIDOperation(this, 0, "2"),
new DeactivateOperation(this, mdbInvoker),
new SendMessageOperation(this, "3"),
new CheckMessageSizeOperation(this, 1, 5000),
new ActivateOperation(this, mdbInvoker),
new CheckMessageSizeOperation(this, 2, 0),
- new CheckJMSDestinationOperation(this, 1, getDestination(), "3"),
+ new CheckJMSDestinationOperation(this, 1, getDestination()),
new CheckMessageIDOperation(this, 1, "3"),
};
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -52,19 +52,26 @@
public void testRestartJMS() throws Exception
{
- Operation[] operations = new Operation[]
- {
- new SendMessageOperation(this, "1"),
- new CheckMessageSizeOperation(this, 1, 0),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
- new CheckMessageIDOperation(this, 0, "1"),
- new StopOperation(this, persistenceManager),
- new StartOperation(this, persistenceManager),
- new SendMessageOperation(this, "2"),
- new CheckMessageSizeOperation(this, 2, 20000),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "2"),
- };
- runTest(operations, defaultProps);
+ if (System.getProperty("jbosstest.useJBM") == null)
+ {
+ Operation[] operations = new Operation[]
+ {
+ new SendMessageOperation(this, "1"),
+ new CheckMessageSizeOperation(this, 1, 0),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
+ new CheckMessageIDOperation(this, 0, "1"),
+ new StopOperation(this, persistenceManager),
+ new StartOperation(this, persistenceManager),
+ new SendMessageOperation(this, "2"),
+ new CheckMessageSizeOperation(this, 2, 20000),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
+ };
+ runTest(operations, defaultProps);
+ }
+ else
+ {
+ System.out.println("testRestartJMS doesn't make sense to be executed on JBM");
+ }
}
public Operation[] getDeliveryActiveOperations() throws Exception
@@ -75,14 +82,14 @@
new CheckMessageSizeOperation(this, 0, 5000),
new ActivateOperation(this, mdbInvoker),
new CheckMessageSizeOperation(this, 1, 0),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
new CheckMessageIDOperation(this, 0, "1"),
new DeactivateOperation(this, mdbInvoker),
new SendMessageOperation(this, "2"),
new CheckMessageSizeOperation(this, 1, 5000),
new ActivateOperation(this, mdbInvoker),
new CheckMessageSizeOperation(this, 2, 0),
- new CheckJMSDestinationOperation(this, 1, getDestination(), "2"),
+ new CheckJMSDestinationOperation(this, 1, getDestination()),
new CheckMessageIDOperation(this, 1, "2"),
};
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java 2007-08-01 22:58:32 UTC (rev 64418)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java 2007-08-01 23:47:24 UTC (rev 64419)
@@ -58,7 +58,7 @@
new CheckMessageSizeOperation(this, 0, 5000),
new SendMessageOperation(this, "1"),
new CheckMessageSizeOperation(this, 1, 0),
- new CheckJMSDestinationOperation(this, 0, getDestination(), "1"),
+ new CheckJMSDestinationOperation(this, 0, getDestination()),
new CheckMessageIDOperation(this, 0, "1"),
new DeactivateOperation(this, mdbInvoker),
new SendMessageOperation(this, "2"),
More information about the jboss-cvs-commits
mailing list