[jboss-svn-commits] JBL Code SVN: r5700 - in labs/jbossesb/trunk/qa: . junit junit/src/org/jboss/soa/esb junit/src/org/jboss/soa/esb/listeners junit/src/org/jboss/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Aug 10 06:52:57 EDT 2006
Author: tfennelly
Date: 2006-08-10 06:52:52 -0400 (Thu, 10 Aug 2006)
New Revision: 5700
Added:
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SimpleListenersTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java
labs/jbossesb/trunk/qa/log4j.xml
Removed:
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SendMessageTest.java
Modified:
labs/jbossesb/trunk/qa/build.xml
labs/jbossesb/trunk/qa/junit/build.xml
Log:
updating the QA test env
Modified: labs/jbossesb/trunk/qa/build.xml
===================================================================
--- labs/jbossesb/trunk/qa/build.xml 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/build.xml 2006-08-10 10:52:52 UTC (rev 5700)
@@ -12,6 +12,7 @@
<echo message="Cleaning..."/>
<delete dir="build" />
+ <delete file="qatests.log" />
</target>
</project>
Modified: labs/jbossesb/trunk/qa/junit/build.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/build.xml 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/junit/build.xml 2006-08-10 10:52:52 UTC (rev 5700)
@@ -2,7 +2,9 @@
<project name="JUnit" default="test" basedir=".">
<property name="product" value="../../product"/>
- <property name="product.lib" value="${product}/build/dist/lib"/>
+ <property name="product.build" value="${product}/build"/>
+ <property name="product.lib" value="${product.build}/dist/lib"/>
+ <property name="coverage" value="${product.build}/tests/coverage"/>
<property name="build.lib" value="${product}/lib"/>
<property name="qa.build" value="../build"/>
<property name="qa.junit.src" value="src"/>
@@ -10,9 +12,10 @@
<property name="qa.junit.report" value="${qa.build}/junit/report" />
<path id="qa.junit.cp">
- <fileset dir="${product.lib}" includes="jbossesb-services.jar,jbossesb-common.jar" />
- <fileset dir="${build.lib}/ext" includes="log4j.jar" />
+ <fileset dir="${coverage}/all/" includes="jbossesb-instr-all.jar" />
<fileset dir="${build.lib}/ejb3" includes="jbossall-client.jar" />
+ <fileset dir="${build.lib}/ext" includes="log4j.jar,emma*.jar" />
+ <pathelement location="../" />
</path>
<target name="test">
@@ -38,7 +41,14 @@
<pathelement location="${qa.junit.src}"/>
</classpath>
- <!-- SystemProperties - pass them through from the test.properties file... -->
+ <!-- emma jvm args -->
+ <jvmarg value="-Demma.coverage.out.file=${coverage}/all/coverage.emma" />
+ <jvmarg value="-Demma.coverage.out.merge=true" />
+
+ <!-- Listener Sys Props... -->
+ <sysproperty key="org.jboss.soa.esb.paramsRepository.file.root" value="${qa.junit.src}" />
+
+ <!-- Sys Props from the test.properties file... -->
<sysproperty key="org.jboss.soa.esb.jndi.server.type" value="${org.jboss.soa.esb.jndi.server.type}" />
<sysproperty key="org.jboss.soa.esb.jndi.server.url" value="${org.jboss.soa.esb.jndi.server.url}" />
</junit>
Deleted: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SendMessageTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SendMessageTest.java 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SendMessageTest.java 2006-08-10 10:52:52 UTC (rev 5700)
@@ -1,53 +0,0 @@
-package org.jboss.soa.esb.listeners;
-
-import javax.jms.*;
-import javax.naming.*;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.common.SystemProperties;
-import org.jboss.soa.esb.helpers.*;
-
-/**
- * QA test for testing ??? TODO: Esteban, please fill in the gaps here!!!
- * @author Esteban
- */
-public class SendMessageTest extends TestCase {
-
- private Context m_oCtx;
- QueueSession m_oQsess;
-
- public void test_SendMessage() throws Exception
- {
- initializeJms();
- Queue oQ = (Queue)m_oCtx.lookup("queue/A");
- MessageProducer oSnd = m_oQsess.createSender(oQ);
-
- TextMessage oMsg = m_oQsess.createTextMessage();
-
-
- oMsg.setStringProperty("gpMsgSelector","test");
- oMsg.setText("shutdown");
-// oMsg.setText("reload param");
-// oMsg.setText("endTime 20060803 16:10:00");
-// oMsg.setStringProperty("listener","maradona");
-// oMsg.setText("MESSAGE TO MARADONA");
-
- oSnd.send(oMsg);
-
- } //________________________________
-
- private void initializeJms () throws Exception
- {
- m_oCtx = AppServerContext.getServerContext
- (SystemProperties.getJndiServerType()
- ,SystemProperties.getJndiServerURL()
- );
- QueueConnectionFactory qcf = (QueueConnectionFactory)
- m_oCtx.lookup("ConnectionFactory");
- QueueConnection oQconn = qcf.createQueueConnection();
- m_oQsess = oQconn.createQueueSession(false
- ,QueueSession.AUTO_ACKNOWLEDGE);
-
- } //________________________________
-} //____________________________________________________________________________
Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SimpleListenersTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SimpleListenersTest.java 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/SimpleListenersTest.java 2006-08-10 10:52:52 UTC (rev 5700)
@@ -0,0 +1,37 @@
+/*
+ * 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 org.jboss.soa.esb.util.JMSClientUtil;
+
+import junit.framework.TestCase;
+
+/**
+ * Simple QA Test of the Listener framework.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SimpleListenersTest extends TestCase {
+
+ public void test() {
+ JMSClientUtil.sendMessageToQueue("Hello there", JMSClientUtil.QUEUE.A, null);
+ }
+}
Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java 2006-08-10 10:52:52 UTC (rev 5700)
@@ -0,0 +1,127 @@
+package org.jboss.soa.esb.util;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.helpers.AppServerContext;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+/**
+ * JMS Client utilities.
+ * @author Esteban
+ */
+public class JMSClientUtil {
+
+ private static Logger logger = Logger.getLogger(JMSClientUtil.class);
+
+ /**
+ * Test queues - correspond to the default queue set e.g. "queue/A", "queue/B" etc.
+ */
+ public enum QUEUE {
+ A, B, C, D, ex
+ };
+
+ /**
+ * Send a message to the specified queue.
+ * @param message The message to be sent (String or other Object).
+ * @param queue The {@link QUEUE} to send the message to.
+ * @param properties The String properties to be set on the message.
+ * @throws Exception
+ */
+ public static void sendMessageToQueue(Serializable message, QUEUE queue, List<KeyValuePair> properties) {
+ JMSQueueSetup queueSetup = null;
+
+ if(message == null || queue == null) {
+ TestCase.fail("Invalid call to sendMessageToQueue: neither 'message' or 'queue' params can be null.");
+ }
+
+ try {
+ queueSetup = new JMSQueueSetup(queue);
+ logger.info("Queue Setup for sending: " + queueSetup.queueName);
+
+ // Send a Text message to the queue...
+ if (message instanceof String) {
+ TextMessage oMsg = queueSetup.jmsSession.createTextMessage();
+
+ logger.info("Sending Text message: [" + message + "]");
+ oMsg.setText((String)message);
+ setStringProperties(oMsg, properties);
+ queueSetup.jmsProducer.send(oMsg);
+ } else {
+ ObjectMessage oMsg = queueSetup.jmsSession.createObjectMessage();
+
+ logger.info("Sending Object message: [" + message + "]");
+ oMsg.setObject(message);
+ setStringProperties(oMsg, properties);
+ queueSetup.jmsProducer.send(oMsg);
+ }
+ logger.info("Message sent: [" + message + "]");
+ } catch(Exception e) {
+ String errorMessage = "Exception while sending message [" + message + "] to queue [" + queue + "].";
+ logger.error(errorMessage, e);
+ TestCase.fail(errorMessage + ": " + e.getMessage());
+ } finally {
+ if(queueSetup != null) {
+ logger.info("Closing Queue Setup: " + queueSetup.queueName);
+ queueSetup.close();
+ }
+ }
+ }
+
+ private static void setStringProperties(Message msg, List<KeyValuePair> properties) throws JMSException {
+ if(properties == null) {
+ return;
+ }
+
+ for(KeyValuePair property : properties) {
+ msg.setStringProperty(property.getKey(), property.getValue());
+ }
+ }
+
+
+ private static class JMSQueueSetup {
+ QueueSession jmsSession;
+ Queue jmsQueue;
+ MessageProducer jmsProducer;
+ String queueName;
+
+ private JMSQueueSetup(QUEUE queue) throws Exception {
+ Context m_oCtx = AppServerContext.getServerContext(
+ SystemProperties.getJndiServerType(),
+ SystemProperties.getJndiServerURL());
+ QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx.lookup("ConnectionFactory");
+ QueueConnection oQconn = qcf.createQueueConnection();
+
+ queueName = "queue/" + queue.name();
+
+ jmsSession = oQconn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ jmsQueue = (Queue) m_oCtx.lookup(queueName);
+ jmsProducer = jmsSession.createSender(jmsQueue);
+ }
+
+ private void close() {
+ try {
+ jmsProducer.close();
+ jmsSession.close();
+ } catch (Exception e) {
+ logger.error("Unable to close JMS Queue Setup.", e);
+ TestCase.fail("Unable to close JMS Queue Setup: " + e.getMessage());
+ }
+ }
+ }
+}
Added: labs/jbossesb/trunk/qa/log4j.xml
===================================================================
--- labs/jbossesb/trunk/qa/log4j.xml 2006-08-10 07:24:06 UTC (rev 5699)
+++ labs/jbossesb/trunk/qa/log4j.xml 2006-08-10 10:52:52 UTC (rev 5700)
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- 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="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./qatests.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ====================== -->
+ <!-- More Appender examples -->
+ <!-- ====================== -->
+
+ <!-- Buffer events and log them asynchronously
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="SMTP"/>
+ </appender>
+ -->
+
+ <!-- EMail events to an administrator
+ <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="To" value="admin at myhost.domain.com"/>
+ <param name="From" value="nobody at myhost.domain.com"/>
+ <param name="Subject" value="JBoss Sever Errors"/>
+ <param name="SMTPHost" value="localhost"/>
+ <param name="BufferSize" value="10"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Syslog events
+ <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Facility" value="LOCAL7"/>
+ <param name="FacilityPrinting" value="true"/>
+ <param name="SyslogHost" value="localhost"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Log events to JMS (requires a topic to be created)
+ <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
+ <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
+ </appender>
+ -->
+
+ <!-- Log events through SNMP
+ <appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
+ <param name="ManagementHost" value="127.0.0.1"/>
+ <param name="ManagementHostTrapListenPort" value="162"/>
+ <param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
+ <param name="LocalIPAddress" value="127.0.0.1"/>
+ <param name="LocalTrapSendPort" value="161"/>
+ <param name="GenericTrapType" value="6"/>
+ <param name="SpecificTrapType" value="12345678"/>
+ <param name="CommunityString" value="public"/>
+ <param name="ForwardStackTraceWithTrap" value="true"/>
+ <param name="Threshold" value="DEBUG"/>
+ <param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Emit events as JMX notifications
+ <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+
+ <param name="Threshold" value="WARN"/>
+ <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
+ <category name="org.apache">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- Limit jboss axis to INFO as its DEBUG is even more verbose -->
+ <category name="org.jboss.axis">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit JBoss categories
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+ -->
+
+ <!-- Limit the JSR77 categories -->
+ <category name="org.jboss.management">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit JBoss webservice category
+ <category name="org.jboss.webservice">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
+ <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ <category name="org.jboss.ejb.plugins">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!--
+ | Logs these events to SNMP:
+ - server starts/stops
+ - cluster evolution (node death/startup)
+ - When an EJB archive is deployed (and associated verified messages)
+ - When an EAR archive is deployed
+
+ <category name="org.jboss.system.server.Server">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.MainDeployer">
+ <priority value="ERROR" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ejb.EJBDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.EARDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+ <!-- Clustering logging -->
+ <!-- Uncomment the following to redirect the org.jgroups and
+ org.jboss.ha categories to a cluster.log file.
+
+ <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.home.dir}/log/cluster.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ <category name="org.jgroups">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ <category name="org.jboss.ha">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ -->
+
+</log4j:configuration>
More information about the jboss-svn-commits
mailing list