Thanks Jordi - I downloaded the latest CVS and my code is now working for system properties. I ended up not subclassing ArgumentsPanel (just using the code you sent). This is because my GUI component is more primitive (single JTextField instead of table).
Currently, the modifyTestElement method looks like this: --------------------------------------------------------- public void modifyTestElement(TestElement args) { ... Properties p = System.getProperties(); ... if ( propName.startsWith(propsPrefix.getText()) ) { Argument arg = new Argument(propName.toString(), p.getProperty(propName), "=") ; --------------------------------------------------------- I can now enter "java" in the Config element's JTextField and then use ${java.vendor}, ${java.classpath}, etc., directly in my tests. Very nice! However, my code can only read System properties and properties specified on the command line with the '-D' param. If I run JMeter with the '-n <propfile>' param, my code can't access the properties specified in '<propfile>' - maybe because they are "JMeter properties". How can my code access "JMeter properties"? Once that is sorted out, I'll post the patch to Jmeter-dev if that's all right. With regards, Sonam Chauhan -- Corporate Express Australia Ltd. Phone: +61-2-9335-0725, Fax: 9335-0753, Email: [EMAIL PROTECTED] > -----Original Message----- > From: Jordi Salvat i Alabart [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 24 December 2003 8:21 PM > To: JMeter Developers List > Subject: Re: Problem initializing JMeter variables - Was "How can I add a > JMeter property in code" > > You're absolutely right: the developer documentation is absolutely > insufficient. > > The change you want to do probably requires changes in the JMeter > engine. I created a "User Defined Variables" element to define variables > outside of the Test Plan and that's what I had to do. I'm attaching the > CVS message for my changes for your reference. If you use latest CVS > code, you may be able to subclass my component in some way... > > Good luck, > > Jordi. > > > En/na Sonam Chauhan ha escrit: > > I tried this code earlier for setting JMeter variable (say, '${var}' > > -------------- > > public void modifyTestElement(TestElement el) > > { > > el.setProperty( > > new StringProperty("var","REPLACED")); > > -------------- > > > > Since that didn't work, I tried manipulating the context (saw this type > > of coding in RegexExtractor.java): > > -------------- > > public void modifyTestElement(TestElement el) > > { > > JMeterVariables jmv = new JMeterVariables(); > > jmv.put("var", "REPLACED"); > > JMeterContext context = > > JMeterContextService.getContext(); > > context.setVariables(jmv); > > -------------- > > > > It didn't work either. "${var}" stays un-substituted. > > > > If someone could help, that would be great - the Javadoc and the > > extension documentation isn't descriptive enough. > > > > With regards, > > Sonam Chauhan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]