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/15 00:48:53 UTC

bigtop git commit: BIGTOP-1593. Fix types in FailureVars

Repository: bigtop
Updated Branches:
  refs/heads/master 5fe581b22 -> 7f3a3dc8a


BIGTOP-1593. Fix types in FailureVars

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/7f3a3dc8
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/7f3a3dc8
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/7f3a3dc8

Branch: refs/heads/master
Commit: 7f3a3dc8a53018090182cfcd09809665377acb12
Parents: 5fe581b
Author: Dasha Boudnik <da...@wandisco.com>
Authored: Wed Jan 14 15:48:18 2015 -0800
Committer: Konstantin Boudnik <co...@apache.org>
Committed: Wed Jan 14 15:48:18 2015 -0800

----------------------------------------------------------------------
 .../itest/failures/FailureExecutor.groovy       |  6 +--
 .../bigtop/itest/failures/FailureVars.groovy    | 56 ++++++++++----------
 .../hadoop/mapreduce/TestHadoopExamples.groovy  |  8 +--
 .../bigtop/itest/iolongevity/TestDFSIO.groovy   |  8 +--
 .../bigtop/itest/iolongevity/TestSLive.groovy   |  8 +--
 5 files changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/7f3a3dc8/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
index 79212b2..daad092 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
@@ -15,9 +15,9 @@ import org.apache.bigtop.itest.shell.Shell
  */
 public class FailureExecutor implements Runnable {
 
-  private String restart = FailureVars.instance.getServiceRestart();
-  private String kill = FailureVars.instance.getServiceKill();
-  private String shutdown = FailureVars.instance.getNetworkShutdown();
+  private boolean restart = FailureVars.instance.getServiceRestart();
+  private boolean kill = FailureVars.instance.getServiceKill();
+  private boolean shutdown = FailureVars.instance.getNetworkShutdown();
   private String testHost = FailureVars.instance.getTestHost();
   private String testRemoteHost = FailureVars.instance.getTestRemoteHost();
   private long failureDelay = FailureVars.instance.getFailureDelay();

http://git-wip-us.apache.org/repos/asf/bigtop/blob/7f3a3dc8/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 3b3f6af..6851337 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
@@ -30,14 +30,14 @@ public class FailureVars {
   private String propertyFile = System.getProperty("failurePropertiesFile");
   private String testHost = "localhost";
   private String testRemoteHost = "apache.org";
-  private String runFailures = "false";
-  private String serviceRestart = "false";
-  private String serviceKill = "false";
-  private String networkShutdown = "false";
+  private boolean runFailures = false;
+  private boolean serviceRestart = false;
+  private boolean serviceKill = false;
+  private boolean networkShutdown = false;
   private String service = "crond";
-  private String failureDelay = "0";
-  private String startDelay = "0";
-  private String killDuration = "0";
+  private long failureDelay = 0;
+  private long startDelay = 0;
+  private long killDuration = 0;
 
   {
     switch (OS.linux_flavor) {
@@ -73,22 +73,22 @@ public class FailureVars {
       is.close();
       testHost = props.getProperty("testhost");
       testRemoteHost = props.getProperty("testremotehost");
-      runFailures = props.getProperty("runall");
-      serviceRestart = props.getProperty("servicerestart");
-      serviceKill = props.getProperty("servicekill");
-      networkShutdown = props.getProperty("networkshutdown");
+      runFailures = Boolean.parseBoolean(props.getProperty("runall"));
+      serviceRestart = Boolean.parseBoolean(props.getProperty("servicerestart"));
+      serviceKill = Boolean.parseBoolean(props.getPropery("servicekill"));
+      networkShutdown = Boolean.parseBoolean(props.getProperty("networkshutdown"));
       service = props.getProperty("service");
-      failureDelay = props.getProperty("failuredelay");
-      startDelay = props.getProperty("startdelay");
-      killDuration = props.getProperty("killduration");
+      failureDelay = Long.parseLong(props.getProperty("failuredelay"));
+      startDelay = Long.parseLong(props.getProperty("startdelay"));
+      killDuration = Long.parseLong(props.getProperty("killduration"));
     }
     catch(IOException ioe) {
       System.out.println(ioe.getMessage());
     }
   }
 
-  public void setKillDuration(String killDuration) {
-    this.killDuration = Long.toString(killDuration);
+  public void setKillDuration(long killDuration) {
+    this.killDuration = killDuration;
   }
 
   public void setTestHost(String testHost) {
@@ -99,24 +99,24 @@ public class FailureVars {
     this.testRemoteHost = testRemoteHost;
   }
 
-  public void setRunAll(String runFailures) {
+  public void setRunAll(boolean runFailures) {
     this.runFailures = runFailures;
   }
 
-  public void setRestart(String serviceRestart) {
+  public void setRestart(boolean serviceRestart) {
     this.serviceRestart = serviceRestart;
   }
 
-  public void setKill(String serviceKill) {
+  public void setKill(boolean serviceKill) {
     this.serviceKill = serviceKill;
   }
 
-  public void setShutdown(String networkShutdown) {
+  public void setShutdown(boolean networkShutdown) {
     this.networkShutdown = networkShutdown;
   }
 
   public void setFailureDelay(long failureDelay) {
-    this.failureDelay = Long.toString(failureDelay);
+    this.failureDelay = failureDelay;
   }
 
   public void setService(String service) {
@@ -124,7 +124,7 @@ public class FailureVars {
   }
 
   public long getKillDuration() {
-    return Long.parseLong(killDuration)*1000;
+    return killDuration*1000;
   }
   public String getTestHost() {
     return testHost;
@@ -139,28 +139,28 @@ public class FailureVars {
   }
 
   public long getStartDelay() {
-    return Long.parseLong(startDelay)*1000;
+    return startDelay*1000;
   }
 
 
-  public String getRunFailures() {
+  public boolean getRunFailures() {
     return runFailures;
   }
 
-  public String getServiceRestart() {
+  public boolean getServiceRestart() {
     return serviceRestart;
   }
 
-  public  String getServiceKill() {
+  public boolean getServiceKill() {
     return serviceKill;
   }
 
-  public String getNetworkShutdown() {
+  public boolean getNetworkShutdown() {
     return networkShutdown;
   }
 
   public long getFailureDelay() {
-    return Long.parseLong(failureDelay)*1000;
+    return failureDelay*1000;
   }
 
   int getSleepTime() {

http://git-wip-us.apache.org/repos/asf/bigtop/blob/7f3a3dc8/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/mapreduce/TestHadoopExamples.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/mapreduce/TestHadoopExamples.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/mapreduce/TestHadoopExamples.groovy
index 2d152cb..9700b08 100644
--- a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/mapreduce/TestHadoopExamples.groovy
+++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/mapreduce/TestHadoopExamples.groovy
@@ -147,10 +147,10 @@ class TestHadoopExamples {
 
   @Test
   void testMRExample() {
-    if(FailureVars.instance.getRunFailures().equals("true")
-        || FailureVars.instance.getServiceRestart().equals("true")
-        || FailureVars.instance.getServiceKill().equals("true")
-        || FailureVars.instance.getNetworkShutdown().equals("true")) {
+    if(FailureVars.instance.getRunFailures()
+        || FailureVars.instance.getServiceRestart()
+        || FailureVars.instance.getServiceKill()
+        || FailureVars.instance.getNetworkShutdown()) {
       runFailureThread();
     }
     sh.exec("hadoop jar $testJar $testName $testArgs");

http://git-wip-us.apache.org/repos/asf/bigtop/blob/7f3a3dc8/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestDFSIO.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestDFSIO.groovy b/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestDFSIO.groovy
index 755ebad..caf2dbc 100644
--- a/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestDFSIO.groovy
+++ b/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestDFSIO.groovy
@@ -72,10 +72,10 @@ public class TestDFSIO {
 
   @Test
   public void testDFSIO() {
-    if(FailureVars.instance.getRunFailures().equals("true")
-    || FailureVars.instance.getServiceRestart().equals("true")
-    || FailureVars.instance.getServiceKill().equals("true")
-    || FailureVars.instance.getNetworkShutdown().equals("true")) {
+    if(FailureVars.instance.getRunFailures()
+    || FailureVars.instance.getServiceRestart()
+    || FailureVars.instance.getServiceKill()
+    || FailureVars.instance.getNetworkShutdown()) {
       runFailureThread();
     }
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/7f3a3dc8/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestSLive.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestSLive.groovy b/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestSLive.groovy
index f4ce338..de03dad 100644
--- a/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestSLive.groovy
+++ b/bigtop-tests/test-artifacts/longevity/src/main/groovy/org/apache/bigtop/itest/iolongevity/TestSLive.groovy
@@ -105,10 +105,10 @@ public class TestSLive {
 
   @Test
   public void testSlive() {
-    if(FailureVars.instance.getRunFailures().equals("true")
-        || FailureVars.instance.getServiceRestart().equals("true")
-        || FailureVars.instance.getServiceKill().equals("true")
-        || FailureVars.instance.getNetworkShutdown().equals("true")) {
+    if(FailureVars.instance.getRunFailures()
+        || FailureVars.instance.getServiceRestart()
+        || FailureVars.instance.getServiceKill()
+        || FailureVars.instance.getNetworkShutdown()) {
       runFailureThread();
     }