[jboss-cvs] JBoss Messaging SVN: r7715 - in trunk/examples/soak/reconnect: server0 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 12 09:32:32 EDT 2009


Author: jmesnil
Date: 2009-08-12 09:32:32 -0400 (Wed, 12 Aug 2009)
New Revision: 7715

Removed:
   trunk/examples/soak/reconnect/jndi.properties
Modified:
   trunk/examples/soak/reconnect/build.xml
   trunk/examples/soak/reconnect/server0/jbm-configuration.xml
   trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java
   trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java
   trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java
Log:
JBMESSAGING-1589: Soak tests

* server configuration can be modified: ant -Dserver.dir=<path to server conf> runServer
  - dir defaults to server0
* senders and receivers JNDI conf can be modified: ant -Djndi.address=192.168.0.10 -Djndi.port=2099 runServer
  - address (resp. port) defaults to localhost (resp. 1099)

Modified: trunk/examples/soak/reconnect/build.xml
===================================================================
--- trunk/examples/soak/reconnect/build.xml	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/build.xml	2009-08-12 13:32:32 UTC (rev 7715)
@@ -32,8 +32,12 @@
 
 	<import file="../../common/build.xml" />
 
+    <property name="server.dir" value="server0" />
+    <property name="jndi.address" value="localhost" />
+    <property name="jndi.port" value="1099" />
+
 	<path id="extra.classpath">
-		<path location="server0" />
+		<path location="${server.dir}" />
 		<fileset dir="extra-libs">
 			<include name="*.jar" />
 		</fileset>
@@ -45,6 +49,7 @@
 	</path>
 
 	<target name="runSender" depends="compile">
+	    <property name="jndi.url" value="jnp://${jndi.address}:${jndi.port}" />
 		<java classname="org.jboss.jms.soak.example.reconnect.SoakReconnectableSender" fork="true" resultproperty="example-result">
 			<jvmarg value="-Xms512M" />
 			<jvmarg value="-Xmx512M" />
@@ -57,10 +62,12 @@
              -->
 			<jvmarg value="-Djava.util.logging.config.file=${config.dir}/logging.properties" />
 			<classpath refid="the.classpath" />
+			<arg line="${jndi.url}" />
 		</java>
 	</target>
 
 	<target name="runReceiver" depends="compile">
+	    <property name="jndi.url" value="jnp://${jndi.address}:${jndi.port}" />
 		<java classname="org.jboss.jms.soak.example.reconnect.SoakReconnectableReceiver" fork="true" resultproperty="example-result">
 			<jvmarg value="-Xms512M" />
 			<jvmarg value="-Xmx512M" />
@@ -73,11 +80,13 @@
              -->
 			<jvmarg value="-Djava.util.logging.config.file=${config.dir}/logging.properties" />
 			<classpath refid="the.classpath" />
+			<arg line="${jndi.url}" />
 		</java>
 	</target>
 
 	<target name="runServer" depends="compile">
-		<java classname="org.jboss.common.example.SpawnedJBMServer" fork="true" resultproperty="example-result">
+	    <echo message="Using server configuration from server.dir: ${server.dir}" />
+		<java classname="org.jboss.common.example.SpawnedJBMServer" fork="true" clonevm="true" resultproperty="example-result">
 			<jvmarg value="-Xms2048M" />
 			<jvmarg value="-Xmx2048M" />
 			<jvmarg value="-XX:+UseParallelGC" />

Deleted: trunk/examples/soak/reconnect/jndi.properties
===================================================================
--- trunk/examples/soak/reconnect/jndi.properties	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/jndi.properties	2009-08-12 13:32:32 UTC (rev 7715)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Modified: trunk/examples/soak/reconnect/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/soak/reconnect/server0/jbm-configuration.xml	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/server0/jbm-configuration.xml	2009-08-12 13:32:32 UTC (rev 7715)
@@ -8,6 +8,7 @@
          <param key="jbm.remoting.netty.tcpnodelay" value="false" type="Boolean"/>
          <param key="jbm.remoting.netty.tcpsendbuffersize" value="1048576" type="Integer"/>
          <param key="jbm.remoting.netty.tcpreceivebuffersize" value="1048576" type="Integer"/>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
       </connector>
    </connectors>
    
@@ -18,6 +19,7 @@
          <param key="jbm.remoting.netty.tcpnodelay" value="false" type="Boolean"/>
          <param key="jbm.remoting.netty.tcpsendbuffersize" value="1048576" type="Integer"/>
          <param key="jbm.remoting.netty.tcpreceivebuffersize" value="1048576" type="Integer"/>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
       </acceptor>
    </acceptors>
 

Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java	2009-08-12 13:32:32 UTC (rev 7715)
@@ -62,9 +62,9 @@
    {
       String fileName;
 
-      if (args.length > 0)
+      if (args.length > 2)
       {
-         fileName = args[0];
+         fileName = args[1];
       }
       else
       {

Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java	2009-08-12 13:32:32 UTC (rev 7715)
@@ -21,6 +21,7 @@
    */
 package org.jboss.jms.soak.example.reconnect;
 
+import java.util.Hashtable;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
@@ -45,14 +46,31 @@
 
    public static void main(String[] args)
    {
+      for (int i = 0; i < args.length; i++)
+      {
+         System.out.println(i + ":" + args[i]);
+      }
+      String jndiURL = "jndi://localhost:1099";
+      if (args.length > 0)
+      {
+         jndiURL = args[0];
+      }
+      
+      System.out.println("Connecting to JNDI at " + jndiURL);
+      
       try
       {
          String fileName = SoakBase.getPerfFileName(args);
 
          SoakParams params = SoakBase.getParams(fileName);
 
-         final SoakReconnectableReceiver receiver = new SoakReconnectableReceiver(params);
+         Hashtable<String, String> jndiProps = new Hashtable<String, String>();
+         jndiProps.put("java.naming.provider.url", jndiURL);
+         jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+         jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
 
+         final SoakReconnectableReceiver receiver = new SoakReconnectableReceiver(jndiProps, params);
+
          Runtime.getRuntime().addShutdownHook(new Thread()
          {
             @Override
@@ -70,13 +88,11 @@
       }
    }
 
-   private SoakParams perfParams;
+   private final Hashtable<String, String> jndiProps;
 
-   private Destination destination;
+   private final SoakParams perfParams;
 
-   private Connection connection;
-
-   private ExceptionListener exceptionListener = new ExceptionListener()
+   private final ExceptionListener exceptionListener = new ExceptionListener()
    {
       public void onException(JMSException e)
       {
@@ -85,7 +101,7 @@
       }
    };
 
-   private MessageListener listener = new MessageListener()
+   private final MessageListener listener = new MessageListener()
    {
       int modulo = 10000;
 
@@ -123,8 +139,11 @@
 
    private Session session;
 
-   private SoakReconnectableReceiver(final SoakParams perfParams)
+   private Connection connection;
+
+   private SoakReconnectableReceiver(final Hashtable<String, String> jndiProps, final SoakParams perfParams)
    {
+      this.jndiProps = jndiProps;
       this.perfParams = perfParams;
    }
 
@@ -182,11 +201,11 @@
       InitialContext ic = null;
       try
       {
-         ic = new InitialContext();
+         ic = new InitialContext(jndiProps);
 
          ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup());
 
-         destination = (Destination)ic.lookup(perfParams.getDestinationLookup());
+         Destination destination = (Destination)ic.lookup(perfParams.getDestinationLookup());
 
          connection = factory.createConnection();
          connection.setExceptionListener(exceptionListener);

Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java	2009-08-12 13:29:37 UTC (rev 7714)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java	2009-08-12 13:32:32 UTC (rev 7715)
@@ -21,6 +21,7 @@
    */
 package org.jboss.jms.soak.example.reconnect;
 
+import java.util.Hashtable;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
 
@@ -46,14 +47,30 @@
 
    public static void main(String[] args)
    {
+      for (int i = 0; i < args.length; i++)
+      {
+         System.out.println(i + ":" + args[i]);
+      }
+      String jndiURL = "jndi://localhost:1099";
+      if (args.length > 0)
+      {
+         jndiURL = args[0];
+      }
+      
+      System.out.println("Connecting to JNDI at " + jndiURL);
       try
       {
          String fileName = SoakBase.getPerfFileName(args);
 
          SoakParams params = SoakBase.getParams(fileName);
 
-         final SoakReconnectableSender sender = new SoakReconnectableSender(params);
+         Hashtable<String, String> jndiProps = new Hashtable<String, String>();
+         jndiProps.put("java.naming.provider.url", jndiURL);
+         jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+         jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
 
+         final SoakReconnectableSender sender = new SoakReconnectableSender(jndiProps, params);
+
          Runtime.getRuntime().addShutdownHook(new Thread()
          {
             @Override
@@ -71,9 +88,9 @@
       }
    }
 
-   private SoakParams perfParams;
+   private final SoakParams perfParams;
 
-   private Destination destination;
+   private final Hashtable<String, String> jndiProps;
 
    private Connection connection;
 
@@ -81,7 +98,7 @@
 
    private MessageProducer producer;
 
-   private ExceptionListener exceptionListener = new ExceptionListener()
+   private final ExceptionListener exceptionListener = new ExceptionListener()
    {
       public void onException(JMSException e)
       {
@@ -92,8 +109,9 @@
 
    };
 
-   private SoakReconnectableSender(final SoakParams perfParams)
+   private SoakReconnectableSender(final Hashtable<String, String> jndiProps, final SoakParams perfParams)
    {
+      this.jndiProps = jndiProps;
       this.perfParams = perfParams;
    }
 
@@ -198,11 +216,11 @@
       InitialContext ic = null;
       try
       {
-         ic = new InitialContext();
+         ic = new InitialContext(jndiProps);
 
          ConnectionFactory factory = (ConnectionFactory)ic.lookup(perfParams.getConnectionFactoryLookup());
 
-         destination = (Destination)ic.lookup(perfParams.getDestinationLookup());
+         Destination destination = (Destination)ic.lookup(perfParams.getDestinationLookup());
 
          connection = factory.createConnection();
 




More information about the jboss-cvs-commits mailing list