Skip to content

Commit c5b22e3

Browse files
author
Simon MacMullen
committed
Add a tiny bit of usability.
1 parent 88ac574 commit c5b22e3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/src/com/rabbitmq/examples/perf/PerformanceMain.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.rabbitmq.tools.json.JSONWriter;
2222

2323
import java.io.FileInputStream;
24+
import java.io.FileNotFoundException;
2425
import java.io.FileWriter;
2526
import java.io.IOException;
2627
import 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);

0 commit comments

Comments
 (0)