[jboss-cvs] JBoss Messaging SVN: r2573 - in projects/jms-integration: src/etc and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 12 18:22:58 EDT 2007
Author: clebert.suconic at jboss.com
Date: 2007-04-12 18:22:58 -0400 (Thu, 12 Apr 2007)
New Revision: 2573
Added:
projects/jms-integration/src/etc/log4j.xml
Removed:
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBDurableTest.java
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionDupsOKTest.java
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionTest.java
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBWithSelectorTest.java
Modified:
projects/jms-integration/build-thirdparty.xml
projects/jms-integration/build.xml
projects/jms-integration/src/etc/deployments/mdb-ejb20/META-INF/jboss.xml
projects/jms-integration/src/main/org/jboss/test/jms/integration/MessagingIntegrationTestBase.java
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/MDBTestBase.java
projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBTest.java
Log:
Fixing MDB Test
Modified: projects/jms-integration/build-thirdparty.xml
===================================================================
--- projects/jms-integration/build-thirdparty.xml 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/build-thirdparty.xml 2007-04-12 22:22:58 UTC (rev 2573)
@@ -88,20 +88,20 @@
<componentref name="retrotranslator" version="0.9.6jboss"/>
<componentref name="oswego-concurrent" version="1.3.4"/>
<componentref name="apache-log4j" version="1.2.8"/>
- <componentref name="javassist" version="3.3.0.GA"/>
+ <componentref name="javassist" version="3.5.0.CR1"/>
<componentref name="jgroups" version="2.4.1"/>
<componentref name="trove" version="1.0.2"/>
<componentref name="jboss/common-core" version="2.0.2.GA"/>
<componentref name="jboss/common-logging-log4j" version="2.0.2.GA"/>
<componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
- <componentref name="jboss/aop" version="1.5.3.GA"/>
+ <componentref name="jboss/aop" version="2.0.0.alpha4"/>
<componentref name="jboss/serialization" version="1.0.3.GA"/>
- <componentref name="jboss/remoting" version="2.2.0.Alpha7"/>
+ <componentref name="jboss/remoting" version="2.2.0.GA"/>
<componentref name="jboss/jbossts" version="4.2.2.GA"/>
<componentref name="jboss/test14" version="snapshot"/>
<componentref name="jboss/jbossretro-rt" version="1.0.4.GA"/>
<componentref name="jboss/backport-concurrent" version="2.1.0.GA"/>
- <componentref name="jboss/messaging" version="1.2.0.CR1"/>
+ <componentref name="jboss/messaging" version="1.2.0.SP.snapshot.aop2beta"/>
<!-- Need this otherwise project doesn't build in Eclipse -->
<componentref name="apache-logging" version="1.0.4.1jboss"/>
Modified: projects/jms-integration/build.xml
===================================================================
--- projects/jms-integration/build.xml 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/build.xml 2007-04-12 22:22:58 UTC (rev 2573)
@@ -308,7 +308,7 @@
</target>
- <target name="compile-report">
+ <target name="tests-report">
<mkdir dir="${build.tests.reports}/html"/>
<junitreport todir="${build.tests.reports}">
<fileset dir="${build.tests.reports}">
@@ -322,4 +322,4 @@
-</project>
\ No newline at end of file
+</project>
Modified: projects/jms-integration/src/etc/deployments/mdb-ejb20/META-INF/jboss.xml
===================================================================
--- projects/jms-integration/src/etc/deployments/mdb-ejb20/META-INF/jboss.xml 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/etc/deployments/mdb-ejb20/META-INF/jboss.xml 2007-04-12 22:22:58 UTC (rev 2573)
@@ -6,7 +6,7 @@
<enterprise-beans>
<message-driven>
<ejb-name>QueueAdapter</ejb-name>
- <destination-jndi-name>queue/testQueue</destination-jndi-name>
+ <destination-jndi-name>queue/testQueue_Integration</destination-jndi-name>
<configuration-name>Standard Message Driven Bean</configuration-name>
<resource-ref>
<res-ref-name>connectionFactory</res-ref-name>
Added: projects/jms-integration/src/etc/log4j.xml
===================================================================
--- projects/jms-integration/src/etc/log4j.xml (rev 0)
+++ projects/jms-integration/src/etc/log4j.xml 2007-04-12 22:22:58 UTC (rev 2573)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- log4j.xml,v 1.1 2006/03/31 21:20:11 timfox Exp -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+ <!--
+ Only to be used for stress tests
+ Stress tests cannot be run using TRACE or DEBUG level since they produce too much output
+ hence they have their own log4j config
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+
+ <param name="File" value="${module.output}/logs/messaging-tests${test.logfile.suffix}.stress.log"/>
+
+ <!-- since majority of the tests are ran in fork mode by ant, the log file is overwritten
+ for each test. We need to append if we want to preserve a full testsuite run log.
+ Make sure the build script clears this log at the beginning of each run.
+ -->
+ <param name="Append" value="true"/>
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- <param name="Threshold" value="INFO"/> -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <!-- <param name="ConversionPattern" value="%d %-5p @%t [%c] %m%n"/> -->
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n -->
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%t %d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss.serial">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss">
+ <priority value="DEBUG"/>
+ </category>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+
+</log4j:configuration>
Property changes on: projects/jms-integration/src/etc/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id LastChangedDate Author Revision
Modified: projects/jms-integration/src/main/org/jboss/test/jms/integration/MessagingIntegrationTestBase.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/MessagingIntegrationTestBase.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/MessagingIntegrationTestBase.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -29,7 +29,12 @@
import javax.jms.MessageConsumer;
import javax.jms.Session;
import javax.jms.Topic;
+import javax.naming.InitialContext;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.MBeanServerInvocationHandler;
import org.jboss.test.JBossTestCase;
+import org.jboss.test.jms.integration.util.JMSAdmin;
/**
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
@@ -65,9 +70,22 @@
String banner =
"####################################################### Start test: " + getName();
+
log.info(banner);
}
+ public static JMSAdmin getDestManager() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ MBeanServerConnection server = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
+ ObjectName mgrName = new ObjectName("jboss.messaging:service=ServerPeer");
+ JMSAdmin destMgr = (JMSAdmin) MBeanServerInvocationHandler.newProxyInstance(
+ server, mgrName, JMSAdmin.class, false);
+
+ return destMgr;
+ }
+
protected void tearDown() throws Exception
{
String banner =
Modified: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/MDBTestBase.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/MDBTestBase.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/MDBTestBase.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -41,11 +41,11 @@
// Constants ------------------------------------------------------------------------------------
static final String CONNECTION_FACTORY = "ConnectionFactory";
- static final String TEST_TOPIC = "topic/testTopic";
- static final String TEST_QUEUE = "queue/testQueue";
- static final String TEST_QUEUE_RESPONSE = "queue/A";
+ static final String TEST_TOPIC = "topic/testTopic_Integration";
+ static final String TEST_QUEUE = "queue/testQueue_Integration";
+ static final String TEST_QUEUE_RESPONSE = "queue/A_Integration";
+
-
// Attributes -----------------------------------------------------------------------------------
InitialContext ctx;
@@ -73,6 +73,8 @@
protected void setUp() throws Exception
{
super.setUp();
+
+ System.out.println("Looking up for Topics and queues!!!");
ctx = new InitialContext();
cf = (ConnectionFactory)ctx.lookup(CONNECTION_FACTORY);
topicDestination = (Destination) ctx.lookup(TEST_TOPIC);
@@ -83,6 +85,11 @@
}
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
// Private --------------------------------------------------------------------------------------
// Inner classes --------------------------------------------------------------------------------
Deleted: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBDurableTest.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBDurableTest.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBDurableTest.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -1,126 +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.jms.integration.mdb;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class SimpleMDBDurableTest extends MDBTestBase
-{
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public SimpleMDBDurableTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testSimpleMDB() throws Exception
- {
- Connection conn = cf.createConnection();
- conn.start();
- Session sess = null;
-
- try
- {
- sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = sess.createProducer(topicDestination);
- MessageConsumer consumer = sess.createConsumer(responseDestination);
-
- for (int i=0;i<100;i++)
- {
- TextMessage message = sess.createTextMessage("Message " + i);
- message.setStringProperty("pair", i%2==0?"even":"odd");
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
- }
-
- Thread.sleep(2000);
-
- int messagesReceived = 0;
-
- while (true)
- {
- TextMessage message = (TextMessage) consumer.receive(5000);
- if (message == null)
- {
- break;
- }
- System.out.println("-----" + message.getText());
- messagesReceived++;
- }
-
- assertEquals(200, messagesReceived);
-
- }
- finally
- {
- if (conn!=null)
- {
- conn.close();
- }
- }
-
- }
-
- public static Test suite() throws Exception
- {
- // This is from JBoss testsuite framework.. it will deploy the MDB before running the test
- return getDeploySetup(SimpleMDBDurableTest.class, "integration-mdb20-durable.jar");
- }
-
-
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Modified: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBTest.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBTest.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBTest.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -28,7 +28,11 @@
import javax.jms.MessageProducer;
import javax.jms.TextMessage;
import javax.jms.MessageConsumer;
-import junit.framework.Test;
+import javax.naming.InitialContext;
+import junit.framework.*;
+import org.jboss.test.JBossTestSetup;
+import org.jboss.test.jms.integration.MessagingIntegrationTestBase;
+import org.jboss.test.jms.integration.util.JMSAdmin;
/**
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
@@ -121,12 +125,44 @@
public static Test suite() throws Exception
{
- // This is from JBoss testsuite framework.. it will deploy the MDB before running the test
- return getDeploySetup(SimpleMDBTest.class, "integration-mdb20.jar");
+ TestSuite suite = new TestSuite();
+
+ suite.addTest(new JBossTestSetup(new TestSuite(SimpleMDBTest.class))
+ {
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ JMSAdmin admin = MessagingIntegrationTestBase.getDestManager();
+ try
+ {
+ admin.deployTopic("testTopic_Integration", "topic/testTopic_Integration");
+ admin.deployQueue("testQueue_Integration", "queue/testQueue_Integration");
+ admin.deployQueue("A_Integration", "queue/A_Integration");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ deploy ("integration-mdb20.jar");
+ }
+ protected void tearDown() throws Exception
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ JMSAdmin admin = MessagingIntegrationTestBase.getDestManager();
+ admin.destroyQueue("testQueue_Integration");
+ admin.destroyTopic("testTopic_Integration");
+ admin.destroyQueue("A_Integration");
+ undeploy ("integration-mdb20.jar");
+ super.tearDown();
+ }
+ });
+
+ return suite;
}
+
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
Deleted: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionDupsOKTest.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionDupsOKTest.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionDupsOKTest.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -1,110 +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.jms.integration.mdb;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision:2392 $</tt>
- * $Id:SimpleMDBUserTransactionDupsOKTest.java 2392 2007-02-21 23:25:21Z clebert.suconic at jboss.com $
- */
-public class SimpleMDBUserTransactionDupsOKTest extends MDBTestBase
-{
-
- // Constants ------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public SimpleMDBUserTransactionDupsOKTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testSimpleMDB() throws Exception
- {
- Connection conn = cf.createConnection();
- conn.start();
- Session sess = null;
-
- try
- {
- sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = sess.createProducer(queueDestination);
- MessageConsumer consumer = sess.createConsumer(responseDestination);
- TextMessage message = sess.createTextMessage("Message " + random.nextLong());
- message.setBooleanProperty("commit",true);
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
-
- TextMessage messageResponse = (TextMessage)consumer.receive(10000);
- assertNotNull(messageResponse);
- System.out.println("Received message " + messageResponse.getText());
-
- message = sess.createTextMessage("Message " + random.nextLong());
- message.setBooleanProperty("commit",false);
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
-
- messageResponse = (TextMessage)consumer.receive(10000);
- assertNull(messageResponse);
- }
- finally
- {
- if (conn!=null)
- {
- conn.close();
- }
- }
-
- }
-
-
-
- public static Test suite() throws Exception
- {
- // This is from JBoss testsuite framework.. it will deploy the MDB before running the test
- return getDeploySetup(SimpleMDBUserTransactionDupsOKTest.class,
- "integration-mdb20-userTransactionDups.jar");
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Deleted: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionTest.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionTest.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBUserTransactionTest.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -1,110 +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.jms.integration.mdb;
-
-import junit.framework.Test;
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision:2392 $</tt>
- * $Id:SimpleMDBUserTransactionTest.java 2392 2007-02-21 23:25:21Z clebert.suconic at jboss.com $
- */
-public class SimpleMDBUserTransactionTest extends MDBTestBase
-{
-
- // Constants ------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public SimpleMDBUserTransactionTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testSimpleMDB() throws Exception
- {
- Connection conn = cf.createConnection();
- conn.start();
- Session sess = null;
-
- try
- {
- sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = sess.createProducer(queueDestination);
- MessageConsumer consumer = sess.createConsumer(responseDestination);
- TextMessage message = sess.createTextMessage("Message " + random.nextLong());
- message.setBooleanProperty("commit",true);
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
-
- TextMessage messageResponse = (TextMessage)consumer.receive(10000);
- assertNotNull(messageResponse);
- System.out.println("Received message " + messageResponse.getText());
-
- message = sess.createTextMessage("Message " + random.nextLong());
- message.setBooleanProperty("commit",false);
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
-
- messageResponse = (TextMessage)consumer.receive(10000);
- assertNull(messageResponse);
- }
- finally
- {
- if (conn!=null)
- {
- conn.close();
- }
- }
-
- }
-
-
-
- public static Test suite() throws Exception
- {
- // This is from JBoss testsuite framework.. it will deploy the MDB before running the test
- return getDeploySetup(SimpleMDBUserTransactionTest.class,
- "integration-mdb20-userTransaction.jar");
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Deleted: projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBWithSelectorTest.java
===================================================================
--- projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBWithSelectorTest.java 2007-04-11 16:59:31 UTC (rev 2572)
+++ projects/jms-integration/src/main/org/jboss/test/jms/integration/mdb/SimpleMDBWithSelectorTest.java 2007-04-12 22:22:58 UTC (rev 2573)
@@ -1,133 +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.jms.integration.mdb;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-import junit.framework.Test;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class SimpleMDBWithSelectorTest extends MDBTestBase
-{
-
- // Constants ------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public SimpleMDBWithSelectorTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testSimpleSelectorMDB() throws Exception
- {
- Connection conn = cf.createConnection();
- conn.start();
- Session sess = null;
-
- try
- {
- sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = sess.createProducer(queueDestination);
- MessageConsumer consumer = sess.createConsumer(responseDestination);
-
- for (int i=0;i<100;i++)
- {
- TextMessage message = sess.createTextMessage("Message " + i);
- message.setStringProperty("pair", i%2==0?"even":"odd");
- message.setJMSReplyTo(responseDestination);
- producer.send(message);
- }
-
- Thread.sleep(2000);
-
- int messagesReceived = 0;
-
- while (true)
- {
- TextMessage message = (TextMessage) consumer.receive(5000);
- if (message == null)
- {
- break;
- }
-
- assertEquals("odd", message.getStringProperty("pair"));
- System.out.println("-----" + message.getText());
- assertEquals("reply to message Message " + (messagesReceived*2 + 1), message.getText());
- messagesReceived++;
- }
-
- assertEquals(50, messagesReceived);
-
- }
- finally
- {
- if (conn!=null)
- {
- conn.close();
- }
- }
-
- }
-
- public static Test suite() throws Exception
- {
- // This is from JBoss testsuite framework.. it will deploy the MDB before running the test
- return getDeploySetup(SimpleMDBWithSelectorTest.class, "integration-mdb20-selector.jar");
- }
-
-
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
More information about the jboss-cvs-commits
mailing list