<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>http://wiki.netsitech.com/index.php?action=history&amp;feed=atom&amp;title=Programmazione%3AJava%2FSampler_Test_for_JMeter</id>
	<title>Programmazione:Java/Sampler Test for JMeter - Cronologia</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.netsitech.com/index.php?action=history&amp;feed=atom&amp;title=Programmazione%3AJava%2FSampler_Test_for_JMeter"/>
	<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;action=history"/>
	<updated>2026-05-04T17:03:04Z</updated>
	<subtitle>Cronologia della pagina su questo sito</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2778&amp;oldid=prev</id>
		<title>Rimondini il 08:30, 14 apr 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2778&amp;oldid=prev"/>
		<updated>2008-04-14T08:30:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;it&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versione meno recente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Versione delle 08:30, 14 apr 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Riga 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Riga 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Programmazione:Java|&amp;lt;&amp;lt; Back to Java]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Questo è un esempio di implementazione di un Sampler di test per JMeter, nello specifico un Sampler per le notifiche JMS su ApacheMQ.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Questo è un esempio di implementazione di un Sampler di test per JMeter, nello specifico un Sampler per le notifiche JMS su ApacheMQ.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2260&amp;oldid=prev</id>
		<title>Rimondini il 12:15, 20 nov 2007</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2260&amp;oldid=prev"/>
		<updated>2007-11-20T12:15:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;it&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versione meno recente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Versione delle 12:15, 20 nov 2007&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot; &gt;Riga 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Riga 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Scrivere la classe Sampler&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Scrivere la classe Sampler&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Per utilizzare successivamente il modulo bisogna esportare il jar nella cartella dei plugin di JMeter...e comparirà nell'elenco dei Sampler disponibili&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ApacheMQ JMS Sampler code &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;ApacheMQ JMS Sampler code&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code java&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code java&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l91&quot; &gt;Riga 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Riga 92:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Per utilizzare successivamente il modulo bisogna esportare il jar nella cartella dei plugin di JMeter...e comparirà nell'alenco dei Sampler disponibili&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2259&amp;oldid=prev</id>
		<title>Rimondini: Nuova pagina: Questo è un esempio di implementazione di un Sampler di test per JMeter, nello specifico un Sampler per le notifiche JMS su ApacheMQ.  I passi sono pochi * Creare un progetto Java * I...</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Sampler_Test_for_JMeter&amp;diff=2259&amp;oldid=prev"/>
		<updated>2007-11-20T12:11:57Z</updated>

		<summary type="html">&lt;p&gt;Nuova pagina: Questo è un esempio di implementazione di un Sampler di test per JMeter, nello specifico un Sampler per le notifiche JMS su ApacheMQ.  I passi sono pochi * Creare un progetto Java * I...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nuova pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Questo è un esempio di implementazione di un Sampler di test per JMeter, nello specifico un Sampler per le notifiche JMS su ApacheMQ.&lt;br /&gt;
&lt;br /&gt;
I passi sono pochi&lt;br /&gt;
* Creare un progetto Java&lt;br /&gt;
* Impostare il runtime in modo tale che il modulo possa funzionare da solo&lt;br /&gt;
* Scrivere la classe Sampler&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ApacheMQ JMS Sampler code :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
public class JMeterJmsProducerSampler extends AbstractJavaSamplerClient {&lt;br /&gt;
   protected class JMeterJmsExceptionListener implements ExceptionListener {&lt;br /&gt;
      protected SampleResult result;&lt;br /&gt;
&lt;br /&gt;
      public JMeterJmsExceptionListener(SampleResult r) {&lt;br /&gt;
         result = r;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      /*&lt;br /&gt;
       * Funzione chiamata se arriva un eccezione&lt;br /&gt;
       */&lt;br /&gt;
      public void onException(JMSException e) {&lt;br /&gt;
         result.setSuccessful(false);&lt;br /&gt;
         result.setResponseMessage(e.getMessage());&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   protected String topic, client, message;&lt;br /&gt;
&lt;br /&gt;
   /*&lt;br /&gt;
    * Definizione dei parametri, con default, configurabili da JMeter&lt;br /&gt;
    */&lt;br /&gt;
   @Override&lt;br /&gt;
   public Arguments getDefaultParameters() {&lt;br /&gt;
      Arguments args = new Arguments();&lt;br /&gt;
      args.addArgument(&amp;quot;topic&amp;quot;, &amp;quot;NotifyTopic&amp;quot;);&lt;br /&gt;
      args.addArgument(&amp;quot;client&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
      args.addArgument(&amp;quot;message&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
      return args;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   /*&lt;br /&gt;
    * Inizializzazione per run&lt;br /&gt;
    */&lt;br /&gt;
   @Override&lt;br /&gt;
   public void setupTest(JavaSamplerContext context) {&lt;br /&gt;
      super.setupTest(context);&lt;br /&gt;
      topic = context.getParameter(&amp;quot;topic&amp;quot;, &amp;quot;NotifyTopic&amp;quot;);&lt;br /&gt;
      client = context.getParameter(&amp;quot;client&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
      message = context.getParameter(&amp;quot;message&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   /*&lt;br /&gt;
    * Lancio del Sampler&lt;br /&gt;
    */&lt;br /&gt;
   public SampleResult runTest(JavaSamplerContext arg0) {&lt;br /&gt;
      SampleResult result = new SampleResult();&lt;br /&gt;
      try {&lt;br /&gt;
         result.sampleStart();&lt;br /&gt;
&lt;br /&gt;
         Properties props = new Properties();&lt;br /&gt;
         props.setProperty(Context.INITIAL_CONTEXT_FACTORY, &amp;quot;org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;quot;);&lt;br /&gt;
         props.setProperty(Context.PROVIDER_URL, &amp;quot;tcp://localhost:61616&amp;quot;);&lt;br /&gt;
         Context ctx = new InitialContext(props);&lt;br /&gt;
&lt;br /&gt;
         TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup(&amp;quot;ConnectionFactory&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
         TopicConnection connection = factory.createTopicConnection();&lt;br /&gt;
         connection.start();&lt;br /&gt;
&lt;br /&gt;
         TopicSession session = connection.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);&lt;br /&gt;
&lt;br /&gt;
         Topic _topic = session.createTopic(topic);&lt;br /&gt;
&lt;br /&gt;
         MessageProducer producer = session.createProducer(_topic);&lt;br /&gt;
&lt;br /&gt;
         TextMessage sms = session.createTextMessage();&lt;br /&gt;
         sms.setStringProperty(&amp;quot;idclient&amp;quot;, client);&lt;br /&gt;
         sms.setText(message);&lt;br /&gt;
&lt;br /&gt;
         producer.send(sms);&lt;br /&gt;
      } catch (Throwable t) {&lt;br /&gt;
         result.setSuccessful(false);&lt;br /&gt;
         getLogger().fatalError(t.getMessage());&lt;br /&gt;
      } finally {&lt;br /&gt;
         result.sampleEnd();&lt;br /&gt;
      }&lt;br /&gt;
      return result;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Per utilizzare successivamente il modulo bisogna esportare il jar nella cartella dei plugin di JMeter...e comparirà nell'alenco dei Sampler disponibili&lt;/div&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
</feed>