File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
test/src/com/rabbitmq/examples/perf Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 2121import com .rabbitmq .tools .json .JSONWriter ;
2222
2323import java .io .FileInputStream ;
24+ import java .io .FileNotFoundException ;
2425import java .io .FileWriter ;
2526import java .io .IOException ;
2627import java .io .InputStreamReader ;
@@ -36,9 +37,23 @@ public class PerformanceMain {
3637 private static Map <String , Object > results = new HashMap <String , Object >();
3738
3839 public static void main (String [] args ) throws Exception {
40+ if (args .length != 2 ) {
41+ System .out .println ("Usage: PerformanceMain input-json-file output-json-file" );
42+ System .exit (1 );
43+ }
3944 String inJSON = args [0 ];
4045 String outJSON = args [1 ];
41- List <Map > scenariosJSON = (List <Map >) new JSONReader ().read (readFile (inJSON ));
46+ List <Map > scenariosJSON = null ;
47+ try {
48+ scenariosJSON = (List <Map >) new JSONReader ().read (readFile (inJSON ));
49+ } catch (FileNotFoundException e ) {
50+ System .out .println ("Input json file " + inJSON + " could not be found" );
51+ System .exit (1 );
52+ }
53+ if (scenariosJSON == null ) {
54+ System .out .println ("Input json file " + inJSON + " could not be parsed" );
55+ System .exit (1 );
56+ }
4257 Scenario [] scenarios = new Scenario [scenariosJSON .size ()];
4358 for (int i = 0 ; i < scenariosJSON .size (); i ++) {
4459 scenarios [i ] = ScenarioFactory .fromJSON (scenariosJSON .get (i ), factory );
You can’t perform that action at this time.
0 commit comments