jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1812931 - in /jmeter/trunk/bin/testfiles: JMS_TESTS.csv JMS_TESTS.jmx JMS_TESTS.xml
Date Sun, 22 Oct 2017 16:57:04 GMT
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(&quot;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,		&quot;org.apache.activemq.jndi.ActiveMQInitialContextFactory&quot;);
+	props.setProperty(Context.PROVIDER_URL,&quot;tcp://127.0.0.1:61616&quot;);	
+	Context namingCtx = new InitialContext(props);
+	ConnectionFactory cf = (ConnectionFactory)namingCtx.lookup(&quot;ConnectionFactory&quot;);
+	Connection con = cf.createConnection();
+	log.info(&quot;Creating connection to &quot;+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(&quot;Starting connection to &quot;+Parameters);
+		con.start();                                             // start the connection (more)
+		Thread.sleep(15000);
+		session.close();
+		log.info(&quot;Closed session&quot;);
+	} finally {
+		con.close();                                             // free all resources (more)	
+	}
+}
+SampleResult.setResponseMessageOK();
+SampleResult.setResponseData(&quot;Started Message Consumer&quot;, &quot;UTF-8&quot;);
+
+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(&quot;Reply queue is: {}&quot;, replyQueue);
+			log.info(&quot;Creating sender&quot;);
+			QueueSender sender = session.createSender(replyQueue);
+			log.info(&quot;Creating reply&quot;);
+			TextMessage reply = session.createTextMessage(&quot;Reply to:&quot;+textMessage.getText());
+			log.info(&quot;Sending reply&quot;);
+			sender.send(reply);
+			log.info(&quot;Tidyup sender - you could be processing many requests&quot;);
+			sender.close();
+	        } catch (JMSException e) {
+	            log.error(&quot;Error replying to message&quot;, 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&apos;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>



Mime
View raw message