[jboss-cvs] JBossAS SVN: r58421 - in trunk/testsuite: . src/main/org/jboss/test/jbossmessaging src/main/org/jboss/test/jbossmessaging/perf src/main/org/jboss/test/jbossmessaging/test src/resources/jbossmessaging
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 15 17:00:35 EST 2006
Author: rachmatowicz at jboss.com
Date: 2006-11-15 17:00:32 -0500 (Wed, 15 Nov 2006)
New Revision: 58421
Removed:
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessagingRefactoringUnitTestCase.java
Modified:
trunk/testsuite/build.xml
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java
trunk/testsuite/src/resources/jbossmessaging/test-destinations-service.xml
Log:
Changes to JMS testcases for new version of JBossTestCase
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/build.xml 2006-11-15 22:00:32 UTC (rev 58421)
@@ -664,8 +664,8 @@
</patternset>
<!-- jbossmessaging includes -->
<patternset id="jbossmessaging.includes">
- <include name="org/jboss/test/jbossmessaging/test/*UnitTestCase.class"/>
- <include name="org/jboss/test/jbossmessaging/perf/*StressTestCase.class"/>
+ <include name="org/jboss/test/jbossmessaging/test/*UnitTestCase.class"/>
+ <include name="org/jboss/test/jbossmessaging/perf/*UnitTestCase.class"/>
</patternset>
<!-- Tests needing xml binding setup -->
<patternset id="jbossxb.includes">
@@ -3206,18 +3206,18 @@
description="Run JMS tests against the Messaging JMS provider">
<!-- Create a scoped Messaging server config -->
- <ant antfile="${jboss.messaging.resources}/release-admin.xml"
- target="create-server-config">
- <property name="jboss.home" value="${jboss.dist}"/>
- <property name="messaging.artifact.name" value="jboss-messaging-scoped.sar"/>
- <property name="relative.artifact.location" value="${jboss.messaging.lib}"/>
- </ant>
+ <!-- <ant antfile="${jboss.messaging.resources}/release-admin.xml" -->
+ <!-- target="create-server-config"> -->
+ <!-- <property name="jboss.home" value="${jboss.dist}"/> -->
+ <!-- <property name="messaging.artifact.name" value="jboss-messaging-scoped.sar"/> -->
+ <!-- <property name="relative.artifact.location" value="${jboss.messaging.lib}"/> -->
+ <!-- </ant> -->
<!-- run the tests by calling a target - this target was defined in order to -->
<!-- allow modification of the test classpath -->
- <server:start name="jbossmessaging"/>
+ <!-- <server:start name="jbossmessaging"/> -->
<antcall target="tests-jbossmessaging-unit" />
- <server:stop name="jbossmessaging"/>
+ <!-- <server:stop name="jbossmessaging"/> -->
</target>
<!-- Test the Messaging JMS provider -->
@@ -3247,7 +3247,7 @@
<pathelement location="${build.classes}"/>
<pathelement location="${build.resources}"/>
<!-- need to prefix classpath to pick up correct versions of scoped client libs -->
- <pathelement location="${jboss.messaging.lib}/jboss-messaging-client.jar"/>
+ <!-- <pathelement location="${jboss.messaging.lib}/jboss-messaging-client.jar"/> -->
<pathelement location="${build.lib}/jbossmessagingtest.jar"/>
<path refid="tests.classpath"/>
</classpath>
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -76,7 +76,7 @@
server = (MBeanServerConnection) initialContext.lookup(adaptorName) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException(e);
}
}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -142,6 +142,9 @@
*/
protected void setUp() throws Exception
{
+ // call setUp() method of the superclass
+ super.setUp() ;
+
// Reconfigure acording to props
QUEUE_FACTORY = System.getProperty("jbosstest.queuefactory", QUEUE_FACTORY);
TOPIC_FACTORY = System.getProperty("jbosstest.topicfactory", TOPIC_FACTORY);
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -36,6 +36,11 @@
/**
* JMSTestCase.
* A base test case for all JMS generic test cases.
+ *
+ * Warning:
+ * If you override setUp() or tearDown(), rememeber to call the superclass
+ * versions of these methods within your overriding methods.
+ * AbstractTestCase uses setUp() and tearDown() to initialise logging.
*
* @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
* @version $Revision: 38213 $
@@ -62,13 +67,16 @@
*/
protected void setUp() throws Exception
{
+ // perform any setUp required in the superclass
+ super.setUp() ;
+
try {
log.info("setting up Admin") ;
// get the Admin implementation for the current JMS provider
// specified in provider.properties
admin = AdminFactory.getAdmin() ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("getAdmin() operation failed", e) ;
}
}
@@ -85,7 +93,7 @@
try {
admin.createQueue(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("createQueue() operation failed", e) ;
}
}
@@ -102,7 +110,7 @@
try {
admin.deleteQueue(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("deleteQueue() operation failed", e) ;
}
}
@@ -119,7 +127,7 @@
try {
admin.createTopic(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("createTopic() operation failed", e) ;
}
}
@@ -136,7 +144,7 @@
try {
admin.deleteTopic(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("deleteTopic() operation failed", e) ;
}
}
@@ -153,7 +161,7 @@
try {
admin.createConnectionFactory(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("createConnectionFactory() operation failed", e) ;
}
}
@@ -170,7 +178,7 @@
try {
admin.deleteConnectionFactory(name) ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("deleteConnectionFactory() operation failed", e) ;
}
}
@@ -190,7 +198,7 @@
}
log.info("Dumped JNDI context") ;
} catch (Exception e) {
- e.printStackTrace() ;
+ throw new NestedRuntimeException("error dumping JNDI context", e) ;
}
}
@@ -217,7 +225,7 @@
props.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME)) ;
directoryName = props.getProperty(PROP_NAME) ;
} catch (Exception e) {
- throw new NestedRuntimeException(e) ;
+ throw new NestedRuntimeException("error getting JMS provider directory name", e) ;
}
if (directoryName == null) {
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -708,9 +708,17 @@
*/
protected void setUp() throws Exception
{
+ // perform any setUp() required by the base class
+ super.setUp() ;
+
if (context == null)
{
+ Logger log = getLog() ;
+ if (log == null)
+ System.out.println("JMSPerfStressTestCase: getLog() returned null") ;
+ getLog().debug("JMSPerfStresTestCase - setUp") ;
+
context = getInitialContext();
QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -285,6 +285,9 @@
protected void setUp() throws Exception
{
+ // call setUp() of superclass
+ super.setUp() ;
+
getLog().info("Starting test: " + getName());
context = getInitialContext();
@@ -303,6 +306,9 @@
getLog().info("Ended test: " + getName());
queueConnection.close();
topicConnection.close();
+
+ // call tearDown() of superclass
+ super.tearDown() ;
}
private void drainQueue() throws Exception
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -65,12 +65,18 @@
protected void setUp()
throws Exception
{
+ // call setUp() in superclass
+ super.setUp() ;
+
this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory started");
}
protected void tearDown() throws Exception
{
this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory done");
+
+ // call tearDown() in superclass
+ super.tearDown() ;
}
// Emptys out all the messages in a queue
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -62,27 +62,30 @@
QueueReceiver receiver;
QueueSender sender;
- Logger log;
-
public MessageBodyUnitTestCase(String name) throws Exception
{
super(name);
- log = getLog();
}
protected void setUp() throws Exception
{
+ // call setUp() in the superclass
+ super.setUp() ;
+
connect();
}
protected void tearDown() throws Exception
{
disconnect();
+
+ // call tearDown() in the superclass to cleanup
+ super.tearDown() ;
}
protected void connect() throws Exception
{
- log.debug("connecting");
+ getLog().debug("connecting");
if (context == null)
{
context = getInitialContext();
@@ -90,20 +93,20 @@
QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
queueConnection = queueFactory.createQueueConnection();
- log.debug("connected");
+ getLog().debug("connected");
queueConnection.start();
session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- log.debug("session established");
+ getLog().debug("session established");
queue = (Queue) context.lookup(TEST_QUEUE);
receiver = session.createReceiver(queue);
sender = session.createSender(queue);
- log.debug("sender established");
+ getLog().debug("sender established");
drainQueue();
- log.debug("end of connect call");
+ getLog().debug("end of connect call");
}
protected void disconnect() throws Exception
@@ -113,7 +116,7 @@
private void drainQueue() throws Exception
{
- log.debug("draining queue");
+ getLog().debug("draining queue");
Message message = receiver.receive(2000);
int c = 0;
@@ -124,33 +127,33 @@
}
if (c != 0)
- log.debug("Drained " + c + " messages from the queue");
+ getLog().debug("Drained " + c + " messages from the queue");
- log.debug("drained queue");
+ getLog().debug("drained queue");
}
protected void validate(String payload) throws Exception
{
- log.debug("validating text |" + payload + "|");
+ getLog().debug("validating text |" + payload + "|");
TextMessage outMessage = session.createTextMessage();
outMessage.setText(payload);
- log.debug("sending |" + payload + "|");
+ getLog().debug("sending |" + payload + "|");
sender.send(outMessage);
- log.debug("receiving |" + payload + "|");
+ getLog().debug("receiving |" + payload + "|");
TextMessage inMessage = (TextMessage) receiver.receive();
- log.debug("received |" + payload + "|");
+ getLog().debug("received |" + payload + "|");
String inPayload = inMessage.getText();
assertEquals("Message body text test", payload, inPayload);
- log.debug("validated text " + payload);
+ getLog().debug("validated text " + payload);
}
public void testTextMessageBody() throws Exception
{
- log.debug("testing text");
+ getLog().debug("testing text");
validate("ordinary text");
validate(" ");
@@ -163,7 +166,7 @@
validate(new String(c));
Arrays.fill(c, '\u0008');
validate(new String(c));
- log.debug("tested text");
+ getLog().debug("tested text");
}
protected void validate(java.io.Serializable payload) throws Exception
@@ -180,7 +183,7 @@
public void testObjectMessageBody() throws Exception
{
- log.debug("testing object");
+ getLog().debug("testing object");
validate(new Integer(0));
validate(new Integer(1));
validate(new Integer(-1));
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -231,6 +231,9 @@
protected void setUp() throws Exception
{
+ // call setUp() in superclass
+ super.setUp() ;
+
context = new InitialContext();
QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
queueConnection = queueFactory.createQueueConnection();
@@ -249,6 +252,9 @@
receiver.close();
session.close();
queueConnection.close();
+
+ // call tearDown() in superclass
+ super.tearDown() ;
}
private Message sendRecMsg(Message in) throws Exception
Deleted: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessagingRefactoringUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessagingRefactoringUnitTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessagingRefactoringUnitTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -1,99 +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.test;
-
-
-import javax.jms.Queue;
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Concurrent delivery tests
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision: 37406 $</tt>
- */
-public class MessagingRefactoringUnitTestCase extends JMSTestCase
-{
- static String QUEUE_NAME = "queue/RAQueue" ;
- static String TOPIC_NAME = "topic/RATopic" ;
- static String CONNECTIONFACTORY_NAME = "RAConnectionFactory" ;
-
- private Logger log = Logger.getLogger(MessagingRefactoringUnitTestCase.class) ;
-
- public MessagingRefactoringUnitTestCase(String name) throws Exception
- {
- super(name);
- }
-
- public void testDirectoryName() throws Exception {
- String name = "Fred" ;
- String prependName = JMSTestCase.getJMSResourceRelativePathname(name) ;
- log.info("Resource name = " + prependName) ;
- }
-
- public void testQueueCreation() throws Exception
- {
- try
- {
- dumpJNDIContext("/queue") ;
-
- // make a call to JMSTestCase method
- log.info("Creating Queue " + QUEUE_NAME) ;
- createQueue(QUEUE_NAME) ;
-
- dumpJNDIContext("/queue") ;
-
- // verify that the queue has been created
- log.info("Looking up Queue " + QUEUE_NAME) ;
- InitialContext ic = getInitialContext() ;
- Queue q = (Queue) ic.lookup(QUEUE_NAME) ;
- } catch (Exception e) {
- e.printStackTrace() ;
- }
- }
-
- public void testQueueDeletion() throws Exception
- {
- try
- {
- dumpJNDIContext("/queue") ;
-
- // make a call to JMSTestCase method
- log.info("Deleting Queue " + QUEUE_NAME) ;
- deleteQueue(QUEUE_NAME) ;
-
- dumpJNDIContext("/queue") ;
-
- // verify that the queue has been created
- log.info("Looking up Queue " + QUEUE_NAME) ;
- InitialContext ic = getInitialContext() ;
- Queue q = (Queue) ic.lookup(QUEUE_NAME) ;
- } catch (Exception e) {
- e.printStackTrace() ;
- }
- }
-}
-
Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java 2006-11-15 22:00:32 UTC (rev 58421)
@@ -533,6 +533,9 @@
*/
protected void setUp() throws Exception
{
+ // call setUp() in superclass
+ super.setUp() ;
+
if (context == null)
{
context = getInitialContext();
Modified: trunk/testsuite/src/resources/jbossmessaging/test-destinations-service.xml
===================================================================
--- trunk/testsuite/src/resources/jbossmessaging/test-destinations-service.xml 2006-11-15 21:57:15 UTC (rev 58420)
+++ trunk/testsuite/src/resources/jbossmessaging/test-destinations-service.xml 2006-11-15 22:00:32 UTC (rev 58421)
@@ -2,9 +2,9 @@
<server>
- <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
- <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
- </loader-repository>
+ <!-- <loader-repository>jboss.messaging:loader=ScopedLoaderRepository -->
+ <!-- <loader-repository-config>java2ParentDelegation=false</loader-repository-config> -->
+ <!-- </loader-repository> -->
<mbean code="org.jboss.jms.server.destination.Topic"
name="jboss.messaging.destination:service=Topic,name=testTopic"
More information about the jboss-cvs-commits
mailing list