jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1200586 - /jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
Date Thu, 10 Nov 2011 21:50:38 GMT
Author: pmouawad
Date: Thu Nov 10 21:50:38 2011
New Revision: 1200586

URL: http://svn.apache.org/viewvc?rev=1200586&view=rev
Log:
Bug 52052 - Using a delimiter to separate result-messages for JMS Subscriber 
There was an issue when following options were checked:
- stopBetweenSamples
- Read Response

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java?rev=1200586&r1=1200585&r2=1200586&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
Thu Nov 10 21:50:38 2011
@@ -25,6 +25,7 @@ import javax.jms.Message;
 import javax.jms.TextMessage;
 import javax.naming.NamingException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.jmeter.engine.event.LoopIterationEvent;
 import org.apache.jmeter.protocol.jms.Utils;
 import org.apache.jmeter.protocol.jms.client.InitialContextFactory;
@@ -110,6 +111,7 @@ public class SubscriberSampler extends B
         SUBSCRIBER = new ReceiveSubscriber(0, getUseJNDIPropertiesAsBoolean(), getJNDIInitialContextFactory(),
                     getProviderUrl(), getConnectionFactory(), getDestination(), getDurableSubscriptionId(),
                     getClientId(), getJmsSelector(), isUseAuth(), getUsername(), getPassword());
+        setupSeparator();
         log.debug("SubscriberSampler.initListenerClient called");
     }
 
@@ -122,6 +124,7 @@ public class SubscriberSampler extends B
         SUBSCRIBER = new ReceiveSubscriber(getUseJNDIPropertiesAsBoolean(),
                 getJNDIInitialContextFactory(), getProviderUrl(), getConnectionFactory(),
getDestination(),
                 getDurableSubscriptionId(), getClientId(), getJmsSelector(), isUseAuth(),
getUsername(), getPassword());
+        setupSeparator();
         log.debug("SubscriberSampler.initReceiveClient called");
     }
 
@@ -250,7 +253,10 @@ public class SubscriberSampler extends B
                     }
                 }
                 Utils.messageProperties(propBuffer, msg);
-                propBuffer.append(separator);
+                if(!StringUtils.isEmpty(separator)) {
+                	propBuffer.append(separator);
+                	buffer.append(separator);
+                }
             } catch (JMSException e) {
                 log.error(e.getMessage());
             }
@@ -450,24 +456,30 @@ public class SubscriberSampler extends B
      * {@inheritDoc}
      */
     public void testIterationStart(LoopIterationEvent event) {
-        //NOOP
+    	// NOOP
     }
 
     /**
      * {@inheritDoc}
      */
     public void testStarted() {
-    	separator = getSeparator();
-    	separator = separator.replace("\\t", "\t");
-    	separator = separator.replace("\\n", "\n");
-    	separator = separator.replace("\\r", "\r");
+    	testStarted("");
     }
 
     /**
      * {@inheritDoc}
      */
     public void testStarted(String host) {
-        // NOOP        
+    	// NOOP
     }
 
-}
+	/**
+	 * 
+	 */
+	private void setupSeparator() {
+		separator = getSeparator();
+		separator = separator.replace("\\t", "\t");
+		separator = separator.replace("\\n", "\n");
+		separator = separator.replace("\\r", "\r");
+	}
+}
\ No newline at end of file



Mime
View raw message