You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by co...@apache.org on 2015/01/09 08:40:30 UTC

[2/2] bigtop git commit: BIGTOP-1526. Property file for FailureVars can not be placed to {{/}}

BIGTOP-1526. Property file for FailureVars can not be placed to {{/}}

Signed-off-by: Konstantin Boudnik <co...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/940b6fda
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/940b6fda
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/940b6fda

Branch: refs/heads/master
Commit: 940b6fda26ad655d1f3972ff0b28d2d031a7ce44
Parents: 4a7b61b
Author: Dasha Boudnik <da...@wandisco.com>
Authored: Wed Jan 7 18:24:08 2015 -0800
Committer: Konstantin Boudnik <co...@apache.org>
Committed: Thu Jan 8 23:39:52 2015 -0800

----------------------------------------------------------------------
 .../bigtop/itest/failures/FailureVars.groovy    | 24 ++++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/940b6fda/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
index 3d11507..d1cb045 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
@@ -8,14 +8,26 @@ import java.io.IOException;
 /**
  * This class manages objects, variables, and command line parameter values for cluster failure testing.
  * By default, all parameters are off or set to false.
+ *
+ * The system property "failurePropertiesFile" represents the path to the file containing test parameters
+ * and must be set in order to parametrize a test. Failure scenario parameters are:
+ * testhost
+ * testremotehost
+ * runall
+ * servicerestart
+ * servicekill
+ * networkshutdown
+ * service
+ * failuredelay
+ * startdelay
+ * killduration
  */
 public class FailureVars {
 
   private final String CRON_SERVICE;
   private final int SLEEP_TIME = 100;
   private static FailureVars instance = null;
-  private String propertyFile = "/failureVars.properties"
-  private Boolean useProperties = Boolean.parseBoolean(System.getProperty("useFailureProperties", "false"));
+  private String propertyFile = System.getProperty("failurePropertiesFile");
   private String testHost;
   private String testRemoteHost;
   private String runFailures;
@@ -38,7 +50,7 @@ public class FailureVars {
   }
 
   protected FailureVars() {
-    if(useProperties) {
+    if(propertyFile != null) {
       loadProps();
     }
   }
@@ -52,7 +64,9 @@ public class FailureVars {
 
   private void loadProps() {
     try {
-      BufferedReader is = new BufferedReader (new InputStreamReader(getClass().getResourceAsStream(propertyFile)));
+      File pFile = new File(propertyFile);
+      assert(pFile.exists()) : "Failure properties file cannot be read";
+      BufferedReader is = new BufferedReader (new InputStreamReader(getClass(pFile)));
       System.out.println("Input Stream Location: " + is);
       Properties props = new Properties();
       props.load(is);
@@ -69,7 +83,7 @@ public class FailureVars {
       killDuration = props.getProperty("killduration", Integer.toString(0));
     }
     catch(IOException ioe) {
-      System.out.println(ioe);
+      System.out.println(ioe.getMessage());
     }
   }