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 21
21
import com .rabbitmq .tools .json .JSONWriter ;
22
22
23
23
import java .io .FileInputStream ;
24
+ import java .io .FileNotFoundException ;
24
25
import java .io .FileWriter ;
25
26
import java .io .IOException ;
26
27
import java .io .InputStreamReader ;
@@ -36,9 +37,23 @@ public class PerformanceMain {
36
37
private static Map <String , Object > results = new HashMap <String , Object >();
37
38
38
39
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
+ }
39
44
String inJSON = args [0 ];
40
45
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
+ }
42
57
Scenario [] scenarios = new Scenario [scenariosJSON .size ()];
43
58
for (int i = 0 ; i < scenariosJSON .size (); i ++) {
44
59
scenarios [i ] = ScenarioFactory .fromJSON (scenariosJSON .get (i ), factory );
You can’t perform that action at this time.
0 commit comments