[jboss-cvs] JBoss Messaging SVN: r1447 - in projects/perf/trunk: . artifacts etc lib src src/etc src/main src/main/org src/main/org/jboss src/main/org/jboss/jms src/main/org/jboss/jms/perf src/main/org/jboss/jms/perf/framework src/main/org/jboss/jms/perf/framework/configuration src/main/org/jboss/jms/perf/framework/data src/main/org/jboss/jms/perf/framework/factories src/main/org/jboss/jms/perf/framework/persistence src/main/org/jboss/jms/perf/framework/protocol src/main/org/jboss/jms/perf/framework/remoting src/main/org/jboss/jms/perf/framework/remoting/jbossremoting src/main/org/jboss/jms/perf/framework/remoting/rmi tests tests/org tests/org/jboss tests/org/jboss/test tests/org/jboss/test/jms tests/org/jboss/test/jms/perf tests/org/jboss/test/jms/perf/framework tests/org/jboss/test/jms/perf/framework/persistence tools tools/etc tools/etc/buildmagic tools/etc/jbossbuild tools/lib
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 6 01:38:21 EDT 2006
Author: ovidiu.feodorov at jboss.com
Date: 2006-10-06 01:37:45 -0400 (Fri, 06 Oct 2006)
New Revision: 1447
Added:
projects/perf/trunk/artifacts/
projects/perf/trunk/artifacts/jbossmq-destinations-service.xml
projects/perf/trunk/artifacts/messaging-destinations-service.xml
projects/perf/trunk/build-perf.xml
projects/perf/trunk/build-thirdparty.xml
projects/perf/trunk/build.xml
projects/perf/trunk/etc/
projects/perf/trunk/etc/log4j.xml
projects/perf/trunk/etc/perf.xml
projects/perf/trunk/lib/
projects/perf/trunk/lib/jboss-j2ee.jar
projects/perf/trunk/lib/jboss-j2se.jar
projects/perf/trunk/src/
projects/perf/trunk/src/etc/
projects/perf/trunk/src/etc/JBossRemotingExecutor-xmbean.xml
projects/perf/trunk/src/etc/RMIExecutor-xmbean.xml
projects/perf/trunk/src/etc/default.mf
projects/perf/trunk/src/etc/jbossremoting-executor-service.xml
projects/perf/trunk/src/etc/rmi-executor-service.xml
projects/perf/trunk/src/main/
projects/perf/trunk/src/main/org/
projects/perf/trunk/src/main/org/jboss/
projects/perf/trunk/src/main/org/jboss/jms/
projects/perf/trunk/src/main/org/jboss/jms/perf/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Charter.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Runner.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/Configuration.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/JobConfiguration.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/AxisInfo.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Execution.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/GraphInfo.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/JobList.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/PerformanceTest.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Provider.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/SimpleJobList.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/AbstractMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/BytesMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ForeignMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MapMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ObjectMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/StreamMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/TextMessageFactory.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/HSQLDBPersistenceManager.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/PersistenceManager.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/AbstractServitor.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/DrainJob.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Failure.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/FillJob.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Job.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/JobSupport.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/KillRequest.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/PingJob.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ReceiveJob.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ResetRequest.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/SendJob.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Servitor.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputJobSupport.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputResult.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Context.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Coordinator.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Executor.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Lock.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Request.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Result.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/ResultSupport.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/SimpleResult.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorInvocationHandler.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorKiller.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingCoordinator.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingExecutor.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/ExecutorKiller.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMICoordinator.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIExecutor.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIURL.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryKiller.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryManagement.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryRunner.java
projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/Server.java
projects/perf/trunk/tests/
projects/perf/trunk/tests/org/
projects/perf/trunk/tests/org/jboss/
projects/perf/trunk/tests/org/jboss/test/
projects/perf/trunk/tests/org/jboss/test/jms/
projects/perf/trunk/tests/org/jboss/test/jms/perf/
projects/perf/trunk/tests/org/jboss/test/jms/perf/PerformanceFrameworkTestCase.java
projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/
projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/persistence/
projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/persistence/HSQLDBPersistenceManagerTest.java
projects/perf/trunk/tools/
projects/perf/trunk/tools/etc/
projects/perf/trunk/tools/etc/buildmagic/
projects/perf/trunk/tools/etc/buildmagic/aliases.ent
projects/perf/trunk/tools/etc/jbossbuild/
projects/perf/trunk/tools/etc/jbossbuild/jbossbuild.properties
projects/perf/trunk/tools/etc/jbossbuild/tasks.xml
projects/perf/trunk/tools/lib/
projects/perf/trunk/tools/lib/jbossbuild.jar
Log:
Initial import
http://jira.jboss.org/jira/browse/JBMESSAGING-468
http://jira.jboss.org/jira/browse/JBMESSAGING-587
Added: projects/perf/trunk/artifacts/jbossmq-destinations-service.xml
===================================================================
--- projects/perf/trunk/artifacts/jbossmq-destinations-service.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/artifacts/jbossmq-destinations-service.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The JBossMQ performance test destinations.
+
+ $Id: jbossmq-destinations-service.xml 895 2006-04-20 04:07:01Z ovidiu $
+ -->
+
+<server>
+
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=simpleQueue">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+ </mbean>
+
+ <!-- just a regular queue, the memory configuration is globally set by MessageCache -->
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=largeQueue">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+ </mbean>
+
+ <!-- just a regular queue, the memory configuration is globally set by MessageCache -->
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=pagingQueue">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+ </mbean>
+
+
+
+</server>
\ No newline at end of file
Added: projects/perf/trunk/artifacts/messaging-destinations-service.xml
===================================================================
--- projects/perf/trunk/artifacts/messaging-destinations-service.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/artifacts/messaging-destinations-service.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The JBoss Messaging performance test destinations.
+
+ $Id: messaging-destinations-service.xml 895 2006-04-20 04:07:01Z ovidiu $
+ -->
+
+<server>
+
+ <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+
+ <mbean code="org.jboss.jms.server.destination.Queue"
+ name="jboss.messaging.performance:service=Queue,name=simpleQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ </mbean>
+
+
+ <mbean code="org.jboss.jms.server.destination.Queue"
+ name="jboss.messaging.performance:service=Queue,name=largeQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <attribute name="FullSize">500000</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.Queue"
+ name="jboss.messaging.performance:service=Queue,name=pagingQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <!-- <attribute name="FullSize">20000</attribute> -->
+ <attribute name="FullSize">75000</attribute>
+ </mbean>
+
+
+
+</server>
\ No newline at end of file
Added: projects/perf/trunk/build-perf.xml
===================================================================
--- projects/perf/trunk/build-perf.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/build-perf.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,617 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY libraries SYSTEM "thirdparty/libraries.ent">
+]>
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- 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. -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- $Id: build.xml 1221 2006-08-10 18:50:43Z ovidiu.feodorov at jboss.com $ -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+
+<project default="compile" name="Messaging Performance Framework">
+
+ <!-- ======================================================================================== -->
+ <!-- Configuration -->
+ <!-- ======================================================================================== -->
+
+ <tstamp>
+ <format property="build.number" pattern="yyyyMMddHHmm"/>
+ </tstamp>
+
+ <property environment="ENV"/>
+
+ <property name="messaging.config.name" value="messaging"/>
+ <property name="jbossmq.config.name" value="jbossmq"/>
+ <property name="perf.config.file" value="perf.xml"/>
+
+ <!--
+ Project paths.
+ -->
+
+ <property name="project.root" value="${basedir}"/>
+ <property name="project.source" value="${project.root}/src"/>
+ <property name="source.java" value="${project.source}/main"/>
+ <property name="source.etc" value="${project.source}/etc"/>
+ <property name="project.output" value="${project.root}/output"/>
+ <property name="build.classes" value="${project.output}/classes"/>
+ <property name="build.lib" value="${project.output}/lib"/>
+ <property name="build.api" value="${project.output}/api"/>
+ <property name="build.etc" value="${project.output}/etc"/>
+ <property name="build.bin" value="${project.output}/bin"/>
+ <property name="build.docs" value="${project.output}/docs"/>
+ <property name="build.parsers" value="${project.output}/gen-parsers"/>
+ <property name="build.resources" value="${project.output}/resources"/>
+ <property name="build.examples" value="${project.output}/examples"/>
+ <property name="build.reports" value="${project.output}/reports"/>
+ <property name="build.gen" value="${project.output}/gen"/>
+ <property name="build.gen-src" value="${project.output}/gen-src"/>
+ <property name="build.todo" value="${project.output}/todo"/>
+ <property name="build.jar" value="${project.output}/jar"/>
+ <property name="build.scoped-sar" value="${project.output}/scoped-sar"/>
+ <property name="project.thirdparty" value="${project.root}/thirdparty"/>
+
+ <!-- ======================================================================================== -->
+ <!-- Thirdparty Dependency Definitions -->
+ <!-- ======================================================================================== -->
+
+ &libraries;
+
+ <!--
+ This module is based on Java 1.4
+ -->
+
+ <property name="javac.target" value="1.4"/>
+ <property name="javac.source" value="1.4"/>
+
+ <property name="javac.debug" value="true"/>
+ <property name="javac.optimize" value="false"/>
+ <property name="javac.depend" value="false"/>
+ <property name="javac.verbose" value="false"/>
+ <property name="javac.deprecation" value="true"/>
+ <property name="javac.include.ant.runtime" value="false"/>
+ <property name="javac.include.java.runtime" value="true"/>
+ <property name="javac.fail.onerror" value="true"/>
+
+ <!--
+ Non-JBoss dependencies.
+ They must available in the repository and declared as <componentrefs> in build-thirdparty.xml.
+ -->
+
+ <path id="external.dependencies.classpath">
+ <path refid="apache.log4j.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="jfreechart.jfreechart.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="hsqldb.hsqldb.classpath"/>
+ <path refid="javassist.javassist.classpath"/>
+ <path refid="trove.trove.classpath"/>
+
+ </path>
+
+ <!--
+ JBoss dependencies.
+ They must available in the repository and declared as <componentrefs> in build-thirdparty.xml.
+ -->
+ <path id="jboss.dependencies.classpath">
+ <path refid="jboss.common.classpath"/>
+ <path refid="jboss.remoting.classpath"/>
+ <path refid="jboss.serialization.classpath"/>
+ <path refid="jboss.aop.classpath"/>
+ <path refid="jboss.messaging.classpath"/>
+ </path>
+
+ <!--
+ Locally maintained dependencies.
+ -->
+
+ <property name="jboss.j2ee.lib" value="${project.root}/lib/"/>
+ <path id="jboss.j2ee.classpath">
+ <pathelement location="${project.root}/lib/jboss-j2ee.jar"/>
+ </path>
+ <property name="jboss.j2se.lib" value="${project.root}/lib/"/>
+ <path id="jboss.j2se.classpath">
+ <pathelement location="${project.root}/lib/jboss-j2se.jar"/>
+ </path>
+
+ <path id="local.dependencies.classpath">
+ <path refid="jboss.j2ee.classpath"/>
+ <path refid="jboss.j2se.classpath"/>
+ </path>
+
+ <!--
+ The compilation classpath.
+ -->
+ <path id="perf.classpath">
+ <!--
+ Make sure we pick up the correct log4j - previously we weren't which made the perf
+ results slow since too much was being logged
+ -->
+ <pathelement location="./etc"/>
+
+ <path refid="local.dependencies.classpath"/>
+ <path refid="external.dependencies.classpath"/>
+ <path refid="jboss.dependencies.classpath"/>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${ENV.JBOSS_HOME}/client/jnp-client.jar"/>
+
+ </path>
+
+ <!-- ======================================================================================== -->
+ <!-- Compilation Tasks -->
+ <!-- ======================================================================================== -->
+
+ <target name="init">
+ <mkdir dir="${build.classes}"/>
+ <mkdir dir="${project.output}/lib"/>
+ <mkdir dir="${project.output}/logs"/>
+ <mkdir dir="${project.output}/db"/>
+ <mkdir dir="${project.output}/results"/>
+ </target>
+
+ <target name="compile" depends="init">
+
+ <!--<display-path path="compilation.classpath"/>-->
+
+ <javac destdir="${build.classes}"
+ target="${javac.target}"
+ source="${javac.source}"
+ optimize="${javac.optimize}"
+ debug="${javac.debug}"
+ depend="${javac.depend}"
+ verbose="${javac.verbose}"
+ deprecation="${javac.deprecation}"
+ includeAntRuntime="${javac.include.ant.runtime}"
+ includeJavaRuntime="${javac.include.java.runtime}"
+ failonerror="${javac.fail.onerror}">
+ <src path="${source.java}"/>
+ <src path="${project.root}/tests"/>
+ <classpath refid="perf.classpath"/>
+ </javac>
+
+ <rmic base="${build.classes}" includes="**/RMIExecutor.class, **/RegistryRunner.class">
+ <classpath refid="perf.classpath"/>
+ </rmic>
+
+ </target>
+
+ <!-- ======================================================================================== -->
+ <!-- Archival Tasks -->
+ <!-- ======================================================================================== -->
+
+ <target name="sar" depends="rmi-sar"/>
+
+ <target name="rmi-sar" depends="compile">
+
+ <!--
+ Create the unscoped sar for JBossMQ ...
+ -->
+
+ <mkdir dir="${build.classes}/META-INF"/>
+ <mkdir dir="${build.classes}/xmdesc"/>
+ <delete file="${build.classes}/META-INF/jboss-service.xml"/>
+ <copy file="${project.source}/etc/rmi-executor-service.xml" tofile="${build.classes}/META-INF/jboss-service.xml" filtering="yes">
+ <filterset>
+ <filter token="NAME_1" value="local-jbossmq"/>
+ <filter token="NAME_2" value="local-jbossmq2"/>
+ </filterset>
+ </copy>
+ <copy file="${project.source}/etc/RMIExecutor-xmbean.xml" todir="${build.classes}/xmdesc"/>
+ <jar jarfile="${project.output}/lib/rmi-executor.sar" manifest="${project.source}/etc/default.mf">
+ <fileset dir="${build.classes}">
+ <include name="**"/>
+ </fileset>
+ </jar>
+
+ <!--
+ ... then the scoped one for Messaging
+ -->
+
+ <delete file="${build.classes}/META-INF/jboss-service.xml"/>
+ <copy file="${project.source}/etc/rmi-executor-service.xml" tofile="${build.classes}/META-INF/jboss-service.xml" filtering="yes">
+ <filterset>
+ <filter token="NAME_1" value="local-messaging"/>
+ <filter token="NAME_2" value="local-messaging2"/>
+ </filterset>
+ </copy>
+
+ <!--
+ Enable scoping.
+ -->
+ <replaceregexp file="${build.classes}/META-INF/jboss-service.xml" flags="s">
+ <regexp pattern="\x3c!\x2d-([ \t\n\r]*)(\x3cloader-repository\x3e.*\x3c/loader-repository\x3e)([ \t\n\r]*)\x2d-\x3e"/>
+ <substitution expression="\2"/>
+ </replaceregexp>
+
+ <jar jarfile="${project.output}/lib/rmi-executor-scoped.sar" manifest="${project.source}/etc/default.mf">
+ <fileset dir="${build.classes}">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="jbossremoting-sar" depends="compile">
+ <mkdir dir="${build.classes}/META-INF"/>
+ <mkdir dir="${build.classes}/xmdesc"/>
+ <copy file=".${project.source}/etc/jbossremoting-executor-service.xml" tofile="${build.classes}/META-INF/jboss-service.xml"/>
+ <copy file="${project.source}/etc/JBossRemotingExecutor-xmbean.xml" todir="${build.classes}/xmdesc"/>
+ <jar jarfile="${project.output}/lib/jbossremoting-executor.sar" manifest="${project.source}/etc/default.mf">
+ <fileset dir="${build.classes}">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ </target>
+
+
+ <!-- ======================================================================================== -->
+ <!-- Deployment Tasks -->
+ <!-- ======================================================================================== -->
+
+ <target name="deploy-destinations">
+
+ <!--
+ The performance tests may need specially crafted destination that behave equivalently
+ on diferent providers.
+ -->
+ <copy file="./artifacts/messaging-destinations-service.xml" todir="${ENV.JBOSS_HOME}/server/${messaging.config.name}/deploy"/>
+ <copy file="./artifacts/jbossmq-destinations-service.xml" todir="${ENV.JBOSS_HOME}/server/${jbossmq.config.name}/deploy"/>
+ </target>
+
+ <target name="undeploy-destinations">
+ <delete file="${ENV.JBOSS_HOME}/server/${messaging.config.name}/deploy/messaging-destinations-service.xml"/>
+ <delete file="${ENV.JBOSS_HOME}/server/${jbossmq.config.name}/deploy/jbossmq-destinations-service.xml"/>
+ </target>
+
+ <!-- ======================================================================================== -->
+ <!-- Cleaning Tasks -->
+ <!-- ======================================================================================== -->
+
+ <target name="clean">
+ <delete dir="${project.output}"/>
+ </target>
+
+ <target name="clean-data">
+ <delete dir="${project.output}/db"/>
+ <delete dir="${project.output}/results"/>
+ </target>
+
+ <!-- ======================================================================================== -->
+ <!-- Execution Tasks -->
+ <!-- ======================================================================================== -->
+
+
+ <target name="run">
+ <!-- <antcall target="start-executors"/> -->
+ <display-path path="perf.classpath"/>
+ <antcall target="runner">
+ <param name="action" value="measure"/>
+ <param name="project.output" value="${project.output}"/>
+ <param name="log.suffix" value="runner"/>
+ </antcall>
+ <!-- <antcall target="stop-executors"/> -->
+ <antcall target="chart"/>
+ </target>
+
+ <target name="chart" depends="compile">
+ <antcall target="runner">
+ <param name="action" value="chart"/>
+ <param name="project.output" value="${project.output}"/>
+ <param name="log.suffix" value="charter"/>
+ </antcall>
+ </target>
+
+ <target name="runner">
+ <java classname="org.jboss.jms.perf.framework.Runner" fork="true">
+ <!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=NONE"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=runner"/>
+ -->
+ <arg line="-config ${project.root}/etc/${perf.config.file} -action ${action}"/>
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="${log.suffix}"/>
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="start-executors" depends="start-rmi-executors"/>
+ <target name="stop-executors" depends="kill-rmi-executors"/>
+
+ <target name="start-remoting-executors">
+ <antcall target="start-standalone-remoting-executor">
+ <param name="executor.host" value="localhost"/>
+ <param name="executor.port" value="1234"/>
+ </antcall>
+ <antcall target="start-standalone-remoting-executor">
+ <param name="executor.host" value="localhost"/>
+ <param name="executor.port" value="1235"/>
+ </antcall>
+ <!-- no use to deploy colocated executors, they don't work with Remoting anyway -->
+ </target>
+
+ <target name="start-rmi-executors">
+ <antcall target="start-rmi-registry"/>
+ <sleep seconds="1"/>
+ <antcall target="start-standalone-rmi-executor">
+ <param name="registry.host" value="localhost"/>
+ <param name="registry.port" value="7777"/>
+ <param name="executor.name" value="remote"/>
+ </antcall>
+ <antcall target="start-standalone-rmi-executor">
+ <param name="registry.host" value="localhost"/>
+ <param name="registry.port" value="7777"/>
+ <param name="executor.name" value="remote2"/>
+ </antcall>
+ <!-- deploy colocated executors; port values hardcoded for the time being -->
+ <copy file="${project.output}/lib/rmi-executor-scoped.sar" todir="${ENV.JBOSS_HOME}/server/${messaging.config.name}/deploy"/>
+ <copy file="${project.output}/lib/rmi-executor.sar" todir="${ENV.JBOSS_HOME}/server/${jbossmq.config.name}/deploy"/>
+ </target>
+
+ <target name="kill-remoting-executors">
+ <antcall target="kill-remoting-executor">
+ <param name="executor.host" value="localhost"/>
+ <param name="executor.port" value="1234"/>
+ </antcall>
+ <antcall target="kill-remoting-executor">
+ <param name="executor.host" value="localhost"/>
+ <param name="executor.port" value="1235"/>
+ </antcall>
+ </target>
+
+ <target name="kill-rmi-executors">
+ <!-- undeploy colocated executors -->
+ <delete file="${ENV.JBOSS_HOME}/server/${messaging.config.name}/deploy/rmi-executor-scoped.sar"/>
+ <delete file="${ENV.JBOSS_HOME}/server/${jbossmq.config.name}/deploy/rmi-executor.sar"/>
+ <!-- and kill the standalone VMs -->
+ <antcall target="kill-rmi-executor">
+ <param name="registry.host" value="localhost"/>
+ <param name="registry.port" value="7777"/>
+ <param name="executor.name" value="remote"/>
+ </antcall>
+ <antcall target="kill-rmi-executor">
+ <param name="registry.host" value="localhost"/>
+ <param name="registry.port" value="7777"/>
+ <param name="executor.name" value="remote2"/>
+ </antcall>
+ <!-- allow some time for service undeployment -->
+ <sleep seconds="3"/>
+ <antcall target="kill-rmi-registry"/>
+ </target>
+
+ <target name="start-standalone-remoting-executor" description="Start a standalone (its own VM) JBoss Remoting executor">
+ <echo message="Starting standalone Remoting executor ${executor.host}:${executor.port}"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.jbossremoting.JBossRemotingExecutor" fork="true" spawn="true">
+ <arg value="${executor.port}"/>
+ <arg value="${executor.host}"/>
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="remoting-executor-${executor.host}-${executor.port}"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="start-standalone-rmi-executor" description="Start a standalone (its own VM) RMI executor">
+ <echo message="Starting standalone RMI executor rmi://${registry.host}:${registry.port}/${executor.name}"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.rmi.RMIExecutor" fork="true" spawn="true">
+ <arg value="${executor.name}"/>
+ <arg value="${registry.port}"/>
+ <arg value="${registry.host}"/>
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="rmi-executor-${registry.host}-${registry.port}-${executor.name}"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="start-rmi-registry">
+ <echo message="Starting registry"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.rmi.RegistryRunner" fork="true" spawn="true">
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="registry"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="kill-rmi-registry">
+ <echo message="Killing registry"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.rmi.RegistryKiller" fork="true" spawn="true">
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="registry.kill"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="kill-remoting-executor" description="Kill a remoting executor (co-located or standalone)">
+ <echo message="Killing remoting executor ${executor.host}:${executor.port}"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.jbossremoting.ExecutorKiller" fork="true">
+ <arg value="${executor.port}"/>
+ <arg value="${executor.host}"/>
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="remoting-executor-${executor.host}-${executor.port}.kill"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+ <target name="kill-rmi-executor" description="Kill a RMI executor (co-located or standalone)">
+ <echo message="Killing RMI executor rmi://${registry.host}:${registry.port}/${executor.name}"/>
+ <java classname="org.jboss.jms.perf.framework.remoting.rmi.ExecutorKiller" fork="true">
+ <arg value="${executor.name}"/>
+ <arg value="${registry.port}"/>
+ <arg value="${registry.host}"/>
+ <sysproperty key="project.output" value="${project.output}"/>
+ <sysproperty key="log.suffix" value="rmi-executor-${registry.host}-${registry.port}-${executor.name}.kill"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=executor"/>
+ -->
+ <classpath refid="perf.classpath"/>
+ </java>
+ </target>
+
+
+
+ <target name="report" depends="tests, copy-stylesheets, compile-report"/>
+
+ <target name="prepare-testdirs">
+ <mkdir dir="${project.output}/reports"/>
+ </target>
+
+ <!-- ======================================================================================== -->
+ <!-- Test tasks -->
+ <!-- ======================================================================================== -->
+
+ <target name="tests" depends="compile, prepare-testdirs">
+
+ <junit printsummary="${junit.printsummary}"
+ fork="no"
+ includeantruntime="yes"
+ haltonerror="${junit.haltonerror}"
+ haltonfailure="${junit.haltonfailure}"
+ showoutput="${junit.showoutput}"
+ timeout="30000">
+
+ <sysproperty key="project.output" value="${project.output}"/>
+ <jvmarg value="-Xmx512M"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+ -->
+ <classpath>
+ <path refid="perf.classpath"/>
+ </classpath>
+ <formatter type="xml" usefile="yes"/>
+ <batchtest fork="${junit.batchtest.fork}"
+ todir="${project.output}/reports"
+ haltonfailure="no"
+ haltonerror="no">
+ <formatter type="plain" usefile="yes"/>
+ <fileset dir="${project.output}/classes">
+ <include name="**/test/**/*Test.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="copy-stylesheets">
+ <mkdir dir="${project.output}/stylesheets"/>
+ <copy todir="${project.output}/stylesheets" filtering="yes">
+ <fileset dir="../tests/src/stylesheets">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="compile-report" depends="copy-stylesheets">
+ <mkdir dir="${project.output}/reports/html"/>
+ <junitreport todir="${project.output}/reports">
+ <fileset dir="${project.output}/reports">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames"
+ todir="${project.output}/reports/html"
+ styledir="${project.output}/stylesheets"/>
+ </junitreport>
+ </target>
+
+ <!-- ======================================================================================== -->
+ <!-- Macros -->
+ <!-- ======================================================================================== -->
+
+ <macrodef name="display-path">
+ <attribute name="path"/>
+ <sequential>
+ <pathconvert refid="@{path}" targetos="unix" property="@{path}.representation"/>
+ <echo message="@{path}: ${@{path}.representation}"/>
+ </sequential>
+ </macrodef>
+
+ <!-- I collected these taks from the main project's build.xml. They don't really belong there
+ since this is perf framework business and the perf framework is going to be separated in
+ its own project anyway. I preserved them here for future consideration.
+ TODO clean up and place these tasks where they belong
+ -->
+
+ <!--
+ <target name="perf-sar-structure-messaging" depends="compile">
+ <mkdir dir="${build.lib}"/>
+ <mkdir dir="${build.perfsar}/META-INF"/>
+ <mkdir dir="${build.perfsar}/xmdesc"/>
+ <copy file="${source.java}/org/jboss/jms/perf/framework/PerfRunner-xmbean.xml" tofile="${build.perfsar}/xmdesc/PerfRunner-xmbean.xml"/>
+ <copy file="${source.java}/org/jboss/jms/perf/framework/jboss-service-jbossmessaging.xml" tofile="${build.perfsar}/META-INF/jboss-service.xml"/>
+ <copy file="${module.source}/../tests/bin/perf-jndi.properties" tofile="${build.perfsar}/perf-jndi.properties"/>
+ <copy file="${module.source}/../tests/bin/jbossmessaging-perf.properties" tofile="${build.perfsar}/perf.properties"/>
+ <copy todir="${build.perfsar}"> <fileset dir="${build.classes}"> <include name="**/jms/perf/**/*.class"/> </fileset> </copy>
+ </target>
+
+ <target name="perf-sar-messaging" depends="perf-sar-structure-messaging">
+ <jar jarfile="${build.lib}/jboss-perf-messaging.sar" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.perfsar}">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="perf-sar-structure-mq" depends="compile">
+ <mkdir dir="${build.lib}"/>
+ <mkdir dir="${build.perfsar}/META-INF"/>
+ <mkdir dir="${build.perfsar}/xmdesc"/>
+ <copy file="${source.java}/org/jboss/jms/perf/framework/PerfRunner-xmbean.xml" tofile="${build.perfsar}/xmdesc/PerfRunner-xmbean.xml"/>
+ <copy file="${source.java}/org/jboss/jms/perf/framework/jboss-service-jbossmq.xml" tofile="${build.perfsar}/META-INF/jboss-service.xml"/>
+ <copy file="${module.source}/../tests/bin/perf-jndi.properties" tofile="${build.perfsar}/perf-jndi.properties"/>
+ <copy file="${module.source}/../tests/bin/jbossmq-perf.properties" tofile="${build.perfsar}/perf.properties"/>
+ <copy todir="${build.perfsar}">
+ <fileset dir="${build.classes}">
+ <include name="**/jms/perf/**/*.class"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="perf-sar-mq" depends="perf-sar-structure-mq">
+ <jar jarfile="${build.lib}/jboss-perf-mq.sar" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.perfsar}">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ </target>
+ -->
+
+</project>
+
Added: projects/perf/trunk/build-thirdparty.xml
===================================================================
--- projects/perf/trunk/build-thirdparty.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/build-thirdparty.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- 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. -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- $Id$ -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+<project name="main.build" default="synchronize">
+
+ <!-- ======================================================================================== -->
+ <!-- Configuration -->
+ <!-- ======================================================================================== -->
+
+ <property file="local.properties"/>
+ <property file="synchronize.properties"/>
+ <property name="librariesEntFile" value="./thirdparty/libraries.ent"/>
+
+ <property environment="ENV"/>
+
+ <!--
+ | Allow jbossbuild.repository to be set from (in order or priority)
+ | 1) Command line -Djbossbuild.repository=...
+ | 2) synchronize.properties jbossbuild.repository setting
+ | 3) JBOSS_REPOSITORY environment variable
+ -->
+ <condition property="jbossbuild.repository" value="${ENV.JBOSS_REPOSITORY}">
+ <isset property="ENV.JBOSS_REPOSITORY"/>
+ </condition>
+
+ <!--
+ | Fall back to default.
+ -->
+ <property name="jbossbuild.repository" value="http://repository.jboss.com"/>
+
+ <import file="./tools/etc/jbossbuild/tasks.xml"/>
+
+ <!--
+ | This is where Performance Framework's external dependencies are declared. The repository is
+ | in CVS under the module repository.jboss.com whose contents are pushed to the
+ | http://repository.jboss.com site.
+ -->
+ <build id="messaging-perf"
+ impltitle="Messaging Performance Framework"
+ implversion="undefined"
+ implvendor="JBoss Inc."
+ implurl="http://www.jboss.org"
+ description="Messaging Performance Framework"
+ cvsroot="${cvs.prefix}@cvs.forge.jboss.com:/cvsroot/jboss"
+ thirdpartypath="./thirdparty/"
+ location="${jbossbuild.repository}"
+ targetdefs="targets">
+
+ <!--
+ Dependencies required to build the project.
+ -->
+ <componentref name="apache-log4j" version="1.2.8"/>
+ <componentref name="oswego-concurrent" version="1.3.4"/>
+ <componentref name="junit" version="3.8.1"/>
+ <componentref name="jfreechart" version="1.0.2"/>
+ <componentref name="jboss/common" version="1.0.2"/>
+ <componentref name="jboss/messaging" version="1.0.1.CR5"/>
+ <componentref name="hsqldb" version="1.8.0.2"/>
+
+ <!--
+ Need this otherwise project doesn't build in Eclipse
+ -->
+ <componentref name="apache-logging" version="1.0.5.GA-jboss"/>
+
+ </build>
+
+ <synchronizeinfo/>
+
+ <!--
+ | Generate the targets.
+ -->
+ <generate generate="messaging-perf"/>
+
+ <target name="generate-libraries-ent" depends="synchronize">
+ <gen-lib-file path="tools/etc/buildmagic" filename="${librariesEntFile}"/>
+ <visit-componentref-graph componentVisitor="org.jboss.ant.util.graph.ComponentRefGraphLicenseVisitor"/>
+ </target>
+
+</project>
Added: projects/perf/trunk/build.xml
===================================================================
--- projects/perf/trunk/build.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/build.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- 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. -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+
+<!-- =========================================================================================== -->
+<!-- -->
+<!-- $Id: build.xml 1221 2006-08-10 18:50:43Z ovidiu.feodorov at jboss.com $ -->
+<!-- -->
+<!-- =========================================================================================== -->
+
+
+<project default="compile" name="Messaging Performance Framework">
+
+ <!--
+ Setting "external.project" to true makes jbossbuild use the current directory, and not its
+ parent, as project root. DO NOT change this.
+ -->
+ <property name="external.project" value="true"/>
+
+ <!--
+ Setting "nodownload" to true inhibits downloading of up-to-date dependencies.
+ -->
+ <property name="nodownload" value="false"/>
+
+ <!--
+ Create the thirdparty folder from items in the repository then generate a new libraries.ent
+ file and include it in the build.
+ -->
+ <target name="createthirdparty" unless="inhibit.downloads" depends="check.inhibit.downloads">
+ <ant antfile="build-thirdparty.xml" target="generate-libraries-ent"/>
+ </target>
+
+ <target name="check.inhibit.downloads">
+ <condition property="inhibit.downloads">
+ <or>
+ <uptodate property="dependencies.current"
+ srcfile="build-thirdparty.xml"
+ targetfile="./thirdparty/libraries.ent"/>
+ <istrue value="${nodownload}"/>
+ </or>
+ </condition>
+ </target>
+
+ <target name="compile" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="compile"/>
+ </target>
+
+ <target name="sar" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="sar"/>
+ </target>
+
+ <target name="start-executors" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="start-executors"/>
+ </target>
+
+ <target name="stop-executors" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="stop-executors"/>
+ </target>
+
+ <target name="deploy-destinations" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="deploy-destinations"/>
+ </target>
+
+ <target name="undeploy-destinations" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="undeploy-destinations"/>
+ </target>
+
+ <target name="run" depends="createthirdparty">
+ <ant antfile="build-perf.xml" target="run"/>
+ </target>
+
+ <target name="clean">
+ <ant antfile="build-perf.xml" target="clean"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: projects/perf/trunk/etc/log4j.xml
===================================================================
--- projects/perf/trunk/etc/log4j.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/etc/log4j.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 1019 2006-07-17 17:15:04Z timfox $ -->
+
+<!--
+ | 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">
+
+ <!-- ================================= -->
+ <!-- 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="${project.output}/logs/${log.suffix}.log"/>
+
+ <param name="Append" value="false"/>
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <param name="Threshold" value="INFO"/>
+ <!--
+ <param name="Threshold" value="TRACE#org.jboss.logging.XLevel"/>
+ -->
+
+ <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"/> -->
+ <param name="ConversionPattern" value="%d %-5p @%t [%c] %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="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss.remoting">
+ <priority value="INFO"/>
+ </category>
+
+
+ <category name="org.jboss.jms">
+ <!-- <priority value="TRACE" class="org.jboss.logging.XLevel"/> -->
+ <!-- <priority value="DEBUG"/> -->
+ <priority value="INFO"/>
+ </category>
+
+ <!--
+ <category name="org.jboss.jms.server.remoting.JMSWireFormat">
+ <priority value="INFO"/>
+ </category>
+ -->
+
+ <category name="org.jboss.jms.perf.framework">
+ <!-- <priority value="TRACE" class="org.jboss.logging.XLevel"/> -->
+ <!-- <priority value="DEBUG"/> -->
+ <priority value="INFO"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+
+</log4j:configuration>
Added: projects/perf/trunk/etc/perf.xml
===================================================================
--- projects/perf/trunk/etc/perf.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/etc/perf.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,977 @@
+<benchmark>
+
+ <!-- benchmark configuration -->
+ <db-url>jdbc:hsqldb:./output/db/perfdb</db-url>
+ <report-directory>./output/results</report-directory>
+ <color-step>15</color-step>
+
+ <!-- benchmark-wide test defaults -->
+
+ <default-executor-url>rmi://localhost:7777/remote</default-executor-url>
+ <destination>/queue/testQueue</destination>
+ <connection-factory>/ConnectionFactory</connection-factory>
+ <acknowledgment-mode>AUTO_ACKNOWLEDGE</acknowledgment-mode>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-factory-class>org.jboss.jms.perf.framework.factories.MessageMessageFactory</message-factory-class>
+ <message-size>0</message-size>
+
+ <!-- safeguard for receive jobs that block waiting messages will never arrive -->
+ <duration>600000</duration>
+
+ <providers>
+
+ <provider name="JBossMessaging">
+ <factory>org.jnp.interfaces.NamingContextFactory</factory>
+ <url>jnp://localhost:1099</url>
+ <pkg>org.jboss.naming:org.jnp.interfaces</pkg>
+ <executor name="REMOTE" url="rmi://localhost:7777/remote"/>
+ <executor name="REMOTE2" url="rmi://localhost:7777/remote2"/>
+ <executor name="LOCAL" url="rmi://localhost:7777/local-messaging"/>
+ <executor name="LOCAL2" url="rmi://localhost:7777/local-messaging2"/>
+ <color>0,0,255</color>
+ </provider>
+
+ <provider name="JBossMQ">
+ <factory>org.jnp.interfaces.NamingContextFactory</factory>
+ <url>jnp://localhost:1199</url>
+ <pkg>org.jboss.naming:org.jnp.interfaces</pkg>
+ <executor name="REMOTE" url="rmi://localhost:7777/remote"/>
+ <executor name="REMOTE2" url="rmi://localhost:7777/remote2"/>
+ <executor name="LOCAL" url="rmi://localhost:7777/local-jbossmq"/>
+ <executor name="LOCAL2" url="rmi://localhost:7777/local-jbossmq2"/>
+ <color>255,0,0</color>
+ </provider>
+ </providers>
+
+ <performance-tests>
+
+ <!-- just makes sure the executors are deployed and ready -->
+ <!--
+ <performance-test name="Ping" loops="1">
+ <ping executor="REMOTE"/>
+ <ping executor="REMOTE2"/>
+ <ping executor="LOCAL"/>
+ <ping executor="LOCAL2"/>
+ <parallel>
+ <ping executor="REMOTE"/>
+ <ping executor="REMOTE2"/>
+ <ping executor="LOCAL"/>
+ <ping executor="LOCAL2"/>
+ </parallel>
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+ -->
+
+ <!--
+ <performance-test name="Single Burst" loops="10">
+ <destination>/queue/simpleQueue</destination>
+ <message-size>0</message-size>
+ <messages>30000</messages>
+ <drain executor="LOCAL"/>
+ <send rate="10000" executor="REMOTE"/>
+ <execution provider="JBossMessaging"/>
+ </performance-test>
+ -->
+
+ <performance-test name="Throughput O KB Message Non-Persistent Non-Transactional, 1 sender, 1 receiver">
+
+ <graph>
+ <x job="send" result="yes" metric="rate" label="measured send rate (msg/s)"/>
+ <y job="receive" result="yes" metric="rate" label="measured receive rate (msg/s)" />
+ </graph>
+
+
+ <message-size>0</message-size>
+ <messages>1000</messages>
+
+ <drain/>
+
+ <parallel>
+ <send rate="200" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <parallel>
+ <send rate="400" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <execution provider="JBossMessaging"/>
+
+ </performance-test>
+
+
+ <!--
+
+ <performance-test name="Throughput-Remote">
+
+ <graph>
+ <x job="send" result="yes" metric="rate" label="measured send rate (msg/s)"/>
+ <y job="receive" result="yes" metric="rate" label="measured receive rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <duration>30000</duration>
+
+ <drain/>
+
+ <parallel>
+ <send rate="500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="1000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="1500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="2000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="2500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="3000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="3500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="4000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="4500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="5000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="5500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="6000" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="6500" executor="REMOTE"/>
+ <receive executor="REMOTE2"/>
+ </parallel>
+
+ <drain/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+
+ </performance-test>
+
+
+ <performance-test name="Throughput-INVM">
+
+ <graph>
+ <x job="send" result="yes" metric="rate" label="measured send rate (msg/s)"/>
+ <y job="receive" result="yes" metric="rate" label="measured receive rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <duration>30000</duration>
+
+ <drain/>
+ <parallel>
+ <send rate="1000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="2000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="3000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="4000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="5000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="6000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+
+ <drain/>
+
+ <parallel>
+ <send rate="7000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="8000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="9000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="10000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="11000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="12000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="13000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <parallel>
+ <send rate="14000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <parallel>
+ <send rate="15000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="16000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="17000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+ <drain/>
+
+ <parallel>
+ <send rate="18000" executor="LOCAL"/>
+ <receive executor="LOCAL2"/>
+ </parallel>
+
+
+ <drain/>
+
+ <execution provider="JBossMessaging"/>
+
+
+ <execution provider="JBossMQ"/>
+
+
+ </performance-test>
+
+ <performance-test name="Measured Send Rate vs. Intended Send Rate INVM">
+
+ <graph>
+ <x job="send" metric="rate" label="intended send rate (msg/s)"/>
+ <y job="send" metric="rate" label="measured send rate (msg/s)" result="true"/>
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <messages>50000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="14000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="16000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="18000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="20000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="22000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="24000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="26000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="28000" executor="LOCAL"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+
+
+<performance-test name="Measured Send Rate vs. Intended Send Rate Remote">
+
+ <graph>
+ <x job="send" metric="rate" label="intended send rate (msg/s)"/>
+ <y job="send" metric="rate" label="measured send rate (msg/s)" result="true"/>
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <messages>50000</messages>
+
+ <drain executor="REMOTE"/>
+ <send rate="1000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="2000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="3000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="4000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="6000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="8000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="10000" executor="REMOTE"/>
+
+ <drain executor="REMOTE"/>
+ <send rate="12000" executor="REMOTE"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+ -->
+
+
+
+
+ <!--
+
+ <performance-test name="Send 50000 Non-Persistent Non-Transactional 0 KB Local">
+
+ <graph>
+ <x job="send" result="no" metric="rate" label="target send rate (msg/s)"/>
+ <y job="send" result="yes" metric="rate" label="measured send rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <messages>50000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="7000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="14000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="14500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="15000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="15500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="16000" executor="LOCAL"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+ -->
+
+<!--
+ <performance-test name="Send 20000 Non-Persistent Non-Transactional 1 KB Text Local" loops="3">
+
+ <graph>
+ <x job="send" result="no" metric="rate" label="target send rate (msg/s)"/>
+ <y job="send" result="yes" metric="rate" label="measured send rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-factory-class>org.jboss.jms.perf.framework.factories.TextMessageFactory</message-factory-class>
+ <message-size>1024</message-size>
+ <messages>30000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="7000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="14000" executor="LOCAL"/>
+
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+-->
+
+ <!--
+ <performance-test name="Send 30000 Non-Persistent Non-Transactional 0 KB Remote">
+
+ <graph>
+ <x job="send" result="no" metric="rate" label="target send rate (msg/s)"/>
+ <y job="send" result="yes" metric="rate" label="measured send rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>NON_PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <messages>30000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="7000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="8500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="9500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="10500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="11500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="12500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="13500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="14000" executor="REMOTE"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+ -->
+
+ <!--
+ <performance-test name="Send 30000 Persistent Non-Transactional 0 KB Local">
+
+ <graph>
+ <x job="send" result="no" metric="rate" label="target send rate (msg/s)"/>
+ <y job="send" result="yes" metric="rate" label="measured send rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>PERSISTENT</delivery-mode>
+ <message-size>0</message-size>
+ <messages>30000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5000" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5250" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5500" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5750" executor="LOCAL"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="LOCAL"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+ -->
+
+
+ <!--
+ <performance-test name="Send 30000 Persistent Non-Transactional 1 KB Text Remote">
+
+ <graph>
+ <x job="send" result="no" metric="rate" label="target send rate (msg/s)"/>
+ <y job="send" result="yes" metric="rate" label="measured send rate (msg/s)" />
+ </graph>
+
+ <destination>/queue/simpleQueue</destination>
+ <delivery-mode>PERSISTENT</delivery-mode>
+ <message-factory-class>org.jboss.jms.perf.framework.factories.TextMessageFactory</message-factory-class>
+ <message-size>1024</message-size>
+ <messages>30000</messages>
+
+ <drain executor="LOCAL"/>
+ <send rate="250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="1750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="2750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="3750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="4750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5000" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5250" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5500" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="5750" executor="REMOTE"/>
+
+ <drain executor="LOCAL"/>
+ <send rate="6000" executor="REMOTE"/>
+
+ <execution provider="JBossMessaging"/>
+ <execution provider="JBossMQ"/>
+ </performance-test>
+
+ -->
+
+
+ </performance-tests>
+
+</benchmark>
+
+
Added: projects/perf/trunk/lib/jboss-j2ee.jar
===================================================================
(Binary files differ)
Property changes on: projects/perf/trunk/lib/jboss-j2ee.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/perf/trunk/lib/jboss-j2se.jar
===================================================================
(Binary files differ)
Property changes on: projects/perf/trunk/lib/jboss-j2se.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/perf/trunk/src/etc/JBossRemotingExecutor-xmbean.xml
===================================================================
--- projects/perf/trunk/src/etc/JBossRemotingExecutor-xmbean.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/etc/JBossRemotingExecutor-xmbean.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE mbean PUBLIC
+ "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <description>A co-located executor. Essential for Messaging IN-VM performance tests.</description>
+ <class>org.jboss.jms.perf.framework.remoting.jbossremoting.JBossRemotingExecutor</class>
+
+ <!-- Managed constructors -->
+
+ <constructor>
+ <name>JBossRemotingExecutor</name>
+ <parameter>
+ <name>port</name>
+ <type>int</type>
+ </parameter>
+ </constructor>
+
+ <constructor>
+ <name>JBossRemotingExecutor</name>
+ <parameter>
+ <name>port</name>
+ <type>int</type>
+ </parameter>
+ <parameter>
+ <name>address</name>
+ <type>java.lang.String</type>
+ </parameter>
+ </constructor>
+
+ <!-- Managed attributes -->
+
+ <attribute access="read-only" getMethod="getPort">
+ <description>The port the associated Connector is listening on</description>
+ <name>Port</name>
+ <type>int</type>
+ </attribute>
+
+ <attribute access="read-only" getMethod="getAddress">
+ <description>The address the associated Connector is bound on</description>
+ <name>Address</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ <attribute access="read-only" getMethod="getLocatorURI">
+ <description>The full locator URI of the associated Connector</description>
+ <name>LocatorURI</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ <!-- Managed operations -->
+
+ <operation>
+ <description>JBoss Service lifecycle operation</description>
+ <name>start</name>
+ </operation>
+
+ <operation>
+ <description>JBoss Service lifecycle operation</description>
+ <name>stop</name>
+ </operation>
+
+</mbean>
\ No newline at end of file
Added: projects/perf/trunk/src/etc/RMIExecutor-xmbean.xml
===================================================================
--- projects/perf/trunk/src/etc/RMIExecutor-xmbean.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/etc/RMIExecutor-xmbean.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE mbean PUBLIC
+ "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <description>A co-located RMI executor. Essential for Messaging IN-VM performance tests.</description>
+ <class>org.jboss.jms.perf.framework.remoting.rmi.RMIExecutor</class>
+
+ <!-- Managed constructors -->
+
+ <constructor>
+ <name>RMIExecutor</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <parameter>
+ <name>registryPort</name>
+ <type>int</type>
+ </parameter>
+ <parameter>
+ <name>registryHost</name>
+ <type>java.lang.String</type>
+ </parameter>
+ </constructor>
+
+ <!-- Managed attributes -->
+
+ <attribute access="read-only" getMethod="getName">
+ <description>The Remote server name</description>
+ <name>Name</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ <attribute access="read-only" getMethod="getRegistryPort">
+ <description>The registry port</description>
+ <name>RegistryPort</name>
+ <type>int</type>
+ </attribute>
+
+
+ <attribute access="read-only" getMethod="getRegistryHost">
+ <description>The registry host</description>
+ <name>RegistryHost</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ <!-- Managed operations -->
+
+ <operation>
+ <description>JBoss Service lifecycle operation</description>
+ <name>start</name>
+ </operation>
+
+ <operation>
+ <description>JBoss Service lifecycle operation</description>
+ <name>stop</name>
+ </operation>
+
+</mbean>
\ No newline at end of file
Added: projects/perf/trunk/src/etc/default.mf
===================================================================
--- projects/perf/trunk/src/etc/default.mf 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/etc/default.mf 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1 @@
+Manifest-Version: 1.0
Added: projects/perf/trunk/src/etc/jbossremoting-executor-service.xml
===================================================================
--- projects/perf/trunk/src/etc/jbossremoting-executor-service.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/etc/jbossremoting-executor-service.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ An JBossRemotingExecutor service deployment descriptor. Used by co-located performance tests.
+ $Id: jbossremoting-executor-service.xml 729 2006-03-12 08:50:25Z ovidiu $
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.perf.framework.remoting.jbossremoting.JBossRemotingExecutor"
+ name="jboss.messaging.performance:service=RemotingExecutor,port=1236"
+ xmbean-dd="xmdesc/JBossRemotingExecutor-xmbean.xml">
+ <constructor>
+ <arg type="int" value="1236"/>
+ <arg type="java.lang.String" value="localhost"/>
+ </constructor>
+ </mbean>
+
+ <mbean code="org.jboss.jms.perf.framework.remoting.jbossremoting.JBossRemotingExecutor"
+ name="jboss.messaging.performance:service=RemotingExecutor,port=1237"
+ xmbean-dd="xmdesc/JBossRemotingExecutor-xmbean.xml">
+ <constructor>
+ <arg type="int" value="1237"/>
+ <arg type="java.lang.String" value="localhost"/>
+ </constructor>
+ </mbean>
+
+</server>
\ No newline at end of file
Added: projects/perf/trunk/src/etc/rmi-executor-service.xml
===================================================================
--- projects/perf/trunk/src/etc/rmi-executor-service.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/etc/rmi-executor-service.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ An RMIExecutor service deployment descriptor. Used by co-located performance tests.
+ $Id: rmi-executor-service.xml 729 2006-03-12 08:50:25Z ovidiu $
+ -->
+
+<server>
+
+ <!--
+ <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+ -->
+
+ <mbean code="org.jboss.jms.perf.framework.remoting.rmi.RMIExecutor"
+ name="jboss.messaging.performance:service=RMIExecutor,name=@NAME_1@"
+ xmbean-dd="xmdesc/RMIExecutor-xmbean.xml">
+ <constructor>
+ <arg type="java.lang.String" value="@NAME_1@"/>
+ <arg type="int" value="7777"/>
+ <arg type="java.lang.String" value="localhost"/>
+ </constructor>
+ </mbean>
+
+ <mbean code="org.jboss.jms.perf.framework.remoting.rmi.RMIExecutor"
+ name="jboss.messaging.performance:service=RMIExecutor,name=@NAME_2@"
+ xmbean-dd="xmdesc/RMIExecutor-xmbean.xml">
+ <constructor>
+ <arg type="java.lang.String" value="@NAME_2@"/>
+ <arg type="int" value="7777"/>
+ <arg type="java.lang.String" value="localhost"/>
+ </constructor>
+ </mbean>
+
+</server>
\ No newline at end of file
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Charter.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Charter.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Charter.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,468 @@
+/*
+ * 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.jms.perf.framework;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Set;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import org.jboss.jms.perf.framework.data.Execution;
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+import org.jboss.jms.perf.framework.data.GraphInfo;
+import org.jboss.jms.perf.framework.data.AxisInfo;
+import org.jboss.jms.perf.framework.persistence.PersistenceManager;
+import org.jboss.jms.perf.framework.protocol.Failure;
+import org.jboss.jms.perf.framework.protocol.ThroughputResult;
+import org.jboss.jms.perf.framework.protocol.Job;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.configuration.Configuration;
+import org.jboss.logging.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+import org.jfree.chart.renderer.AbstractRenderer;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import com.sun.image.codec.jpeg.JPEGCodec;
+import com.sun.image.codec.jpeg.JPEGImageEncoder;
+
+/**
+ * Chars performance test results
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 896 $
+ *
+ * $Id: Charter.java 896 2006-04-20 04:08:18Z ovidiu $
+ */
+class Charter
+{
+ // Constants -----------------------------------------------------
+
+ //TODO configure from ant task
+ private static final String OUTPUT_FILE = "benchmark-results.html";
+ private static final Logger log = Logger.getLogger(Charter.class);
+
+ public static final DateFormat dateFormat = new SimpleDateFormat("MMM d yy hh:mm a");
+
+ // Static --------------------------------------------------------
+
+ String generateImageName(String testName)
+ {
+ StringBuffer sb = new StringBuffer();
+ for(StringTokenizer st = new StringTokenizer(testName, " \t,;!:-"); st.hasMoreTokens();)
+ {
+ String s = st.nextToken();
+ sb.append(s);
+ }
+ sb.append(".jpg");
+ return sb.toString();
+ }
+
+ // Attributes ----------------------------------------------------
+
+ protected PersistenceManager pm;
+ protected Configuration configuration;
+ protected Writer writer;
+ protected File outputDir;
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * It is not the Charter's responsibility to start/stop the peristence manager the database.
+ */
+ Charter(PersistenceManager pm, Configuration configuration)
+ {
+ this.pm = pm;
+ this.configuration = configuration;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void run() throws Exception
+ {
+ outputDir = new File(configuration.getReportDirectory());
+ writer = new FileWriter(new File(outputDir, OUTPUT_FILE));
+
+ try
+ {
+ writer.write("<html><body>\n");
+ doCharts();
+ writer.write("</body></html>\n");
+ log.debug("success");
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+
+ protected void doCharts() throws Exception
+ {
+ // one chart (image) per performance test
+
+ // only chart the performance tests from the current configuration file; the database may
+ // contain much more that those, but it MUST contains the ones from the config file, they
+ // just ran
+
+ if (configuration.getPerformanceTests().isEmpty())
+ {
+ log.info("No performance tests defined in the configuration file");
+ }
+
+ for(Iterator i = configuration.getPerformanceTests().iterator(); i.hasNext(); )
+ {
+ String testName = ((PerformanceTest)i.next()).getName();
+ PerformanceTest pt = pm.getPerformanceTest(testName);
+
+ if (pt == null)
+ {
+ throw new Exception("The performance test '" + testName + "' found in configuration " +
+ "file but not in the database");
+ }
+ chartPerformanceTest(pt);
+ }
+ }
+
+ protected void chartPerformanceTest(PerformanceTest pt) throws Exception
+ {
+ String testName = pt.getName();
+
+ GraphInfo graphInfo = null;
+
+ // we only have graph info in memory, not in database
+ for(Iterator i = configuration.getPerformanceTests().iterator(); i.hasNext(); )
+ {
+ PerformanceTest thispt = (PerformanceTest)i.next();
+ if (thispt.getName().equals(testName))
+ {
+ graphInfo = thispt.getGraphInfo();
+ break;
+ }
+ }
+
+ if (graphInfo == null)
+ {
+ log.warn("No <graph> section for " + testName + ", skipping generating chart");
+ return;
+ }
+
+
+ XYSeriesCollection dataset = new XYSeriesCollection();
+ ProviderToSeriesIndexMapper providerToSeries = new ProviderToSeriesIndexMapper();
+
+ for(Iterator i = pt.getEffectiveExecutions().iterator(); i.hasNext(); )
+ {
+ Execution e = (Execution)i.next();
+ chartExecution(dataset, e, providerToSeries, graphInfo);
+ }
+
+ String xLabel = graphInfo.getAxisInfo(GraphInfo.X).getLabel();
+ xLabel = xLabel == null ? "undefined label" : xLabel;
+ String yLabel = graphInfo.getAxisInfo(GraphInfo.Y).getLabel();
+ yLabel = yLabel == null ? "undefined label" : yLabel;
+
+ JFreeChart chart =
+ ChartFactory.createXYLineChart(testName, xLabel, yLabel, dataset, PlotOrientation.VERTICAL,
+ true, true, false);
+
+ createImage(chart, providerToSeries, generateImageName(testName));
+ }
+
+ protected void chartExecution(XYSeriesCollection dataset, Execution execution,
+ ProviderToSeriesIndexMapper providerToSeries,
+ GraphInfo graphInfo) throws Exception
+ {
+ log.info("Charting " + execution);
+
+ String providerName = execution.getProviderName();
+
+ AxisInfo xAxis = graphInfo.getAxisInfo(GraphInfo.X);
+ AxisInfo yAxis = graphInfo.getAxisInfo(GraphInfo.Y);
+
+ String seriesDescription =
+ generateSeriesDescription(dataset, providerName, execution.getStartDate());
+
+ XYSeries series = new XYSeries(seriesDescription);
+
+ outer:for(Iterator i = execution.iterator(); i.hasNext(); )
+ {
+ List measurement = (List)i.next();
+
+ double x = 0, y = 0;
+ boolean xReady = false, yReady = false;
+
+ // TODO this won't work for multiple identical jobs, and also for more than one
+ // parallel jobs
+ for(Iterator j = measurement.iterator(); j.hasNext(); )
+ {
+ Result result = (Result)j.next();
+
+ if (result instanceof Failure)
+ {
+ // ignore this measurment
+ continue outer;
+ }
+
+ Job job = (Job)result.getRequest();
+
+ if (job.getType() == xAxis.getJobType())
+ {
+ if (xAxis.isResult())
+ {
+ // TODO basically we're ignoring that we can also want the number of messages
+ x = ((ThroughputResult)result).getThroughput();
+ log.debug("recording " + x + " on the x axis, as result");
+ }
+ else
+ {
+ // TODO basically we're ignoring anything else but rates
+ x = job.getRate();
+ log.debug("recording " + x + " on the x axis");
+ }
+
+ xReady = true;
+ }
+
+ if (job.getType() == yAxis.getJobType())
+ {
+ if (yAxis.isResult())
+ {
+ // TODO basically we're ignoring that we can also want the number of messages
+ y = ((ThroughputResult)result).getThroughput();
+ log.debug("recording " + y + " on the y axis, as result");
+ }
+ else
+ {
+ // TODO basically we're ignoring anything else but rates
+ y = job.getRate();
+ log.debug("recording " + y + " on the y axis");
+ }
+
+ yReady = true;
+ }
+
+ if (xReady && yReady)
+ {
+ log.debug("adding (" + x + ", " + y + ") to series");
+ series.add(x, y);
+ }
+ }
+ }
+
+ dataset.addSeries(series);
+ providerToSeries.newSeries(providerName);
+ }
+
+
+ // Private -------------------------------------------------------
+
+ private String generateSeriesDescription(XYSeriesCollection dataset,
+ String providerName,
+ Date executionStartDate)
+ {
+ String seriesDescriptionBase =
+ providerName + " (" +
+ (executionStartDate == null ? "Not Dated" : dateFormat.format(executionStartDate));
+
+ // make sure I don't have already a series with the same description; this is possible if more
+ // than one execution start the same minute
+
+ int counter = 0;
+ String seriesDescription = null;
+
+ outer:while(true)
+ {
+ seriesDescription =
+ seriesDescriptionBase + (counter == 0 ? "" : " " + Integer.toString(counter)) + ")";
+
+ for(Iterator i = dataset.getSeries().iterator(); i.hasNext(); )
+ {
+ XYSeries s = (XYSeries)i.next();
+ String sd = s.getDescription();
+ // TODO: apparently there is a bug in JFreeCharts so s.getDescription() would return
+ // null here, so this mechanism of nicely indexing series generated in the same
+ // minute doesn't work. No big deal, though.
+ if (seriesDescription.equals(sd))
+ {
+ counter ++;
+ continue outer;
+ }
+ }
+
+ break;
+ }
+
+ return seriesDescription;
+ }
+
+ private void createImage(JFreeChart chart, ProviderToSeriesIndexMapper providerToSeries,
+ String imageFileName) throws Exception
+ {
+ XYPlot plot = (XYPlot)chart.getPlot();
+
+ chart.setBackgroundPaint(Color.white);
+
+ plot.setBackgroundPaint(Color.lightGray);
+ plot.setRangeGridlinePaint(Color.white);
+
+ ValueAxis rangeAxis = plot.getRangeAxis();
+
+ NumberAxis axis = (NumberAxis)rangeAxis;
+
+ axis.setAutoRangeIncludesZero(true);
+
+ XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer();
+
+ renderer.setShapesVisible(true);
+ renderer.setDrawOutlines(true);
+ renderer.setUseFillPaint(true);
+
+ adjustColors(renderer, providerToSeries);
+
+ File imageFile = new File(outputDir, imageFileName);
+
+ FileOutputStream fos = new FileOutputStream(imageFile);
+
+ JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
+ BufferedImage image = chart.createBufferedImage(1000, 1000);
+
+ encoder.encode(image);
+
+ fos.close();
+
+ writer.write("<img src=\"" + imageFileName + "\"><br>\n");
+ }
+
+
+
+
+ /**
+ * Make series corresponding to the same provider have close colors.
+ */
+ private void adjustColors(AbstractRenderer renderer,
+ ProviderToSeriesIndexMapper providerToSeries)
+ {
+
+ int colorStep = configuration.getColorStep();
+
+ for(Iterator i = providerToSeries.providerNames().iterator(); i.hasNext(); )
+ {
+ String providerName = (String)i.next();
+
+ Color baseColor = configuration.getProvider(providerName).getColor();
+ int baser = baseColor.getRed();
+ int baseg = baseColor.getGreen();
+ int baseb = baseColor.getBlue();
+
+ List indexes = (List)providerToSeries.getIndexes(providerName);
+
+ // uniformly spread the colors around the base color
+ int offset = 0;
+ for(Iterator j = indexes.iterator(); j.hasNext(); offset++)
+ {
+ int index = ((Integer)j.next()).intValue();
+
+ int newr = limit(baser + offset * colorStep);
+ int newg = limit(baseg + offset * colorStep);
+ int newb = limit(baseb + offset * colorStep);
+
+ renderer.setSeriesPaint(index, new Color(newr, newg, newb));
+ }
+
+ }
+ }
+
+ private int limit(int color)
+ {
+ if (color < 0)
+ {
+ return 0;
+ }
+ else if (color > 255)
+ {
+ return 255;
+ }
+ else
+ {
+ return color;
+ }
+ }
+
+ // Inner classes -------------------------------------------------
+
+ private class ProviderToSeriesIndexMapper
+ {
+ private int index;
+ private Map providerToIndexes;
+
+ private ProviderToSeriesIndexMapper()
+ {
+ index = 0;
+ providerToIndexes = new HashMap();
+ }
+
+ private void newSeries(String providerName)
+ {
+ List indexes = (List)providerToIndexes.get(providerName);
+ if (indexes == null)
+ {
+ indexes = new ArrayList();
+ providerToIndexes.put(providerName, indexes);
+ }
+ indexes.add(new Integer(index++));
+ }
+
+ private Set providerNames()
+ {
+ return providerToIndexes.keySet();
+ }
+
+ private List getIndexes(String providerName)
+ {
+ return (List)providerToIndexes.get(providerName);
+ }
+ }
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Runner.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Runner.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/Runner.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,183 @@
+/*
+ * 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.jms.perf.framework;
+
+import java.util.Iterator;
+import java.io.File;
+
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+import org.jboss.jms.perf.framework.persistence.HSQLDBPersistenceManager;
+import org.jboss.jms.perf.framework.persistence.PersistenceManager;
+import org.jboss.jms.perf.framework.configuration.Configuration;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version $Revision: 735 $
+ *
+ * $Id: Runner.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class Runner
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(Runner.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args) throws Exception
+ {
+ Runner runner = new Runner(args);
+ runner.start();
+ try
+ {
+ runner.run();
+ }
+ finally
+ {
+ runner.stop();
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private Configuration configuration;
+ protected PersistenceManager pm;
+ private String action;
+
+ // Constructors --------------------------------------------------
+
+ public Runner(String[] args) throws Exception
+ {
+ action = "measure";
+ init(args);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void start() throws Exception
+ {
+ pm = new HSQLDBPersistenceManager(configuration.getDatabaseURL());
+ pm.start();
+ }
+
+ protected void stop() throws Exception
+ {
+ pm.stop();
+ pm = null;
+ }
+
+ protected void run() throws Exception
+ {
+ if ("measure".equals(action))
+ {
+ measure();
+
+ }
+ else if ("chart".equals(action))
+ {
+ chart();
+ }
+ else
+ {
+ throw new Exception("Don't know what to do!");
+ }
+ }
+
+ // Private -------------------------------------------------------
+
+ private void init(String[] args) throws Exception
+ {
+ String configFileName = null;
+
+ for(int i = 0; i < args.length; i++)
+ {
+ if ("-config".equals(args[i]))
+ {
+ if (i == args.length - 1)
+ {
+ throw new Exception("A configuration file name must follow after -config!");
+ }
+ configFileName = args[i + 1];
+ }
+ else if ("-action".equals(args[i]))
+ {
+ if (i == args.length - 1)
+ {
+ throw new Exception("An action name must follow after -action!");
+ }
+ action = args[i + 1];
+ }
+ }
+
+ if (action == null)
+ {
+ throw new Exception("No action specified!. Use -action <measure|chart|...>");
+ }
+
+ if (configFileName == null)
+ {
+ throw new Exception("A configuration file name must be specified. Example: -config perf.xml");
+ }
+
+ File conf = new File(configFileName);
+
+ if (!conf.isFile() || !conf.canRead())
+ {
+ throw new Exception("The file " + configFileName + " does not exist or cannot be read!");
+ }
+
+ configuration = new Configuration(this, conf);
+
+ }
+
+ private void measure() throws Exception
+ {
+ for(Iterator i = configuration.getPerformanceTests().iterator(); i.hasNext(); )
+ {
+ PerformanceTest pt = (PerformanceTest)i.next();
+ pt.run();
+ pm.savePerformanceTest(pt);
+ }
+ }
+
+ private void chart() throws Exception
+ {
+ Charter charter = new Charter(pm, configuration);
+ charter.run();
+ log.info("charts created");
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/Configuration.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/Configuration.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/Configuration.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,670 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.configuration;
+
+import org.jboss.jms.util.XMLUtil;
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+import org.jboss.jms.perf.framework.data.Execution;
+import org.jboss.jms.perf.framework.data.JobList;
+import org.jboss.jms.perf.framework.data.SimpleJobList;
+import org.jboss.jms.perf.framework.data.Provider;
+import org.jboss.jms.perf.framework.data.GraphInfo;
+import org.jboss.jms.perf.framework.data.AxisInfo;
+import org.jboss.jms.perf.framework.protocol.DrainJob;
+import org.jboss.jms.perf.framework.Runner;
+import org.jboss.jms.perf.framework.remoting.Coordinator;
+import org.jboss.jms.perf.framework.protocol.SendJob;
+import org.jboss.jms.perf.framework.protocol.ReceiveJob;
+import org.jboss.jms.perf.framework.protocol.Job;
+import org.jboss.jms.perf.framework.protocol.PingJob;
+import org.jboss.jms.perf.framework.protocol.JobSupport;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
+
+import java.io.File;
+import java.io.Reader;
+import java.io.FileReader;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+import java.awt.*;
+
+/**
+ * A performance run configuration.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 740 $</tt>
+ * $Id: Configuration.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class Configuration
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static boolean toBoolean(String os)
+ {
+ if (os == null)
+ {
+ throw new IllegalArgumentException("literal boolean required");
+ }
+
+ String s = os.toLowerCase();
+
+ if ("true".equals(s) || "yes".equals(s))
+ {
+ return true;
+ }
+ else if ("false".equals(s) || "no".equals(s))
+ {
+ return false;
+ }
+
+ throw new IllegalArgumentException("invalid boolean literal: " + os);
+ }
+
+ public static String coordinatorTypeToString(int type)
+ {
+ if (Coordinator.JBOSSREMOTING == type)
+ {
+ return "JBoss Remoting";
+ }
+ else if (Coordinator.RMI == type)
+ {
+ return "RMI";
+ }
+ else
+ {
+ return "UNKNOWN (" + type +")";
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private File xmlConfiguration;
+ private Runner runner;
+
+ private String dbURL;
+ private String reportDirectory;
+ private boolean startExecutors;
+ private String defaultExecutorURL;
+ int colorStep;
+ private List performanceTests;
+
+ // Map<providerName - provider>
+ private Map providers;
+
+ private JobConfiguration defaultsPerBenchmark;
+
+ // Constructors --------------------------------------------------
+
+ public Configuration(Runner runner, File xmlConfiguration) throws Exception
+ {
+ this.runner = runner;
+ this.xmlConfiguration = xmlConfiguration;
+
+ performanceTests = new ArrayList();
+ providers = new HashMap();
+
+ defaultsPerBenchmark = new JobConfiguration();
+
+ parse();
+ validate();
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getDatabaseURL()
+ {
+ return dbURL;
+ }
+
+ public String getReportDirectory()
+ {
+ return reportDirectory;
+ }
+
+ public boolean isStartExecutors()
+ {
+ return startExecutors;
+ }
+
+ public String getDefaultExecutorURL()
+ {
+ return defaultExecutorURL;
+ }
+
+ public int getColorStep()
+ {
+ return colorStep;
+ }
+
+ public List getPerformanceTests()
+ {
+ return performanceTests;
+ }
+
+ public Provider getProvider(String providerName)
+ {
+ return (Provider)providers.get(providerName);
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Configuration:\n");
+ sb.append(" dbURL: ").append(dbURL).append('\n');
+ sb.append("Tests:\n");
+ for(Iterator i = performanceTests.iterator(); i.hasNext(); )
+ {
+ PerformanceTest pt = (PerformanceTest)i.next();
+ sb.append(" ").append(pt).append('\n');
+ }
+ return sb.toString();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void parse() throws Exception
+ {
+
+ Reader reader = new FileReader(xmlConfiguration);
+
+ try
+ {
+ Element root = XMLUtil.readerToElement(reader);
+
+ if (!"benchmark".equals(root.getNodeName()))
+ {
+ throw new Exception("Invalid root element: " + root.getNodeName());
+ }
+
+ if (root.hasChildNodes())
+ {
+ NodeList nl = root.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+
+ if ("db-url".equals(name))
+ {
+ dbURL = XMLUtil.getTextContent(n);
+ }
+ else if ("report-directory".equals(name))
+ {
+ reportDirectory = XMLUtil.getTextContent(n);
+ }
+ else if ("start-executors".equals(name))
+ {
+ startExecutors = toBoolean(XMLUtil.getTextContent(n));
+ }
+ else if ("default-executor-url".equals(name))
+ {
+ defaultExecutorURL = XMLUtil.getTextContent(n);
+ }
+ else if ("color-step".equals(name))
+ {
+ colorStep = Integer.parseInt(XMLUtil.getTextContent(n));
+ }
+ else if ("providers".equals(name))
+ {
+ extractProviders(n);
+ }
+ else if (JobConfiguration.isValidJobConfigurationElementName(name))
+ {
+ defaultsPerBenchmark.add(n);
+ }
+ else if ("performance-tests".equals(name))
+ {
+ extractPerformanceTests(n);
+ }
+ else
+ {
+ if (!name.startsWith("#"))
+ {
+ throw new Exception("Unexpected child <" + name +
+ "> of node " + root.getNodeName());
+ }
+ }
+ }
+ }
+ }
+ finally
+ {
+ reader.close();
+ }
+ }
+
+ private void extractProviders(Node providers) throws Exception
+ {
+ if (!providers.hasChildNodes())
+ {
+ return;
+ }
+
+ NodeList nl = providers.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ if ("provider".equals(name))
+ {
+ addProvider(n);
+ }
+ }
+ }
+
+ private void addProvider(Node pn) throws Exception
+ {
+ NamedNodeMap attrs = pn.getAttributes();
+ Node nameNode = attrs.getNamedItem("name");
+ String providerName = nameNode.getNodeValue();
+
+ Provider provider = new Provider(providerName);
+
+ if (pn.hasChildNodes())
+ {
+ Properties props = new Properties();
+ NodeList nl = pn.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ String value = XMLUtil.getTextContent(n);
+ if ("factory".equals(name))
+ {
+ props.setProperty("java.naming.factory.initial", value);
+ }
+ else if ("url".equals(name))
+ {
+ props.setProperty("java.naming.provider.url", value);
+ }
+ else if ("pkg".equals(name))
+ {
+ props.setProperty("java.naming.factory.url.pkg", value);
+ }
+ else if ("executor".equals(name))
+ {
+ addExecutor(provider, n);
+ }
+ else if ("color".equals(name))
+ {
+ addColor(provider, n);
+ }
+ else if (name.startsWith("#"))
+ {
+ // ignore
+ }
+ else
+ {
+ throw new Exception("Unknown provider configuration element: " + name);
+ }
+ }
+
+ provider.setJNDIProperties(props);
+ providers.put(providerName, provider);
+ }
+ }
+
+ private void addExecutor(Provider provider, Node n) throws Exception
+ {
+ NamedNodeMap attrs = n.getAttributes();
+ Node name = attrs.getNamedItem("name");
+ Node url = attrs.getNamedItem("url");
+ provider.addExecutor(name.getNodeValue(), url.getNodeValue());
+ }
+
+ private void addColor(Provider provider, Node n) throws Exception
+ {
+ String color = XMLUtil.getTextContent(n);
+ StringTokenizer st = new StringTokenizer(color, ",; ");
+
+ String reds = st.nextToken();
+ int red = Integer.parseInt(reds);
+ String greens = st.nextToken();
+ int green = Integer.parseInt(greens);
+ String blues = st.nextToken();
+ int blue = Integer.parseInt(blues);
+
+ provider.setColor(new Color(red, green, blue));
+ }
+
+ private void extractPerformanceTests(Node tests) throws Exception
+ {
+ if (!tests.hasChildNodes())
+ {
+ return;
+ }
+
+ NodeList nl = tests.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ if ("performance-test".equals(name))
+ {
+ addPerformanceTest(n);
+ }
+ else
+ {
+ if(!name.startsWith("#"))
+ {
+ throw new Exception("Unexpected child <" + name +
+ "> of node " + tests.getNodeName());
+ }
+ }
+ }
+ }
+
+ private void addPerformanceTest(Node test) throws Exception
+ {
+ NamedNodeMap attrs = test.getAttributes();
+
+ Node nameNode = attrs.getNamedItem("name");
+ String performanceTestName = nameNode.getNodeValue();
+
+ Node loopsNode = attrs.getNamedItem("loops");
+ int loops = 1;
+ if (loopsNode != null)
+ {
+ loops = Integer.parseInt(loopsNode.getNodeValue());
+ }
+
+ PerformanceTest pt = new PerformanceTest(runner, performanceTestName, loops);
+
+ for(Iterator i = performanceTests.iterator(); i.hasNext(); )
+ {
+ PerformanceTest t = (PerformanceTest)i.next();
+ if (t.getName().equals(pt.getName()))
+ {
+ throw new Exception("Duplicate performance test name: " + performanceTestName);
+ }
+ }
+
+ if (test.hasChildNodes())
+ {
+ NodeList nl = test.getChildNodes();
+ JobConfiguration defaultsPerTest = defaultsPerBenchmark.copy();
+
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+
+ if ("graph".equals(name))
+ {
+ addGraphDetails(pt, n);
+ }
+ else if (JobConfiguration.isValidJobConfigurationElementName(name))
+ {
+ defaultsPerTest.add(n);
+ }
+ else if (JobSupport.isValidJobType(name))
+ {
+ addJob(pt, n, defaultsPerTest);
+ }
+ else if ("parallel".equals(name))
+ {
+ addParallel(pt, n, defaultsPerTest);
+ }
+ else if ("execution".equals(name))
+ {
+ addExecution(pt, n);
+ }
+ else
+ {
+ if (!name.startsWith("#"))
+ {
+ throw new Exception("Unexpected child <" + name +
+ "> of node " + test.getNodeName());
+ }
+ }
+ }
+ }
+
+ performanceTests.add(pt);
+ }
+
+ private void addGraphDetails(PerformanceTest pt, Node graph) throws Exception
+ {
+ if (!graph.hasChildNodes())
+ {
+ throw new Exception("The graph node has no children");
+ }
+
+ GraphInfo graphInfo = new GraphInfo();
+ pt.setGraphInfo(graphInfo);
+
+ NodeList nl = graph.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ if ("x".equals(name))
+ {
+ addAxisInfo(graphInfo, GraphInfo.X, n);
+ }
+ else if ("y".equals(name))
+ {
+ addAxisInfo(graphInfo, GraphInfo.Y, n);
+ }
+ else
+ {
+ if (!name.startsWith("#"))
+ {
+ throw new Exception("Unknow graph axis: " + name);
+ }
+ }
+ }
+ }
+
+ private void addAxisInfo(GraphInfo graphInfo, int axisType, Node axis) throws Exception
+ {
+ if (!axis.hasAttributes())
+ {
+ throw new Exception("Axis " + GraphInfo.axisTypeToString(axisType) + " info incomplete");
+ }
+
+ AxisInfo info = new AxisInfo();
+
+ NamedNodeMap attrs = axis.getAttributes();
+ for(int i = 0; i < attrs.getLength(); i++)
+ {
+ Node n = attrs.item(i);
+ String name = n.getNodeName();
+ String value = n.getNodeValue();
+ if ("job".equals(name))
+ {
+ info.setJobType(JobSupport.getJobType(value));
+ }
+ else if ("metric".equals(name))
+ {
+ // TODO - this is kind of flaky, but it'll work for now
+ info.setMetric(value);
+ }
+ else if ("label".equals(name))
+ {
+ info.setLabel(value);
+ }
+ else if ("result".equals(name))
+ {
+ info.setResult(toBoolean(value));
+ }
+ else
+ {
+ if (!name.startsWith("#"))
+ {
+ throw new Exception("Unknow graph axis: " + name);
+ }
+ }
+ }
+
+ if (info.getJobType() == null)
+ {
+ throw new Exception("Axis info incompletely specified, job type missing");
+ }
+
+ if (info.getMetric() == null)
+ {
+ throw new Exception("Axis info incompletely specified, metric missing");
+ }
+
+ graphInfo.addAxisInfo(axisType, info);
+ }
+
+ private void addExecution(PerformanceTest pt, Node execution) throws Exception
+ {
+ String providerName = null;
+
+ if (execution.hasChildNodes())
+ {
+ NodeList nl = execution.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ if ("provider".equals(name))
+ {
+ providerName = XMLUtil.getTextContent(n);
+ }
+ }
+ }
+ else
+ {
+ if (execution.hasAttributes())
+ {
+ NamedNodeMap attrs = execution.getAttributes();
+ Node n = attrs.getNamedItem("provider");
+ providerName = n.getNodeValue();
+ }
+ }
+
+ if (providerName == null)
+ {
+ throw new Exception("No provider name found!");
+ }
+
+ pt.addRequestedExecution(new Execution(providerName));
+ }
+
+ private void addParallel(PerformanceTest pt, Node pn, JobConfiguration defaultPerTest)
+ throws Exception
+ {
+ if (!pn.hasChildNodes())
+ {
+ return;
+ }
+
+ JobList parallelJobs = new SimpleJobList();
+
+ NodeList nl = pn.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ addJob(parallelJobs, n, defaultPerTest);
+ }
+ pt.addParallelJobs(parallelJobs);
+ }
+
+ private void addJob(JobList jl, Node n, JobConfiguration defaultPerTest) throws Exception
+ {
+ String name = n.getNodeName();
+ Job job = null;
+
+ if (name.startsWith("#"))
+ {
+ return;
+ }
+ else if ("drain".equals(name))
+ {
+ job = new DrainJob();
+ }
+ else if ("send".equals(name))
+ {
+ job = new SendJob();
+ }
+ else if ("receive".equals(name))
+ {
+ job = new ReceiveJob();
+ }
+ else if ("ping".equals(name))
+ {
+ job = new PingJob();
+ }
+ else
+ {
+ throw new Exception("Unknown job " + name);
+ }
+ setCommonJobAttributes(job, n, defaultPerTest);
+ jl.addJob(job);
+ }
+
+ private void setCommonJobAttributes(Job j, Node jn, JobConfiguration defaultPerTest)
+ throws Exception
+ {
+ JobConfiguration config = defaultPerTest.copy();
+
+ // job configuration attributes can be specified as XML attributes or sub-elements.
+ // Sub-elements have priority
+ if (jn.hasAttributes())
+ {
+ NamedNodeMap attrs = jn.getAttributes();
+ for(int i = 0; i < attrs.getLength(); i++)
+ {
+ Node n = attrs.item(i);
+ String name = n.getNodeName();
+ if (!JobConfiguration.isValidJobConfigurationElementName(name))
+ {
+ throw new Exception("Invalid job configuration attribute: " + name);
+ }
+ config.add(n);
+ }
+ }
+
+ if (jn.hasChildNodes())
+ {
+ NodeList nl = jn.getChildNodes();
+ for(int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+ String name = n.getNodeName();
+ if (name.startsWith("#"))
+ {
+ continue;
+ }
+ if (!JobConfiguration.isValidJobConfigurationElementName(name))
+ {
+ throw new Exception("Invalid job configuration element: " + name);
+ }
+ config.add(n);
+ }
+ }
+ config.configure(j);
+ }
+
+ private void validate() throws Exception
+ {
+ if (dbURL == null)
+ {
+ throw new Exception("No <db-url> element in " + xmlConfiguration);
+ }
+ }
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/JobConfiguration.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/JobConfiguration.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/configuration/JobConfiguration.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,443 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.configuration;
+
+import org.w3c.dom.Node;
+import org.jboss.jms.util.XMLUtil;
+import org.jboss.jms.perf.framework.protocol.Job;
+
+import javax.jms.Session;
+import javax.jms.DeliveryMode;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 740 $</tt>
+ * $Id: JobConfiguration.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class JobConfiguration
+{
+ // Constants -----------------------------------------------------
+
+ private static final String DESTINATION = "destination";
+ private static final String CONNECTION_FACTORY = "connection-factory";
+ private static final String EXECUTOR = "executor";
+ private static final String MESSAGES = "messages";
+ private static final String MESSAGE_SIZE = "message-size";
+ private static final String DURATION = "duration";
+ private static final String RATE = "rate";
+ private static final String ACKNOWLEDGMENT_MODE = "acknowledgment-mode";
+ private static final String DELIVERY_MODE = "delivery-mode";
+ private static final String MESSAGE_FACTORY_CLASS = "message-factory-class";
+
+
+ // Static --------------------------------------------------------
+
+ public static boolean isValidJobConfigurationElementName(String name)
+ {
+ if (DESTINATION.equals(name) ||
+ CONNECTION_FACTORY.equals(name) ||
+ EXECUTOR.equals(name) ||
+ MESSAGES.equals(name) ||
+ MESSAGE_SIZE.equals(name) ||
+ DURATION.equals(name) ||
+ RATE.equals(name) ||
+ ACKNOWLEDGMENT_MODE.equals(name) ||
+ DELIVERY_MODE.equals(name) ||
+ MESSAGE_FACTORY_CLASS.equals(name))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static void validateAcknowledgmentMode(int acknowledgmentMode)
+ {
+ if (acknowledgmentMode != Session.AUTO_ACKNOWLEDGE &&
+ acknowledgmentMode != Session.CLIENT_ACKNOWLEDGE &&
+ acknowledgmentMode != Session.DUPS_OK_ACKNOWLEDGE &&
+ acknowledgmentMode != Session.SESSION_TRANSACTED)
+ {
+ throw new IllegalArgumentException("invalid acknowledgment mode: " + acknowledgmentMode);
+ }
+ }
+
+ public static void validateDeliveryMode(int deliveryMode)
+ {
+ if (deliveryMode != DeliveryMode.NON_PERSISTENT &&
+ deliveryMode != DeliveryMode.PERSISTENT)
+ {
+ throw new IllegalArgumentException("invalid delivery mode: " + deliveryMode);
+ }
+ }
+
+ public static int validateAcknowledgmentMode(String acknowledgmentMode)
+ {
+ if (acknowledgmentMode == null)
+ {
+ throw new IllegalArgumentException("null acknowledgment mode");
+ }
+
+ String s = acknowledgmentMode.toUpperCase();
+
+ if ("AUTO_ACKNOWLEDGE".equals(s))
+ {
+ return Session.AUTO_ACKNOWLEDGE;
+ }
+ else if ("CLIENT_ACKNOWLEDGE".equals(s))
+ {
+ return Session.CLIENT_ACKNOWLEDGE;
+ }
+ else if ("DUPS_OK_ACKNOWLEDGE".equals(s))
+ {
+ return Session.DUPS_OK_ACKNOWLEDGE;
+ }
+ else if ("SESSION_TRANSACTED".equals(s))
+ {
+ return Session.SESSION_TRANSACTED;
+ }
+ throw new IllegalArgumentException("invalid acknowledgment mode: " + acknowledgmentMode);
+ }
+
+ public static int validateDeliveryMode(String deliveryMode)
+ {
+ if (deliveryMode == null)
+ {
+ throw new IllegalArgumentException("null delivery mode");
+ }
+
+ String s = deliveryMode.toUpperCase();
+
+ if ("NON_PERSISTENT".equals(s))
+ {
+ return DeliveryMode.NON_PERSISTENT;
+ }
+ else if ("PERSISTENT".equals(s))
+ {
+ return DeliveryMode.PERSISTENT;
+ }
+ throw new IllegalArgumentException("invalid delivery mode: " + deliveryMode);
+ }
+
+ public static String executionURLToString(String executionURL)
+ {
+ if (executionURL == null)
+ {
+ return "null";
+ }
+
+ int i = executionURL.indexOf("://");
+ return executionURL.substring(i + 3);
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private String destinationName;
+ private String connectionFactoryName;
+ private String executor;
+ private Integer messageCount;
+ private Integer messageSize;
+ private Long duration;
+ private Integer rate;
+ private Integer acknowledgmentMode;
+ private Integer deliveryMode;
+ private String messageFactoryClass;
+
+ // Constructors --------------------------------------------------
+
+ public JobConfiguration()
+ {
+ destinationName = null;
+ connectionFactoryName = null;
+ executor = null;
+ messageCount = null;
+ messageSize = null;
+ duration = null;
+ rate = null;
+ acknowledgmentMode = null;
+ deliveryMode = null;
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * null means no default
+ */
+ public String getDestinationName()
+ {
+ return destinationName;
+ }
+
+ public void setDestinationName(String destinationName)
+ {
+ this.destinationName = destinationName;
+ }
+
+ /**
+ * null means no default
+ */
+ public String getConnectionFactoryName()
+ {
+ return connectionFactoryName;
+ }
+
+ public void setConnectionFactoryName(String connectionFactoryName)
+ {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ /**
+ * null means no default
+ */
+ public String getExecutor()
+ {
+ return executor;
+ }
+
+ public void setExecutor(String executor)
+ {
+ this.executor = executor;
+ }
+
+ /**
+ * null means no default
+ */
+ public Integer getMessageCount()
+ {
+ return messageCount;
+ }
+
+ public void setMessageCount(int messageCount)
+ {
+ this.messageCount = new Integer(messageCount);
+ }
+
+ /**
+ * null means no default
+ */
+ public Integer getMessageSize()
+ {
+ return messageSize;
+ }
+
+ public void setMessageSize(int messageSize)
+ {
+ this.messageSize = new Integer(messageSize);
+ }
+
+ /**
+ * null means no default
+ */
+ public Long getDuration()
+ {
+ return duration;
+ }
+
+ public void setDuration(long duration)
+ {
+ this.duration= new Long(duration);
+ }
+
+ /**
+ * null means no default
+ */
+ public Integer getRate()
+ {
+ return rate;
+ }
+
+ public void setRate(int rate)
+ {
+ this.rate = new Integer(rate);
+ }
+
+ /**
+ * null means no default
+ */
+ public Integer getAcknowledgmentMode()
+ {
+ return acknowledgmentMode;
+ }
+
+ public void setAcknowledgmentMode(int acknowledgmentMode)
+ {
+ validateAcknowledgmentMode(acknowledgmentMode);
+ this.acknowledgmentMode = new Integer(acknowledgmentMode);
+ }
+
+ /**
+ * null means no default
+ */
+ public Integer getDeliveryMode()
+ {
+ return deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode)
+ {
+ validateDeliveryMode(deliveryMode);
+ this.deliveryMode = new Integer(deliveryMode);
+ }
+
+ /**
+ * null means no default
+ */
+ public String getMessageFactoryClass()
+ {
+ return messageFactoryClass;
+ }
+
+ public void setMessageFactoryClass(String messageFactoryClass)
+ {
+ this.messageFactoryClass = messageFactoryClass;
+ }
+
+ public JobConfiguration copy()
+ {
+ JobConfiguration n = new JobConfiguration();
+ n.destinationName = this.destinationName;
+ n.connectionFactoryName = this.connectionFactoryName;
+ n.executor = this.executor;
+ n.messageCount = this.messageCount;
+ n.messageSize = this.messageSize;
+ n.duration = this.duration;
+ n.rate = this.rate;
+ n.acknowledgmentMode = this.acknowledgmentMode;
+ n.deliveryMode = this.deliveryMode;
+ n.messageFactoryClass = this.messageFactoryClass;
+
+ return n;
+ }
+
+ public void add(Node n) throws Exception
+ {
+ String name = n.getNodeName();
+ String value = XMLUtil.getTextContent(n);
+
+ if (value == null)
+ {
+ // one more try
+ value = n.getNodeValue();
+ }
+
+ if (DESTINATION.equals(name))
+ {
+ setDestinationName(value);
+ }
+ else if (CONNECTION_FACTORY.equals(name))
+ {
+ setConnectionFactoryName(value);
+ }
+ else if (EXECUTOR.equals(name))
+ {
+ setExecutor(value);
+ }
+ else if (MESSAGES.equals(name))
+ {
+ int i = Integer.parseInt(value);
+ setMessageCount(i);
+ }
+ else if (MESSAGE_SIZE.equals(name))
+ {
+ int i = Integer.parseInt(value);
+ setMessageSize(i);
+ }
+ else if (DURATION.equals(name))
+ {
+ long l = Long.parseLong(value);
+ setDuration(l);
+ }
+ else if (RATE.equals(name))
+ {
+ int i = Integer.parseInt(value);
+ setRate(i);
+ }
+ else if (ACKNOWLEDGMENT_MODE.equals(name))
+ {
+ int i = validateAcknowledgmentMode(value);
+ setAcknowledgmentMode(i);
+ }
+ else if (DELIVERY_MODE.equals(name))
+ {
+ int i = validateDeliveryMode(value);
+ setDeliveryMode(i);
+ }
+ else if (MESSAGE_FACTORY_CLASS.equals(name))
+ {
+ setMessageFactoryClass(value);
+ }
+ else
+ {
+ throw new Exception("Unknown node " + name);
+ }
+ }
+
+ public void configure(Job j)
+ {
+ String s;
+ Integer i;
+ Long l;
+
+ s = getDestinationName();
+ if (s != null)
+ {
+ j.setDestinationName(s);
+ }
+ s = getConnectionFactoryName();
+ if (s != null)
+ {
+ j.setConnectionFactoryName(s);
+ }
+ s = getExecutor();
+ if (s != null)
+ {
+ j.setExecutorName(s);
+ }
+ i = getMessageCount();
+ if (i != null)
+ {
+ j.setMessageCount(i.intValue());
+ }
+ i = getMessageSize();
+ if (i != null)
+ {
+ j.setMessageSize(i.intValue());
+ }
+ l = getDuration();
+ if (l != null)
+ {
+ j.setDuration(l.longValue());
+ }
+ i = getRate();
+ if (i != null)
+ {
+ j.setRate(i.intValue());
+ }
+ i = getAcknowledgmentMode();
+ if (i != null)
+ {
+ j.setAcknowledgmentMode(i.intValue());
+ }
+ i = getDeliveryMode();
+ if (i != null)
+ {
+ j.setDeliveryMode(i.intValue());
+ }
+ s = getMessageFactoryClass();
+ if (s != null)
+ {
+ j.setMessageFactoryClass(s);
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/AxisInfo.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/AxisInfo.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/AxisInfo.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,83 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 740 $</tt>
+ * $Id: AxisInfo.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class AxisInfo
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String jobType;
+ private boolean result;
+ private String label;
+ private String metric;
+
+ // Constructors --------------------------------------------------
+
+ public AxisInfo()
+ {
+ result = false;
+ }
+
+ // Public --------------------------------------------------------
+
+ public void setJobType(String jobType)
+ {
+ this.jobType = jobType;
+ }
+
+ public String getJobType()
+ {
+ return jobType;
+ }
+
+ public void setMetric(String metric)
+ {
+ this.metric = metric;
+ }
+
+ public String getMetric()
+ {
+ return metric;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public void setResult(boolean b)
+ {
+ result = b;
+ }
+
+ public boolean isResult()
+ {
+ return result;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Execution.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Execution.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Execution.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+import org.jboss.jms.perf.framework.remoting.Result;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Date;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+/**
+ * Represents the record of an execution of a PerformanceTest on a particular Date, against a
+ * particular provider e.g. JBossMQ, JBossMessaging etc.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 735 $
+ *
+ * $Id: Execution.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class Execution implements Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 8086268408804672852L;
+
+ public static final DateFormat dateFormat = new SimpleDateFormat("MMM d yy HH:mm:ss:SSS a");
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String providerName;
+ private Date start;
+ private Date finish;
+ private List measurements;
+
+ // Constructors --------------------------------------------------
+
+ public Execution(String providerName)
+ {
+ this.providerName = providerName;
+ measurements = new ArrayList();
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getProviderName()
+ {
+ return providerName;
+ }
+
+ public void setStartDate(Date start)
+ {
+ this.start = start;
+ }
+
+ public Date getStartDate()
+ {
+ return start;
+ }
+
+ public void setFinishDate(Date finish)
+ {
+ this.finish = finish;
+ }
+
+ public Date getFinishDate()
+ {
+ return finish;
+ }
+
+ public int size()
+ {
+ return measurements.size();
+ }
+
+ public void addMeasurement(List results)
+ {
+ measurements.add(results);
+ }
+
+ public void addMeasurement(Result result)
+ {
+ List l = new ArrayList();
+ l.add(result);
+ measurements.add(l);
+ }
+
+ public Iterator iterator()
+ {
+ return measurements.iterator();
+ }
+
+ public String toString()
+ {
+ Date sd = getStartDate();
+ return "Execution[" + providerName + ", " +
+ (sd == null ? "not dated" : dateFormat.format(sd)) + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/GraphInfo.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/GraphInfo.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/GraphInfo.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,69 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 740 $</tt>
+ * $Id: GraphInfo.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class GraphInfo
+{
+ // Constants -----------------------------------------------------
+
+ public static final int X = 0;
+ public static final int Y = 1;
+
+ // Static --------------------------------------------------------
+
+ public static String axisTypeToString(int type)
+ {
+ if (type == X)
+ {
+ return "X";
+ }
+ else if (type == Y)
+ {
+ return "Y";
+ }
+ else
+ {
+ return "UNKNOWN";
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private AxisInfo[] info;
+
+ // Constructors --------------------------------------------------
+
+ public GraphInfo()
+ {
+ info = new AxisInfo[2];
+ }
+
+ // Public --------------------------------------------------------
+
+ public void addAxisInfo(int axisType, AxisInfo ai)
+ {
+ info[axisType] = ai;
+ }
+
+ public AxisInfo getAxisInfo(int axisType)
+ {
+ return info[axisType];
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/JobList.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/JobList.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/JobList.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,26 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+import org.jboss.jms.perf.framework.protocol.Job;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: JobList.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public interface JobList
+{
+ void addJob(Job job);
+
+ int size();
+
+ Iterator iterator();
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/PerformanceTest.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/PerformanceTest.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/PerformanceTest.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,482 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.protocol.Job;
+import org.jboss.jms.perf.framework.Runner;
+import org.jboss.jms.perf.framework.configuration.Configuration;
+import org.jboss.jms.perf.framework.protocol.Failure;
+import org.jboss.jms.perf.framework.protocol.ResetRequest;
+import org.jboss.jms.perf.framework.remoting.Coordinator;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.rmi.RMICoordinator;
+import org.jboss.jms.perf.framework.remoting.jbossremoting.JBossRemotingCoordinator;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Date;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 740 $
+ *
+ * $Id: PerformanceTest.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class PerformanceTest implements Serializable, JobList
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 4821514879181362348L;
+
+ private static final Logger log = Logger.getLogger(PerformanceTest.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Runner runner;
+
+ protected long id;
+ protected String name;
+ private int loops;
+
+ private List requestedExecutions; // the executions declared in the XML file
+ private List effectiveExecutions; // the execution effectively performed
+
+ protected String destination;
+ protected String connectionFactory;
+ protected List jobs;
+
+ private GraphInfo graphInfo;
+
+ // Constructors --------------------------------------------------
+
+ public PerformanceTest(Runner runner, String name)
+ {
+ this(runner, name, 1);
+ }
+
+ public PerformanceTest(Runner runner, String name, int loops)
+ {
+ this.runner = runner;
+ this.name = name;
+ this.loops = loops;
+ id = Long.MIN_VALUE;
+ requestedExecutions = new ArrayList();
+ effectiveExecutions = new ArrayList();
+ jobs = new ArrayList();
+ }
+
+ // JobList implementation ----------------------------------------
+
+ public void addJob(Job job)
+ {
+ jobs.add(job);
+ }
+
+ public int size()
+ {
+ return jobs.size();
+ }
+
+ public Iterator iterator()
+ {
+ return jobs.iterator();
+ }
+
+ // Public --------------------------------------------------------
+
+ public void addParallelJobs(JobList parallelJobs)
+ {
+ jobs.add(parallelJobs);
+ }
+
+ public void setDestination(String destination)
+ {
+ this.destination = destination;
+ }
+
+ public String getDestination()
+ {
+ return destination;
+ }
+
+ public void setConnectionFactory(String cf)
+ {
+ this.connectionFactory = cf;
+ }
+
+ public String getConnectionFactory()
+ {
+ return connectionFactory;
+ }
+
+ public void addRequestedExecution(Execution e)
+ {
+ requestedExecutions.add(e);
+ }
+
+ public void addEffectiveExecution(Execution e)
+ {
+ effectiveExecutions.add(e);
+ }
+
+ public List getRequestedExecutions()
+ {
+ return requestedExecutions;
+ }
+
+ public List getEffectiveExecutions()
+ {
+ return effectiveExecutions;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public GraphInfo getGraphInfo()
+ {
+ return graphInfo;
+ }
+
+ public void setGraphInfo(GraphInfo graphInfo)
+ {
+ this.graphInfo = graphInfo;
+ }
+
+ public void run() throws Exception
+ {
+ if (getRequestedExecutions().size() == 0)
+ {
+ log.debug(this + " has no executions requested, skipping ...");
+ return;
+ }
+
+ log.info("");
+ log.info(this);
+
+ int executionCounter = 1;
+
+ for(int loopCounter = 0; loopCounter < loops; loopCounter++)
+ {
+ for(Iterator ri = getRequestedExecutions().iterator(); ri.hasNext(); )
+ {
+ String providerName = ((Execution)ri.next()).getProviderName();
+ Execution effectiveExecution = new Execution(providerName);
+
+ addEffectiveExecution(effectiveExecution);
+
+ Coordinator coordinator = prepareJobs(providerName);
+
+ log.info("");
+ log.info("Execution " + executionCounter++ + " (provider " +
+ effectiveExecution.getProviderName() + ")");
+
+ effectiveExecution.setStartDate(new Date());
+
+ for(Iterator i = jobs.iterator(); i.hasNext(); )
+ {
+ Object o = i.next();
+
+ if (o instanceof Job)
+ {
+ Result result = run(coordinator, (Job)o);
+ log.info(effectiveExecution.size() + ". " + result);
+ effectiveExecution.addMeasurement(result);
+ }
+ else
+ {
+ log.info(effectiveExecution.size() + ". PARALLEL");
+
+ List results = runParallel(coordinator, (JobList)o);
+ for(Iterator resi = results.iterator(); resi.hasNext(); )
+ {
+ log.info(" " + resi.next());
+ }
+ effectiveExecution.addMeasurement(results);
+ }
+ }
+
+ effectiveExecution.setFinishDate(new Date());
+ }
+ }
+
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("PerformanceTest[").append(name).append("]");
+ if (requestedExecutions.size() > 0)
+ {
+ sb.append('(');
+ for(Iterator i = requestedExecutions.iterator(); i.hasNext(); )
+ {
+ Execution e = (Execution)i.next();
+ sb.append(e.getProviderName());
+ if (i.hasNext())
+ {
+ sb.append(", ");
+ }
+ }
+ sb.append(")");
+ }
+ return sb.toString();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ /**
+ * Prepares the list of jobs to be ran in a specific execution context, and also probe executors.
+ */
+ private Coordinator prepareJobs(String providerName) throws Exception
+ {
+ // leave this here!
+ log.info("");
+
+ List executorURLs = new ArrayList();
+
+ for(Iterator i = jobs.iterator(); i.hasNext(); )
+ {
+ Object o = i.next();
+ if (o instanceof Job)
+ {
+ prepare((Job)o, providerName, executorURLs);
+ }
+ else
+ {
+ for(Iterator ji = ((JobList)o).iterator(); ji.hasNext(); )
+ {
+ prepare((Job)ji.next(), providerName, executorURLs);
+ }
+ }
+ }
+
+ Coordinator coordinator = pickCoordinator(executorURLs);
+ checkExecutors(coordinator, executorURLs);
+ return coordinator;
+ }
+
+ private Coordinator pickCoordinator(List executorURLs) throws Exception
+ {
+ int coordinatorType = -1;
+
+ for(Iterator i = executorURLs.iterator(); i.hasNext(); )
+ {
+ String executorURL = (String)i.next();
+ int type;
+ if (JBossRemotingCoordinator.isValidURL(executorURL))
+ {
+ type = Coordinator.JBOSSREMOTING;
+ }
+ else if (RMICoordinator.isValidURL(executorURL))
+ {
+ type = Coordinator.RMI;
+ }
+ else
+ {
+ throw new Exception("Unknown URL type: " + executorURL);
+ }
+
+ if (coordinatorType != -1 && coordinatorType != type)
+ {
+ throw new Exception("Mixed URL types (" +
+ Configuration.coordinatorTypeToString(coordinatorType) + ", " +
+ Configuration.coordinatorTypeToString(type) + "), use a homogeneous configuration");
+ }
+
+ coordinatorType = type;
+ }
+
+ if (coordinatorType == Coordinator.JBOSSREMOTING)
+ {
+ return new JBossRemotingCoordinator();
+ }
+ else if (coordinatorType == Coordinator.RMI)
+ {
+ return new RMICoordinator();
+ }
+ else
+ {
+ throw new Exception("Cannot decide on a coordinator");
+ }
+ }
+
+ private void checkExecutors(Coordinator coordinator, List executorURLs) throws Exception
+ {
+ for(Iterator i = executorURLs.iterator(); i.hasNext(); )
+ {
+ String executorURL = (String)i.next();
+
+ try
+ {
+ log.debug("resetting " + executorURL);
+ coordinator.sendToExecutor(executorURL, new ResetRequest());
+ log.info("executor " + executorURL + " on-line");
+ }
+ catch(Throwable e)
+ {
+ log.error("executor " + executorURL + " failed", e);
+ throw new Exception("executor check failed");
+ }
+ }
+ }
+
+ /**
+ * @param executorURLs - list to be updated with current run's executor URLs.
+ */
+ private void prepare(Job j, String providerName, List executorURLs) throws Exception
+ {
+ Configuration config = runner.getConfiguration();
+ Provider provider = config.getProvider(providerName);
+ Properties jndiProperties = provider.getJNDIProperties();
+
+ String executorName = j.getExecutorName();
+ String executorURL;
+
+ if (executorName == null)
+ {
+ // use the default executor
+ executorURL = config.getDefaultExecutorURL();
+ }
+ else
+ {
+ executorURL = provider.getExecutorURL(executorName);
+ if (executorURL == null)
+ {
+ throw new Exception("Provider " + providerName +
+ " doesn't know to map executor " + executorName);
+ }
+ }
+
+ j.setJNDIProperties(jndiProperties);
+ j.setExecutorURL(executorURL);
+
+ // update the executor URL list
+ if (!executorURLs.contains(executorURL))
+ {
+ executorURLs.add(executorURL);
+ }
+ }
+
+ private Result run(Coordinator coordinator, Job job)
+ {
+ try
+ {
+ String executorURL = job.getExecutorURL();
+
+ if (executorURL == null)
+ {
+ throw new Exception("An executorURL must be configured on this job");
+ }
+
+ log.debug("sending job " + job + " to " + coordinator);
+
+ Result result = coordinator.sendToExecutor(executorURL, job);
+ result.setRequest(job);
+ return result;
+ }
+ catch(Throwable t)
+ {
+ log.warn("job " + job + " failed: " + t.getMessage());
+ log.debug("job " + job + " failed", t);
+ return new Failure(job);
+ }
+ }
+
+ private List runParallel(Coordinator coordinator, JobList parallelJobs)
+ {
+ List jobExecutors = new ArrayList();
+
+ for(Iterator i = parallelJobs.iterator(); i.hasNext(); )
+ {
+ JobExecutor je = new JobExecutor(coordinator, (Job)i.next());
+ jobExecutors.add(je);
+ Thread t = new Thread(je);
+ je.setThread(t);
+ t.start();
+ }
+
+ log.debug("all " + parallelJobs.size() + " jobs fired");
+
+ List results = new ArrayList();
+
+ for(Iterator i = jobExecutors.iterator(); i.hasNext(); )
+ {
+ JobExecutor je = (JobExecutor)i.next();
+ try
+ {
+ je.getThread().join();
+ log.debug("parallel job finished");
+ }
+ catch (InterruptedException e)
+ {}
+ results.add(je.getResult());
+ }
+ return results;
+ }
+
+
+ // Inner classes -------------------------------------------------
+
+ private class JobExecutor implements Runnable
+ {
+ private Job job;
+ private Coordinator coordinator;
+ private Result result;
+ private Thread thread;
+
+ JobExecutor(Coordinator coordinator, Job job)
+ {
+ this.coordinator = coordinator;
+ this.job = job;
+ }
+
+ public void run()
+ {
+ log.debug("parallel job fired");
+ result = PerformanceTest.this.run(coordinator, job);
+ }
+
+ private void setThread(Thread thread)
+ {
+ this.thread = thread;
+ }
+
+ private Thread getThread()
+ {
+ return thread;
+ }
+
+ private Result getResult()
+ {
+ return result;
+ }
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Provider.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Provider.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/Provider.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,85 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.awt.*;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 735 $</tt>
+ * $Id: Provider.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class Provider
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+ private Properties jndiProperties;
+ // Map <executorName - executorURL>
+ private Map executorMap;
+ private Color color;
+
+ // Constructors --------------------------------------------------
+
+ public Provider(String name)
+ {
+ this.name = name;
+ executorMap = new HashMap();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setJNDIProperties(Properties p)
+ {
+ jndiProperties = p;
+ }
+
+ public Properties getJNDIProperties()
+ {
+ return jndiProperties;
+ }
+
+ public void addExecutor(String executorName, String url)
+ {
+ executorMap.put(executorName, url);
+ }
+
+ public String getExecutorURL(String executorName)
+ {
+ return (String)executorMap.get(executorName);
+ }
+
+ public Color getColor()
+ {
+ return color;
+ }
+
+ public void setColor(Color color)
+ {
+ this.color = color;
+ }
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/SimpleJobList.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/SimpleJobList.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/data/SimpleJobList.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,63 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.data;
+
+import org.jboss.jms.perf.framework.protocol.Job;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: SimpleJobList.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class SimpleJobList implements JobList
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private List jobs;
+
+ // Constructors --------------------------------------------------
+
+ public SimpleJobList()
+ {
+ jobs = new ArrayList();
+ }
+
+ // JobList implementation ----------------------------------------
+
+ public void addJob(Job job)
+ {
+ jobs.add(job);
+ }
+
+ public int size()
+ {
+ return jobs.size();
+ }
+
+ public Iterator iterator()
+ {
+ return jobs.iterator();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/AbstractMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/AbstractMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/AbstractMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import java.util.Arrays;
+
+/**
+ *
+ * A AbstractMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 715 $
+ *
+ * $Id: AbstractMessageFactory.java 715 2006-03-09 21:50:10Z ovidiu $
+ */
+public abstract class AbstractMessageFactory implements MessageFactory
+{
+ protected static byte[] getBytes(int size)
+ {
+ byte[] bytes = new byte[size];
+ //Just fill it with something so we can recognise it if we look at it via TCPDump for instance
+ Arrays.fill(bytes, (byte)99);
+ return bytes;
+ }
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/BytesMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/BytesMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/BytesMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ *
+ * A BytesMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: BytesMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class BytesMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = 594068477879961702L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ BytesMessage theMessage = sess.createBytesMessage();
+ theMessage.writeBytes(getBytes(size));
+ return theMessage;
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ForeignMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ForeignMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ForeignMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,308 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Enumeration;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ *
+ * A ForeignMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: ForeignMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class ForeignMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = -4148818964934832961L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ return new ForeignMessage(size);
+ }
+
+ static class ForeignMessage implements Message, Serializable
+ {
+
+ private static final long serialVersionUID = 6055142727806821394L;
+
+
+ private byte[] hidden;
+ ForeignMessage(int size)
+ {
+ hidden = getBytes(size);
+ }
+
+ public byte[] getHidden()
+ {
+ //Never gets called
+ //But it's to prevent the compiler optimising the hidden field away!!
+ return hidden;
+ }
+
+ public void acknowledge() throws JMSException
+ {
+ // FIXME acknowledge
+
+ }
+
+ public void clearBody() throws JMSException
+ {
+ // FIXME clearBody
+
+ }
+
+ public void clearProperties() throws JMSException
+ {
+ // FIXME clearProperties
+
+ }
+
+ public boolean getBooleanProperty(String name) throws JMSException
+ {
+ // FIXME getBooleanProperty
+ return false;
+ }
+
+ public byte getByteProperty(String name) throws JMSException
+ {
+ throw new NumberFormatException();
+ }
+
+ public double getDoubleProperty(String name) throws JMSException
+ {
+ // FIXME getDoubleProperty
+ throw new NumberFormatException();
+ }
+
+ public float getFloatProperty(String name) throws JMSException
+ {
+ // FIXME getFloatProperty
+ throw new NumberFormatException();
+ }
+
+ public int getIntProperty(String name) throws JMSException
+ {
+ // FIXME getIntProperty
+ throw new NumberFormatException();
+ }
+
+ private String correlationID;
+
+ public String getJMSCorrelationID() throws JMSException
+ {
+ return correlationID;
+ }
+
+ private byte[] correlationIDBytes;
+
+ public byte[] getJMSCorrelationIDAsBytes() throws JMSException
+ {
+ // FIXME getJMSCorrelationIDAsBytes
+ return correlationIDBytes;
+ }
+
+ private int deliveryMode;
+
+ public int getJMSDeliveryMode() throws JMSException
+ {
+ return deliveryMode;
+ }
+
+ private Destination dest;
+
+ public Destination getJMSDestination() throws JMSException
+ {
+ return dest;
+ }
+
+ private long expiration;
+
+ public long getJMSExpiration() throws JMSException
+ {
+ return expiration;
+ }
+
+ private String messageID;
+
+ public String getJMSMessageID() throws JMSException
+ {
+ return messageID;
+ }
+
+ private int priority;
+
+ public int getJMSPriority() throws JMSException
+ {
+ return priority;
+ }
+
+ private boolean redelivered;
+
+ public boolean getJMSRedelivered() throws JMSException
+ {
+ return redelivered;
+ }
+
+ private Destination replyTo;
+
+ public Destination getJMSReplyTo() throws JMSException
+ {
+ return replyTo;
+ }
+
+ private long timestamp;
+
+ public long getJMSTimestamp() throws JMSException
+ {
+ return timestamp;
+ }
+
+ private String type;
+
+ public String getJMSType() throws JMSException
+ {
+ return type;
+ }
+
+ public long getLongProperty(String name) throws JMSException
+ {
+ throw new NumberFormatException();
+ }
+
+ public Object getObjectProperty(String name) throws JMSException
+ {
+ return null;
+ }
+
+ public Enumeration getPropertyNames() throws JMSException
+ {
+ return Collections.enumeration(Collections.EMPTY_SET);
+ }
+
+ public short getShortProperty(String name) throws JMSException
+ {
+ throw new NumberFormatException();
+ }
+
+ public String getStringProperty(String name) throws JMSException
+ {
+ return null;
+ }
+
+ public boolean propertyExists(String name) throws JMSException
+ {
+ return false;
+ }
+
+ public void setBooleanProperty(String name, boolean value) throws JMSException
+ {
+ }
+
+ public void setByteProperty(String name, byte value) throws JMSException
+ {
+ }
+
+ public void setDoubleProperty(String name, double value) throws JMSException
+ {
+ }
+
+ public void setFloatProperty(String name, float value) throws JMSException
+ {
+ }
+
+ public void setIntProperty(String name, int value) throws JMSException
+ {
+ }
+
+ public void setJMSCorrelationID(String correlationID) throws JMSException
+ {
+ this.correlationID = correlationID;
+ }
+
+ public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException
+ {
+ this.correlationIDBytes = correlationID;
+
+ }
+
+ public void setJMSDeliveryMode(int deliveryMode) throws JMSException
+ {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public void setJMSDestination(Destination destination) throws JMSException
+ {
+ this.dest = destination;
+ }
+
+ public void setJMSExpiration(long expiration) throws JMSException
+ {
+ this.expiration = expiration;
+
+ }
+
+ public void setJMSMessageID(String id) throws JMSException
+ {
+ this.messageID = id;
+ }
+
+ public void setJMSPriority(int priority) throws JMSException
+ {
+ this.priority = priority;
+ }
+
+ public void setJMSRedelivered(boolean redelivered) throws JMSException
+ {
+ this.redelivered = redelivered;
+ }
+
+ public void setJMSReplyTo(Destination replyTo) throws JMSException
+ {
+ this.replyTo = replyTo;
+ }
+
+ public void setJMSTimestamp(long timestamp) throws JMSException
+ {
+ this.timestamp = timestamp;
+ }
+
+ public void setJMSType(String type) throws JMSException
+ {
+ this.type = type;
+ }
+
+ public void setLongProperty(String name, long value) throws JMSException
+ {
+ }
+
+ public void setObjectProperty(String name, Object value) throws JMSException
+ {
+
+ }
+
+ public void setShortProperty(String name, short value) throws JMSException
+ {
+
+ }
+
+ public void setStringProperty(String name, String value) throws JMSException
+ {
+
+ }
+
+ }
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MapMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MapMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MapMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ *
+ * A MapMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: MapMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class MapMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = 4180086702224773753L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ MapMessage theMessage = sess.createMapMessage();
+ theMessage.setBytes("b", getBytes(size));
+ return theMessage;
+ }
+}
+
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 715 $
+ *
+ * $Id: MessageFactory.java 715 2006-03-09 21:50:10Z ovidiu $
+ */
+public interface MessageFactory extends Serializable
+{
+ Message getMessage(Session sess, int size) throws JMSException;
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/MessageMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version $Revision: 715 $
+ *
+ * $Id: MessageMessageFactory.java 715 2006-03-09 21:50:10Z ovidiu $
+ */
+public class MessageMessageFactory extends AbstractMessageFactory
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 2067915341101651125L;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // MessageFactory implementation ---------------------------------
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ Message m = sess.createMessage();
+ byte[] bytes = getBytes(size);
+ String s = new String(bytes);
+ m.setStringProperty("s", s);
+ return m;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ObjectMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ObjectMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/ObjectMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ *
+ * A ObjectMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: ObjectMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class ObjectMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = -8665223704967440412L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ return sess.createObjectMessage(getBytes(size));
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/StreamMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/StreamMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/StreamMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+
+/**
+ *
+ * A StreamMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: StreamMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class StreamMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = -5188777779031562013L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ StreamMessage m = sess.createStreamMessage();
+ m.writeBytes(getBytes(size));
+ return m;
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/TextMessageFactory.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/TextMessageFactory.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/factories/TextMessageFactory.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.factories;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ *
+ * A TextMessageFactory.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 739 $
+ *
+ * $Id: TextMessageFactory.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class TextMessageFactory extends AbstractMessageFactory
+{
+ private static final long serialVersionUID = -6708553993263367407L;
+
+ public Message getMessage(Session sess, int size) throws JMSException
+ {
+ byte[] bytes = getBytes(size);
+ String s = new String(bytes);
+ return sess.createTextMessage(s);
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/HSQLDBPersistenceManager.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/HSQLDBPersistenceManager.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/HSQLDBPersistenceManager.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,415 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.persistence;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Date;
+
+import org.jboss.jms.perf.framework.data.Execution;
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+import org.jboss.jms.perf.framework.protocol.ThroughputResult;
+import org.jboss.jms.perf.framework.protocol.Job;
+import org.jboss.jms.perf.framework.protocol.Failure;
+import org.jboss.jms.perf.framework.protocol.JobSupport;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * A HSQLDBPersistenceManager.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 735 $
+ *
+ * $Id: HSQLDBPersistenceManager.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class HSQLDBPersistenceManager implements PersistenceManager
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(HSQLDBPersistenceManager.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected Connection conn;
+ protected String dbURL;
+
+ // Constructors --------------------------------------------------
+
+ public HSQLDBPersistenceManager(String dbURL)
+ {
+ this.dbURL = dbURL;
+ }
+
+ // PersitenceManager implementation ------------------------------
+
+ public void start()
+ {
+ try
+ {
+ Class.forName("org.hsqldb.jdbcDriver");
+ conn = DriverManager.getConnection(dbURL, "sa", "");
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to get db connection", e);
+ }
+ createSchema();
+ }
+
+ public void stop()
+ {
+ try
+ {
+ Statement statement = conn.createStatement();
+ statement.executeQuery("SHUTDOWN COMPACT");
+ conn.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to shutdown db", e);
+ }
+ }
+
+ public void deleteAllResults()
+ {
+ try
+ {
+ conn.createStatement().executeQuery("DELETE FROM EXECUTION");
+ conn.createStatement().executeQuery("DELETE FROM PERFORMANCE_TEST");
+ conn.commit();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to close db connection", e);
+ }
+ }
+
+
+ public void savePerformanceTest(PerformanceTest pt) throws Exception
+ {
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+
+ // if the performance test has no executions, don't bother
+ if (pt.getEffectiveExecutions().size() == 0)
+ {
+ log.debug(pt + " has no executions, skipping");
+ return;
+ }
+
+ try
+ {
+ ps = conn.prepareStatement("SELECT ID, NAME FROM PERFORMANCE_TEST WHERE NAME=?");
+
+ ps.setString(1, pt.getName());
+ rs = ps.executeQuery();
+ long id;
+ if (rs.next())
+ {
+ id = rs.getLong(1);
+ rs.close();
+ ps.close();
+ }
+ else
+ {
+ // performance test does not exist
+
+ log.debug("creating new performance test in database: " + pt);
+
+ rs.close();
+ ps.close();
+
+ ps = conn.prepareStatement("INSERT INTO PERFORMANCE_TEST (NAME) VALUES (?)");
+ ps.setString(1, pt.getName());
+ ps.executeUpdate();
+ ps.close();
+
+ ps = conn.prepareStatement("CALL IDENTITY()");
+ rs = ps.executeQuery();
+ rs.next();
+ id = rs.getLong(1);
+ rs.close();
+ ps.close();
+ }
+
+ for(Iterator i = pt.getEffectiveExecutions().iterator(); i.hasNext(); )
+ {
+ Execution e = (Execution)i.next();
+
+ ps = conn.prepareStatement("INSERT INTO EXECUTION (PERFORMANCE_TEST_ID, PROVIDER, STARTDATE, FINISHDATE) VALUES (?,?,?,?)");
+ ps.setLong(1, id);
+ ps.setString(2, e.getProviderName());
+
+ Date d = e.getStartDate();
+ if (d != null)
+ {
+ ps.setTimestamp(3, new java.sql.Timestamp(d.getTime()));
+ }
+ d = e.getFinishDate();
+ if (d != null)
+ {
+ ps.setTimestamp(4, new java.sql.Timestamp(d.getTime()));
+ }
+
+ ps.executeUpdate();
+ ps.close();
+
+ ps = conn.prepareStatement("CALL IDENTITY()");
+ rs = ps.executeQuery();
+ rs.next();
+ long executionId = rs.getLong(1);
+ rs.close();
+ ps.close();
+
+ int index = 0;
+ for(Iterator j = e.iterator(); j.hasNext(); index++)
+ {
+ for(Iterator m = ((List)j.next()).iterator(); m.hasNext(); )
+ {
+ Result r = (Result)m.next();
+ Job job = (Job)r.getRequest();
+ ps = conn.prepareStatement("INSERT INTO MEASUREMENT (EXECUTION_ID, MEASUREMENT_INDEX, JOB_TYPE, MESSAGE_COUNT, MESSAGE_SIZE, DURATION, RATE, MEASURED_DURATION, MEASURED_MESSAGE_COUNT) VALUES (?,?,?,?,?,?,?,?,?)");
+ ps.setLong(1, executionId);
+ ps.setInt(2, index);
+ ps.setString(3, job.getType());
+ ps.setInt(4, job.getMessageCount());
+ ps.setInt(5, job.getMessageSize());
+ ps.setLong(6, job.getDuration());
+ ps.setInt(7, job.getRate());
+ if (r instanceof ThroughputResult)
+ {
+ ps.setLong(8, ((ThroughputResult)r).getTime());
+ ps.setLong(9, ((ThroughputResult)r).getMessages());
+ }
+ else
+ {
+ ps.setLong(8, Long.MAX_VALUE);
+ ps.setLong(9, 0);
+ }
+ ps.executeUpdate();
+ ps.close();
+ }
+ }
+ }
+ conn.commit();
+
+ log.debug("saved test");
+
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to save test", e);
+ }
+ finally
+ {
+ try
+ {
+ if (rs != null) rs.close();
+ if (ps != null) ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to close resources", e);
+ }
+ }
+ }
+
+ public List getPerformanceTestNames() throws Exception
+ {
+ List result = new ArrayList();
+ try
+ {
+ PreparedStatement ps = conn.prepareStatement("SELECT NAME FROM PERFORMANCE_TEST");
+ ResultSet rs = ps.executeQuery();
+ while(rs.next())
+ {
+ String name = rs.getString(1);
+ result.add(name);
+ }
+ rs.close();
+ ps.close();
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to get benchmark", e);
+ return null;
+ }
+ return result;
+ }
+
+ public PerformanceTest getPerformanceTest(String name)
+ {
+ try
+ {
+ PreparedStatement ps =
+ conn.prepareStatement("SELECT ID, NAME FROM PERFORMANCE_TEST WHERE NAME=?");
+ ps.setString(1, name);
+ ResultSet rs = ps.executeQuery();
+ long id;
+ PerformanceTest pt = null;
+ if (rs.next())
+ {
+ id = rs.getLong(1);
+ pt = new PerformanceTest(null, name);
+ }
+ else
+ {
+ return null;
+ }
+ rs.close();
+ ps.close();
+
+ ps = conn.prepareStatement("SELECT ID, PROVIDER, STARTDATE, FINISHDATE FROM EXECUTION WHERE PERFORMANCE_TEST_ID=?");
+ ps.setLong(1, id);
+ rs = ps.executeQuery();
+ while (rs.next())
+ {
+ long executionID = rs.getLong(1);
+ String provider = rs.getString(2);
+ Timestamp start = rs.getTimestamp(3);
+ Timestamp finish = rs.getTimestamp(4);
+ Execution ex = new Execution(provider);
+ if (start != null)
+ {
+ ex.setStartDate(new Date(start.getTime()));
+ }
+ if (finish != null)
+ {
+ ex.setFinishDate(new Date(finish.getTime()));
+ }
+ pt.addEffectiveExecution(ex);
+
+ PreparedStatement ps2 = conn.prepareStatement("SELECT MEASUREMENT_INDEX, JOB_TYPE, MESSAGE_COUNT, MESSAGE_SIZE, DURATION, RATE, MEASURED_DURATION, MEASURED_MESSAGE_COUNT FROM MEASUREMENT WHERE EXECUTION_ID=?");
+ ps2.setLong(1, executionID);
+ ResultSet rs2 = ps2.executeQuery();
+
+ Map measurements = new HashMap();
+
+ while (rs2.next())
+ {
+ Integer index = new Integer(rs2.getInt(1));
+
+ List l = (List)measurements.get(index);
+ if (l == null)
+ {
+ l = new ArrayList();
+ measurements.put(index, l);
+ }
+
+ String jobType = rs2.getString(2);
+ int messageCount = rs2.getInt(3);
+ int messageSize = rs2.getInt(4);
+ long duration = rs2.getLong(5);
+ int rate = rs2.getInt(6);
+ long measuredDuration = rs2.getLong(7);
+ long measuredMessageCount = rs2.getLong(8);
+
+ Job j = JobSupport.create(jobType);
+ j.setMessageCount(messageCount);
+ j.setMessageSize(messageSize);
+ j.setDuration(duration);
+ j.setRate(rate);
+
+ Result r = null;
+ if (measuredDuration == Long.MAX_VALUE && measuredMessageCount == 0)
+ {
+ r = new Failure();
+ }
+ else
+ {
+ r = new ThroughputResult(measuredDuration, measuredMessageCount);
+ }
+ r.setRequest(j);
+ l.add(r);
+ }
+
+ rs2.close();
+ ps2.close();
+
+ List indices = new ArrayList(measurements.keySet());
+ Collections.sort(indices);
+ for(Iterator i = indices.iterator(); i.hasNext();)
+ {
+ Integer index = (Integer)i.next();
+ List l = (List)measurements.get(index);
+ ex.addMeasurement(l);
+ }
+ }
+ rs.close();
+ ps.close();
+ return pt;
+ }
+ catch (SQLException e)
+ {
+ log.error("Failed to get benchmark", e);
+ return null;
+ }
+ }
+
+
+ public void createSchema()
+ {
+ try
+ {
+ String sql = "CREATE TABLE PERFORMANCE_TEST (ID IDENTITY, NAME VARCHAR)";
+ conn.createStatement().executeUpdate(sql);
+ }
+ catch (SQLException e)
+ {
+ log.debug("Failed to create table", e);
+ }
+
+ try
+ {
+ String sql = "CREATE TABLE EXECUTION (ID IDENTITY, PERFORMANCE_TEST_ID INTEGER, PROVIDER VARCHAR, STARTDATE TIMESTAMP, FINISHDATE TIMESTAMP, FOREIGN KEY (PERFORMANCE_TEST_ID) REFERENCES PERFORMANCE_TEST (ID))";
+ conn.createStatement().executeUpdate(sql);
+ }
+ catch (SQLException e)
+ {
+ log.debug("Failed to create table", e);
+ }
+
+ try
+ {
+ String sql = "CREATE TABLE MEASUREMENT (EXECUTION_ID INTEGER, MEASUREMENT_INDEX INTEGER, JOB_TYPE VARCHAR, MESSAGE_COUNT INTEGER, MESSAGE_SIZE INTEGER, DURATION BIGINT, RATE INTEGER, MEASURED_DURATION BIGINT, MEASURED_MESSAGE_COUNT BIGINT, FOREIGN KEY (EXECUTION_ID) REFERENCES EXECUTION (ID))";
+ conn.createStatement().executeUpdate(sql);
+ }
+ catch (SQLException e)
+ {
+ log.debug("Failed to create table", e);
+ }
+ log.debug("created tables");
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/PersistenceManager.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/PersistenceManager.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/persistence/PersistenceManager.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.persistence;
+
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+
+import java.util.List;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 735 $
+ *
+ * $Id: PersistenceManager.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public interface PersistenceManager
+{
+ List getPerformanceTestNames() throws Exception;
+
+ PerformanceTest getPerformanceTest(String name) throws Exception;
+
+ void savePerformanceTest(PerformanceTest test) throws Exception;
+
+ void deleteAllResults() throws Exception;
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/AbstractServitor.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/AbstractServitor.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/AbstractServitor.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,81 @@
+/*
+ * 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.jms.perf.framework.protocol;
+
+/**
+ *
+ * A AbstractServitor.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 741 $
+ *
+ * $Id: AbstractServitor.java 741 2006-03-17 02:16:13Z ovidiu $
+ */
+abstract class AbstractServitor implements Servitor
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected boolean failed;
+ protected long duration;
+ protected long actualTime;
+ protected int currentMessageCount;
+
+ // Constructors --------------------------------------------------
+
+ AbstractServitor(long duration)
+ {
+ this.duration = duration;
+ }
+
+ // Servitor implementation ---------------------------------------
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+
+ public long getTime()
+ {
+ return actualTime;
+ }
+
+ public int getMessages()
+ {
+ return currentMessageCount;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/DrainJob.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/DrainJob.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/DrainJob.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.Topic;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Context;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiux at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 1019 $
+ *
+ * $Id: DrainJob.java 1019 2006-07-17 17:15:04Z timfox $
+ */
+public class DrainJob extends JobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -4637670167659745878L;
+ private static final Logger log = Logger.getLogger(DrainJob.class);
+ public static final String TYPE = "DRAIN";
+
+ protected static final long RECEIVE_TIMEOUT = 5000;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected String subName;
+ protected String clientID;
+
+ // Constructors --------------------------------------------------
+
+ // Job implemenation ---------------------------------------------
+
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ // JobSupport overrides ---------------------------------------------
+
+ protected Result doWork(Context context) throws Exception
+ {
+ Connection conn = null;
+
+ int count = 0;
+
+ try
+ {
+ log.info("started DRAIN job on " + destinationName);
+
+ conn = cf.createConnection();
+
+ if (clientID != null)
+ {
+ try
+ {
+ conn.setClientID(clientID);
+ }
+ catch (Exception e)
+ {
+ //Some providers may provide a connection with client id already set
+ }
+ }
+
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer;
+ if (subName == null)
+ {
+ consumer = sess.createConsumer(destination);
+ }
+ else
+ {
+ consumer = sess.createDurableSubscriber((Topic)destination, subName);
+ }
+
+ if (log.isTraceEnabled()) { log.trace("consumer created " + consumer); }
+
+ while (true)
+ {
+ Message m = consumer.receive(1000);
+ if (m == null)
+ {
+ break;
+ }
+ count++;
+ if (count % 1000 == 0)
+ {
+ log.info("received " + count + " messages");
+ }
+ }
+
+ log.info("finished DRAIN job, drained " + count + " messages");
+
+ return new ThroughputResult(0, count);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "DRAIN JOB";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+
+ public void setSubName(String subName)
+ {
+ this.subName = subName;
+ }
+
+ public void setClientID(String clientID)
+ {
+ this.clientID = clientID;
+ }
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Failure.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Failure.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Failure.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,70 @@
+/*
+ * 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.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.ResultSupport;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 723 $
+ *
+ * $Id: Failure.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class Failure extends ResultSupport
+{
+ // Constants -----------------------------------------------------
+
+ public static final long serialVersionUID = 5338059261642836113L;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public Failure()
+ {
+ this(null);
+ }
+
+ public Failure(Request request)
+ {
+ super(request);
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "FAILURE";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/FillJob.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/FillJob.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/FillJob.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.jboss.jms.perf.framework.factories.MessageFactory;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Context;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+
+ * @version $Revision: 739 $
+ *
+ * $Id: FillJob.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public class FillJob extends JobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 339586193389055268L;
+ private static final Logger log = Logger.getLogger(FillJob.class);
+ public static final String TYPE = "FILL";
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected int numMessages; // TODO - it's already availabe in JobSupport
+ protected int msgSize; // TODO - it's already availabe in JobSupport
+
+
+ // Constructors --------------------------------------------------
+
+ // Job implemenation ---------------------------------------------
+
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ // JobSupport overrides ---------------------------------------------
+
+ protected Result doWork(Context context) throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ MessageFactory mf = (MessageFactory)Class.forName(getMessageFactoryClass()).newInstance();
+
+ conn = cf.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(destination);
+ prod.setDeliveryMode(deliveryMode);
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ Message m = mf.getMessage(sess, msgSize);
+ prod.send(m);
+ }
+
+ log.debug("filled");
+
+ return null;
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ public void setDeliveryMode(int deliveryMode)
+ {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public String toString()
+ {
+ return "FILL JOB";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
\ No newline at end of file
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Job.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Job.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Job.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.Request;
+
+import java.util.Properties;
+
+/**
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version $Revision: 739 $
+ *
+ * $Id: Job.java 739 2006-03-14 23:42:31Z ovidiu $
+ */
+public interface Job extends Request
+{
+ String getType();
+
+ String getExecutorName();
+
+ void setExecutorName(String executorName);
+
+ String getExecutorURL();
+
+ void setExecutorURL(String executorURL);
+
+ int getMessageCount();
+
+ void setMessageCount(int count);
+
+ /**
+ * In bytes.
+ */
+ int getMessageSize();
+
+ /**
+ * In bytes.
+ */
+ void setMessageSize(int messageSize);
+
+ /**
+ * In milliseconds.
+ */
+ long getDuration();
+
+ /**
+ * In milliseconds.
+ */
+ void setDuration(long duration);
+
+ /**
+ * In messages/second.
+ */
+ int getRate();
+
+ /**
+ * In messages/second.
+ */
+ void setRate(int rate);
+
+ Properties getJNDIProperties();
+
+ void setJNDIProperties(Properties jndiProperties);
+
+ String getDestinationName();
+
+ void setDestinationName(String destinationName);
+
+ String getConnectionFactoryName();
+
+ void setConnectionFactoryName(String connectionFactoryName);
+
+ boolean isTransacted();
+
+ void setTransacted(boolean b);
+
+ int getAcknowledgmentMode();
+
+ void setAcknowledgmentMode(int acknowledgmentMode);
+
+ int getDeliveryMode();
+
+ void setDeliveryMode(int deliveryMode);
+
+ String getMessageFactoryClass();
+
+ void setMessageFactoryClass(String messageFactoryClass);
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/JobSupport.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/JobSupport.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/JobSupport.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,370 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Session;
+import javax.jms.DeliveryMode;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.configuration.JobConfiguration;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Context;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version $Revision: 740 $
+ *
+ * $Id: JobSupport.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public abstract class JobSupport implements Job, Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 2343453409584398L;
+
+ private transient static final Logger log = Logger.getLogger(JobSupport.class);
+
+ // Static --------------------------------------------------------
+
+ public static Job create(String type)
+ {
+ if (SendJob.TYPE.equals(type))
+ {
+ return new SendJob();
+ }
+ else if (ReceiveJob.TYPE.equals(type))
+ {
+ return new ReceiveJob();
+ }
+ else if (FillJob.TYPE.equals(type))
+ {
+ return new FillJob();
+ }
+ else if (DrainJob.TYPE.equals(type))
+ {
+ return new DrainJob();
+ }
+ else if (PingJob.TYPE.equals(type))
+ {
+ return new PingJob();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown job type " + type);
+ }
+ }
+
+ /**
+ * Validate and canonicize the job name.
+ */
+ public static String getJobType(String name) throws Exception
+ {
+ name = name.toUpperCase();
+ if (SendJob.TYPE.equals(name))
+ {
+ return SendJob.TYPE;
+ }
+ else if (ReceiveJob.TYPE.equals(name))
+ {
+ return ReceiveJob.TYPE;
+ }
+ else if (FillJob.TYPE.equals(name))
+ {
+ return FillJob.TYPE;
+ }
+ else if (DrainJob.TYPE.equals(name))
+ {
+ return DrainJob.TYPE;
+ }
+ else if (PingJob.TYPE.equals(name))
+ {
+ return PingJob.TYPE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown job type " + name);
+ }
+ }
+
+ public static boolean isValidJobType(String name)
+ {
+ if ("send".equals(name) ||
+ "receive".equals(name) ||
+ "drain".equals(name) ||
+ "fill".equals(name) ||
+ "ping".equals(name))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static String acknowledgmentModeToString(int ackMode)
+ {
+ if (Session.AUTO_ACKNOWLEDGE == ackMode)
+ {
+ return "AUTO_ACKNOWLEDGE";
+ }
+ else if (Session.CLIENT_ACKNOWLEDGE == ackMode)
+ {
+ return "CLIENT_ACKNOWLEDGE";
+ }
+ else if (Session.DUPS_OK_ACKNOWLEDGE == ackMode)
+ {
+ return "DUPS_OK_ACKNOWLEDGE";
+ }
+ else if (Session.SESSION_TRANSACTED == ackMode)
+ {
+ return "SESSION_TRANSACTED";
+ }
+ else
+ {
+ return "UNKNOWN";
+ }
+ }
+
+ public static String deliveryModeToString(int deliveryMode)
+ {
+ if (DeliveryMode.NON_PERSISTENT == deliveryMode)
+ {
+ return "NON_PERSISTENT";
+ }
+ else if (DeliveryMode.PERSISTENT == deliveryMode)
+ {
+ return "PERSISTENT";
+ }
+ else
+ {
+ return "UNKNOWN";
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private String executorName;
+ protected String executorURL;
+ protected int messageCount;
+ protected int messageSize;
+ protected long duration;
+ protected int rate;
+
+ protected Properties jndiProperties;
+
+ protected String destinationName;
+ protected Destination destination;
+ protected String connectionFactoryName;
+ protected ConnectionFactory cf;
+
+ protected boolean transacted;
+ protected int acknowledgmentMode;
+ protected int deliveryMode;
+ protected String messageFactoryClass;
+
+ // Constructors --------------------------------------------------
+
+ JobSupport()
+ {
+ duration = Long.MAX_VALUE;
+ }
+
+ // Job implementation --------------------------------------------
+
+ public synchronized final Result execute(Context c) throws Exception
+ {
+ try
+ {
+ initialize(c);
+ return doWork(c);
+ }
+ catch(Exception e)
+ {
+ log.error("job failed", e);
+ throw e;
+ }
+ }
+
+ public String getExecutorName()
+ {
+ return executorName;
+ }
+
+ public void setExecutorName(String executorName)
+ {
+ this.executorName = executorName;
+ }
+
+ public String getExecutorURL()
+ {
+ return executorURL;
+ }
+
+ public void setExecutorURL(String executorURL)
+ {
+ this.executorURL = executorURL;
+ }
+
+ public int getMessageCount()
+ {
+ return messageCount;
+ }
+
+ public void setMessageCount(int messageCount)
+ {
+ this.messageCount = messageCount;
+ }
+
+ public int getMessageSize()
+ {
+ return messageSize;
+ }
+
+ public void setMessageSize(int messageSize)
+ {
+ this.messageSize = messageSize;
+ }
+
+ public long getDuration()
+ {
+ return duration;
+ }
+
+ public void setDuration(long duration)
+ {
+ this.duration = duration;
+ }
+
+ public int getRate()
+ {
+ return rate;
+ }
+
+ public void setRate(int rate)
+ {
+ this.rate = rate;
+ }
+
+ public Properties getJNDIProperties()
+ {
+ return jndiProperties;
+ }
+
+ public void setJNDIProperties(Properties jndiProperties)
+ {
+ this.jndiProperties = jndiProperties;
+ }
+
+ public String getDestinationName()
+ {
+ return destinationName;
+ }
+
+ public void setDestinationName(String destinationName)
+ {
+ this.destinationName = destinationName;
+ }
+
+ public String getConnectionFactoryName()
+ {
+ return connectionFactoryName;
+ }
+
+ public void setConnectionFactoryName(String connectionFactoryName)
+ {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ public boolean isTransacted()
+ {
+ return transacted;
+ }
+
+ public void setTransacted(boolean transacted)
+ {
+ this.transacted = transacted;
+ }
+
+ public int getAcknowledgmentMode()
+ {
+ return acknowledgmentMode;
+ }
+
+ public void setAcknowledgmentMode(int acknowledgmentMode)
+ {
+ this.acknowledgmentMode = acknowledgmentMode;
+ }
+
+ public int getDeliveryMode()
+ {
+ return deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode)
+ {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public String getMessageFactoryClass()
+ {
+ return messageFactoryClass;
+ }
+
+ public void setMessageFactoryClass(String messageFactoryClass)
+ {
+ this.messageFactoryClass = messageFactoryClass;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return getType() + "[" + JobConfiguration.executionURLToString(getExecutorURL()) + ", " +
+ getDestinationName() + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected abstract Result doWork(Context context) throws Exception;
+
+ protected void initialize(Context context) throws Exception
+ {
+ if (jndiProperties == null)
+ {
+ return;
+ }
+
+ InitialContext ic = new InitialContext(jndiProperties);
+
+ try
+ {
+ destination = (Destination)ic.lookup(destinationName);
+ log.debug(this + " looking up destination " + destinationName + " and got " + destination);
+
+ cf = (ConnectionFactory)ic.lookup(connectionFactoryName);
+ log.debug(this + " looking up connection factory " + connectionFactoryName + " and got " +
+ connectionFactoryName);
+ }
+ finally
+ {
+ ic.close();
+ }
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/KillRequest.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/KillRequest.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/KillRequest.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,101 @@
+/*
+ * 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.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.SimpleResult;
+import org.jboss.jms.perf.framework.remoting.Context;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 729 $
+ *
+ * $Id: KillRequest.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class KillRequest implements Request
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -777019545487801390L;
+
+ private transient static final Logger log = Logger.getLogger(KillRequest.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Request implementation ----------------------------------------
+
+ public Result execute(Context context) throws Exception
+ {
+
+ if (context.isColocated())
+ {
+ // You SHALL NOT KILL in a colocated context
+ log.warn(this + " ignored!");
+ return new Failure();
+ }
+ else
+ {
+ new Thread(new Killer()).start();
+ log.info("killer thread started");
+ return new SimpleResult();
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "KILL REQUEST";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ class Killer implements Runnable
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(1000);
+ }
+ catch (InterruptedException e)
+ {
+ //Ignore
+ }
+ log.debug("just about to exit");
+ System.exit(0);
+ }
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/PingJob.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/PingJob.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/PingJob.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.SimpleResult;
+import org.jboss.jms.perf.framework.remoting.Context;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 735 $
+ *
+ * $Id: PingJob.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class PingJob extends JobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -23312534535892666L;
+
+ private transient static final Logger log = Logger.getLogger(PingJob.class);
+
+ public static final String TYPE = "PING";
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long sleep = 500;
+
+ // Constructors --------------------------------------------------
+
+ public PingJob()
+ {
+ }
+
+ // JobSupport overrides ------------------------------------------
+
+ protected Result doWork(Context context) throws Exception
+ {
+ log.info("sleeping for " + sleep + " milliseconds");
+ Thread.sleep(sleep);
+ log.info("woke up, returning");
+ return new SimpleResult();
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "PING";
+ }
+
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ReceiveJob.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ReceiveJob.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ReceiveJob.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,261 @@
+
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.Topic;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 1019 $
+ *
+ * $Id: ReceiveJob.java 1019 2006-07-17 17:15:04Z timfox $
+ */
+public class ReceiveJob extends ThroughputJobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 3633353742146810600L;
+
+ private static final Logger log = Logger.getLogger(ReceiveJob.class);
+
+ public static final String TYPE = "RECEIVE";
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected String subName;
+ protected String selector;
+ protected boolean noLocal;
+ protected boolean asynch;
+ protected String clientID;
+
+ // Constructors --------------------------------------------------
+
+ public ReceiveJob()
+ {
+ numConnections = 1;
+ numSessions = 1;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ public Servitor createServitor(long testTime)
+ {
+ return new Receiver(testTime);
+ }
+
+ public void setAsynch(boolean asynch)
+ {
+ this.asynch = asynch;
+ }
+
+ public void setNoLocal(boolean noLocal)
+ {
+ this.noLocal = noLocal;
+ }
+
+ public void setSelector(String selector)
+ {
+ this.selector = selector;
+ }
+
+ public void setSubName(String subName)
+ {
+ this.subName = subName;
+ }
+
+ public void setClientID(String clientID)
+ {
+ this.clientID = clientID;
+ }
+
+ public String toString()
+ {
+ return "RECEIVE JOB";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private String fullDump()
+ {
+ StringBuffer sb = new StringBuffer();
+ Properties p = getJNDIProperties();
+
+ sb.append("receiver job\n");
+ sb.append(" JNDI properties\n");
+ sb.append(" java.naming.factory.initial: ").
+ append(p.getProperty("java.naming.factory.initial")).append('\n');
+ sb.append(" java.naming.provider.url: ").
+ append(p.getProperty("java.naming.provider.url")).append('\n');
+ sb.append(" java.naming.factory.url.pkg: ").
+ append(p.getProperty("java.naming.factory.url.pkg")).append('\n');
+ sb.append(" destination name: ").
+ append(getDestinationName()).append('\n');
+ sb.append(" connection factory name: ").
+ append(getConnectionFactoryName()).append('\n');
+ sb.append(" transacted: ").
+ append(isTransacted()).append('\n');
+ sb.append(" acknowledgmentMode: ").
+ append(JobSupport.acknowledgmentModeToString(getAcknowledgmentMode())).append('\n');
+ sb.append(" message size: ").
+ append(getMessageSize()).append(" bytes").append('\n');
+ sb.append(" message count: ").
+ append(getMessageCount()).append('\n');
+ sb.append(" duration: ").
+ append(getDuration()).append('\n');
+
+ return sb.toString();
+ }
+
+ // Inner classes -------------------------------------------------
+
+ protected class Receiver extends AbstractServitor
+ {
+ Receiver(long testTime)
+ {
+ super(testTime);
+ }
+
+ private Session session;
+ private MessageConsumer consumer;
+
+ public void deInit()
+ {
+ try
+ {
+ if (subName != null)
+ {
+ session.unsubscribe(subName);
+ }
+
+ session.close();
+ }
+ catch (Throwable e)
+ {
+ log.error("deInit failed", e);
+ failed = true;
+ }
+ }
+
+ public void init()
+ {
+ try
+ {
+ Connection conn = getNextConnection();
+
+ if (subName != null)
+ {
+ try
+ {
+ conn.setClientID(clientID);
+ }
+ catch (Exception e)
+ {
+ //Some providers may provide a connection with client id already set
+ }
+ }
+
+ session = conn.createSession(transacted, getAcknowledgmentMode());
+
+ log.debug("session " + session + " created");
+
+ if (subName == null)
+ {
+ consumer = session.createConsumer(destination, selector, noLocal);
+ }
+ else
+ {
+ consumer = session.createDurableSubscriber((Topic)destination, subName,
+ selector, noLocal);
+ }
+ }
+ catch (Throwable e)
+ {
+ log.error("Init failed", e);
+ failed = true;
+ }
+ }
+
+ public void run()
+ {
+ try
+ {
+ log.debug("start receiving using " + fullDump());
+
+ long start = System.currentTimeMillis();
+
+ while (true)
+ {
+ long timeLeft = duration - System.currentTimeMillis() + start;
+
+ if (timeLeft <= 0)
+ {
+ log.debug("terminating receiving because time (" + duration + " ms) expired");
+ break;
+ }
+
+ Message m = consumer.receive(timeLeft);
+
+ if (m == null)
+ {
+ log.debug("terminating receiving because time (" + duration + " ms) expired");
+ break;
+ }
+
+ currentMessageCount++;
+
+ if (transacted)
+ {
+ if (currentMessageCount % transactionSize == 0)
+ {
+ session.commit();
+ }
+ }
+
+ if (currentMessageCount == messageCount)
+ {
+ if (transacted)
+ {
+ session.commit();
+ }
+
+ log.debug("terminating receiving because message count (" + messageCount +
+ ") has been reached");
+ break;
+ }
+ }
+
+ actualTime = System.currentTimeMillis() - start;
+ }
+ catch (Throwable e)
+ {
+ log.error("Receiver failed", e);
+ failed = true;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ResetRequest.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ResetRequest.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ResetRequest.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,74 @@
+/*
+ * 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.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.SimpleResult;
+import org.jboss.jms.perf.framework.remoting.Context;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 729 $
+ *
+ * $Id: ResetRequest.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class ResetRequest implements Request
+{
+ // Constants -----------------------------------------------------
+
+ private transient static final Logger log = Logger.getLogger(ResetRequest.class);
+
+ private static final long serialVersionUID = -349573297432452357L;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Request implementation ----------------------------------------
+
+ public Result execute(Context context) throws Exception
+ {
+ log.info("reset request executed");
+ return new SimpleResult();
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "RESET REQUEST";
+ }
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/SendJob.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/SendJob.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/SendJob.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,319 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.jboss.jms.perf.framework.factories.MessageFactory;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 1019 $
+ *
+ * $Id: SendJob.java 1019 2006-07-17 17:15:04Z timfox $
+ */
+public class SendJob extends ThroughputJobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -4031253412475892666L;
+
+ private transient static final Logger log = Logger.getLogger(SendJob.class);
+
+ private static final long SAMPLE_PERIOD = 50;
+
+ public static final String TYPE = "SEND";
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected boolean anon;
+ double targetMsgsPerSamplePeriod;
+
+ private MessageFactory messageFactory;
+
+ private boolean trace = log.isTraceEnabled();
+
+ // Constructors --------------------------------------------------
+
+ public SendJob()
+ {
+ numConnections = 1;
+ numSessions = 1;
+ transacted = false;
+ transactionSize = 0;
+ duration = Long.MAX_VALUE;
+ anon = false;
+ messageSize = 0;
+ rate = 0;
+ targetMsgsPerSamplePeriod = (((double)rate) * SAMPLE_PERIOD) / 1000;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ public Servitor createServitor(long duration)
+ {
+ return new Sender(duration);
+ }
+
+ public void setAnon(boolean anon)
+ {
+ this.anon = anon;
+ }
+
+ public String toString()
+ {
+ return "SEND JOB";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private String fullDump()
+ {
+ StringBuffer sb = new StringBuffer();
+ Properties p = getJNDIProperties();
+
+ sb.append("sender job\n");
+ sb.append(" JNDI properties\n");
+ sb.append(" java.naming.factory.initial: ").
+ append(p.getProperty("java.naming.factory.initial")).append('\n');
+ sb.append(" java.naming.provider.url: ").
+ append(p.getProperty("java.naming.provider.url")).append('\n');
+ sb.append(" java.naming.factory.url.pkg: ").
+ append(p.getProperty("java.naming.factory.url.pkg")).append('\n');
+ sb.append(" destination name: ").
+ append(getDestinationName()).append('\n');
+ sb.append(" connection factory name: ").
+ append(getConnectionFactoryName()).append('\n');
+ sb.append(" transacted: ").
+ append(isTransacted()).append('\n');
+ sb.append(" message factory class: ").
+ append(getMessageFactoryClass()).append('\n');
+ sb.append(" delivery mode: ").
+ append(JobSupport.deliveryModeToString(getDeliveryMode())).append('\n');
+ sb.append(" message size: ").
+ append(getMessageSize()).append(" bytes").append('\n');
+ sb.append(" message count: ").
+ append(getMessageCount()).append('\n');
+ sb.append(" duration: ").
+ append(getDuration()).append('\n');
+ sb.append(" rate: ").
+ append(rate).append(" messages/second");
+
+ return sb.toString();
+ }
+
+ // Inner classes -------------------------------------------------
+
+ protected class Sender extends AbstractServitor
+ {
+
+ // Constants --------------------------------------------------
+
+ // Static -----------------------------------------------------
+
+ // Attributes -------------------------------------------------
+
+ private Session sess;
+ private MessageProducer prod;
+
+ // Constructors -----------------------------------------------
+
+ Sender(long duration)
+ {
+ super(duration);
+ }
+
+ // Servitor implementation ------------------------------------
+
+ public void init()
+ {
+ log.debug(this + " initializing");
+ try
+ {
+ messageFactory = (MessageFactory)Class.forName(getMessageFactoryClass()).newInstance();
+
+ Connection conn = getNextConnection();
+ sess = conn.createSession(transacted, getAcknowledgmentMode());
+ prod = null;
+
+ if (anon)
+ {
+ prod = sess.createProducer(null);
+ }
+ else
+ {
+ prod = sess.createProducer(destination);
+ }
+
+ prod.setDeliveryMode(deliveryMode);
+ }
+ catch (Throwable e)
+ {
+ log.error("Failed to init", e);
+ failed = true;
+ }
+ }
+
+ public void deInit()
+ {
+ log.debug(this + " de-initializing");
+
+ try
+ {
+ sess.close();
+ }
+ catch (Throwable e)
+ {
+ log.error("Failed to deInit()", e);
+ failed = true;
+ }
+ }
+
+ // Runnable implementation ------------------------------------
+
+ public void run()
+ {
+
+ // if both duration and message count are set, the job sends until the first condition
+ // is met
+
+ try
+ {
+ log.debug("start sending using " + fullDump());
+
+ long start = System.currentTimeMillis();
+ long timeLeft;
+
+ Message m = messageFactory.getMessage(sess, messageSize);
+
+ while (true)
+ {
+ timeLeft = duration - System.currentTimeMillis() + start;
+
+ if (timeLeft <= 0)
+ {
+ log.debug("terminating sending because time (" + duration + " ms) expired");
+ break;
+ }
+
+ if (anon)
+ {
+ prod.send(destination, m);
+ }
+ else
+ {
+ prod.send(m);
+ }
+
+ currentMessageCount++;
+
+ if (trace) { log.trace("sent message " + currentMessageCount); }
+
+ if (transacted)
+ {
+ if (currentMessageCount % transactionSize == 0)
+ {
+ sess.commit();
+ if (log.isTraceEnabled()) { log.trace("committed"); }
+ }
+ }
+
+ if (currentMessageCount == messageCount)
+ {
+ // message count exit condition
+
+ if (transacted)
+ {
+ sess.commit();
+ if (log.isTraceEnabled()) { log.trace("committed"); }
+ }
+
+ log.debug("terminating sending because message count (" + messageCount +
+ ") has been reached");
+ break;
+ }
+
+ if (rate > 0)
+ {
+ doThrottle(start);
+ }
+ }
+
+ actualTime = System.currentTimeMillis() - start;
+
+ log.info("sent " + currentMessageCount + " messages, actual duration is " +
+ actualTime + " ms, actual send rate is " +
+ (((double)Math.round(currentMessageCount * 100000 / actualTime)) / 100) +
+ " messages/sec");
+
+ }
+ catch (Throwable e)
+ {
+ log.error("Sender failed", e);
+ failed = true;
+ }
+ finally
+ {
+ log.info("finished sending on " + destination);
+ }
+ }
+
+ // Public -----------------------------------------------------
+
+ // Package protected ------------------------------------------
+
+ // Protected --------------------------------------------------
+
+ // Private ----------------------------------------------------
+
+ private void doThrottle(long start)
+ {
+ long plannedTime = Math.round((double)start + (double)currentMessageCount * 1000 / rate);
+ long sleepTime = plannedTime - System.currentTimeMillis();
+
+ if (sleepTime <= 0)
+ {
+ // we're falling behind schedule, but there's nothing we can do, planned send rate
+ // is too high, we cannot send messages faster that that
+
+ if (log.isTraceEnabled()) { log.trace("falling behind schedule, mustn't sleep"); }
+ return;
+ }
+
+ try
+ {
+ if (log.isTraceEnabled()) { log.trace("throttling control says sleep for " + sleepTime); }
+ Thread.sleep(sleepTime);
+ }
+ catch(InterruptedException e)
+ {
+ // that's OK, next time we'll sleep longer
+ }
+ }
+
+ // Inner classes ----------------------------------------------
+
+ }
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Servitor.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Servitor.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/Servitor.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+/**
+ *
+ * A Servitor.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 723 $
+ *
+ * $Id: Servitor.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+interface Servitor extends Runnable
+{
+ boolean isFailed();
+
+ void init();
+
+ void deInit();
+
+ long getTime();
+
+ int getMessages();
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputJobSupport.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputJobSupport.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputJobSupport.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,179 @@
+
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.protocol;
+
+import javax.jms.Connection;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Context;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 729 $
+ *
+ * $Id: ThroughputJobSupport.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+abstract class ThroughputJobSupport extends JobSupport
+{
+ // Constants -----------------------------------------------------
+
+ private transient static final Logger log = Logger.getLogger(ThroughputJobSupport.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected int numConnections;
+
+ /* Number of concurrent session to use - sessions use connections in round-robin fashion */
+ protected int numSessions;
+ protected int connIndex;
+ protected int transactionSize;
+
+ protected Connection[] conns;
+ protected Thread[] servitorThreads;
+ protected Servitor[] servitors;
+
+ // Constructors --------------------------------------------------
+
+ protected ThroughputJobSupport()
+ {
+ super();
+ }
+
+ // JobSupport overrides ------------------------------------------
+
+ protected final Result doWork(Context context) throws Exception
+ {
+ try
+ {
+ boolean failed = false;
+
+ log.debug(this + " runs test with " + numSessions + " parallel sessions");
+
+ for (int i = 0; i < numSessions; i++)
+ {
+ servitorThreads[i].start();
+ }
+
+ for (int i = 0; i < numSessions; i++)
+ {
+ try
+ {
+ servitorThreads[i].join();
+ }
+ catch (InterruptedException e)
+ {
+ throw new Exception("Thread interrupted");
+ }
+ }
+
+ long totalTime = 0;
+ long totalMessages = 0;
+
+ for (int i = 0; i < numSessions; i++)
+ {
+ Servitor servitor = servitors[i];
+ servitor.deInit();
+
+ if (servitor.isFailed())
+ {
+ failed = true;
+ break;
+ }
+ else
+ {
+ totalTime += servitor.getTime();
+ totalMessages += servitor.getMessages();
+ }
+ }
+
+ if (failed)
+ {
+ throw new Exception("Job failed");
+ }
+
+ return new ThroughputResult(totalTime, totalMessages);
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ public void setNumConnections(int numConnections)
+ {
+ this.numConnections = numConnections;
+ }
+
+ public void setNumSessions(int numSessions)
+ {
+ this.numSessions = numSessions;
+ }
+
+ public void setTransactionSize(int transactionSize)
+ {
+ this.transactionSize = transactionSize;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected abstract Servitor createServitor(long duration);
+
+ protected void initialize(Context context) throws Exception
+ {
+ super.initialize(context);
+
+ conns = new Connection[numConnections];
+
+ for (int i = 0; i < numConnections; i++)
+ {
+ conns[i] = cf.createConnection();
+ conns[i].start();
+ }
+
+ servitors = new Servitor[numSessions];
+ servitorThreads = new Thread[numSessions];
+
+
+ for (int i = 0; i < numSessions; i++)
+ {
+ Servitor servitor = createServitor(duration);
+
+ servitor.init();
+ servitors[i] = servitor;
+ servitorThreads[i] = new Thread(servitors[i]);
+ }
+
+ log.debug("initialized " + this);
+ }
+
+ protected synchronized Connection getNextConnection()
+ {
+ return conns[connIndex++ % conns.length];
+ }
+
+ private void tearDown() throws Exception
+ {
+ for (int i = 0; i < numConnections; i++)
+ {
+ conns[i].close();
+ }
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
\ No newline at end of file
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputResult.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputResult.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/protocol/ThroughputResult.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,109 @@
+/*
+ * 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.jms.perf.framework.protocol;
+
+import org.jboss.jms.perf.framework.remoting.ResultSupport;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 740 $
+ *
+ * $Id: ThroughputResult.java 740 2006-03-16 05:40:57Z ovidiu $
+ */
+public class ThroughputResult extends ResultSupport
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -6238059261642836113L;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long time;
+ private long messages;
+
+ // Constructors --------------------------------------------------
+
+ public ThroughputResult(long time, long messages)
+ {
+ this.time = time;
+ this.messages = messages;
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getTime()
+ {
+ return time;
+ }
+
+ public long getMessages()
+ {
+ return messages;
+ }
+
+ public double getThroughput()
+ {
+ return 1000 * (double)messages / time;
+ }
+
+ public String toString()
+ {
+ if (request == null)
+ {
+ return "INCOMPLETE THROUGHPUT RESULT";
+ }
+
+ boolean isSender = request instanceof SendJob;
+ boolean isReceiver = request instanceof ReceiveJob;
+ boolean isDrain = request instanceof DrainJob;
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(request.toString());
+ sb.append(isSender ? " sent " : (isReceiver ? " received " : " drained "));
+ sb.append(getMessages()).append(" messages");
+
+ if (!isDrain)
+ {
+ Job job = (Job)request;
+ double t = getThroughput();
+ t = ((double)Math.round(t * 100))/100;
+ sb.append(" in ").append(getTime()).append(" ms with a target rate ").
+ append(job.getRate()).append(" messages/sec, real rate ").
+ append(t).append(" messages/sec");
+ }
+
+ return sb.toString();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Context.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Context.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Context.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,21 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: Context.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public interface Context
+{
+ /**
+ * @return true if this execution context was deployed inside an AS, false if it a "remote"
+ * execution context.
+ */
+ boolean isColocated();
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Coordinator.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Coordinator.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Coordinator.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,20 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: Coordinator.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public interface Coordinator
+{
+ int JBOSSREMOTING = 1;
+ int RMI = 2;
+
+ Result sendToExecutor(String executorURL, Request request) throws Throwable;
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Executor.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Executor.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Executor.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,94 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.protocol.KillRequest;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 731 $</tt>
+ * $Id: Executor.java 731 2006-03-13 05:26:40Z ovidiu $
+ */
+public class Executor implements Context
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(Executor.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Lock lock;
+ private Context delegator;
+
+ // Constructors --------------------------------------------------
+
+ public Executor(Context delegator)
+ {
+ lock = new Lock();
+ this.delegator = delegator;
+ }
+
+ // Context implementation ----------------------------------------
+
+ public boolean isColocated()
+ {
+ return delegator.isColocated();
+ }
+
+ // Public --------------------------------------------------------
+
+ public Result execute(Request request) throws Exception
+ {
+ log.debug(delegator + " received " + request);
+
+ // kill requests override the lock, so better know what you're doing
+
+ if (request instanceof KillRequest)
+ {
+ if (lock.isAcquired())
+ {
+ log.warn("Executor currently executing job, killing regardless ...");
+ }
+ return request.execute(this);
+ }
+ else
+ {
+ try
+ {
+ lock.acquire();
+
+ log.info(delegator + " executing " + request);
+
+ Result result = request.execute(this);
+
+ log.info(delegator + " executed " + request + " successfully");
+
+ return result;
+ }
+ catch(Exception e)
+ {
+ log.error(delegator + " failed to execute request", e);
+ throw e;
+ }
+ finally
+ {
+ lock.release();
+ }
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Lock.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Lock.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Lock.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,62 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: Lock.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class Lock
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private volatile Thread owner;
+
+ // Constructors --------------------------------------------------
+
+ public Lock()
+ {
+ }
+
+ // Public --------------------------------------------------------
+
+ public synchronized void acquire() throws Exception
+ {
+ if (owner != null)
+ {
+ throw new Exception("LOCKED by " + owner);
+ }
+
+ owner = Thread.currentThread();
+ }
+
+ public synchronized void release()
+ {
+ if (Thread.currentThread() == owner)
+ {
+ owner = null;
+ }
+ }
+
+ public synchronized boolean isAcquired()
+ {
+ return owner != null;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Request.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Request.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Request.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,19 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: Request.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public interface Request extends Serializable
+{
+ Result execute(Context c) throws Exception;
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Result.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Result.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/Result.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,24 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: Result.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public interface Result extends Serializable
+{
+ /**
+ * @return the instance of the Request that was sent and produced this Result.
+ */
+ Request getRequest();
+
+ void setRequest(Request request);
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/ResultSupport.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/ResultSupport.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/ResultSupport.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,58 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1174 $</tt>
+ * $Id: ResultSupport.java 1174 2006-08-02 14:14:32Z timfox $
+ */
+public class ResultSupport implements Result
+{
+ // Constants -----------------------------------------------------
+
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected Request request;
+
+ // Constructors --------------------------------------------------
+
+ public ResultSupport()
+ {
+ }
+
+ public ResultSupport(Request request)
+ {
+ this.request = request;
+ }
+
+ // Result support ------------------------------------------------
+
+ public Request getRequest()
+ {
+ return request;
+ }
+
+ public void setRequest(Request request)
+ {
+ this.request = request;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/SimpleResult.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/SimpleResult.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/SimpleResult.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,51 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: SimpleResult.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class SimpleResult extends ResultSupport
+{
+ // Constants -----------------------------------------------------
+
+ public static final long serialVersionUID = 357239732309853045L;
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SimpleResult()
+ {
+ super();
+ }
+
+ public SimpleResult(Request request)
+ {
+ super(request);
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "EMPTY RESULT";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorInvocationHandler.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorInvocationHandler.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorInvocationHandler.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.jms.perf.framework.remoting.jbossremoting;
+
+import javax.management.MBeanServer;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Executor;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 729 $
+ *
+ * $Id: ExecutorInvocationHandler.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class ExecutorInvocationHandler implements ServerInvocationHandler
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ExecutorInvocationHandler.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Executor delegateExecutor;
+
+ // Constructors --------------------------------------------------
+
+ public ExecutorInvocationHandler(JBossRemotingExecutor remotingExecutor)
+ {
+ delegateExecutor = new Executor(remotingExecutor);
+ }
+
+ // ServerInvocationHandler implementation -----------------------
+
+ public synchronized Object invoke(InvocationRequest invocation) throws Throwable
+ {
+ Request request = (Request)invocation.getParameter();
+ return delegateExecutor.execute(request);
+ }
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ log.debug("addListener(" + callbackHandler + ") ignored");
+ }
+
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ log.debug("removeListener(" + callbackHandler + ") ignored");
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ log.debug("setMBeanServer(" + server + ") ignored");
+ }
+
+ public void setInvoker(ServerInvoker invoker)
+ {
+ log.debug("setInvoker(" + invoker + ") ignored");
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+
+
+}
\ No newline at end of file
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorKiller.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorKiller.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/ExecutorKiller.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,78 @@
+/*
+ * 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.jms.perf.framework.remoting.jbossremoting;
+
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.jms.perf.framework.protocol.KillRequest;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version $Revision: 723 $
+ *
+ * $Id: ExecutorKiller.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class ExecutorKiller
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ExecutorKiller.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ new ExecutorKiller().run(Integer.valueOf(args[0]).intValue(), args[1]);
+ }
+ catch(Throwable t)
+ {
+ log.error("Killing failed", t);
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void run(int port, String host) throws Throwable
+ {
+ InvokerLocator locator = new InvokerLocator("socket://" + host + ":" + port);
+ Client client = new Client(locator, "executor");
+ client.invoke(new KillRequest());
+ log.info("kill request has been sent to " + locator.getLocatorURI());
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingCoordinator.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingCoordinator.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingCoordinator.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,68 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.jbossremoting;
+
+import org.jboss.jms.perf.framework.remoting.Coordinator;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Client;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: JBossRemotingCoordinator.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class JBossRemotingCoordinator implements Coordinator
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(JBossRemotingCoordinator.class);
+
+ // Static --------------------------------------------------------
+
+ public static boolean isValidURL(String url)
+ {
+ if (url.startsWith("socket://"))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Coordinator implementation ------------------------------------
+
+ public Result sendToExecutor(String executorURL, Request request) throws Throwable
+ {
+ InvokerLocator locator = new InvokerLocator(executorURL);
+ Client client = new Client(locator, "executor");
+
+ log.debug("sending request to the remoting client");
+
+ Result result = (Result)client.invoke(request);
+
+ log.debug("received response from the remoting client");
+
+ return result;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
+
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingExecutor.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingExecutor.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/jbossremoting/JBossRemotingExecutor.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,193 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.jbossremoting;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.jms.perf.framework.remoting.Context;
+
+/**
+ * An Executor listens on a port and executes generic commands submitted to it. It can be deployed
+ * as an XMBean inside a JBoss instance, hence it could submit co-located messages to a provider
+ * living in the same VM, or it can be started in its own JVM, hence playing a "remote" client.
+ *
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version $Revision: 943 $
+ *
+ * $Id: JBossRemotingExecutor.java 943 2006-05-08 21:35:39Z ovidiu $
+ */
+public class JBossRemotingExecutor implements Context
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(JBossRemotingExecutor.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr of this VM
+ // are going to be discarded
+
+ try
+ {
+ int port;
+ String ip = null;
+
+ try
+ {
+ port = Integer.parseInt(args[0]);
+ if (args.length == 2)
+ {
+ ip = args[1];
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Invalid port or no port specified");
+ return;
+ }
+
+ JBossRemotingExecutor ex = new JBossRemotingExecutor(port, ip);
+ ex.setColocated(false);
+ ex.start();
+ }
+ catch(Throwable t)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr
+ // of this VM are going to be discarded
+ log.error("executor failed to start", t);
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ private int port;
+ private String address;
+ private InvokerLocator locator;
+ private Connector connector;
+
+ private boolean colocated;
+
+ // Constructors --------------------------------------------------
+
+ public JBossRemotingExecutor(int port)
+ {
+ this(port, null);
+ }
+
+ /**
+ * @param address - null is accepted, will be interpreted as 0.0.0.0
+ */
+ public JBossRemotingExecutor(int port, String address)
+ {
+ this.port = port;
+ this.address = address;
+ colocated = true;
+ }
+
+ // Context implemenation -----------------------------------------
+
+ public boolean isColocated()
+ {
+ return colocated;
+ }
+
+ // JMX managed attributes ----------------------------------------
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public String getLocatorURI()
+ {
+ if (locator == null)
+ {
+ return null;
+ }
+ return locator.getLocatorURI();
+ }
+
+ // JMX managed operations ----------------------------------------
+
+ public void start() throws Exception
+ {
+ if (connector != null)
+ {
+ log.debug("already started");
+ return;
+ }
+
+ connector = new Connector();
+ if (address == null)
+ {
+ locator = new InvokerLocator("socket://0.0.0.0:" + port + "/?timeout=0");
+ }
+ else
+ {
+ locator = new InvokerLocator("socket://" + address + ":" + port + "/?timeout=0");
+ }
+
+ connector.setInvokerLocator(locator.getLocatorURI());
+ connector.create();
+ connector.addInvocationHandler("executor", new ExecutorInvocationHandler(this));
+ connector.start();
+
+ log.info(this + " successfully started");
+ }
+
+ public void stop()
+ {
+ if (connector == null)
+ {
+ log.debug("already stopped");
+ return;
+ }
+
+ try
+ {
+ connector.removeInvocationHandler("executor");
+ connector.stop();
+ connector.destroy();
+ connector = null;
+ log.info(this + " successfully stopped");
+ }
+ catch(Exception e)
+ {
+ log.error("Failed to stop connector", e);
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "JBossRemotingExecutor[" + getLocatorURI() + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void setColocated(boolean colocated)
+ {
+ this.colocated = colocated;
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/ExecutorKiller.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/ExecutorKiller.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/ExecutorKiller.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,108 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.protocol.KillRequest;
+
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * $Id: ExecutorKiller.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class ExecutorKiller
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ExecutorKiller.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr of this VM
+ // are going to be discarded
+
+ try
+ {
+
+ String name = args[0];
+ int port = -1;
+ String host = null;
+
+ if (args.length > 1)
+ {
+ port = Integer.parseInt(args[1]);
+
+ if (args.length > 2)
+ {
+ host = args[2];
+ }
+ }
+
+ new ExecutorKiller(name, port, host).run();
+ }
+ catch(Throwable t)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr
+ // of this VM are going to be discarded
+ log.error("rmi executor failed to start", t);
+ }
+ }
+
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+ private int registryPort;
+ private String registryHost;
+ private String url;
+
+ // Constructors --------------------------------------------------
+
+ public ExecutorKiller(String name,
+ int registryPort,
+ String registryHost) throws Exception
+ {
+ this.name = name;
+ this.registryPort = registryPort;
+ this.registryHost = registryHost;
+ }
+
+ // Public --------------------------------------------------------
+
+ public void run() throws Exception
+ {
+ if (registryPort > 0 && registryPort < 65535)
+ {
+ if (registryHost != null)
+ {
+ url = "//" + registryHost + ":" + registryPort + "/" + name;
+ }
+ else
+ {
+ url = "//localhost:" + registryPort + "/" + name;
+ }
+ }
+
+ Registry r = LocateRegistry.getRegistry(registryHost, registryPort);
+ Server server = (Server)r.lookup(url);
+ server.execute(new KillRequest());
+ log.info("kill request sent sucessfully");
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMICoordinator.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMICoordinator.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMICoordinator.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,79 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import org.jboss.jms.perf.framework.remoting.Coordinator;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.logging.Logger;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: RMICoordinator.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class RMICoordinator implements Coordinator
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RMICoordinator.class);
+
+ // Static --------------------------------------------------------
+
+ public static boolean isValidURL(String url)
+ {
+ try
+ {
+ new RMIURL(url);
+ return true;
+ }
+ catch(Exception e)
+ {
+ return false;
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Coordinator implementation ------------------------------------
+
+ public Result sendToExecutor(String executorURL, Request request) throws Throwable
+ {
+ RMIURL url = new RMIURL(executorURL);
+
+ log.debug(this + " sending " + request + " to " + executorURL);
+
+ Registry r = LocateRegistry.getRegistry(url.getHost(), url.getPort());
+ Server server = (Server)r.lookup(url.getURL());
+ Result result = server.execute(request);
+
+ log.debug(this + " received result from " + executorURL);
+
+ return result;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String toString()
+ {
+ return "RMICoordinator[" + Integer.toHexString(hashCode()) + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
+
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIExecutor.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIExecutor.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIExecutor.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,184 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.remoting.Result;
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Executor;
+import org.jboss.jms.perf.framework.remoting.Context;
+
+import java.rmi.server.UnicastRemoteObject;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.AlreadyBoundException;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: RMIExecutor.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class RMIExecutor extends UnicastRemoteObject implements Server, Context
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RMIExecutor.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr of this VM
+ // are going to be discarded
+
+ try
+ {
+
+ String name = args[0];
+ int port = -1;
+ String host = null;
+
+ if (args.length > 1)
+ {
+ port = Integer.parseInt(args[1]);
+
+ if (args.length > 2)
+ {
+ host = args[2];
+ }
+ }
+
+ RMIExecutor executor = new RMIExecutor(name, port, host);
+ executor.setColocated(false);
+ executor.start();
+ }
+ catch(Throwable t)
+ {
+ // catch everything and dump it on the log, since most likely the stdout and stderr
+ // of this VM are going to be discarded
+ log.error("rmi executor failed to start", t);
+ }
+ }
+
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+ private int registryPort;
+ private String registryHost;
+ private String url;
+ private Registry registry;
+
+ private Executor delegateExecutor;
+
+ private boolean colocated;
+
+ // Constructors --------------------------------------------------
+
+ public RMIExecutor(String name,
+ int registryPort,
+ String registryHost) throws Exception
+ {
+ this.name = name;
+ this.registryPort = registryPort;
+ this.registryHost = registryHost;
+ registry = null;
+ delegateExecutor = new Executor(this);
+ colocated = true;
+ }
+
+ // Server implemenation ------------------------------------------
+
+ public Result execute(Request request) throws Exception
+ {
+ return delegateExecutor.execute(request);
+ }
+
+ // Context implementation ----------------------------------------
+
+ public boolean isColocated()
+ {
+ return colocated;
+ }
+
+ // Public --------------------------------------------------------
+
+ // JMX managed attributes ----------------------------------------
+
+ public int getRegistryPort()
+ {
+ return registryPort;
+ }
+
+ public String getRegistryHost()
+ {
+ return registryHost;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ // JMX managed operations ----------------------------------------
+
+ public void start() throws Exception
+ {
+ if (registryPort > 0 && registryPort < 65535)
+ {
+ if (registryHost != null)
+ {
+ url = "//" + registryHost + ":" + registryPort + "/" + name;
+ System.setProperty("java.rmi.server.hostname", registryHost);
+ }
+ else
+ {
+ url = "//localhost:" + registryPort + "/" + name;
+ }
+ }
+ else
+ {
+ throw new Exception("registry port name needed");
+ }
+
+ registry = LocateRegistry.getRegistry(registryHost, registryPort);
+ try
+ {
+ registry.bind(url, this);
+ log.info(this + " started");
+ }
+ catch(AlreadyBoundException e)
+ {
+ log.warn(this + " already started, try to stop it first!");
+ }
+ }
+
+ public void stop() throws Exception
+ {
+ log.debug("Unbinding " + url + " from " + registry);
+ registry.unbind(url);
+ log.info(this + " stopped");
+ }
+
+ public String toString()
+ {
+ return "RMIExecutor[" + url + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void setColocated(boolean colocated)
+ {
+ this.colocated = colocated;
+ }
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIURL.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIURL.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RMIURL.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,85 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 723 $</tt>
+ * <p/>
+ * $Id: RMIURL.java 723 2006-03-11 07:05:24Z ovidiu $
+ */
+public class RMIURL
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int port;
+ private String host;
+ private String name;
+
+ // Constructors --------------------------------------------------
+
+ public RMIURL(String url) throws Exception
+ {
+ String s = url;
+ if (s.startsWith("rmi://"))
+ {
+ s = s.substring(6);
+ int idx = s.indexOf(':');
+ if (idx != -1)
+ {
+ host = s.substring(0, idx);
+ s = s.substring(idx + 1);
+ idx = s.indexOf('/');
+ if (idx != -1)
+ {
+ String sp = s.substring(0, idx);
+ port = Integer.parseInt(sp);
+ name = s.substring(idx + 1);
+ return;
+ }
+ }
+ }
+
+ throw new Exception("Invalid RMI URL: " + url);
+
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getURL()
+ {
+ return "//" + (host != null ? host : "localhost") + ":" + port + "/" + name;
+ }
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryKiller.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryKiller.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryKiller.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,63 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import org.jboss.logging.Logger;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: RegistryKiller.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class RegistryKiller
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RegistryKiller.class);
+
+ // Static --------------------------------------------------------
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ Registry registry = LocateRegistry.getRegistry("localhost", 7777);
+
+ log.info("registry: " + registry);
+
+ RegistryManagement m = (RegistryManagement)registry.lookup("//localhost:7777/management");
+
+ m.kill();
+
+ log.info("registry killed");
+ }
+ catch(Throwable t)
+ {
+ log.error("exception", t);
+ }
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // RegistryManagement interface ----------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryManagement.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryManagement.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryManagement.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,19 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import java.rmi.Remote;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: RegistryManagement.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public interface RegistryManagement extends Remote
+{
+ void kill() throws Exception;
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryRunner.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryRunner.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/RegistryRunner.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,91 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+import org.jboss.logging.Logger;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 729 $</tt>
+ * $Id: RegistryRunner.java 729 2006-03-12 08:50:25Z ovidiu $
+ */
+public class RegistryRunner extends UnicastRemoteObject implements RegistryManagement
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RegistryRunner.class);
+
+ // Static --------------------------------------------------------
+
+ public static Registry registry;
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ int port = 7777;
+
+ System.setProperty("java.rmi.server.hostname", "localhost");
+
+ registry = LocateRegistry.createRegistry(port);
+
+ log.info("registry created");
+
+ registry.bind("//localhost:7777/management", new RegistryRunner());
+
+ log.info("management instance bound");
+ }
+ catch(Throwable t)
+ {
+ log.error("registry failed", t);
+ }
+
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public RegistryRunner() throws Exception
+ {
+ }
+
+ // RegistryManagement interface ----------------------------------
+
+ public void kill() throws Exception
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(500);
+ log.debug("just about to exit");
+ System.exit(0);
+ }
+ catch(Exception e)
+ {
+ }
+ }
+ }).run();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/Server.java
===================================================================
--- projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/Server.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/src/main/org/jboss/jms/perf/framework/remoting/rmi/Server.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,23 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.perf.framework.remoting.rmi;
+
+
+import java.rmi.Remote;
+
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Result;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1174 $</tt>
+ * $Id: Server.java 1174 2006-08-02 14:14:32Z timfox $
+ */
+public interface Server extends Remote
+{
+ Result execute(Request request) throws Exception;
+}
Added: projects/perf/trunk/tests/org/jboss/test/jms/perf/PerformanceFrameworkTestCase.java
===================================================================
--- projects/perf/trunk/tests/org/jboss/test/jms/perf/PerformanceFrameworkTestCase.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/tests/org/jboss/test/jms/perf/PerformanceFrameworkTestCase.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,67 @@
+/*
+* 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.perf;
+
+import org.jboss.logging.Logger;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 715 $</tt>
+ * $Id: PerformanceFrameworkTestCase.java 715 2006-03-09 21:50:10Z ovidiu $
+ */
+public class PerformanceFrameworkTestCase extends TestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected Logger log = Logger.getLogger(getClass());
+
+ // Constructors --------------------------------------------------
+
+ public PerformanceFrameworkTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ }
+
+ protected void tearDown() throws Exception
+ {
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/persistence/HSQLDBPersistenceManagerTest.java
===================================================================
--- projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/persistence/HSQLDBPersistenceManagerTest.java 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/tests/org/jboss/test/jms/perf/framework/persistence/HSQLDBPersistenceManagerTest.java 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,468 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.jms.perf.framework.persistence;
+
+import org.jboss.test.jms.perf.PerformanceFrameworkTestCase;
+import org.jboss.logging.Logger;
+import org.jboss.jms.perf.framework.persistence.HSQLDBPersistenceManager;
+import org.jboss.jms.perf.framework.data.PerformanceTest;
+import org.jboss.jms.perf.framework.data.Execution;
+import org.jboss.jms.perf.framework.protocol.Job;
+import org.jboss.jms.perf.framework.protocol.ThroughputResult;
+import org.jboss.jms.perf.framework.protocol.SendJob;
+import org.jboss.jms.perf.framework.protocol.DrainJob;
+import org.jboss.jms.perf.framework.protocol.ReceiveJob;
+import org.jboss.jms.perf.framework.protocol.FillJob;
+import org.jboss.jms.perf.framework.protocol.Failure;
+import org.jboss.jms.perf.framework.remoting.Result;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 735 $</tt>
+ * $Id: HSQLDBPersistenceManagerTest.java 735 2006-03-14 01:15:22Z ovidiu $
+ */
+public class HSQLDBPersistenceManagerTest extends PerformanceFrameworkTestCase
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(HSQLDBPersistenceManagerTest.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected String databaseURL = "jdbc:hsqldb:mem:mydatabase";
+ protected HSQLDBPersistenceManager pm;
+
+ // Constructors --------------------------------------------------
+
+ public HSQLDBPersistenceManagerTest(String name)
+ {
+ super(name);
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testPerformanceTestStorage() throws Exception
+ {
+ PerformanceTest t = new PerformanceTest(null, "One");
+ Execution e = new Execution("someexecution");
+ t.addEffectiveExecution(e);
+
+ pm.savePerformanceTest(t);
+
+ PerformanceTest tl = pm.getPerformanceTest("One");
+
+ assertEquals("One", tl.getName());
+
+ List executions = tl.getEffectiveExecutions();
+ assertEquals(1, executions.size());
+
+ Execution execution = (Execution)executions.get(0);
+ assertEquals("someexecution", execution.getProviderName());
+ assertNull(execution.getStartDate());
+ assertNull(execution.getFinishDate());
+ Iterator measurments = execution.iterator();
+ assertFalse(measurments.hasNext());
+ }
+
+ public void testComplexPerformanceTestStorage() throws Exception
+ {
+ PerformanceTest t;
+
+ t = new PerformanceTest(null, "One");
+ Execution e = new Execution("someexecution");
+ t.addEffectiveExecution(e);
+
+ pm.savePerformanceTest(t);
+
+ t = new PerformanceTest(null, "Two");
+
+ e = new Execution("JBossMessaging");
+ t.addEffectiveExecution(e);
+
+ Job j = null;
+ ThroughputResult r = null;
+ List l = null;
+
+ j = new SendJob();
+ j.setMessageCount(1);
+ j.setMessageSize(2);
+ j.setDuration(3);
+ j.setRate(4);
+ r = new ThroughputResult(5, 6);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+ l = new ArrayList();
+
+ j = new SendJob();
+ j.setMessageCount(7);
+ j.setMessageSize(8);
+ j.setDuration(9);
+ j.setRate(10);
+ r = new ThroughputResult(11, 12);
+ r.setRequest(j);
+ l.add(r);
+
+ j = new SendJob();
+ j.setMessageCount(13);
+ j.setMessageSize(14);
+ j.setDuration(15);
+ j.setRate(16);
+ r = new ThroughputResult(17, 18);
+ r.setRequest(j);
+ l.add(r);
+
+ j = new SendJob();
+ j.setMessageCount(19);
+ j.setMessageSize(20);
+ j.setDuration(21);
+ j.setRate(22);
+ r = new ThroughputResult(23, 24);
+ r.setRequest(j);
+ l.add(r);
+
+ e.addMeasurement(l);
+
+ j = new DrainJob();
+ j.setMessageCount(25);
+ j.setMessageSize(26);
+ j.setDuration(27);
+ j.setRate(28);
+ r = new ThroughputResult(29, 30);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+ e = new Execution("ActiveMQ");
+
+ t.addEffectiveExecution(e);
+
+ e = new Execution("JBossMQ");
+
+ t.addEffectiveExecution(e);
+
+ l = new ArrayList();
+
+ j = new ReceiveJob();
+ j.setMessageCount(31);
+ j.setMessageSize(32);
+ j.setDuration(33);
+ j.setRate(34);
+ r = new ThroughputResult(35, 36);
+ r.setRequest(j);
+ l.add(r);
+
+ j = new SendJob();
+ j.setMessageCount(37);
+ j.setMessageSize(38);
+ j.setDuration(39);
+ j.setRate(40);
+ r = new ThroughputResult(41, 42);
+ r.setRequest(j);
+ l.add(r);
+
+ j = new DrainJob();
+ j.setMessageCount(43);
+ j.setMessageSize(44);
+ j.setDuration(45);
+ j.setRate(46);
+ r = new ThroughputResult(47, 48);
+ r.setRequest(j);
+ l.add(r);
+
+ j = new FillJob();
+ j.setMessageCount(49);
+ j.setMessageSize(50);
+ j.setDuration(51);
+ j.setRate(52);
+ r = new ThroughputResult(53, 54);
+ r.setRequest(j);
+ l.add(r);
+
+ e.addMeasurement(l);
+
+ j = new ReceiveJob();
+ j.setMessageCount(55);
+ j.setMessageSize(56);
+ j.setDuration(57);
+ j.setRate(58);
+ r = new ThroughputResult(59, 60);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+ j = new SendJob();
+ j.setMessageCount(61);
+ j.setMessageSize(62);
+ j.setDuration(63);
+ j.setRate(64);
+ r = new ThroughputResult(65, 66);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+
+ j = new DrainJob();
+ j.setMessageCount(67);
+ j.setMessageSize(68);
+ j.setDuration(69);
+ j.setRate(70);
+ r = new ThroughputResult(71, 72);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+ j = new FillJob();
+ j.setMessageCount(73);
+ j.setMessageSize(74);
+ j.setDuration(75);
+ j.setRate(76);
+ r = new ThroughputResult(77, 78);
+ r.setRequest(j);
+
+ e.addMeasurement(r);
+
+ pm.savePerformanceTest(t);
+
+
+ // retrieve and check data
+
+ PerformanceTest pt = pm.getPerformanceTest("One");
+ assertEquals("One", pt.getName());
+ List executions = pt.getEffectiveExecutions();
+ assertEquals(1, executions.size());
+
+ Execution execution = (Execution)executions.get(0);
+ assertEquals("someexecution", execution.getProviderName());
+ Iterator measurments = execution.iterator();
+ assertFalse(measurments.hasNext());
+
+ PerformanceTest pt2 = pm.getPerformanceTest("Two");
+ assertEquals("Two", pt2.getName());
+
+ executions = pt2.getEffectiveExecutions();
+ assertEquals(3, executions.size());
+
+ // JBossMessaging execution
+
+ execution = null;
+
+ for(Iterator i = executions.iterator(); i.hasNext(); )
+ {
+ Execution ex = (Execution)i.next();
+ if ("JBossMessaging".equals(ex.getProviderName()))
+ {
+ execution = ex;
+ break;
+ }
+ }
+
+ measurments = execution.iterator();
+
+ List list = (List)measurments.next();
+ assertContains(list, SendJob.TYPE, 1, 2, 3, 4, 5, 6);
+ assertEquals(0, list.size());
+
+
+ list = (List)measurments.next();
+ assertEquals(3, list.size());
+ assertContains(list, SendJob.TYPE, 7, 8, 9, 10, 11, 12);
+ assertContains(list, SendJob.TYPE, 13, 14, 15, 16, 17, 18);
+ assertContains(list, SendJob.TYPE, 19, 20, 21, 22, 23, 24);
+ assertEquals(0, list.size());
+
+ list = (List)measurments.next();
+ assertContains(list, DrainJob.TYPE, 25, 26, 27, 28, 29, 30);
+ assertEquals(0, list.size());
+
+ assertFalse(measurments.hasNext());
+
+ // ActiveMQ execution
+
+ for(Iterator i = executions.iterator(); i.hasNext(); )
+ {
+ Execution ex = (Execution)i.next();
+ if ("ActiveMQ".equals(ex.getProviderName()))
+ {
+ execution = ex;
+ break;
+ }
+ }
+
+ measurments = execution.iterator();
+ assertFalse(measurments.hasNext());
+
+ // JBossMQ excution
+
+ for(Iterator i = executions.iterator(); i.hasNext(); )
+ {
+ Execution ex = (Execution)i.next();
+ if ("JBossMQ".equals(ex.getProviderName()))
+ {
+ execution = ex;
+ break;
+ }
+ }
+
+ measurments = execution.iterator();
+
+ list = (List)measurments.next();
+ assertEquals(4, list.size());
+ assertContains(list, ReceiveJob.TYPE, 31, 32, 33, 34, 35, 36);
+ assertContains(list, SendJob.TYPE, 37, 38, 39, 40, 41, 42);
+ assertContains(list, DrainJob.TYPE, 43, 44, 45, 46, 47, 48);
+ assertContains(list, FillJob.TYPE, 49, 50, 51, 52, 53, 54);
+ assertEquals(0, list.size());
+
+ list = (List)measurments.next();
+ assertEquals(1, list.size());
+ assertContains(list, ReceiveJob.TYPE, 55, 56, 57, 58, 59, 60);
+ assertEquals(0, list.size());
+
+ list = (List)measurments.next();
+ assertEquals(1, list.size());
+ assertContains(list, SendJob.TYPE, 61, 62, 63, 64, 65, 66);
+ assertEquals(0, list.size());
+
+ list = (List)measurments.next();
+ assertEquals(1, list.size());
+ assertContains(list, DrainJob.TYPE, 67, 68, 69, 70, 71, 72);
+ assertEquals(0, list.size());
+
+ list = (List)measurments.next();
+ assertEquals(1, list.size());
+ assertContains(list, FillJob.TYPE, 73, 74, 75, 76, 77, 78);
+ assertEquals(0, list.size());
+
+ assertFalse(measurments.hasNext());
+
+ }
+
+ public void testFailureStorage() throws Exception
+ {
+ PerformanceTest t = new PerformanceTest(null, "One");
+ Execution e = new Execution("someexecution");
+ t.addEffectiveExecution(e);
+
+ Job j = new SendJob();
+ Result r = new Failure();
+ r.setRequest(j);
+ e.addMeasurement(r);
+
+ pm.savePerformanceTest(t);
+
+ // retrieve and check data
+
+ PerformanceTest pt = pm.getPerformanceTest("One");
+ List executions = pt.getEffectiveExecutions();
+ assertEquals(1, executions.size());
+ Execution execution = (Execution)executions.get(0);
+ Iterator measurments = execution.iterator();
+
+ List list = (List)measurments.next();
+ assertEquals(1, list.size());
+ Failure f = (Failure)list.get(0);
+ assertEquals(SendJob.TYPE, ((Job)f.getRequest()).getType());
+
+ assertFalse(measurments.hasNext());
+ }
+
+
+ public void testPersistEmptyTest() throws Exception
+ {
+ PerformanceTest t = new PerformanceTest(null, "Empty");
+
+ pm.savePerformanceTest(t);
+
+ assertNull(pm.getPerformanceTest("Empty"));
+ }
+
+ public void testExecutionStartAndFinishDates() throws Exception
+ {
+ PerformanceTest t = new PerformanceTest(null, "One");
+ Execution e = new Execution("someexecution");
+ e.setStartDate(new Date(1));
+ e.setFinishDate(new Date(2));
+ t.addEffectiveExecution(e);
+
+ pm.savePerformanceTest(t);
+
+ PerformanceTest tl = pm.getPerformanceTest("One");
+ List executions = tl.getEffectiveExecutions();
+ Execution execution = (Execution)executions.get(0);
+ assertEquals(1l, execution.getStartDate().getTime());
+ assertEquals(2l, execution.getFinishDate().getTime());
+ }
+
+
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ pm = new HSQLDBPersistenceManager(databaseURL);
+ pm.start();
+ log.debug("setup done");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ pm.stop();
+ pm = null;
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ private static void assertContains(List list,
+ String jobType,
+ int messageCount,
+ int messageSize,
+ long duration,
+ int rate,
+ long time,
+ long messages)
+ {
+ for(Iterator i = list.iterator(); i.hasNext(); )
+ {
+ ThroughputResult tr = (ThroughputResult)i.next();
+ Job job = (Job)tr.getRequest();
+
+ if (jobType.equals(job.getType()) &&
+ messageCount == job.getMessageCount() &&
+ messageSize == job.getMessageSize() &&
+ duration == job.getDuration() &&
+ rate == job.getRate() &&
+ time == tr.getTime() &&
+ messages == tr.getMessages())
+ {
+ // found
+ i.remove();
+ return;
+ }
+ }
+ fail("The list doesn't contain specified element!");
+ }
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/perf/trunk/tools/etc/buildmagic/aliases.ent
===================================================================
--- projects/perf/trunk/tools/etc/buildmagic/aliases.ent 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/tools/etc/buildmagic/aliases.ent 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,97 @@
+<!-- list of aliases used to bridge gap between buildmagic defs and jbossbuild -->
+
+
+<path id="apache.commons.classpath">
+ <pathelement path="${apache.collections.lib}/commons-collections.jar"/>
+ <pathelement path="${apache.logging.lib}/commons-logging.jar"/>
+ <pathelement path="${apache.httpclient.lib}/commons-httpclient.jar"/>
+ <pathelement path="${apache.pool.lib}/commons-pool.jar"/>
+ <pathelement path="${apache.discovery.lib}/commons-discovery.jar"/>
+ <pathelement path="${apache.fileupload.lib}/commons-fileupload.jar"/>
+ <pathelement path="${apache.lang.lib}/commons-lang-2.0.jar"/>
+</path>
+
+<path id="sax.classpath">
+ <pathelement path="${xml-sax.classpath}"/>
+</path>
+
+<property name="xdoclet-xdoclet.lib" value="${xdoclet.xdoclet.lib}"/>
+<path id="xdoclet.task.classpath">
+ <path refid="xdoclet.xdoclet.classpath"/>
+</path>
+
+<property name="gjt.jpl-util.lib" value="${gjt.jpl.util.lib}"/>
+<path id="gjt.jpl-util.classpath">
+ <path refid="gjt.jpl.util.classpath"/>
+</path>
+
+<property name="opennms.joesnmp.lib" value="${joesnmp.joesnmp.lib}"/>
+<path id="opennms.joesnmp.classpath">
+ <path refid="joesnmp.joesnmp.classpath"/>
+</path>
+
+<path id="jacorb.idl.classpath">
+ <path refid="apache.avalon.logkit.classpath"/>
+ <pathelement path="${jacorb.jacorb.lib}/idl.jar"/>
+</path>
+
+<property name="jacorb.idl.include" value="${jacorb.jacorb.resources}"/>
+<property name="jacorb.jacorb.properties" value="${jacorb.jacorb.resources}"/>
+
+<property name="sleepycat.lib" value="${sleepycat.sleepycat.lib}"/>
+<path id="sleepycat.classpath">
+ <path refid="sleepycat.sleepycat.classpath"/>
+</path>
+
+<property name="apache.tomcat55.root" value="${apache.tomcat.root}"/>
+<property name="apache.tomcat55.lib" value="${apache.tomcat.lib}"/>
+<path id="apache.tomcat55.classpath">
+ <path refid="apache.tomcat.classpath"/>
+</path>
+
+<property name="trove.lib" value="${trove.trove.lib}"/>
+<path id="trove.classpath">
+ <path refid="trove.trove.classpath"/>
+</path>
+
+<path id="qdox.classpath">
+ <path refid="qdox.qdox.classpath"/>
+</path>
+
+<property name="javassist.lib" value="${javassist.javassist.lib}"/>
+<path id="javassist.classpath">
+ <path refid="javassist.javassist.classpath"/>
+</path>
+
+<property name="hibernate.lib" value="${hibernate.hibernate.lib}"/>
+<path id="hibernate3.classpath">
+ <path refid="hibernate.hibernate.classpath"/>
+</path>
+
+<property name="odmg.lib" value="${odmg.odmg.lib}"/>
+<path id="odmg.classpath">
+ <path refid="odmg.odmg.classpath"/>
+</path>
+
+<property name="cglib.lib" value="${cglib.cglib.lib}"/>
+<path id="cglib.classpath">
+ <path refid="cglib.cglib.classpath"/>
+</path>
+
+<path id="ejb3-persistence.classpath">
+ <path refid="hibernate.annotations.classpath"/>
+ <path refid="hibernate.entitymanager.classpath"/>
+</path>
+
+<property name="spring.lib" value="${spring.spring.lib}"/>
+<path id="spring.classpath">
+ <path refid="spring.spring.classpath"/>
+</path>
+
+<!-- Ant -->
+<property name="apache.ant.root" value="${project.tools}"/>
+<property name="apache.ant.lib" value="${apache.ant.root}/lib"/>
+<path id="apache.ant.classpath">
+ <pathelement path="${apache.ant.lib}/ant.jar"/>
+</path>
+
\ No newline at end of file
Added: projects/perf/trunk/tools/etc/jbossbuild/jbossbuild.properties
===================================================================
--- projects/perf/trunk/tools/etc/jbossbuild/jbossbuild.properties 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/tools/etc/jbossbuild/jbossbuild.properties 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,9 @@
+
+# The location of the thirdparty (prebuilt artifacts) directory relative to the project root
+jbossbuild.thirdparty.dir=thirdparty
+
+# The name of the component info file
+jbossbuild.component.info=component-info.xml
+
+# The targetdefs to use
+jbossbuild.targetdefs.refid=targets
\ No newline at end of file
Added: projects/perf/trunk/tools/etc/jbossbuild/tasks.xml
===================================================================
--- projects/perf/trunk/tools/etc/jbossbuild/tasks.xml 2006-10-06 05:33:28 UTC (rev 1446)
+++ projects/perf/trunk/tools/etc/jbossbuild/tasks.xml 2006-10-06 05:37:45 UTC (rev 1447)
@@ -0,0 +1,1023 @@
+<?xml version="1.0"?>
+
+<!--
+ JBoss, the OpenSource J2EE webOS
+
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+-->
+<project name="jboss.ant.tasks"
+ default="help-fragment"
+>
+<!-- ================================================================== -->
+<!-- Properties -->
+<!-- ================================================================== -->
+
+ <!-- because this file may be imported from various locations
+ locations must be referenced in an absolute fashion -->
+ <dirname property="imported.basedir" file="${ant.file.jboss.ant.tasks}"/>
+
+
+ <property file="${imported.basedir}/jbossbuild.properties"/>
+
+ <property name="jboss.tasks.path"
+ value="${imported.basedir}/../../../tools/lib/jbossbuild.jar" />
+
+ <!-- items required for javcc task -->
+ <property name="sun.javacc.lib"
+ value="${imported.basedir}/../../../${jbossbuild.thirdparty.dir}/sun-javacc/lib/"/>
+
+ <property name="jacorb.root"
+ value="${imported.basedir}/../../../${jbossbuild.thirdparty.dir}/jacorb"/>
+
+ <property name="apache.logkit.lib"
+ value="${imported.basedir}/../../../${jbossbuild.thirdparty.dir}/apache-avalon-logkit/lib"/>
+
+
+ <path id="jacorb.idl.classpath">
+ <pathelement path="${jacorb.root}/lib/idl.jar"/>
+ <pathelement path="${apache.logkit.lib}/logkit.jar"/>
+ </path>
+
+
+<!-- ================================================================== -->
+<!-- Type Definitions -->
+<!-- ================================================================== -->
+
+ <!-- The generate type -->
+ <typedef name="generate"
+ classname="org.jboss.ant.types.Generate"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The build type -->
+ <typedef name="build"
+ classname="org.jboss.ant.types.build.Build"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The artifact type definition type -->
+ <typedef name="artifacttype"
+ classname="org.jboss.ant.types.build.ArtifactType"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The component definition type -->
+ <typedef name="componentdef"
+ classname="org.jboss.ant.types.component.ComponentDefinition"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The component type -->
+ <typedef name="component"
+ classname="org.jboss.ant.types.build.Component"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The includes type -->
+ <typedef name="includes"
+ classname="org.jboss.ant.types.Includes"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- The build targets type -->
+ <typedef name="targets"
+ classname="org.jboss.ant.types.target.TargetDefinitions"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+<!-- ================================================================== -->
+<!-- Task Definitions -->
+<!-- ================================================================== -->
+
+ <!-- Update ide info for the main build -->
+ <taskdef name="idemain"
+ classname="org.jboss.ant.tasks.build.IDETask"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- Update ide info for the component -->
+ <taskdef name="idecomponent"
+ classname="org.jboss.ant.tasks.component.IDETask"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- Generate a componentref graph and resolve the dependencies -->
+ <taskdef name="synchronizeinfo"
+ classname="org.jboss.ant.tasks.build.SynchronizeComponentsTask"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- A task which allows a visitor to visit the graph -->
+ <taskdef name="visit-componentref-graph"
+ classname="org.jboss.ant.tasks.build.VisitComponentRefGraphTask"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- Generate libraries.ent with version number in paths -->
+ <taskdef name="gen-lib-file"
+ classname="org.jboss.ant.tasks.build.GenerateLibrariesFile"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- RMIC compilation logic -->
+ <taskdef name="rmic-helper"
+ classname="org.jboss.ant.tasks.build.RMICHelper"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- Executes a given target without reparsing the project file -->
+ <taskdef name="execute-target"
+ classname="org.jboss.ant.tasks.build.TargetExecutor"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- Copy with support for zipfile sets -->
+ <taskdef name="copy-zfs"
+ classname="org.jboss.ant.tasks.build.CopyWithZipFileSetSupport"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+ <!-- File release task -->
+ <taskdef name="copy-release"
+ classname="org.jboss.ant.tasks.build.CopyRelease"
+ loaderRef="jboss.tasks.path"
+ classpath="${jboss.tasks.path}"
+ />
+
+
+
+
+
+
+<!-- ================================================================== -->
+<!-- Artifact Definitions -->
+<!-- ================================================================== -->
+
+ <artifacttype type="jar" outputtype="lib"/>
+ <artifacttype type="zip" outputtype="lib"/>
+ <artifacttype type="sar" outputtype="lib"/>
+ <artifacttype type="rar" outputtype="lib"/>
+ <artifacttype type="war" outputtype="lib"/>
+ <artifacttype type="deployer" outputtype="lib"/>
+ <artifacttype type="api" outputtype="api"/>
+ <artifacttype type="xml" outputtype="resource"/>
+ <artifacttype type="policy" outputtype="resource"/>
+ <artifacttype type="properties" outputtype="resource"/>
+ <artifacttype type="sh" outputtype="bin"/>
+ <artifacttype type="bat" outputtype="bin"/>
+ <artifacttype type="conf" outputtype="bin"/>
+ <artifacttype type="dtd" outputtype="dtd"/>
+ <artifacttype type="xsd" outputtype="schema"/>
+ <artifacttype type="aop" outputtype="resource"/>
+ <artifacttype type="idl" outputtype="resource"/>
+ <artifacttype type="md5" outputtype="bin"/>
+ <artifacttype type="dir" outputtype="lib"/>
+ <artifacttype type="ddl" outputtype="resource"/>
+
+<!-- ================================================================== -->
+<!-- Target Definitions -->
+<!-- ================================================================== -->
+
+ <targets id="targets">
+
+ <!-- ============================================================ -->
+ <!-- Build All -->
+ <!-- Builds everything (build, docs, tests and release archives) -->
+ <!-- ============================================================ -->
+
+ <targetdef target="all" description="Build All">
+ <main depends="build, doc, test, archives" components="none"/>
+ <component depends="build, doc, test"/>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Init -->
+ <!-- Basic initilization tasks and property setup -->
+ <!-- ============================================================ -->
+ <targetdef target="build.init" description="initilization tasks and property setup">
+
+ <!-- for each componentdef in jbossbuild file, setup properties
+ in case a use wishes to access them
+ -->
+ <component>
+ <property name="build.module" value="@{parentDir}"/>
+ <property name="build.module.src" value="${build.module}/src"/>
+ <property name="build.module.resources" value="${build.module}/src/resources"/>
+ <property name="build.module.etc" value="${build.module}/src/etc"/>
+ <property name="build.module.output" value="@{output}"/>
+ <property name="build.module.output.gen-src" value="${build.module.output}/gen-src"/>
+ <property name="build.module.dir" value="@{output}"/>
+ <property name="build.module.output.resources" value="${build.module.output}/resources"/>
+ <property name="build.module.output.lib" value="${build.module.output}/lib"/>
+ <property name="build.module.output.classes" value="${build.module.output}/classes"/>
+ </component>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Build -->
+ <!-- Builds the artifacts and compiles all source -->
+ <!-- ============================================================ -->
+
+ <targetdef target="build" description="Build" >
+
+ <!-- Build the main release
+ Creates the main release directory and copies artifacts
+ to the specified location
+ -->
+ <main>
+ <mkdir dir="@{releaseDir}"/>
+ <antCall target="release"/>
+ </main>
+
+
+ <!--
+ Build the component
+ Just makes the output folder
+ -->
+ <component depends="build.init, build.etc">
+ <mkdir dir="@{output}/etc"/>
+ <copy todir="@{output}/etc" filtering="yes">
+ <fileset dir="@{component.dir}/src/etc/" includes="**"/>
+ </copy>
+ </component>
+
+ <!-- Build resources if the component has a
+ resource node -->
+ <resource depends="build.resources"/>
+
+ <!-- JTREE-JAVACC source generation -->
+ <generatedsource when="@{jtree-javacc}">
+
+ <dirname file="/@{jtree-javacc}" property="@{id}.path"/>
+ <property name="@{id}.output.path" value="@{output}/${@{id}.path}"/>
+
+ <mkdir dir="${@{id}.output.path}"/>
+ <jjtree
+ target="src/@{srcdir}/@{jtree-javacc}"
+ outputdirectory="${@{id}.output.path}"
+ javacchome="${sun.javacc.lib}"/>
+
+ <basename file="@{jtree-javacc}"
+ property="@{id}.basename"
+ suffix="jjt"/>
+
+ <javacc
+ target="${@{id}.output.path}/${@{id}.basename}.jj"
+ javacchome="${sun.javacc.lib}"/>
+
+ </generatedsource>
+
+ <!-- JAVACC source generation -->
+ <generatedsource when="@{javacc}">
+
+ <dirname file="/@{javacc}" property="@{id}.path"/>
+ <property name="@{id}.output.path" value="@{output}/${@{id}.path}"/>
+
+ <mkdir dir="${@{id}.output.path}"/>
+
+ <javacc
+ target="src/@{srcdir}/@{javacc}"
+ javacchome="${sun.javacc.lib}"
+ static="@{static}"
+ outputdirectory="${@{id}.output.path}"/>
+
+ </generatedsource>
+
+ <!-- IDL compilation -->
+ <generatedsource when="@{idl}">
+
+ <!-- Task to compile idl files required by jacorb -->
+ <taskdef name="jacidl"
+ classname="org.jacorb.idl.JacIDL"
+ classpathref="jacorb.idl.classpath"
+ />
+
+ <property name="@{id}.output.path" value="@{output}/@{id}"/>
+
+ <mkdir dir="${@{id}.output.path}"/>
+
+ <jacidl
+ srcdir ="src/@{idl}"
+ destdir="${@{id}.output.path}"
+ includes="*.idl"
+ includepath="${jacorb.root}/resources/"
+ />
+
+ </generatedsource>
+
+
+ <!-- Compile the source
+ Runs depend on the source output then compiles the source
+ -->
+ <source if="@{compileable}">
+
+ <mkdir dir="@{output}"/>
+ <depend srcdir="@{sourcePath}"
+ destdir="@{output}"
+ >
+ <classpath>
+ <buildpathelements/>
+ </classpath>
+ </depend>
+ <javac srcdir="@{sourcePath}"
+ destdir="@{output}"
+ debug="true"
+ deprecation="true"
+ excludes="@{excludes}"
+ target="@{jvmTarget}"
+ source="@{jvmSource}"
+ fork="true"
+ memoryMaximumSize="512M"
+ >
+ <classpath>
+ <buildpathelements/>
+ </classpath>
+ <src path="@{sourcePath}"/>
+ <!-- allow multiple sources to be compiled at once to handle circular references -->
+ <srcelements/>
+ </javac>
+
+ <copy toDir="@{output}">
+ <fileset dir="@{sourcePath}">
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+ </source>
+
+ <source when="@{stubversion}">
+ <property name="jb.stubversion" value="@{stubversion}"/>
+ </source>
+
+
+ <!-- Remote method call compilation. -->
+ <source when="@{rmic}">
+ <rmic-helper
+ base="@{output}"
+ includes="@{rmic}"
+ verify="true"
+ debug="false"
+ iiop="@{iiop}"
+ idl="false"
+ external="@{external}"
+ stubversion="${jb.stubversion}"
+
+ >
+ <classpath>
+ <buildpathelements/>
+ </classpath>
+ </rmic-helper>
+ </source>
+
+ <!-- Create a jar archive
+ Jars the inputs of the jar artifact
+ -->
+ <jar null="@{manifest}" if="@{buildable}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <manifest>
+ <attribute name="Created-by" value="@{component.VMVersion} @{component.VMVendor}"/>
+ <attribute name="Specification-Title" value="@{component.specTitle}"/>
+ <attribute name="Specification-Version" value="@{component.specVersion}"/>
+ <attribute name="Specification-Vendor" value="@{component.specVendor}"/>
+ <attribute name="Implementation-Title" value="@{component.implTitle}"/>
+ <attribute name="Implementation-URL" value="@{component.implURL}"/>
+ <attribute name="Implementation-Version" value="@{component.implVersion}"/>
+ <attribute name="Implementation-Vendor" value="@{component.implVendor}"/>
+ <attribute name="Implementation-Vendor-Id" value="@{component.implURL}"/>
+ <attribute name="Class-Path" value="@{classpath}"/>
+ </manifest>
+ <filesets/>
+ </jar>
+ </jar>
+
+ <!-- Create an aop archive
+ Jars the inputs of the aop artifact
+ -->
+ <aop if="@{buildable}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <filesets/>
+ </jar>
+ </aop>
+
+ <jar when="@{manifest}" if="@{buildable}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}"
+ manifest="@{component.output}/etc/manifest/@{manifest}">
+ <filesets/>
+ </jar>
+ </jar>
+
+
+
+ <!-- Create a sar archive
+ Jars the inputs of the sar artifact
+ -->
+ <sar null="@{manifest}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <manifest>
+ <attribute name="Created-by" value="@{component.VMVersion} @{component.VMVendor}"/>
+ <attribute name="Specification-Title" value="@{component.specTitle}"/>
+ <attribute name="Specification-Version" value="@{component.specVersion}"/>
+ <attribute name="Specification-Vendor" value="@{component.specVendor}"/>
+ <attribute name="Implementation-Title" value="@{component.implTitle}"/>
+ <attribute name="Implementation-URL" value="@{component.implURL}"/>
+ <attribute name="Implementation-Version" value="@{component.implVersion}"/>
+ <attribute name="Implementation-Vendor" value="@{component.implVendor}"/>
+ <attribute name="Implementation-Vendor-Id" value="@{component.implURL}"/>
+ <attribute name="Class-Path" value="@{classpath}"/>
+ </manifest>
+ <filesets/>
+ </jar>
+ </sar>
+
+
+ <!-- Create a rar archive
+ Jars the inputs of the rar artifact
+ -->
+ <rar null="@{manifest}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <manifest>
+ <attribute name="Created-by" value="@{component.VMVersion} @{component.VMVendor}"/>
+ <attribute name="Specification-Title" value="@{component.specTitle}"/>
+ <attribute name="Specification-Version" value="@{component.specVersion}"/>
+ <attribute name="Specification-Vendor" value="@{component.specVendor}"/>
+ <attribute name="Implementation-Title" value="@{component.implTitle}"/>
+ <attribute name="Implementation-URL" value="@{component.implURL}"/>
+ <attribute name="Implementation-Version" value="@{component.implVersion}"/>
+ <attribute name="Implementation-Vendor" value="@{component.implVendor}"/>
+ <attribute name="Implementation-Vendor-Id" value="@{component.implURL}"/>
+ <attribute name="Class-Path" value="@{classpath}"/>
+ </manifest>
+ <filesets/>
+ </jar>
+ </rar>
+
+ <!-- Create a war archive
+ Jars the inputs of the war artifact
+ -->
+ <war null="@{manifest}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <manifest>
+ <attribute name="Created-by" value="@{component.VMVersion} @{component.VMVendor}"/>
+ <attribute name="Specification-Title" value="@{component.specTitle}"/>
+ <attribute name="Specification-Version" value="@{component.specVersion}"/>
+ <attribute name="Specification-Vendor" value="@{component.specVendor}"/>
+ <attribute name="Implementation-Title" value="@{component.implTitle}"/>
+ <attribute name="Implementation-URL" value="@{component.implURL}"/>
+ <attribute name="Implementation-Version" value="@{component.implVersion}"/>
+ <attribute name="Implementation-Vendor" value="@{component.implVendor}"/>
+ <attribute name="Implementation-Vendor-Id" value="@{component.implURL}"/>
+ <attribute name="Class-Path" value="@{classpath}"/>
+ </manifest>
+ <filesets/>
+ </jar>
+ </war>
+
+ <!-- Create a deployer archive
+ Jars the inputs of the war artifact
+ -->
+ <deployer null="@{manifest}" if="@{buildable}">
+ <mkdir dir="@{parentDir}"/>
+ <jar destfile="@{output}">
+ <manifest>
+ <attribute name="Created-by" value="@{component.VMVersion} @{component.VMVendor}"/>
+ <attribute name="Specification-Title" value="@{component.specTitle}"/>
+ <attribute name="Specification-Version" value="@{component.specVersion}"/>
+ <attribute name="Specification-Vendor" value="@{component.specVendor}"/>
+ <attribute name="Implementation-Title" value="@{component.implTitle}"/>
+ <attribute name="Implementation-URL" value="@{component.implURL}"/>
+ <attribute name="Implementation-Version" value="@{component.implVersion}"/>
+ <attribute name="Implementation-Vendor" value="@{component.implVendor}"/>
+ <attribute name="Implementation-Vendor-Id" value="@{component.implURL}"/>
+ <attribute name="Class-Path" value="@{classpath}"/>
+ </manifest>
+ <filesets/>
+ </jar>
+ </deployer>
+
+ <!-- Create a md5 checksumarchive -->
+ <md5 null="@{manifest}">
+ <mkdir dir="@{parentDir}"/>
+ <checksum>
+ <filesets/>
+ </checksum>
+ </md5>
+
+ <!-- create a directory and copy into it all of the filesets or zipfilesets -->
+ <dir if="@{buildable}">
+ <mkdir dir="@{output}"/>
+ <copy-zfs todir="@{output}">
+ <filesets/>
+ </copy-zfs>
+ </dir>
+
+
+ <!-- this is a hack. jbbuild will not allow artifacts with same id
+ varia requires a dir to be created called kernel, but cannot be created
+ because kernel already exists as a component. Only option is to create the dir
+ and rename it to kernel -->
+ <dir if="@{buildable}" when="@{rename}">
+ <mkdir dir="@{parentDir}/@{rename}"/>
+ <copy-zfs todir="@{parentDir}/@{rename}">
+ <filesets/>
+ </copy-zfs>
+ </dir>
+
+ <!-- copying of artifacts to new name -->
+ <artifactdef when="@{toname}">
+ <mkdir dir="@{parentDir}"/>
+ <copy toFile="@{parentDir}/@{toname}">
+ <filesets/>
+ </copy>
+ </artifactdef>
+
+ <sh depends="build.bin"/>
+ <bat depends="build.bin"/>
+ </targetdef>
+
+ <!-- Copy the etc -->
+ <targetdef target="build.etc">
+
+ <component>
+
+ <mkdir dir="@{output}/etc"/>
+ <mkdir dir="@{component.dir}/src/etc/"/>
+ <copy todir="@{output}/etc" filtering="yes">
+
+ <fileset dir="@{component.dir}/src/etc/" includes="**"/>
+ <filterset>
+ <filter token="java.vm.version" value="@{component.VMVersion}"/>
+ <filter token="java.vm.vendor" value="@{component.VMVendor}"/>
+ <filter token="specification.title" value="@{component.specTitle}"/>
+ <filter token="specification.version" value="@{component.specVersion}"/>
+ <filter token="specification.vendor" value="@{component.specVendor}"/>
+ <filter token="implementation.title" value="@{component.implTitle}"/>
+ <filter token="implementation.url" value="@{component.implURL}"/>
+ <filter token="implementation.version" value="@{component.implVersion}"/>
+ <filter token="implementation.vendor" value="@{component.implVendor}"/>
+ <filter token="implementation.vendor.id" value="@{component.implURL}"/>
+ </filterset>
+ </copy>
+ </component>
+
+ </targetdef>
+
+ <targetdef target="build.resources">
+
+ <component>
+ <mkdir dir="@{output}/resources"/>
+ <copy todir="@{output}" filtering="yes">
+ <fileset dir="@{component.dir}/src" includes="resources/**"/>
+ </copy>
+ </component>
+ </targetdef>
+
+
+
+ <targetdef target="build.bin">
+ <component>
+ <mkdir dir="@{output}/bin"/>
+ <copy todir="@{output}/bin" filtering="yes">
+ <fileset dir="@{component.dir}/src/bin">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <fixcrlf srcdir="@{output}/bin"
+ eol="lf" eof="remove"
+ includes="**/*.sh"/>
+
+ <fixcrlf srcdir="@{output}/bin"
+ eol="crlf" eof="remove"
+ includes="**/*.bat, **/*.cmd"/>
+
+ <chmod perm="+x">
+ <fileset dir="@{output}/bin">
+ <include name="**/*.sh"/>
+ </fileset>
+ </chmod>
+
+ </component>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Release -->
+ <!-- Create the release by copying all artifacts that have a -->
+ <!-- release tag to that specified location. -->
+ <!-- ============================================================ -->
+
+ <targetdef target="release">
+
+
+ <!-- Copy the artifact into the release -->
+ <artifact when="@{tofile}">
+ <copy-release release="@{release}" tofile="@{tofile}" requiredJDK="@{requiredJDK}"
+ exploded="@{exploded}" overwrite="@{overwrite}">
+ <output/>
+ </copy-release>
+ </artifact>
+
+ <artifact null="@{tofile}" when="@{release}" >
+ <copy-release release="@{release}"
+ exploded="@{exploded}"
+ requiredJDK="@{requiredJDK}"
+ overwrite="@{overwrite}"
+ >
+ <output/>
+ </copy-release>
+ </artifact>
+
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Publish -->
+ <!-- Copy an artifact to the location specified by -->
+ <!-- ${jbossbuild.repository.root} -->
+ <!-- Used by the continous build to publish to the repository. -->
+ <!-- ============================================================ -->
+
+ <targetdef target="publish" if="@{local}">
+
+ <!-- copy the component-info.xml into the repository -->
+ <componentmain if="@{local}">
+ <fail unless="repository.root">
+ The publish target requires repository.root to be set.
+ </fail>
+ <mkdir dir="${repository.root}/@{relativePath}"/>
+ <copy failonerror="false" file="@{dir}/${jbossbuild.component.info}"
+ todir="${repository.root}/@{relativePath}"
+ />
+
+ </componentmain>
+
+ <!-- Copy the artifact into the release -->
+ <artifact if="@{component.local}">
+ <fail unless="repository.root">
+ The publish target requires repository.root to be set.
+ </fail>
+ <mkdir dir="${repository.root}/@{relativePath}"/>
+ <copy todir="${repository.root}/@{relativePath}">
+ <output/>
+ </copy>
+ </artifact>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Archives -->
+ <!-- Builds the release archive(s) -->
+ <!-- ============================================================ -->
+
+ <!-- Build the release archives -->
+ <targetdef target="archives" description="Build the release archives">
+
+ <!-- Make the archives -->
+ <main>
+
+ <!-- Create the zip file -->
+ <zip destfile="@{output}/@{releaseName}.zip"
+ basedir="@{releaseDir}"
+ />
+ </main>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Doc -->
+ <!-- Creates the documentation. -->
+ <!-- ============================================================ -->
+
+ <targetdef target="doc" description="Documentation">
+
+ <!-- Generate the documentation -->
+ <component depends="api"/>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- API -->
+ <!-- Creates the javadoc -->
+ <!-- ============================================================ -->
+
+ <targetdef target="api" description="Javadoc">
+
+ <!-- Generate the javadoc -->
+ <component/>
+ <api>
+ <mkdir dir="@{output}"/>
+ <javadoc packagenames="*"
+ destdir="@{output}"
+ >
+ <doctitle>
+ <![CDATA[<h1>@{description} API Documentation</h1>]]>
+ </doctitle>
+ <bottom>
+ <![CDATA[
+ <i>
+ <div align="center">
+ <font size="-1">
+ Copyright © 2005 JBoss Inc. All Rights Reservered.
+ </font>
+ </div>
+ </i>
+ ]]>
+ </bottom>
+ <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+ <sourcepath>
+ <sourcepaths/>
+ </sourcepath>
+ <classpath>
+ <sourcepathelements/>
+ </classpath>
+ </javadoc>
+ </api>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Clean -->
+ <!-- Deletes the output folder -->
+ <!-- ============================================================ -->
+
+ <targetdef target="clean" description="Clean">
+ <common>
+ <delete dir="@{output}" failonerror="false"/>
+ </common>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Clobber -->
+ <!-- Deletes the output folder and removes thirdparty -->
+ <!-- ============================================================ -->
+
+ <targetdef target="clobber" description="Clobber">
+ <main depends="clean">
+ <delete dir="@{thirdparty}"/>
+ </main>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Synchronize -->
+ <!-- Resynchronizes the project with cvs -->
+ <!-- ============================================================ -->
+
+ <targetdef target="synchronize" description="Synchronize">
+
+ <!-- Update the main build folder and tools from cvs
+ then do the same for the components before running
+ the after synchronization processing
+ NOTE: Does not automatically invoke component builds
+ as the list of components maybe out-of-date at this point
+ and we need to conditionally do cvs co/update
+ -->
+ <main components="none">
+ <!-- cvs command="update -dP" failonerror="true"/-->
+ <!--invoke target="synchronize" dir="../tools"/-->
+ <execute-target target="synchronize.components" />
+ <!-- execant target="synchronize.after.main"/-->
+ </main>
+
+ <componentmain unless="@{local}">
+ <mkdir dir="@{thirdpartyDir}"/>
+ <get src="@{location}/${jbossbuild.component.info}"
+ dest="@{thirdpartyDir}/${jbossbuild.component.info}"
+ useTimestamp="false"
+ verbose="true"
+ />
+ </componentmain>
+
+ <!-- If the component exists we just do a cvs update -->
+ <componentmain if="@{exists}">
+ <cvs dest="@{dir}" command="update"/>
+ <!-- NOTE: unable to delegate to component until JBBUILD-62 is resolved -->
+ <!--invoke target="synchronize" dir="@{dir}"/-->
+ <!--execant target="synchronize.after" dir="@{dir}"/-->
+ </componentmain>
+
+ <!-- If the component doesn't exist and we want to
+ get the source build check it out from cvs
+ -->
+ <componentmain unless="@{exists}" if="@{local}">
+ <cvs dest="@{dir.parent}">
+ <commandline>
+ <argument value="-d"/>
+ <argument value="@{build.cvsroot}"/>
+ <argument value="co"/>
+ <argument value="-d"/>
+ <argument value="@{id}"/>
+ <argument value="@{module}"/>
+ </commandline>
+ </cvs>
+ <!-- execant target="synchronize.after" dir="@{dir}"/-->
+ </componentmain>
+
+ <!-- The component already exists do a cvs update
+ and run the after synchronization
+ -->
+ <component nomain="true">
+ <cvs command="update -dP" failonerror="true"/>
+ <!--execant target="synchronize.after"/-->
+ </component>
+
+ <!-- If we are not doing a source checkout of this
+ component, download the artifacts to thirdparty
+ -->
+ <artifact unless="@{component.local}">
+ <mkdir dir="@{parentDir}"/>
+ <get src="@{location}"
+ dest="@{output}"
+ useTimestamp="false"
+ verbose="true"
+ />
+ </artifact>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Commit -->
+ <!-- Commits the changes to cvs -->
+ <!-- ============================================================ -->
+
+ <targetdef target="commit" description="Commit">
+ <!-- Commit the main build and tools -->
+ <main>
+ <fail message="Use -Dm="xxx" to specify the commit message" unless="m"/>
+ <cvs failonerror="true">
+ <commandline>
+ <argument value="commit"/>
+ <argument value="-m"/>
+ <argument value="${m}"/>
+ </commandline>
+ </cvs>
+ <invoke target="commit" dir="../tools"/>
+ </main>
+ <!-- Commit the component -->
+ <component>
+ <fail message="Use -Dm="xxx" to specify the commit message" unless="m"/>
+ <cvs failonerror="true">
+ <commandline>
+ <argument value="commit"/>
+ <argument value="-m"/>
+ <argument value="${m}"/>
+ </commandline>
+ </cvs>
+ </component>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Test -->
+ <!-- Builds and runs the tests -->
+ <!-- ============================================================ -->
+
+ <targetdef target="test" description="Build and run the tests">
+ <component depends="build, runtest"/>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- RunTest -->
+ <!-- Runs the tests for sources marked with a test attribute -->
+ <!-- ============================================================ -->
+
+ <!-- Run the Test -->
+ <targetdef target="runtest" description="Run tests">
+ <component/>
+ <source when="@{test}">
+ <mkdir dir="@{testDir}"/>
+ <delete file="@{testDir}/test.log"/>
+ <junit fork="true"
+ printSummary="true">
+ <sysproperty key="org.jboss.test.logfile" value="@{testDir}/test.log"/>
+ <formatter type="plain"/>
+ <classpath>
+ <pathElements/>
+ </classpath>
+ <batchtest todir="@{testDir}">
+ <fileset dir="@{sourceDir}" includes="@{test}"/>
+ </batchtest>
+ </junit>
+ </source>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Rebuild -->
+ <!-- Synchronizes then builds -->
+ <!-- ============================================================ -->
+
+ <!-- Rebuild -->
+ <targetdef target="rebuild" description="Synchronize then build">
+ <common depends="synchronize">
+ <execant target="build"/>
+ </common>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- RebuildAll -->
+ <!-- Synchronizes then builds all -->
+ <!-- ============================================================ -->
+
+ <!-- Rebuild all -->
+ <targetdef target="rebuildall" description="Synchronize then build all">
+ <common depends="synchronize">
+ <execant target="all"/>
+ </common>
+ </targetdef>
+
+ <!-- ============================================================ -->
+ <!-- Synchronize.After -->
+ <!-- After synchronization processing -->
+ <!-- ============================================================ -->
+
+ <!-- After synchronization processing -->
+ <targetdef target="synchronize.after" description="After synchronization processing">
+ <main>
+ <idemain/>
+ </main>
+ <component>
+ <idecomponent/>
+ </component>
+ </targetdef>
+
+
+
+ </targets>
+
+<!-- ================================================================== -->
+<!-- Macro Definitions -->
+<!-- ================================================================== -->
+
+ <condition property="execant-executable" value="cmd.exe">
+ <os family="windows"/>
+ </condition>
+ <property name="execant-executable" value="ant"/>
+ <condition property="execant-prefix" value="/c ant">
+ <os family="windows"/>
+ </condition>
+ <property name="execant-prefix" value=""/>
+ <!-- Set the execant.args to empty unless it already exists -->
+ <condition property="execant.args" value="">
+ <not><isset property="execant.args"/></not>
+ </condition>
+
+ <!-- The execant macro -->
+ <macrodef name="execant">
+ <attribute name="dir"
+ default="${basedir}"
+ description="The directory"
+ />
+ <attribute name="target"
+ description="The target"
+ />
+ <attribute name="filename"
+ default="jbossbuild.xml"
+ description="The ant file to execute"
+ />
+ <sequential>
+ <!-- Invoke using a new ant -->
+ <exec dir="@{dir}"
+ executable="${execant-executable}"
+ >
+ <arg line="${execant-prefix} ${execant.args} -f @{filename} @{target}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <!-- The invoke macro -->
+ <macrodef name="invoke">
+ <attribute name="dir"
+ default="${basedir}"
+ description="The directory"
+ />
+ <attribute name="target"
+ description="The target"
+ />
+ <sequential>
+ <!-- Invoke using a new ant -->
+ <ant antfile="jbossbuild.xml" dir="@{dir}" target="@{target}"/>
+ </sequential>
+ </macrodef>
+
+<!-- ================================================================== -->
+<!-- Targets -->
+<!-- ================================================================== -->
+
+ <target name="help-fragment">
+ <fail message="Do not execute this build fragment directly!"/>
+ </target>
+
+</project>
+
Added: projects/perf/trunk/tools/lib/jbossbuild.jar
===================================================================
(Binary files differ)
Property changes on: projects/perf/trunk/tools/lib/jbossbuild.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-cvs-commits
mailing list