Author: milamber
Date: Sat Nov 20 23:59:07 2010
New Revision: 1037357
URL: http://svn.apache.org/viewvc?rev=1037357&view=rev
Log:
JMS Subscriber - Add dynamic destination
Modified:
jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_pub.png
jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_sub.png
jakarta/jmeter/trunk/docs/images/screenshots/jmssubscriber.png
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/images/screenshots/jms/jms_sub.png
jakarta/jmeter/trunk/xdocs/images/screenshots/jmssubscriber.png
jakarta/jmeter/trunk/xdocs/usermanual/build-jms-topic-test-plan.xml
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_pub.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_pub.png?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_sub.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/jms/jms_sub.png?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/docs/images/screenshots/jmssubscriber.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/docs/images/screenshots/jmssubscriber.png?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
Binary files - no diff available.
Modified:
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java
Sat Nov 20 23:59:07 2010
@@ -21,6 +21,7 @@ package org.apache.jmeter.protocol.jms.c
import java.awt.BorderLayout;
import javax.naming.Context;
+import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@@ -91,6 +92,16 @@ public class JMSSubscriberGui extends Ab
private final JCheckBox stopBetweenSamples =
new JCheckBox(JMeterUtils.getResString("jms_stop_between_samples"),
true); // $NON-NLS-1$
+ // 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$
+
+ private final static String DEST_SETUP_DYNAMIC = "jms_dest_setup_dynamic";
// $NON-NLS-1$
+ // Button group resources
+ private final static String[] DEST_SETUP_ITEMS = { DEST_SETUP_STATIC,
DEST_SETUP_DYNAMIC };
+
+ private final JLabeledRadioI18N destSetup =
+ new JLabeledRadioI18N("jms_dest_setup", DEST_SETUP_ITEMS,
DEST_SETUP_STATIC); // $NON-NLS-1$
+
public JMSSubscriberGui() {
init();
}
@@ -129,6 +140,7 @@ public class JMSSubscriberGui extends Ab
sampler.setClientChoice(clientChoice.getText());
sampler.setStopBetweenSamples(stopBetweenSamples.isSelected());
sampler.setTimeout(timeout.getText());
+
sampler.setDestinationStatic(destSetup.getText().equals(DEST_SETUP_STATIC));
}
/**
@@ -151,7 +163,7 @@ public class JMSSubscriberGui extends Ab
mainPanel.add(jndiICF);
mainPanel.add(urlField);
mainPanel.add(jndiConnFac);
- mainPanel.add(jmsDestination);
+ mainPanel.add(createDestinationPane());
mainPanel.add(useAuth);
mainPanel.add(jmsUser);
mainPanel.add(jmsPwd);
@@ -189,6 +201,7 @@ public class JMSSubscriberGui extends Ab
clientChoice.setText(sampler.getClientChoice());
stopBetweenSamples.setSelected(sampler.isStopBetweenSamples());
timeout.setText(sampler.getTimeout());
+ destSetup.setText(sampler.isDestinationStatic() ? DEST_SETUP_STATIC :
DEST_SETUP_DYNAMIC);
}
@Override
@@ -207,6 +220,7 @@ public class JMSSubscriberGui extends Ab
readResponse.setSelected(true);
clientChoice.setText(RECEIVE_RSC);
stopBetweenSamples.setSelected(false);
+ destSetup.setText(DEST_SETUP_STATIC);
}
/**
@@ -222,4 +236,12 @@ public class JMSSubscriberGui extends Ab
jmsPwd.setEnabled(!useAuth.isSelected());
}
}
+
+ private JPanel createDestinationPane() {
+ JPanel pane = new JPanel(new BorderLayout(3, 0));
+ pane.add(jmsDestination, BorderLayout.CENTER);
+ destSetup.setLayout(new BoxLayout(destSetup, BoxLayout.X_AXIS));
+ pane.add(destSetup, BorderLayout.EAST);
+ return pane;
+ }
}
\ No newline at end of file
Modified:
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
Sat Nov 20 23:59:07 2010
@@ -78,7 +78,8 @@ public class SubscriberSampler extends B
private static final String TIMEOUT = "jms.timeout"; // $NON-NLS-1$
private static final String TIMEOUT_DEFAULT = "";
private static final String STOP_BETWEEN = "jms.stop_between_samples"; //
$NON-NLS-1$
-
+
+ private transient boolean START_ON_SAMPLE = false;
public SubscriberSampler() {
}
@@ -118,6 +119,10 @@ public class SubscriberSampler extends B
// TODO - should we call start() and stop()?
@Override
public SampleResult sample() {
+ // run threadStarted only if Destination setup on each sample
+ if (!isDestinationStatic()) {
+ threadStarted(true);
+ }
SampleResult result = new SampleResult();
result.setDataType(SampleResult.TEXT);
result.setSampleLabel(getName());
@@ -188,6 +193,10 @@ public class SubscriberSampler extends B
log.warn("Problem stopping subscriber", e);
}
}
+ // run threadFinished only if Destination setup on each sample (stop
Listen queue)
+ if (!isDestinationStatic()) {
+ threadFinished(true);
+ }
return result;
}
@@ -238,37 +247,47 @@ public class SubscriberSampler extends B
* {...@inheritdoc}
*/
public void threadStarted() {
- timeout = getTimeoutAsLong();
- interrupted = false;
- exceptionDuringInit = null;
- useReceive = getClientChoice().equals(JMSSubscriberGui.RECEIVE_RSC);
- stopBetweenSamples = isStopBetweenSamples();
- if (useReceive) {
- try {
- initReceiveClient();
- if (!stopBetweenSamples){ // Don't start yet if stop between
samples
- SUBSCRIBER.start();
+ // Disabled thread start if listen on sample choice
+ if (isDestinationStatic() || START_ON_SAMPLE) {
+ timeout = getTimeoutAsLong();
+ interrupted = false;
+ exceptionDuringInit = null;
+ useReceive =
getClientChoice().equals(JMSSubscriberGui.RECEIVE_RSC);
+ stopBetweenSamples = isStopBetweenSamples();
+ if (useReceive) {
+ try {
+ initReceiveClient();
+ if (!stopBetweenSamples){ // Don't start yet if stop
between samples
+ SUBSCRIBER.start();
+ }
+ } catch (NamingException e) {
+ exceptionDuringInit = e;
+ } catch (JMSException e) {
+ exceptionDuringInit = e;
}
- } catch (NamingException e) {
- exceptionDuringInit = e;
- } catch (JMSException e) {
- exceptionDuringInit = e;
- }
- } else {
- try {
- initListenerClient();
- if (!stopBetweenSamples){ // Don't start yet if stop between
samples
- SUBSCRIBER.start();
+ } else {
+ try {
+ initListenerClient();
+ if (!stopBetweenSamples){ // Don't start yet if stop
between samples
+ SUBSCRIBER.start();
+ }
+ } catch (JMSException e) {
+ exceptionDuringInit = e;
+ } catch (NamingException e) {
+ exceptionDuringInit = e;
}
- } catch (JMSException e) {
- exceptionDuringInit = e;
- } catch (NamingException e) {
- exceptionDuringInit = e;
+ }
+ if (exceptionDuringInit != null){
+ log.error("Could not initialise client",exceptionDuringInit);
}
}
- if (exceptionDuringInit != null){
- log.error("Could not initialise client",exceptionDuringInit);
+ }
+
+ public void threadStarted(boolean wts) {
+ if (wts) {
+ START_ON_SAMPLE = true; // listen on sample
}
+ threadStarted();
}
/**
@@ -281,6 +300,13 @@ public class SubscriberSampler extends B
SUBSCRIBER.close();
}
}
+
+ public void threadFinished(boolean wts) {
+ if (wts) {
+ START_ON_SAMPLE = false; // listen on sample
+ }
+ threadFinished();
+ }
/**
* Handle an interrupt of the test.
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Sat Nov 20 23:59:07 2010
@@ -125,6 +125,7 @@ To override the default local language f
<li>Bug 49775 - Allow sending messages without a body</li>
<li>Bug 49862 - Improve SMTPSampler Request output.</li>
<li>Bug 50268 - Adds static and dynamic destinations to JMS Publisher</li>
+<li>JMS Subscriber - Add dynamic destination</li>
</ul>
<h3>Controllers</h3>
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/jms/jms_sub.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/jms/jms_sub.png?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/jmssubscriber.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/jmssubscriber.png?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/build-jms-topic-test-plan.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/build-jms-topic-test-plan.xml?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/build-jms-topic-test-plan.xml
(original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/build-jms-topic-test-plan.xml Sat Nov
20 23:59:07 2010
@@ -125,7 +125,10 @@ Then, select the JMS Subscriber element
<li>Enter the provider URL. This is the URL for the JNDI server, if there is
one. For example, with ActiveMQ 5.4 on local machine with default port, the
value is "tcp://localhost:61616"</li>
<li>Enter the name of the connection factory. Please refer to the documentation
of the JMS provider for the information. For ActiveMQ, the default is
"ConnectionFactory"</li>
-<li>Enter the name of the message topic. For ActiveMQ Dynamic Topics (create
topics dynamically), example value is "dynamicTopics/MyStaticTopic1"</li>
+<li>Enter the name of the message topic. For ActiveMQ Dynamic Topics (create
topics dynamically), example value is "dynamicTopics/MyStaticTopic1"
+Note: Setup at startup mean that JMeter starting to listen on the Destination
at beginning of test without name change possibility.
+Setup on Each sample mean that JMeter (re)starting to listen before run each
JMS Subscriber sample,
+this last option permit to have Destination name with some JMeter
variables</li>
<li>If the JMS provider requires authentication, check "required" and enter
the
username and password. For example, Orion JMS requires authentication, while
ActiveMQ
and MQSeries does not</li>
@@ -154,8 +157,8 @@ Then, select the JMS Publisher element i
<li>Enter the name of the connection factory. Please refer to the documentation
of the JMS provider for the information. For ActiveMQ, the default is
"ConnectionFactory"</li>
<li>Enter the name of the message topic. For ActiveMQ Dynamic Topics (create
topics dynamically), example value is "dynamicTopics/MyStaticTopic1".
-Note: Setup at startup mean that JMeter starting connection with the
Destination at begin's test without name change possibility.
-Setup on Each sample mean that JMeter (re)starting the connection before
execute each JMS Publisher sample,
+Note: Setup at startup mean that JMeter starting connection with the
Destination at beginning of test without name change possibility.
+Setup on Each sample mean that JMeter (re)starting the connection before run
each JMS Publisher sample,
this last option permit to have Destination name with some JMeter
variables</li>
<li>If the JMS provider requires authentication, check "required" and enter
the
username and password. For example, Orion JMS requires authentication, while
ActiveMQ
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1037357&r1=1037356&r2=1037357&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Nov 20
23:59:07 2010
@@ -1205,7 +1205,7 @@ The following table shows some values wh
</p>
</component>
-<component name="JMS Subscriber" index="§-num;.1.14" width="679"
height="408" screenshot="jmssubscriber.png">
+<component name="JMS Subscriber" index="§-num;.1.14"
screenshot="jmssubscriber.png">
<note>BETA CODE - the code is still subject to change</note>
<description>
<p>
@@ -1226,6 +1226,7 @@ The following table shows some values wh
<property name="JNDI Initial Context Factory" required="No">Name of the
context factory</property>
<property name="Provider URL" required="No">The URL for the jms
provider</property>
<property name="Destination" required="Yes">the message destination (topic
or queue name)</property>
+ <property name="Setup" required="Yes">The destination setup type. With At
startup, the destination name is static (i.e. always same name during the
test), with Each sample, the destination name is dynamic and is evaluate at
each sample (i.e. the destination name may be a variable)</property>
<property name="Authentication" required="Yes">Authentication requirement
for the JMS provider</property>
<property name="User" required="No">User Name</property>
<property name="Password" required="No">Password</property>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]