You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by sl...@apache.org on 2013/04/03 04:04:33 UTC

[1/2] git commit: [HELIX-7]Fix test failure

Updated Branches:
  refs/heads/master 24fd28c9c -> 58944dc4b


[HELIX-7]Fix test failure

Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/fe6c846b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/fe6c846b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/fe6c846b

Branch: refs/heads/master
Commit: fe6c846b1a138a719484b344c9bf5d7310301df4
Parents: 24fd28c
Author: slu2011 <lu...@gmail.com>
Authored: Tue Apr 2 18:53:43 2013 -0700
Committer: slu2011 <lu...@gmail.com>
Committed: Tue Apr 2 18:53:43 2013 -0700

----------------------------------------------------------------------
 .../apache/helix/manager/zk/TestZkHelixAdmin.java  |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/fe6c846b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
index fd3c495..7e4af44 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
@@ -130,9 +130,18 @@ public class TestZkHelixAdmin extends ZkUnitTestBase
     {
       // OK
     }
+    catch(IllegalArgumentException ex)
+    {
+      // OK
+    }
+    
+    tool.addStateModelDef(clusterName,
+        "MasterSlave",
+        new StateModelDefinition(StateModelConfigGenerator.generateConfigForMasterSlave()));
+    stateModelRecord = StateModelConfigGenerator.generateConfigForMasterSlave();
     try
     {
-      tool.addStateModelDef(clusterName, "id1", new StateModelDefinition(
+      tool.addStateModelDef(clusterName, stateModelRecord.getId(), new StateModelDefinition(
           stateModelRecord));
       Assert.fail("should fail if add an already-existing state model");
     } catch (HelixException e)
@@ -140,7 +149,7 @@ public class TestZkHelixAdmin extends ZkUnitTestBase
       // OK
     }
     list = tool.getStateModelDefs(clusterName);
-    AssertJUnit.assertEquals(list.size(), 0);
+    AssertJUnit.assertEquals(list.size(), 1);
 
     try
     {


[2/2] git commit: [HELIX-7] fix test failures

Posted by sl...@apache.org.
[HELIX-7] fix test failures

Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/58944dc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/58944dc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/58944dc4

Branch: refs/heads/master
Commit: 58944dc4bbb6a427da6b557851a456b07856c143
Parents: fe6c846
Author: slu2011 <lu...@gmail.com>
Authored: Tue Apr 2 19:04:24 2013 -0700
Committer: slu2011 <lu...@gmail.com>
Committed: Tue Apr 2 19:04:24 2013 -0700

----------------------------------------------------------------------
 .../integration/TestStateTransitionTimeout.java    |    2 +-
 .../helix/mock/participant/MockMSStateModel.java   |   20 +++++++++------
 .../helix/mock/participant/MockTransition.java     |    2 +-
 .../helix/mock/participant/SleepTransition.java    |    3 +-
 4 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/58944dc4/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
index 1b91025..0a786d7 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
@@ -116,7 +116,7 @@ public class TestStateTransitionTimeout extends ZkStandAloneCMTestBase
     }
 
     @Transition(to="MASTER",from="SLAVE")
-    public void onBecomeMasterFromSlave(Message message, NotificationContext context)
+    public void onBecomeMasterFromSlave(Message message, NotificationContext context) throws InterruptedException
     {
       LOG.info("Become MASTER from SLAVE");
       if (_transition != null && _sleep)

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/58944dc4/helix-core/src/test/java/org/apache/helix/mock/participant/MockMSStateModel.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/MockMSStateModel.java b/helix-core/src/test/java/org/apache/helix/mock/participant/MockMSStateModel.java
index acebf3e..a523abd 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/participant/MockMSStateModel.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/participant/MockMSStateModel.java
@@ -51,14 +51,18 @@ public class MockMSStateModel extends StateModel
     LOG.info("Become DROPPED from ERROR");
     if (_transition != null)
     {
-      _transition.doTransition(message, context);
-
+      try
+      {
+        _transition.doTransition(message, context);
+      }
+      catch(Exception e)
+      {}
     }
   }
 
   
   @Transition(to = "SLAVE", from = "OFFLINE")
-  public void onBecomeSlaveFromOffline(Message message, NotificationContext context)
+  public void onBecomeSlaveFromOffline(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become SLAVE from OFFLINE");
     if (_transition != null)
@@ -69,7 +73,7 @@ public class MockMSStateModel extends StateModel
   }
 
   @Transition(to = "MASTER", from = "SLAVE")
-  public void onBecomeMasterFromSlave(Message message, NotificationContext context)
+  public void onBecomeMasterFromSlave(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become MASTER from SLAVE");
     if (_transition != null)
@@ -79,7 +83,7 @@ public class MockMSStateModel extends StateModel
   }
 
   @Transition(to = "SLAVE", from = "MASTER")
-  public void onBecomeSlaveFromMaster(Message message, NotificationContext context)
+  public void onBecomeSlaveFromMaster(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become SLAVE from MASTER");
     if (_transition != null)
@@ -89,7 +93,7 @@ public class MockMSStateModel extends StateModel
   }
 
   @Transition(to = "OFFLINE", from = "SLAVE")
-  public void onBecomeOfflineFromSlave(Message message, NotificationContext context)
+  public void onBecomeOfflineFromSlave(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become OFFLINE from SLAVE");
     if (_transition != null)
@@ -99,7 +103,7 @@ public class MockMSStateModel extends StateModel
   }
 
   @Transition(to = "DROPPED", from = "OFFLINE")
-  public void onBecomeDroppedFromOffline(Message message, NotificationContext context)
+  public void onBecomeDroppedFromOffline(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become DROPPED from OFFLINE");
     if (_transition != null)
@@ -109,7 +113,7 @@ public class MockMSStateModel extends StateModel
   }
 
   @Transition(to = "OFFLINE", from = "ERROR")
-  public void onBecomeOfflineFromError(Message message, NotificationContext context)
+  public void onBecomeOfflineFromError(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("Become OFFLINE from ERROR");
     // System.err.println("Become OFFLINE from ERROR");

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/58944dc4/helix-core/src/test/java/org/apache/helix/mock/participant/MockTransition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/MockTransition.java b/helix-core/src/test/java/org/apache/helix/mock/participant/MockTransition.java
index bdbcd13..e646849 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/participant/MockTransition.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/participant/MockTransition.java
@@ -29,7 +29,7 @@ public class MockTransition
   private static Logger LOG = Logger.getLogger(MockTransition.class);
 
   // called by state model transition functions
-  public void doTransition(Message message, NotificationContext context)
+  public void doTransition(Message message, NotificationContext context) throws InterruptedException
   {
     LOG.info("default doTransition() invoked");
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/58944dc4/helix-core/src/test/java/org/apache/helix/mock/participant/SleepTransition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/SleepTransition.java b/helix-core/src/test/java/org/apache/helix/mock/participant/SleepTransition.java
index eacd131..68de72b 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/participant/SleepTransition.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/participant/SleepTransition.java
@@ -33,13 +33,14 @@ public class SleepTransition extends MockTransition
   }
 
   @Override
-  public void doTransition(Message message, NotificationContext context)
+  public void doTransition(Message message, NotificationContext context) throws InterruptedException
   {
     try {
       Thread.sleep(_delay);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
+      throw e;
     }
 
   }