You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/10/22 16:57:04 UTC
svn commit: r1812931 - in /jmeter/trunk/bin/testfiles: JMS_TESTS.csv
JMS_TESTS.jmx JMS_TESTS.xml
Author: pmouawad
Date: Sun Oct 22 16:57:04 2017
New Revision: 1812931
URL: http://svn.apache.org/viewvc?rev=1812931&view=rev
Log:
JMS : Increase coverage
Add test for TemporaryQueue
Modified:
jmeter/trunk/bin/testfiles/JMS_TESTS.csv
jmeter/trunk/bin/testfiles/JMS_TESTS.jmx
jmeter/trunk/bin/testfiles/JMS_TESTS.xml
Modified: jmeter/trunk/bin/testfiles/JMS_TESTS.csv
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/JMS_TESTS.csv?rev=1812931&r1=1812930&r2=1812931&view=diff
==============================================================================
--- jmeter/trunk/bin/testfiles/JMS_TESTS.csv (original)
+++ jmeter/trunk/bin/testfiles/JMS_TESTS.csv Sun Oct 22 16:57:04 2017
@@ -1,6 +1,8 @@
label,responseCode,responseMessage,threadName,dataType,success,grpThreads,allThreads,SampleCount,ErrorCount
BSS_startActiveMQ,200,OK,setUp Thread Group 1-1,text,true,1,1,1,0
JMS-P2P-DefaultCorrelationId,200,OK,TG-JMS-P2P 1-1,text,true,1,1,1,0
+JSS-ConsumeUpcomingMessage,200,OK,TG-JMS-P2P 1-1,text,true,1,1,1,0
+JMS-P2P-DefaultCorrelationId-TempQueue,200,OK,TG-JMS-P2P 1-1,text,true,1,1,1,0
JMS-P2P-CustomCorrelationId,200,OK,TG-JMS-P2P 1-1,text,true,1,1,1,0
JMS-P2P-DifferentSelector,,No reply message received,TG-JMS-P2P 1-1,text,true,1,1,1,0
JMS-P2P-SameSelector,200,OK,TG-JMS-P2P 1-1,text,true,1,1,1,0
Modified: jmeter/trunk/bin/testfiles/JMS_TESTS.jmx
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/JMS_TESTS.jmx?rev=1812931&r1=1812930&r2=1812931&view=diff
==============================================================================
--- jmeter/trunk/bin/testfiles/JMS_TESTS.jmx (original)
+++ jmeter/trunk/bin/testfiles/JMS_TESTS.jmx Sun Oct 22 16:57:04 2017
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jmeterTestPlan version="1.2" properties="3.4" jmeter="3.4-SNAPSHOT.20171021">
+<jmeterTestPlan version="1.2" properties="3.4" jmeter="3.4-SNAPSHOT.20171022">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
@@ -95,6 +95,115 @@ bsh.shared.myMap.put("ACTIVEMQ_BROK
</collectionProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
+ <intProp name="Assertion.test_type">16</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ </hashTree>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSS-ConsumeUpcomingMessage" enabled="true">
+ <stringProp name="cacheKey">c7334ba5-f18d-407c-9a7f-28c29a6bee84</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters">dynamicQueues/requestQueue0-tmp</stringProp>
+ <stringProp name="script">import org.apache.activemq.ActiveMQConnectionFactory;
+import javax.jms.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+import java.util.Properties;
+def thread = Thread.start {
+ Properties props = new Properties();
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+ props.setProperty(Context.PROVIDER_URL,"tcp://127.0.0.1:61616");
+ Context namingCtx = new InitialContext(props);
+ ConnectionFactory cf = (ConnectionFactory)namingCtx.lookup("ConnectionFactory");
+ Connection con = cf.createConnection();
+ log.info("Creating connection to "+Parameters);
+ Destination dest = (Destination)namingCtx.lookup(Parameters);
+
+ try {
+ Session session =
+ con.createSession(false, Session.AUTO_ACKNOWLEDGE); // non-transacted session (more)
+ MessageConsumer consumer = session.createConsumer(dest);
+ consumer.setMessageListener(new MyMessageListener(session));
+ log.info("Starting connection to "+Parameters);
+ con.start(); // start the connection (more)
+ Thread.sleep(15000);
+ session.close();
+ log.info("Closed session");
+ } finally {
+ con.close(); // free all resources (more)
+ }
+}
+SampleResult.setResponseMessageOK();
+SampleResult.setResponseData("Started Message Consumer", "UTF-8");
+
+class MyMessageListener implements MessageListener {
+ Logger log = LoggerFactory.getLogger(MyMessageListener.class);
+ Session session;
+ public MyMessageListener(Session session) {
+ this.session = session;
+ }
+ public void onMessage(Message message) {
+ TextMessage textMessage = (TextMessage) message;
+ try {
+ Queue replyQueue = (Queue) message.getJMSReplyTo();
+ log.info("Reply queue is: {}", replyQueue);
+ log.info("Creating sender");
+ QueueSender sender = session.createSender(replyQueue);
+ log.info("Creating reply");
+ TextMessage reply = session.createTextMessage("Reply to:"+textMessage.getText());
+ log.info("Sending reply");
+ sender.send(reply);
+ log.info("Tidyup sender - you could be processing many requests");
+ sender.close();
+ } catch (JMSException e) {
+ log.error("Error replying to message", e);
+ }
+ }
+}
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ <stringProp name="TestPlan.comments">Uses ReplyTo Queue to answer a message</stringProp>
+ </JSR223Sampler>
+ <hashTree>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="1700117006">Started Message Consumer</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <boolProp name="Assertion.assume_success">false</boolProp>
+ <intProp name="Assertion.test_type">16</intProp>
+ </ResponseAssertion>
+ <hashTree/>
+ </hashTree>
+ <JMSSampler guiclass="JMSSamplerGui" testclass="JMSSampler" testname="JMS-P2P-DefaultCorrelationId-TempQueue" enabled="true">
+ <stringProp name="JMSSampler.queueconnectionfactory">ConnectionFactory</stringProp>
+ <stringProp name="JMSSampler.SendQueue">dynamicQueues/requestQueue0-tmp</stringProp>
+ <stringProp name="JMSSampler.ReceiveQueue"></stringProp>
+ <boolProp name="JMSSampler.isFireAndForget">false</boolProp>
+ <boolProp name="JMSSampler.isNonPersistent">false</boolProp>
+ <boolProp name="JMSSampler.useReqMsgIdAsCorrelId">true</boolProp>
+ <stringProp name="JMSSampler.timeout"></stringProp>
+ <stringProp name="HTTPSamper.xml_data">Test</stringProp>
+ <stringProp name="JMSSampler.initialContextFactory">org.apache.activemq.jndi.ActiveMQInitialContextFactory</stringProp>
+ <stringProp name="JMSSampler.contextProviderUrl">tcp://localhost:61616</stringProp>
+ <elementProp name="JMSSampler.jndiProperties" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <elementProp name="arguments" elementType="JMSProperties">
+ <collectionProp name="JMSProperties.properties"/>
+ </elementProp>
+ <boolProp name="JMSSampler.useResMsgIdAsCorrelId">true</boolProp>
+ <stringProp name="TestPlan.comments">Test case where Request queue is empty meaning we'll wait for a reply on ReplyTo queue</stringProp>
+ </JMSSampler>
+ <hashTree>
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <collectionProp name="Asserion.test_strings">
+ <stringProp name="1806444283">Reply to:Test</stringProp>
+ </collectionProp>
+ <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
+ <boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">16</intProp>
</ResponseAssertion>
<hashTree/>
Modified: jmeter/trunk/bin/testfiles/JMS_TESTS.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/JMS_TESTS.xml?rev=1812931&r1=1812930&r2=1812931&view=diff
==============================================================================
--- jmeter/trunk/bin/testfiles/JMS_TESTS.xml (original)
+++ jmeter/trunk/bin/testfiles/JMS_TESTS.xml Sun Oct 22 16:57:04 2017
@@ -8,6 +8,20 @@
<error>false</error>
</assertionResult>
</sample>
+<sample s="true" lb="JSS-ConsumeUpcomingMessage" rc="200" rm="OK" tn="TG-JMS-P2P 1-1" dt="text" sc="1" ec="0" ng="1" na="1">
+ <assertionResult>
+ <name>Response Assertion</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</sample>
+<sample s="true" lb="JMS-P2P-DefaultCorrelationId-TempQueue" rc="200" rm="OK" tn="TG-JMS-P2P 1-1" dt="text" sc="1" ec="0" ng="1" na="1">
+ <assertionResult>
+ <name>Response Assertion</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</sample>
<sample s="true" lb="JMS-P2P-CustomCorrelationId" rc="200" rm="OK" tn="TG-JMS-P2P 1-1" dt="text" sc="1" ec="0" ng="1" na="1">
<assertionResult>
<name>Response Assertion</name>