jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Laverge" <aerost...@hotmail.com>
Subject Second try on 'AbstractJavaSamplerClient' how-to
Date Fri, 26 Nov 2004 14:22:45 GMT
Hello,

		 After reading on JMeter I whanted to create a custom 'Java Request' to 
show to my co-worker how we could Load test our JMS application with this 
product. I simply cannot get my AbstractJavaSamplerClient class to show up 
into the 'Java Request' combo-box.
		 My class is in Jar under the /lib/ext folder (like in the User doc). What 
else should I do to get this thing working ? Any issues with the Classloader 
? Do I have to edit a .jmx file ?

After some research, it looks like I am not the only one with this problem :

http://www.javalobby.com/forums/thread.jspa?forumID=16&threadID=11892

http://groups.google.com/groups?q=JMeter+%22Java+Request%22&hl=en&lr=&c2coff=1&selm=fbf4af5e.0307020507.4b33097f%40posting.google.com&rnum=1


Thank you for your Help.

//---------My  Sample Java Request

public class HvSampler extends AbstractJavaSamplerClient
{


        static private Arguments _arguments;
        static
        {
                _arguments = new Arguments();
                _arguments.addArgument("myArg1",",myValue1");
                _arguments.addArgument("myArg2",",myValue2");
        }


        public Arguments getDefaultParameters()
        {
                return _arguments;
        }
        public void setupTest(JavaSamplerContext context)
        {
                System.out.println("inside setUp");


        }


        public SampleResult runTest(JavaSamplerContext context)
        {
                System.out.println("inside runTest");
                printContext(context);
                try
                {
                        Thread.sleep(2000);
                }
                catch (InterruptedException e){ e.printStackTrace();}
                return getSampleResult();
        }


        public void teardownTest(JavaSamplerContext context)
        {
                System.out.println("inside teadDown");
        }
        private SampleResult getSampleResult()
        {
                SampleResult r = new SampleResult();
                r.setSuccessful(true);
                r.setResponseMessage("coucou");
                return r;
        }
        private void printContext(JavaSamplerContext ctx)
        {
                Iterator iterator = ctx.getParameterNamesIterator();
                System.out.println("SamplerContext :");
                while (iterator.hasNext())
                {
                        String  name= (String) iterator.next();
                        String value = ctx.getParameter(name);
                        System.out.println(name+ "=" + value);
                }
                System.out.println("");
        }
}



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message