jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1293947 - in /jmeter/trunk: src/protocol/jms/org/apache/jmeter/protocol/jms/client/ src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/ src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/ xdocs/
Date Sun, 26 Feb 2012 22:16:10 GMT
Author: pmouawad
Date: Sun Feb 26 22:16:10 2012
New Revision: 1293947

URL: http://svn.apache.org/viewvc?rev=1293947&view=rev
Log:
Bug 52775 - JMS Publisher : Add Non Persistent Delivery option

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java?rev=1293947&r1=1293946&r2=1293947&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java (original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java Sun
Feb 26 22:16:10 2012
@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import javax.jms.Connection;
+import javax.jms.DeliveryMode;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.MapMessage;
@@ -54,6 +55,29 @@ public class Publisher implements Closea
 
     /**
      * Create a publisher using either the jndi.properties file or the provided parameters.
+     * Uses a static destination and persistent messages(for backward compatibility)
+     * 
+     * @param useProps true if a jndi.properties file is to be used
+     * @param initialContextFactory the (ignored if useProps is true)
+     * @param providerUrl (ignored if useProps is true)
+     * @param connfactory
+     * @param destinationName
+     * @param useAuth (ignored if useProps is true)
+     * @param securityPrincipal (ignored if useProps is true)
+     * @param securityCredentials (ignored if useProps is true) 
+     * @throws JMSException if the context could not be initialised, or there was some other
error
+     * @throws NamingException 
+     */
+    public Publisher(boolean useProps, String initialContextFactory, String providerUrl,

+            String connfactory, String destinationName, boolean useAuth,
+            String securityPrincipal, String securityCredentials) throws JMSException, NamingException
{
+        this(useProps, initialContextFactory, providerUrl, connfactory,
+                destinationName, useAuth, securityPrincipal,
+                securityCredentials, true, false);
+    }
+    
+    /**
+     * Create a publisher using either the jndi.properties file or the provided parameters.
      * Uses a static destination (for backward compatibility)
      * 
      * @param useProps true if a jndi.properties file is to be used
@@ -64,15 +88,16 @@ public class Publisher implements Closea
      * @param useAuth (ignored if useProps is true)
      * @param securityPrincipal (ignored if useProps is true)
      * @param securityCredentials (ignored if useProps is true)
+     * @param useNonPersistentMessages Flag Delivery Mode as Non persistent if true
      * @throws JMSException if the context could not be initialised, or there was some other
error
      * @throws NamingException 
      */
     public Publisher(boolean useProps, String initialContextFactory, String providerUrl,

             String connfactory, String destinationName, boolean useAuth,
-            String securityPrincipal, String securityCredentials) throws JMSException, NamingException
{
+            String securityPrincipal, String securityCredentials, boolean useNonPersistentMessages)
throws JMSException, NamingException {
         this(useProps, initialContextFactory, providerUrl, connfactory,
                 destinationName, useAuth, securityPrincipal,
-                securityCredentials, true);
+                securityCredentials, true, useNonPersistentMessages);
     }
     
     /**
@@ -86,13 +111,14 @@ public class Publisher implements Closea
      * @param securityPrincipal (ignored if useProps is true)
      * @param securityCredentials (ignored if useProps is true)
      * @param staticDestination true is the destination is not to change between loops
+     * @param useNonPersistentMessages Flag Delivery Mode as Non persistent if true
      * @throws JMSException if the context could not be initialised, or there was some other
error
      * @throws NamingException 
      */
     public Publisher(boolean useProps, String initialContextFactory, String providerUrl,

             String connfactory, String destinationName, boolean useAuth,
             String securityPrincipal, String securityCredentials,
-            boolean staticDestination) throws JMSException, NamingException {
+            boolean staticDestination,  boolean useNonPersistentMessages) throws JMSException,
NamingException {
         super();
         boolean initSuccess = false;
         try{
@@ -107,6 +133,9 @@ public class Publisher implements Closea
             } else {
                 producer = session.createProducer(null);
             }
+            if(useNonPersistentMessages) {
+                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            }
             initSuccess = true;
         } finally {
             if(!initSuccess) {

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java?rev=1293947&r1=1293946&r2=1293947&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
Sun Feb 26 22:16:10 2012
@@ -99,6 +99,7 @@ public class JMSPublisherGui extends Abs
 
     private final JLabeledRadioI18N msgChoice = new JLabeledRadioI18N("jms_message_type",
MSGTYPES_ITEMS, TEXT_MSG_RSC); //$NON-NLS-1$
     
+    private JCheckBox useNonPersistentDelivery;
 
     // These are the names of properties used to define the labels
     private final static String DEST_SETUP_STATIC = "jms_dest_setup_static"; // $NON-NLS-1$
@@ -141,6 +142,7 @@ public class JMSPublisherGui extends Abs
         sampler.setMessageChoice(msgChoice.getText());
         sampler.setIterations(iterations.getText());
         sampler.setUseAuth(useAuth.isSelected());
+        sampler.setUseNonPersistentDelivery(useNonPersistentDelivery.isSelected());
         return sampler;
     }
 
@@ -167,6 +169,7 @@ public class JMSPublisherGui extends Abs
         sampler.setIterations(iterations.getText());
         sampler.setUseAuth(useAuth.isSelected());
         sampler.setDestinationStatic(destSetup.getText().equals(DEST_SETUP_STATIC));
+        sampler.setUseNonPersistentDelivery(useNonPersistentDelivery.isSelected());
     }
 
     /**
@@ -228,6 +231,7 @@ public class JMSPublisherGui extends Abs
         jmsUser.setEnabled(false);
         jmsPwd.setEnabled(false);
         destSetup.setText(DEST_SETUP_STATIC);
+        useNonPersistentDelivery.setSelected(false);
     }
 
     /**
@@ -255,6 +259,7 @@ public class JMSPublisherGui extends Abs
         jmsUser.setEnabled(useAuth.isSelected());
         jmsPwd.setEnabled(useAuth.isSelected());
         destSetup.setText(sampler.isDestinationStatic() ? DEST_SETUP_STATIC : DEST_SETUP_DYNAMIC);
+        useNonPersistentDelivery.setSelected(sampler.getUseNonPersistentDelivery());
     }
 
     /**
@@ -314,9 +319,11 @@ public class JMSPublisherGui extends Abs
     
     private JPanel createDestinationPane() {
         JPanel pane = new JPanel(new BorderLayout(3, 0));
-        pane.add(jmsDestination, BorderLayout.CENTER);
+        pane.add(jmsDestination, BorderLayout.WEST);
         destSetup.setLayout(new BoxLayout(destSetup, BoxLayout.X_AXIS));
-        pane.add(destSetup, BorderLayout.EAST);
+        pane.add(destSetup, BorderLayout.CENTER);
+        useNonPersistentDelivery = new JCheckBox(JMeterUtils.getResString("jms_use_non_persistent_delivery"),false);
//$NON-NLS-1$
+        pane.add(useNonPersistentDelivery, BorderLayout.EAST);
         return pane;
     }
 }

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java?rev=1293947&r1=1293946&r2=1293947&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
Sun Feb 26 22:16:10 2012
@@ -60,6 +60,8 @@ public class PublisherSampler extends Ba
     private static final String CONFIG_CHOICE = "jms.config_choice"; //$NON-NLS-1$
 
     private static final String MESSAGE_CHOICE = "jms.config_msg_type"; //$NON-NLS-1$
+    
+    private static final String NON_PERSISTENT_DELIVERY = "jms.non_persistent"; //$NON-NLS-1$
     //--
 
     // Does not need to be synch. because it is only accessed from the sampler thread
@@ -117,7 +119,7 @@ public class PublisherSampler extends Ba
     private void initClient() throws JMSException, NamingException {
         publisher = new Publisher(getUseJNDIPropertiesAsBoolean(), getJNDIInitialContextFactory(),

                 getProviderUrl(), getConnectionFactory(), getDestination(), isUseAuth(),
getUsername(),
-                getPassword(), isDestinationStatic());
+                getPassword(), isDestinationStatic(), getUseNonPersistentDelivery());
         ClientPool.addClient(publisher);
         log.debug("PublisherSampler.initClient called");
     }
@@ -344,4 +346,18 @@ public class PublisherSampler extends Ba
     public String getTextMessage() {
         return getPropertyAsString(TEXT_MSG);
     }
+
+    /**
+     * @param value boolean use NON_PERSISTENT
+     */
+    public void setUseNonPersistentDelivery(boolean value) {
+        setProperty(NON_PERSISTENT_DELIVERY, value, false);
+    }
+    
+    /**
+     * @return true if NON_PERSISTENT delivery must be used
+     */
+    public boolean getUseNonPersistentDelivery() {
+        return getPropertyAsBoolean(NON_PERSISTENT_DELIVERY, false);
+    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1293947&r1=1293946&r2=1293947&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Feb 26 22:16:10 2012
@@ -121,6 +121,7 @@ When doing replacement of User Defined V
 
 <h3>Other samplers</h3>
 <ul>
+<li>Bug 52775 - JMS Publisher : Add Non Persistent Delivery option</li>
 </ul>
 
 <h3>Controllers</h3>



Mime
View raw message