*Should I write a custom Java Program that reads in each of the 200 JMX
files in a loop, and calls the SaveService,loadTree and SaveService.saveTree
methods on each JMX?*

i.e. Something like the Java program below?  (unfortunately, it isn't
working yet)

Regards
Sonam

*ConvertJMX.java*
import java.io.*;
import org.apache.jmeter.save.SaveService;
import org.apache.jorphan.collections.HashTree;

public class ConvertJMX {

public static void main (String args []) {
String filename = "a.jmx";
FileInputStream reader = null;
 //Read file
try {
reader = new FileInputStream(filename);
System.out.println("Found file "+filename);
System.out.println("Attempting to load tree for "+filename);
HashTree tree = SaveService.loadTree(reader);
System.out.println("Loaded tree for "+filename);
//SaveService.saveTree(tree);

} catch (Exception e){
System.out.println("Problem in conversion of "+filename + ", error was: " +
e.toString());
System.exit (1);
}
}
}


On Fri, Apr 29, 2011 at 4:40 PM, Sonam Chauhan <son...@gmail.com> wrote:

> There is an API class named 'SaveService' and a 'saveservice.properties'
> configuration file.
>
> The SaveService class has two interesting-looking methods:
>
>  static 
> HashTree<http://jakarta.apache.org/jmeter/api/org/apache/jorphan/collections/HashTree.html>
> *loadTree<http://jakarta.apache.org/jmeter/api/org/apache/jmeter/save/SaveService.html#loadTree(java.io.InputStream)>
> *(InputStream<http://java.sun.com/j2se/1.5.0/docs/api/java/io/InputStream.html?is-external=true>
>  reader)
>           Load a Test tree (JMX file)
>
>  static 
> void*saveTree<http://jakarta.apache.org/jmeter/api/org/apache/jmeter/save/SaveService.html#saveTree(org.apache.jorphan.collections.HashTree,+java.io.OutputStream)>
> *(HashTree<http://jakarta.apache.org/jmeter/api/org/apache/jorphan/collections/HashTree.html>
>  tree, 
> OutputStream<http://java.sun.com/j2se/1.5.0/docs/api/java/io/OutputStream.html?is-external=true>
>  out)
>
>
> Should I write a custom Java Program that reads in each of the 200 JMX
> files in a loop, and calls the SaveService,loadTree and SaveService.saveTree
> methods on each JMX?
>
> Regards
> Sonam
>
>
>
> On Fri, Apr 29, 2011 at 12:46 PM, Deepak Shetty <shet...@gmail.com> wrote:
>
>> If I remember correctly there was a file called SaveService which had the
>> load and save methods that you could call from a custom program ?
>>
>> regards
>> deepak
>>
>> On Thu, Apr 28, 2011 at 7:33 PM, Sonam Chauhan <son...@gmail.com> wrote:
>>
>> > Due to new functionality I required, I upgraded my testsuite from JMeter
>> > 2.3.1 to 2.4.
>> >
>> > However, I see that JMeter 2.4 cannot open my old JMX test scripts (more
>> > than 200  scripts).*
>> > My old test scripts are 2.3.1 and earlier.
>> > *
>> >
>> > From http://jakarta.apache.org/jmeter/changes.html
>> >
>> > **
>> >
>> > *The Avalon file format for JMX and JTL files is no longer supported.
>> Any
>> > such files will need to be converted by reading them in JMeter 2.3.4 and
>> > resaving them.**
>> >
>> > *
>> >
>> > *
>> > Is there any way to  bulk-convert them?
>> > *
>> > *
>> >
>> > *
>> > *
>> > **
>> > I can programmatically
>> > **
>> > open the scripts
>> > **
>> > in
>> > **
>> > non-GUI mode.
>> > **
>> > Is there a flag I can supply to the
>> > **
>> > JMeter 2.3.4
>> > **
>> > non-GUI invoke to make JMeter 'force-save' the JMX?
>> > *
>> >
>> >
>> > Regards
>> >
>> > Sonam
>> >
>>
>
>

Reply via email to