[jboss-svn-commits] JBL Code SVN: r5792 - labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 11 15:24:11 EDT 2006
Author: arvinder
Date: 2006-08-11 15:24:10 -0400 (Fri, 11 Aug 2006)
New Revision: 5792
Added:
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerConfig.xml
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerTest.java
Log:
Initial entry of jms queue listener
Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerConfig.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerConfig.xml 2006-08-11 19:02:18 UTC (rev 5791)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerConfig.xml 2006-08-11 19:24:10 UTC (rev 5792)
@@ -0,0 +1,39 @@
+<JmsListenerExample
+ commandConnFactoryClass="ConnectionFactory"
+ commandJndiType="jboss"
+ commandJndiURL="localhost"
+ commandIsTopic="false"
+ messageSelector="gpMsgSelector='zambia'"
+ commandJndiName="queue/A"
+ parameterReloadSecs="20"
+>
+
+
+ <QueueExample
+ listenerClass="org.jboss.soa.esb.listeners.JmsQueueListener"
+ actionClass="org.jboss.soa.esb.actions.FileCopier"
+ maxThreads="1"
+ queueConnFactoryClass="ConnectionFactory"
+ listenJndiType="jboss"
+ listenJndiURL="localhost"
+ listenQueue="queue/A"
+ listenMsgSelector="listener='zambia'"
+ >
+ <NotificationList type="OK">
+ <target class="NotifyFiles">
+ <file URI="@qa.build@/notifyDir/JmsQueueListenerExample.notifOK"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+
+ <NotificationList type="err">
+ <target class="NotifyFiles">
+ <file URI="@qa.build@/notifyDir/JmsQueueListenerExample.notifErr"
+ append="true"
+ />
+ </target>
+ </NotificationList>
+ </QueueExample>
+
+</JmsListenerExample>
Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerTest.java 2006-08-11 19:02:18 UTC (rev 5791)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/JmsQueueListenerTest.java 2006-08-11 19:24:10 UTC (rev 5792)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.soa.esb.listeners;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.util.ClassUtils;
+import org.jboss.soa.esb.util.FileUtils;
+import org.jboss.soa.esb.util.JMSClientUtil;
+import org.jboss.soa.esb.util.ListenerUtils;
+
+import java.io.File;
+
+/**
+ * QA Tests for the JmsQueueListener.
+ *
+ */
+public class JmsQueueListenerTest extends TestCase {
+
+ private ListenerUtils.ListenersManagerExecThread listenersMgr;
+ File notifyDir;
+
+ protected void setUp() throws Exception {
+ // Create the directories required by the test...
+ notifyDir = FileUtils.createTestDir("notifyDir");
+ // Start the listener...
+ listenersMgr = ListenerUtils.startListeners(ClassUtils.toResourcePath(getClass().getPackage()) + "/JmsQueueListenerConfig.xml");
+ }
+
+ public void test() throws InterruptedException {
+ // There should have been no exceptions...
+ listenersMgr.assertNotInException();
+ // Send a request via jms
+ JMSClientUtil.sendMessageToQueue("hello is anyone there?", JMSClientUtil.QUEUE.A, new KeyValuePair[] {new KeyValuePair("gpMsgSelector", "zambia")});
+
+ //
+ //
+ //Check if the file was written, or if there is any acknowledgement from the listener
+ //
+ //
+
+ // Send a Shutdown message to the command queue...
+ JMSClientUtil.sendMessageToQueue("shutdown", JMSClientUtil.QUEUE.A, new KeyValuePair[] {new KeyValuePair("gpMsgSelector", "zambia")});
+ listenersMgr.assertShutdownOK(10000);
+ }
+
+ protected void tearDown() throws Exception {
+ // Remove the directories required by the test...
+ FileUtils.assertCanDelete(notifyDir, 10000);
+ }
+
+
+
+}
More information about the jboss-svn-commits
mailing list