You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/10/02 21:23:05 UTC

svn commit: r701218 - in /jakarta/jmeter/trunk: docs/images/screenshots/jms/ src/core/org/apache/jmeter/resources/ src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/ src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/ xdocs/ xdocs/images...

Author: sebb
Date: Thu Oct  2 12:23:05 2008
New Revision: 701218

URL: http://svn.apache.org/viewvc?rev=701218&view=rev
Log:
Bug 45571 - JMS Sampler correlation enhancement

Modified:
    jakarta/jmeter/trunk/docs/images/screenshots/jms/JMS_Point-to-Point.png
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSConfigGui.java
    jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
    jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/images/screenshots/jms/JMS_Point-to-Point.png
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/docs/images/screenshots/jms/JMS_Point-to-Point.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/jms/JMS_Point-to-Point.png?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Thu Oct  2 12:23:05 2008
@@ -365,6 +365,7 @@
 jms_use_non_persistent_delivery=Use non-persistent delivery mode?
 jms_use_properties_file=Use jndi.properties file
 jms_use_random_file=Random File
+jms_use_req_msgid_as_correlid=Use Request Message Id As Correlation Id
 jms_use_text=Textarea
 jms_user=User
 jndi_config_title=JNDI Configuration

Modified: jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSConfigGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSConfigGui.java?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSConfigGui.java (original)
+++ jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSConfigGui.java Thu Oct  2 12:23:05 2008
@@ -70,6 +70,8 @@
     private ArgumentsPanel jndiPropertiesPanel;
 
     private JCheckBox useNonPersistentDelivery;
+    
+    private JCheckBox useReqMsgIdAsCorrelId;
 
     public JMSConfigGui() {
         init();
@@ -80,14 +82,14 @@
      */
     public void clearGui() {// renamed from clear
         super.clearGui();
-        queueuConnectionFactory.setText("");
-        sendQueue.setText("");
-        receiveQueue.setText("");
+        queueuConnectionFactory.setText(""); // $NON-NLS-1$
+        sendQueue.setText(""); // $NON-NLS-1$
+        receiveQueue.setText(""); // $NON-NLS-1$
         ((JComboBox) oneWay.getComponentList().get(1)).setSelectedItem(JMeterUtils.getResString("jms_request")); //$NON-NLS-1$
-        timeout.setText("");
-        soapXml.setText("");
-        initialContextFactory.setText("");
-        providerUrl.setText("");
+        timeout.setText("");  // $NON-NLS-1$
+        soapXml.setText(""); // $NON-NLS-1$
+        initialContextFactory.setText(""); // $NON-NLS-1$
+        providerUrl.setText(""); // $NON-NLS-1$
         jmsPropertiesPanel.clear();
         jndiPropertiesPanel.clear();
     }
@@ -110,6 +112,7 @@
         element.setIsOneway(isOneway);
 
         element.setNonPersistent(useNonPersistentDelivery.isSelected());
+        element.setUseReqMsgIdAsCorrelId(useReqMsgIdAsCorrelId.isSelected());
         element.setTimeout(timeout.getText());
         element.setContent(soapXml.getText());
 
@@ -179,7 +182,8 @@
         box.setSelectedItem(selected);
 
         useNonPersistentDelivery.setSelected(sampler.isNonPersistent());
-
+        useReqMsgIdAsCorrelId.setSelected(sampler.isUseReqMsgIdAsCorrelId());
+        
         timeout.setText(String.valueOf(sampler.getTimeout()));
         soapXml.setText(sampler.getContent());
         initialContextFactory.setText(sampler.getInitialContextFactory());
@@ -227,9 +231,12 @@
         messagePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
                 JMeterUtils.getResString("jms_message_title"))); //$NON-NLS-1$
 
+        useReqMsgIdAsCorrelId = new JCheckBox(JMeterUtils.getResString("jms_use_req_msgid_as_correlid"),false); //$NON-NLS-1$
+        
         JPanel messageNorthPanel = new JPanel(new BorderLayout());
-        JPanel onewayPanel = new JPanel(new BorderLayout());
+        JPanel onewayPanel = new HorizontalPanel();
         onewayPanel.add(oneWay);
+        onewayPanel.add(useReqMsgIdAsCorrelId);
         messageNorthPanel.add(onewayPanel, BorderLayout.NORTH);
 
         useNonPersistentDelivery = new JCheckBox(JMeterUtils.getResString("jms_use_non_persistent_delivery"),false); //$NON-NLS-1$

Modified: jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java (original)
+++ jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/FixedQueueExecutor.java Thu Oct  2 12:23:05 2008
@@ -42,6 +42,8 @@
 
     /** Timeout used for waiting on message. */
     private final int timeout;
+    
+    private final boolean useReqMsgIdAsCorrelId;
 
     /**
      * Constructor.
@@ -54,6 +56,23 @@
     public FixedQueueExecutor(QueueSender producer, int timeout) {
         this.producer = producer;
         this.timeout = timeout;
+        this.useReqMsgIdAsCorrelId = false;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param producer
+     *            the queue to send the message on
+     * @param timeout
+     *            timeout to use for the return message
+     * @param useReqMsgIdAsCorrelId
+     *            whether to use the request message id as the correlation id
+     */
+    public FixedQueueExecutor(QueueSender producer, int timeout, boolean useReqMsgIdAsCorrelId) {
+        this.producer = producer;
+        this.timeout = timeout;
+        this.useReqMsgIdAsCorrelId = useReqMsgIdAsCorrelId;
     }
 
     /*
@@ -63,11 +82,16 @@
      */
     public Message sendAndReceive(Message request) throws JMSException {
         String id = request.getJMSCorrelationID();
-        if(id == null){
+        if(id == null && !useReqMsgIdAsCorrelId){
             log.error("Correlation id is null. Set the JMSCorrelationID header");
             return null;
         }
         producer.send(request);
+        
+        if(useReqMsgIdAsCorrelId) {
+        	id = request.getJMSMessageID();
+        }
+
         MessageAdmin.getAdmin().putRequest(id, request);
         try {
             if (log.isDebugEnabled()) {

Modified: jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java Thu Oct  2 12:23:05 2008
@@ -57,6 +57,8 @@
 
     private static final Logger LOGGER = LoggingManager.getLoggerForClass();
 
+    private static final long serialVersionUID = 233L;
+
     private static final int DEFAULT_TIMEOUT = 2000;
 
     //++ These are JMX names, and must not be changed
@@ -82,6 +84,8 @@
 
     private static final String IS_NON_PERSISTENT = "JMSSampler.isNonPersistent"; // $NON-NLS-1$
 
+    private static final String USE_REQ_MSGID_AS_CORRELID = "JMSSampler.useReqMsgIdAsCorrelId"; // $NON-NLS-1$
+
     //--
 
     //
@@ -179,7 +183,13 @@
             if (LOGGER.isDebugEnabled()) {
                 LOGGER.debug("Adding property [" + name + "=" + value + "]");
             }
-            msg.setStringProperty(name, value);
+            
+            // WebsphereMQ does not allow corr. id. to be set using setStringProperty()
+            if("JMSCorrelationID".equalsIgnoreCase(name)) { // $NON-NLS-1$
+            	msg.setJMSCorrelationID(value);
+            } else {
+            	msg.setStringProperty(name, value);
+            }
         }
     }
 
@@ -239,6 +249,10 @@
         return getPropertyAsBoolean(IS_NON_PERSISTENT);
     }
 
+    public boolean isUseReqMsgIdAsCorrelId() {
+        return getPropertyAsBoolean(USE_REQ_MSGID_AS_CORRELID);
+    }
+
     public String getInitialContextFactory() {
         return getPropertyAsString(JMSSampler.JNDI_INITIAL_CONTEXT_FACTORY);
     }
@@ -255,6 +269,10 @@
         setProperty(new BooleanProperty(IS_NON_PERSISTENT, value));
     }
 
+    public void setUseReqMsgIdAsCorrelId(boolean value) {
+        setProperty(new BooleanProperty(USE_REQ_MSGID_AS_CORRELID, value));
+    }
+
     public String toString() {
         return getQueueConnectionFactory() + ", queue: " + getSendQueue();
     }
@@ -315,7 +333,7 @@
                     if (isNonPersistent()) {
                         producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                     }
-                    executor = new FixedQueueExecutor(producer, getTimeout());
+                    executor = new FixedQueueExecutor(producer, getTimeout(), isUseReqMsgIdAsCorrelId());
                 }
             }
             if (LOGGER.isDebugEnabled()) {

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Oct  2 12:23:05 2008
@@ -128,6 +128,7 @@
 <li>Bug 45694 - Support GZIP compressed logs</li>
 <li>Random Variable - new configuration element to create random numeric variables</li>
 <li>Bug 45929 - improved French translations</li>
+<li>Bug 45571 - JMS Sampler correlation enhancement</li>
 </ul>
 
 <h3>Non-functional changes</h3>

Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/jms/JMS_Point-to-Point.png
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/jms/JMS_Point-to-Point.png?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
Binary files - no diff available.

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=701218&r1=701217&r2=701218&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Oct  2 12:23:05 2008
@@ -1080,7 +1080,7 @@
 </properties>
 </component>
 
-<component name="JMS Point-to-Point" index="&sect-num;.1.15"  width="568" height="730" screenshot="jms/JMS_Point-to-Point.png">
+<component name="JMS Point-to-Point" index="&sect-num;.1.15"  width="635" height="733" screenshot="jms/JMS_Point-to-Point.png">
 <note>ALPHA CODE</note>
 	<description>
 		<p>
@@ -1111,6 +1111,10 @@
     temporary queues will be used for the communication between the requestor and the server. This is very different from
     the fixed reply queue. With temporary queues the diffent threads will block until the reply message has been received.
   </property>
+  <property name="Use Request Message Id As Correlation Id" required="Yes">
+    If this is selected, then the request message id is used as the correlation id.
+    Otherwise, the correlation id needs to be specified in the request.
+  </property>
   <property name="Timeout" required="Yes">
       The timeout in milliseconds for the reply-messages. If a reply has not been received within the specified
       time, the specific testcase failes and the specific reply message received after the timeout is discarded.



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org