some debugging/logging stuff
diff --git a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index f1fa2a3..7f1591d 100644
--- a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -188,10 +188,16 @@
private static String[] handleError(GetMethod method) throws Exception {
String errorBody = method.getResponseBodyAsString();
- JSONObject result = new JSONObject(errorBody);
- String[] errors = { result.getJSONArray("error-code").getString(0), result.getString("summary"),
- result.getString("stacktrace") };
- return errors;
+ try {
+ JSONObject result = new JSONObject(errorBody);
+ String[] errors = { result.getJSONArray("error-code").getString(0), result.getString("summary"),
+ result.getString("stacktrace") };
+ return errors;
+ } catch (JSONException je) {
+ GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, "Response body is not in JSON " + errorBody);
+ String[] errors = { "no error code", "no summary", "no stacktrace" };
+ return errors;
+ }
}
// Executes Query and returns results as JSONArray
@@ -277,8 +283,17 @@
// Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
- // Execute the method.
- int statusCode = client.executeMethod(method);
+ int statusCode = HttpStatus.SC_BAD_REQUEST;
+ int retry = 0;
+ while (retry++ < 3) {
+ // Execute the method.
+ statusCode = client.executeMethod(method);
+ if (statusCode == HttpStatus.SC_OK) {
+ break;
+ }
+ GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, "Method failed: " + method.getStatusLine());
+ Thread.sleep(1000);
+ }
// Check if the method was executed successfully.
if (statusCode != HttpStatus.SC_OK) {
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/transaction/RecoveryIT.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/transaction/RecoveryIT.java
index 89cbec8..3346203 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/transaction/RecoveryIT.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/transaction/RecoveryIT.java
@@ -69,6 +69,7 @@
}
})[0];
managixHomePath = new File(installerTargetPath, managixHomeDirName).getAbsolutePath();
+ LOGGER.info("MANAGIX_HOME=" + managixHomePath);
String fileListPath = asterixInstallerPath.getAbsolutePath() + File.separator + "src" + File.separator + "test"
+ File.separator + "resources" + File.separator + "transactionts" + File.separator + "data"
@@ -76,6 +77,7 @@
String srcBasePath = asterixAppPath.getAbsolutePath();
String destBasePath = managixHomePath + File.separator + "clusters" + File.separator + "local" + File.separator
+ "working_dir";
+ LOGGER.info("working dir: " + destBasePath);
prepareDataFiles(fileListPath, srcBasePath, destBasePath);
pb = new ProcessBuilder();
@@ -110,7 +112,7 @@
File outdir = new File(PATH_ACTUAL);
FileUtils.deleteDirectory(outdir);
TestsUtils.executeScript(pb, scriptHomePath + File.separator + "setup_teardown" + File.separator
- + "stop_and_delete.sh");
+ + "stop.sh");
TestsUtils.executeScript(pb, scriptHomePath + File.separator + "setup_teardown" + File.separator
+ "shutdown.sh");
}
diff --git a/asterix-installer/src/test/resources/transactionts/scripts/setup_teardown/stop.sh b/asterix-installer/src/test/resources/transactionts/scripts/setup_teardown/stop.sh
new file mode 100755
index 0000000..4fd44b8
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/scripts/setup_teardown/stop.sh
@@ -0,0 +1,2 @@
+$MANAGIX_HOME/bin/managix stop -n nc1;
+