http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestCorrectnessOnConnectivityLoss.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCorrectnessOnConnectivityLoss.java b/helix-core/src/test/java/org/apache/helix/integration/TestCorrectnessOnConnectivityLoss.java index 2d8749e..a5f7d50 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestCorrectnessOnConnectivityLoss.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestCorrectnessOnConnectivityLoss.java @@ -39,7 +39,9 @@ import org.apache.helix.spectator.RoutingTableProvider; import org.apache.helix.tools.ClusterStateVerifier; import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; +import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -73,6 +75,11 @@ public class TestCorrectnessOnConnectivityLoss { _controller.connect(); } + @AfterMethod + public void afterMethod() throws Exception { + TestHelper.stopZkServer(_zkServer); + } + @Test public void testParticipant() throws Exception { Map<String, Integer> stateReachedCounts = Maps.newHashMap(); @@ -138,11 +145,6 @@ public class TestCorrectnessOnConnectivityLoss { } } - @AfterMethod - public void afterMethod() throws Exception { - TestHelper.stopZkServer(_zkServer); - } - @StateModelInfo(initialState = "OFFLINE", states = { "MASTER", "SLAVE", "OFFLINE", "ERROR" })
http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java index d512e9e..faf212b 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java @@ -27,7 +27,7 @@ import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.ZkTestHelper; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -42,7 +42,7 @@ import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestDisable extends ZkIntegrationTestBase { +public class TestDisable extends ZkTestBase { @Test public void testDisableNodeCustomIS() throws Exception { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java index f4deef9..653dd82 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java @@ -23,7 +23,7 @@ import java.util.Date; import org.apache.helix.HelixProperty; import org.apache.helix.PropertyKey; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixAdmin; @@ -42,7 +42,7 @@ import org.testng.annotations.Test; * if DISABLE_EXTERNAL_VIEW is set to true in a resource's idealstate, * there should be no external view for this resource. */ -public class TestDisableExternalView extends ZkIntegrationTestBase { +public class TestDisableExternalView extends ZkTestBase { private static final String TEST_DB1 = "test_db1"; private static final String TEST_DB2 = "test_db2"; http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java index 116aed5..c9e5646 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java @@ -153,6 +153,7 @@ public class TestDisableResource extends ZkUnitTestBase { for (int i = 0; i < N; i++) { participants[i].syncStop(); } + TestHelper.dropCluster(clusterName, _gZkClient); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @@ -219,6 +220,7 @@ public class TestDisableResource extends ZkUnitTestBase { for (int i = 0; i < N; i++) { participants[i].syncStop(); } + TestHelper.dropCluster(clusterName, _gZkClient); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java index 515c640..82f38d9 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java @@ -24,7 +24,7 @@ import java.util.Date; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterDistributedController; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -36,7 +36,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestDistributedCMMain extends ZkIntegrationTestBase { +public class TestDistributedCMMain extends ZkTestBase { @Test public void testDistributedCMMain() throws Exception { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java index 3095a2b..777ba67 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java @@ -24,7 +24,7 @@ import java.util.Date; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterDistributedController; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -35,7 +35,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestDistributedClusterController extends ZkIntegrationTestBase { +public class TestDistributedClusterController extends ZkTestBase { @Test public void testDistributedClusterController() throws Exception { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java index 73af2bb..cf20def 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.helix.HelixManager; import org.apache.helix.PropertyPathBuilder; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZNRecordSerializer; @@ -39,7 +39,6 @@ import org.apache.helix.model.IdealState.RebalanceMode; import org.apache.helix.store.PropertyJsonSerializer; import org.apache.helix.store.PropertyStoreException; import org.apache.helix.tools.ClusterSetup; -import org.apache.helix.tools.ClusterStateVerifier; import org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier; import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier; import org.apache.helix.tools.DefaultIdealStateCalculator; @@ -55,7 +54,7 @@ import org.testng.Assert; public class TestDriver { private static Logger LOG = LoggerFactory.getLogger(TestDriver.class); - private static final String ZK_ADDR = ZkIntegrationTestBase.ZK_ADDR; + private static final String ZK_ADDR = ZkTestBase.ZK_ADDR; // private static final String CLUSTER_PREFIX = "TestDriver"; private static final String STATE_MODEL = "MasterSlave"; http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java index 3142b80..511888c 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java @@ -31,7 +31,7 @@ import org.apache.helix.HelixDefinedState; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.PropertyKey; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixAdmin; @@ -48,7 +48,7 @@ import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestDrop extends ZkIntegrationTestBase { +public class TestDrop extends ZkTestBase { /** * Assert externalView and currentState for each participant are empty http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestDropResource.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDropResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestDropResource.java index 7f0b77c..1fb6785 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDropResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDropResource.java @@ -31,8 +31,8 @@ public class TestDropResource extends ZkStandAloneCMTestBase { @Test() public void testDropResource() throws Exception { // add a resource to be dropped - _setupTool.addResourceToCluster(CLUSTER_NAME, "MyDB", 6, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB", 3); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, "MyDB", 6, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB", 3); boolean result = ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier( @@ -50,8 +50,8 @@ public class TestDropResource extends ZkStandAloneCMTestBase { @Test() public void testDropResourceWhileNodeDead() throws Exception { // add a resource to be dropped - _setupTool.addResourceToCluster(CLUSTER_NAME, "MyDB2", 16, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB2", 3); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, "MyDB2", 16, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB2", 3); boolean verifyResult = ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier( http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java index 6bd950c..e6e02fa 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java @@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit; import org.I0Itec.zkclient.serialize.BytesPushThroughSerializer; import org.apache.helix.PropertyPathBuilder; import org.apache.helix.TestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZkClient; @@ -43,7 +43,7 @@ import org.testng.annotations.Test; * Compression can be enabled for a specific resource by setting enableCompression=true in the * idealstate of the resource. Generally this is used when the number of partitions is large */ -public class TestEnableCompression extends ZkIntegrationTestBase { +public class TestEnableCompression extends ZkTestBase { @Test() public void testEnableCompressionResource() throws Exception { // Logger.getRootLogger().setLevel(Level.INFO); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java index 7c8e9e8..21f2035 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java @@ -24,7 +24,7 @@ import java.util.Date; import org.apache.helix.HelixManager; import org.apache.helix.NotificationContext; import org.apache.helix.TestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.mock.participant.MockTransition; @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; -public class TestEnablePartitionDuringDisable extends ZkIntegrationTestBase { +public class TestEnablePartitionDuringDisable extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestEnablePartitionDuringDisable.class); static { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java b/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java index dc38369..a879320 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java @@ -128,6 +128,7 @@ public class TestEntropyFreeNodeBounce extends ZkUnitTestBase { for (HelixManager participant : participants) { participant.disconnect(); } + TestHelper.dropCluster(clusterName, _gZkClient); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java b/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java index deef1bc..9ded9b1 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java @@ -26,7 +26,7 @@ import java.util.Map; import java.util.Set; import org.apache.helix.TestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixAdmin; @@ -35,7 +35,7 @@ import org.apache.helix.tools.ClusterStateVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestErrorPartition extends ZkIntegrationTestBase { +public class TestErrorPartition extends ZkTestBase { @Test() public void testErrorPartition() throws Exception { String clusterName = getShortClassName(); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java b/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java index 2bf2b85..e3e018d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java @@ -33,35 +33,35 @@ public class TestExpandCluster extends ZkStandAloneCMTestBase { @Test public void testExpandCluster() throws Exception { String DB2 = "TestDB2"; - int partitions = 100; + int partitions = 30; int replica = 3; - _setupTool.addResourceToCluster(CLUSTER_NAME, DB2, partitions, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, DB2, replica, "keyX"); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, DB2, partitions, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, DB2, replica, "keyX"); String DB3 = "TestDB3"; - _setupTool.addResourceToCluster(CLUSTER_NAME, DB3, partitions, STATE_MODEL); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, DB3, partitions, STATE_MODEL); IdealState testDB0 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB); IdealState testDB2 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB2); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB2); IdealState testDB3 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB3); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB3); for (int i = 0; i < 5; i++) { String storageNodeName = PARTICIPANT_PREFIX + "_" + (27960 + i); - _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); + _gSetupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); } String command = "-zkSvr localhost:2183 -expandCluster " + CLUSTER_NAME; ClusterSetup.processCommandLineArgs(command.split(" ")); IdealState testDB0_1 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB); IdealState testDB2_1 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB2); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB2); IdealState testDB3_1 = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB3); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, DB3); Map<String, Object> resultOld2 = RebalanceUtil.buildInternalIdealState(testDB2); Map<String, Object> result2 = RebalanceUtil.buildInternalIdealState(testDB2_1); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java b/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java index beff46d..de90677 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java @@ -26,7 +26,7 @@ import org.apache.helix.BaseDataAccessor; import org.apache.helix.PropertyKey.Builder; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZkBaseDataAccessor; @@ -37,7 +37,7 @@ import org.apache.zookeeper.data.Stat; import org.testng.Assert; import org.testng.annotations.Test; -public class TestExternalViewUpdates extends ZkIntegrationTestBase { +public class TestExternalViewUpdates extends ZkTestBase { @Test public void testExternalViewUpdates() throws Exception { System.out.println("START testExternalViewUpdates at " + new Date(System.currentTimeMillis())); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java b/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java index 5b331c5..3ff0086 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java @@ -29,7 +29,7 @@ import org.apache.helix.HelixConstants.ChangeType; import org.apache.helix.NotificationContext.Type; import org.apache.helix.PropertyKey.Builder; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; -public class TestHelixCustomCodeRunner extends ZkIntegrationTestBase { +public class TestHelixCustomCodeRunner extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestHelixCustomCodeRunner.class); private final String _clusterName = "CLUSTER_" + getShortClassName(); @@ -133,6 +133,8 @@ public class TestHelixCustomCodeRunner extends ZkIntegrationTestBase { for (int i = 0; i < _nodeNb; i++) { participants[i].syncStop(); } + accessor.removeProperty(keyBuilder.liveInstance("newLiveInstance")); + TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestHelixInstanceTag.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestHelixInstanceTag.java b/helix-core/src/test/java/org/apache/helix/integration/TestHelixInstanceTag.java index 211cca1..3c8d197 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestHelixInstanceTag.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestHelixInstanceTag.java @@ -43,10 +43,10 @@ public class TestHelixInstanceTag extends ZkStandAloneCMTestBase { int replica = 2; for (int i = 0; i < 2; i++) { String instanceName = "localhost_" + (12918 + i); - _setupTool.getClusterManagementTool().addInstanceTag(CLUSTER_NAME, instanceName, DB2tag); + _gSetupTool.getClusterManagementTool().addInstanceTag(CLUSTER_NAME, instanceName, DB2tag); } - _setupTool.addResourceToCluster(CLUSTER_NAME, DB2, partitions, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, DB2, DB2tag, replica); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, DB2, partitions, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, DB2, DB2tag, replica); boolean result = ClusterStateVerifier @@ -72,10 +72,10 @@ public class TestHelixInstanceTag extends ZkStandAloneCMTestBase { replica = 3; for (int i = 1; i < 5; i++) { String instanceName = "localhost_" + (12918 + i); - _setupTool.getClusterManagementTool().addInstanceTag(CLUSTER_NAME, instanceName, DB3Tag); + _gSetupTool.getClusterManagementTool().addInstanceTag(CLUSTER_NAME, instanceName, DB3Tag); } - _setupTool.addResourceToCluster(CLUSTER_NAME, DB3, partitions, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, DB3, DB3Tag, replica); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, DB3, partitions, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, DB3, DB3Tag, replica); result = ClusterStateVerifier http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java b/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java index 6f3d832..4350faf 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java @@ -21,12 +21,12 @@ package org.apache.helix.integration; import java.util.Date; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; -public class TestHelixUsingDifferentParams extends ZkIntegrationTestBase { +public class TestHelixUsingDifferentParams extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestHelixUsingDifferentParams.class); @Test() http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java index 7b56f5d..cb2c1c2 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java @@ -97,6 +97,7 @@ public class TestInvalidResourceRebalance extends ZkUnitTestBase { participants[i].syncStop(); } controller.syncStop(); + TestHelper.dropCluster(clusterName, _gZkClient); } } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java index bef21a7..37b8b82 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java @@ -24,7 +24,7 @@ import java.util.Date; import org.apache.helix.PropertyPathBuilder; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.model.IdealState; @@ -33,7 +33,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestNullReplica extends ZkIntegrationTestBase { +public class TestNullReplica extends ZkTestBase { @Test public void testNullReplica() throws Exception { @@ -82,6 +82,7 @@ public class TestNullReplica extends ZkIntegrationTestBase { for (int i = 0; i < 5; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java index 0f2fe6d..3ec3279 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java @@ -30,7 +30,7 @@ import org.apache.helix.HelixDataAccessor; import org.apache.helix.NotificationContext; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixAdmin; @@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; -public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBase { +public class TestPartitionLevelTransitionConstraint extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestPartitionLevelTransitionConstraint.class); @@ -197,6 +197,7 @@ public class TestPartitionLevelTransitionConstraint extends ZkIntegrationTestBas for (int i = 0; i < n; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java index 6c9c2e2..ca2d7dd 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java @@ -43,7 +43,6 @@ import org.apache.helix.model.ClusterConfig; import org.apache.helix.model.IdealState; import org.apache.helix.model.IdealState.RebalanceMode; import org.apache.helix.model.Message; -import org.apache.helix.tools.ClusterSetup; import org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier; import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier; import org.testng.Assert; @@ -60,18 +59,12 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { public void beforeClass() throws Exception { System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - String namespace = "/" + CLUSTER_NAME; - if (_gZkClient.exists(namespace)) { - _gZkClient.deleteRecursively(namespace); - } - _setupTool = new ClusterSetup(_gZkClient); - // setup storage cluster - _setupTool.addCluster(CLUSTER_NAME, true); + _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NODE_NR; i++) { String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i); - _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); + _gSetupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); } // add dummy participants @@ -117,8 +110,9 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100); clusterConfig - .setStateTransitionThrottleConfigs(Arrays.asList(resourceLoadThrottle, instanceLoadThrottle, - clusterLoadThrottle, resourceRecoveryThrottle, clusterRecoveryThrottle)); + .setStateTransitionThrottleConfigs(Arrays + .asList(resourceLoadThrottle, instanceLoadThrottle, clusterLoadThrottle, + resourceRecoveryThrottle, clusterRecoveryThrottle)); clusterConfig.setPersistIntermediateAssignment(true); _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); @@ -133,9 +127,9 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { for (int i = 0; i < 5; i++) { String dbName = "TestDB-" + i; - _setupTool.addResourceToCluster(CLUSTER_NAME, dbName, 10, STATE_MODEL, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, dbName, 10, STATE_MODEL, RebalanceMode.FULL_AUTO + ""); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, _replica); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, _replica); _dbs.add(dbName); } @@ -168,9 +162,9 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { for (int i = 0; i < NODE_NR - 2; i++) { _participants[i].syncStart(); } - _setupTool.addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, 10, STATE_MODEL, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, 10, STATE_MODEL, RebalanceMode.FULL_AUTO.name()); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, _replica); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, _replica); HelixClusterVerifier _clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build(); @@ -202,9 +196,9 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { for (int i = 0; i < NODE_NR - 3; i++) { _participants[i].syncStart(); } - _setupTool.addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_ANY", 20, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_ANY", 20, STATE_MODEL, RebalanceMode.FULL_AUTO.name()); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_ANY", + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_ANY", _replica); HelixClusterVerifier _clusterVerifier = @@ -234,7 +228,7 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { @AfterMethod public void cleanupTest() throws InterruptedException { for (String db : _dbs) { - _setupTool.dropResourceFromCluster(CLUSTER_NAME, db); + _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, db); Thread.sleep(20); } _dbs.clear(); @@ -267,7 +261,7 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { for (int i = 0; i < 5; i++) { String dbName = "TestDB-" + i; IdealState is = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, dbName); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, dbName); if (is != null) { System.err.println(dbName + "exists!"); is.setReplicas(String.valueOf(replica)); @@ -276,12 +270,12 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { is.setRebalanceDelay(delay); } is.setRebalancerClassName(DelayedAutoRebalancer.class.getName()); - _setupTool.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, dbName, is); + _gSetupTool.getClusterManagementTool().setResourceIdealState(CLUSTER_NAME, dbName, is); } else { createResourceWithDelayedRebalance(CLUSTER_NAME, dbName, STATE_MODEL, partition, replica, minActiveReplica, delay); } - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, _replica); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, dbName, _replica); _dbs.add(dbName); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java index badf572..3a0e784 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java @@ -24,7 +24,7 @@ import java.util.Date; import org.apache.helix.HelixDataAccessor; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -38,7 +38,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestPauseSignal extends ZkIntegrationTestBase { +public class TestPauseSignal extends ZkTestBase { @Test() public void testPauseSignal() throws Exception { // Logger.getRootLogger().setLevel(Level.INFO); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java b/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java index debd923..c39ce0e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java @@ -50,17 +50,12 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { // Logger.getRootLogger().setLevel(Level.INFO); System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - String namespace = "/" + CLUSTER_NAME; - if (_gZkClient.exists(namespace)) { - _gZkClient.deleteRecursively(namespace); - } - _setupTool = new ClusterSetup(ZK_ADDR); // setup storage cluster - _setupTool.addCluster(CLUSTER_NAME, true); + _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NODE_NR; i++) { String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i); - _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); + _gSetupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); } // start controller @@ -87,9 +82,9 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { throws Exception { String testDb = "TestDB2-" + rebalanceMode.name(); - _setupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, BuiltInStateModelDefinitions.LeaderStandby.name(), rebalanceMode.name()); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); BestPossibleExternalViewVerifier.Builder verifierBuilder = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR) @@ -106,14 +101,14 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { Assert.assertTrue(verifierBuilder.build().verify()); IdealState idealState = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); Set<String> excludedInstances = new HashSet<String>(); excludedInstances.add(_participants[0].getInstanceName()); verifyAssignmentInIdealStateWithPersistDisabled(idealState, excludedInstances); // clean up - _setupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); _participants[0] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, _participants[0].getInstanceName()); _participants[0].syncStart(); @@ -125,9 +120,9 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { String testDb = "TestDB1-" + rebalanceMode.name(); enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); - _setupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, BuiltInStateModelDefinitions.LeaderStandby.name(), rebalanceMode.name()); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); BestPossibleExternalViewVerifier.Builder verifierBuilder = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR) @@ -136,7 +131,7 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { Assert.assertTrue(verifierBuilder.build().verify()); IdealState idealState = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); verifyAssignmentInIdealStateWithPersistEnabled(idealState, new HashSet<String>()); // kill 1 node @@ -147,7 +142,7 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { verifierBuilder.setExpectLiveInstances(liveInstances); Assert.assertTrue(verifierBuilder.build().verify()); - idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); // verify that IdealState contains updated assignment in it map fields. Set<String> excludedInstances = new HashSet<String>(); @@ -155,7 +150,7 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { verifyAssignmentInIdealStateWithPersistEnabled(idealState, excludedInstances); // clean up - _setupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); _participants[0] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, _participants[0].getInstanceName()); _participants[0].syncStart(); @@ -171,9 +166,9 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { String testDb = "TestDB1-MasterSlave"; enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); - _setupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, + _gSetupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5, BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.SEMI_AUTO.name()); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, 3); BestPossibleExternalViewVerifier.Builder verifierBuilder = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR) @@ -182,7 +177,7 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { Assert.assertTrue(verifierBuilder.build().verify()); IdealState idealState = - _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); verifySemiAutoMasterSlaveAssignment(idealState); // kill 1 node @@ -193,18 +188,18 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { verifierBuilder.setExpectLiveInstances(liveInstances); Assert.assertTrue(verifierBuilder.build().verify()); - idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); verifySemiAutoMasterSlaveAssignment(idealState); // disable an instance - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool() .enableInstance(CLUSTER_NAME, _participants[1].getInstanceName(), false); - idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); + idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, testDb); verifySemiAutoMasterSlaveAssignment(idealState); // clean up - _setupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb); + _gSetupTool.getClusterManagementTool() .enableInstance(CLUSTER_NAME, _participants[1].getInstanceName(), true); _participants[0].reset(); _participants[0].syncStart(); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java index a1f1868..d81344c 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java @@ -157,6 +157,7 @@ public class TestReelectedPipelineCorrectness extends ZkUnitTestBase { for (int i = 2; i < NUM_PARTICIPANTS; i++) { participants[i].syncStop(); } + TestHelper.dropCluster(clusterName, _gZkClient); System.out.println("STOP " + clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java index 5177564..0f74565 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java @@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -40,7 +40,7 @@ import org.apache.helix.tools.DefaultIdealStateCalculator; import org.testng.Assert; import org.testng.annotations.Test; -public class TestRenamePartition extends ZkIntegrationTestBase { +public class TestRenamePartition extends ZkTestBase { // map from clusterName to participants final Map<String, MockParticipantManager[]> _participantMap = new ConcurrentHashMap<String, MockParticipantManager[]>(); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java index a24e488..b307799 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; import org.apache.helix.TestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.mock.participant.ErrTransition; @@ -34,7 +34,7 @@ import org.apache.helix.tools.ClusterStateVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestResetInstance extends ZkIntegrationTestBase { +public class TestResetInstance extends ZkTestBase { @Test public void testResetInstance() throws Exception { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java index 295c1c0..c1e92a6 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java @@ -28,7 +28,7 @@ import org.apache.helix.NotificationContext; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -41,7 +41,7 @@ import org.apache.helix.tools.ClusterStateVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestResetPartitionState extends ZkIntegrationTestBase { +public class TestResetPartitionState extends ZkTestBase { int _errToOfflineInvoked = 0; class ErrTransitionWithResetCnt extends ErrTransition { @@ -175,6 +175,7 @@ public class TestResetPartitionState extends ZkIntegrationTestBase { for (int i = 0; i < 5; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java index 2246c6e..e038ebb 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; import org.apache.helix.TestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.mock.participant.ErrTransition; @@ -34,7 +34,7 @@ import org.apache.helix.tools.ClusterStateVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestResetResource extends ZkIntegrationTestBase { +public class TestResetResource extends ZkTestBase { @Test public void testResetNode() throws Exception { String className = TestHelper.getTestClassName(); @@ -106,6 +106,7 @@ public class TestResetResource extends ZkIntegrationTestBase { for (int i = 0; i < 5; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestResourceGroupEndtoEnd.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResourceGroupEndtoEnd.java b/helix-core/src/test/java/org/apache/helix/integration/TestResourceGroupEndtoEnd.java index f2d876d..ffd3000 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResourceGroupEndtoEnd.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResourceGroupEndtoEnd.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.CountDownLatch; import org.apache.helix.HelixAdmin; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.ZkTestManager; import org.apache.helix.manager.zk.CallbackHandler; @@ -36,7 +36,6 @@ import org.apache.helix.mock.participant.DummyProcess; import org.apache.helix.model.BuiltInStateModelDefinitions; import org.apache.helix.model.IdealState; import org.apache.helix.model.InstanceConfig; -import org.apache.helix.model.OnlineOfflineSMD; import org.apache.helix.spectator.RoutingTableProvider; import org.apache.helix.tools.ClusterStateVerifier; import org.testng.Assert; @@ -54,7 +53,7 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -public class TestResourceGroupEndtoEnd extends ZkIntegrationTestBase { +public class TestResourceGroupEndtoEnd extends ZkTestBase { protected static final int GROUP_NODE_NR = 5; protected static final int START_PORT = 12918; @@ -140,6 +139,7 @@ public class TestResourceGroupEndtoEnd extends ZkIntegrationTestBase { _controller.syncStop(); _spectator.disconnect(); _routingTableProvider.shutdown(); + _gSetupTool.deleteCluster(CLUSTER_NAME); } private void addInstanceGroup(String clusterName, String instanceTag, int numInstance) { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java b/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java index bbb46eb..23bc801 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java @@ -119,6 +119,7 @@ public class TestResourceWithSamePartitionKey extends ZkUnitTestBase { for (int i = 0; i < n; i++) { participants[i].syncStop(); } + TestHelper.dropCluster(clusterName, _gZkClient); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java index 36ff05d..7cc367c 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java @@ -26,7 +26,7 @@ import java.util.Map; import org.apache.helix.PropertyKey; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -38,7 +38,7 @@ import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.testng.Assert; import org.testng.annotations.Test; -public class TestSchemataSM extends ZkIntegrationTestBase { +public class TestSchemataSM extends ZkTestBase { @Test public void testSchemataSM() throws Exception { String className = TestHelper.getTestClassName(); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java index fc2b3b5..698b099 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.helix.NotificationContext; import org.apache.helix.TestHelper; import org.apache.helix.ZkTestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.mock.participant.MockTransition; @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; -public class TestSessionExpiryInTransition extends ZkIntegrationTestBase { +public class TestSessionExpiryInTransition extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestSessionExpiryInTransition.class); public class SessionExpiryTransition extends MockTransition { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java b/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java index 7c2c930..4b56c09 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java @@ -23,7 +23,7 @@ import java.util.Date; import org.apache.helix.TestHelper; import org.apache.helix.ZkTestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.tools.ClusterSetup; @@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; -public class TestStandAloneCMSessionExpiry extends ZkIntegrationTestBase { +public class TestStandAloneCMSessionExpiry extends ZkTestBase { private static Logger LOG = LoggerFactory.getLogger(TestStandAloneCMSessionExpiry.class); @Test() http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java b/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java index 348cfe2..30e37af 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java @@ -24,13 +24,13 @@ import java.util.Date; import org.apache.helix.PropertyPathBuilder; import org.apache.helix.TestHelper; import org.apache.helix.ZkTestHelper; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.model.IdealState.RebalanceMode; import org.testng.Assert; import org.testng.annotations.Test; -public class TestStartMultipleControllersWithSameName extends ZkIntegrationTestBase { +public class TestStartMultipleControllersWithSameName extends ZkTestBase { @Test public void test() throws Exception { String className = TestHelper.getTestClassName(); @@ -67,6 +67,7 @@ public class TestStartMultipleControllersWithSameName extends ZkIntegrationTestB for (int i = 0; i < 4; i++) { controllers[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionCancellation.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionCancellation.java b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionCancellation.java index e080e84..e2fa6f5 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionCancellation.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionCancellation.java @@ -66,13 +66,8 @@ public class TestStateTransitionCancellation extends TaskTestBase { _numReplicas = 2; _verifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build(); - String namespace = "/" + CLUSTER_NAME; - if (_gZkClient.exists(namespace)) { - _gZkClient.deleteRecursively(namespace); - } - _setupTool = new ClusterSetup(ZK_ADDR); - _setupTool.addCluster(CLUSTER_NAME, true); + _gSetupTool.addCluster(CLUSTER_NAME, true); setupParticipants(); setupDBs(); @@ -98,13 +93,13 @@ public class TestStateTransitionCancellation extends TaskTestBase { Thread.sleep(2000); // Disable the resource - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool() .enableResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, false); // Wait for pipeline reaching final stage Assert.assertTrue(_verifier.verify()); - ExternalView externalView = _setupTool.getClusterManagementTool() + ExternalView externalView = _gSetupTool.getClusterManagementTool() .getResourceExternalView(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB); for (String partition : externalView.getPartitionSet()) { for (String currentState : externalView.getStateMap(partition).values()) { @@ -122,19 +117,19 @@ public class TestStateTransitionCancellation extends TaskTestBase { // Reenable resource stateCleanUp(); - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool() .enableResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, true); // Wait for assignment done Thread.sleep(2000); // Disable the resource - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool() .enableResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, false); // Wait for pipeline reaching final stage Thread.sleep(2000L); - ExternalView externalView = _setupTool.getClusterManagementTool() + ExternalView externalView = _gSetupTool.getClusterManagementTool() .getResourceExternalView(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB); for (String partition : externalView.getPartitionSet()) { Assert.assertTrue(externalView.getStateMap(partition).values().contains("SLAVE")); @@ -151,7 +146,7 @@ public class TestStateTransitionCancellation extends TaskTestBase { // Reenable resource stateCleanUp(); - _setupTool.getClusterManagementTool() + _gSetupTool.getClusterManagementTool() .enableResource(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB, true); // Wait for assignment done @@ -159,7 +154,7 @@ public class TestStateTransitionCancellation extends TaskTestBase { int numNodesToStart = 10; for (int i = 0; i < numNodesToStart; i++) { String storageNodeName = PARTICIPANT_PREFIX + "_" + (_startPort + _numNodes + i); - _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); + _gSetupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName); } MockParticipantManager[] newParticipants = new MockParticipantManager[numNodesToStart]; registerParticipants(newParticipants, numNodesToStart, _startPort + _numNodes, 1000, -3000000L); @@ -167,7 +162,7 @@ public class TestStateTransitionCancellation extends TaskTestBase { // Wait for pipeline reaching final stage Thread.sleep(2000L); int numOfMasters = 0; - ExternalView externalView = _setupTool.getClusterManagementTool() + ExternalView externalView = _gSetupTool.getClusterManagementTool() .getResourceExternalView(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB); for (String partition : externalView.getPartitionSet()) { if (externalView.getStateMap(partition).values().contains("MASTER")) { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java index 5e8db94..124160e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java @@ -21,7 +21,7 @@ package org.apache.helix.integration; import org.apache.helix.*; import org.apache.helix.api.config.StateTransitionThrottleConfig; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixDataAccessor; @@ -38,7 +38,7 @@ import org.testng.annotations.Test; import java.util.*; -public class TestStateTransitionThrottle extends ZkIntegrationTestBase { +public class TestStateTransitionThrottle extends ZkTestBase { int participantCount = 4; String resourceName = "TestDB0"; String resourceNamePrefix = "TestDB"; @@ -103,6 +103,7 @@ public class TestStateTransitionThrottle extends ZkIntegrationTestBase { for (int i = 0; i < participantCount; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @@ -178,6 +179,7 @@ public class TestStateTransitionThrottle extends ZkIntegrationTestBase { for (int i = 0; i < participantCount; i++) { participants[i].syncStop(); } + _gSetupTool.deleteCluster(clusterName); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @@ -205,6 +207,8 @@ public class TestStateTransitionThrottle extends ZkIntegrationTestBase { StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100)); clusterConfig.setStateTransitionThrottleConfigs(throttleConfigs); accessor.setProperty(keyBuilder.clusterConfig(), clusterConfig); + + _gSetupTool.deleteCluster(clusterName); } private static boolean pollForPartitionAssignment(final HelixDataAccessor accessor, http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestStatusUpdate.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStatusUpdate.java b/helix-core/src/test/java/org/apache/helix/integration/TestStatusUpdate.java index ab6b2a3..01460aa 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStatusUpdate.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStatusUpdate.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Set; import org.apache.helix.PropertyKey.Builder; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.common.ZkStandAloneCMTestBase; import org.apache.helix.manager.zk.ZKHelixDataAccessor; import org.apache.helix.manager.zk.ZNRecordSerializer; @@ -40,7 +40,7 @@ public class TestStatusUpdate extends ZkStandAloneCMTestBase { // this test // @Test public void testParticipantStatusUpdates() throws Exception { - ZkClient zkClient = new ZkClient(ZkIntegrationTestBase.ZK_ADDR); + ZkClient zkClient = new ZkClient(ZkTestBase.ZK_ADDR); zkClient.setZkSerializer(new ZNRecordSerializer()); ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(CLUSTER_NAME, new ZkBaseDataAccessor(zkClient)); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestSwapInstance.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSwapInstance.java b/helix-core/src/test/java/org/apache/helix/integration/TestSwapInstance.java index e086671..acb2f65 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSwapInstance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSwapInstance.java @@ -35,8 +35,8 @@ public class TestSwapInstance extends ZkStandAloneCMTestBase { public void TestSwap() throws Exception { HelixManager manager = _controller; HelixDataAccessor helixAccessor = manager.getHelixDataAccessor(); - _setupTool.addResourceToCluster(CLUSTER_NAME, "MyDB", 64, STATE_MODEL); - _setupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB", _replica); + _gSetupTool.addResourceToCluster(CLUSTER_NAME, "MyDB", 64, STATE_MODEL); + _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "MyDB", _replica); ZNRecord idealStateOld1 = new ZNRecord("TestDB"); ZNRecord idealStateOld2 = new ZNRecord("MyDB"); @@ -51,8 +51,7 @@ public class TestSwapInstance extends ZkStandAloneCMTestBase { .verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, CLUSTER_NAME))); String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + 0); - ZKHelixAdmin tool = new ZKHelixAdmin(_gZkClient); - _setupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, instanceName, false); + _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, instanceName, false); boolean result = ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier( @@ -60,11 +59,11 @@ public class TestSwapInstance extends ZkStandAloneCMTestBase { Assert.assertTrue(result); String instanceName2 = PARTICIPANT_PREFIX + "_" + (START_PORT + 444); - _setupTool.addInstanceToCluster(CLUSTER_NAME, instanceName2); + _gSetupTool.addInstanceToCluster(CLUSTER_NAME, instanceName2); boolean exception = false; try { - _setupTool.swapInstance(CLUSTER_NAME, instanceName, instanceName2); + _gSetupTool.swapInstance(CLUSTER_NAME, instanceName, instanceName2); } catch (Exception e) { exception = true; } @@ -75,7 +74,7 @@ public class TestSwapInstance extends ZkStandAloneCMTestBase { exception = false; try { - _setupTool.swapInstance(CLUSTER_NAME, instanceName, instanceName2); + _gSetupTool.swapInstance(CLUSTER_NAME, instanceName, instanceName2); } catch (Exception e) { e.printStackTrace(); exception = true; http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestSyncSessionToController.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSyncSessionToController.java b/helix-core/src/test/java/org/apache/helix/integration/TestSyncSessionToController.java index 116b469..4579dfb 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSyncSessionToController.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSyncSessionToController.java @@ -9,7 +9,7 @@ import org.apache.helix.NotificationContext; import org.apache.helix.PropertyKey; import org.apache.helix.TestHelper; import org.apache.helix.ZNRecord; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.integration.manager.ClusterControllerManager; import org.apache.helix.integration.manager.MockParticipantManager; import org.apache.helix.manager.zk.ZKHelixManager; @@ -20,7 +20,7 @@ import org.testng.Assert; import org.testng.annotations.Test; -public class TestSyncSessionToController extends ZkIntegrationTestBase { +public class TestSyncSessionToController extends ZkTestBase { @Test public void testSyncSessionToController() throws Exception { System.out.println("START testSyncSessionToController at " + new Date(System.currentTimeMillis())); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java b/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java index 488fcab..243ce9e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java @@ -14,9 +14,8 @@ import org.apache.helix.controller.rebalancer.constraint.dataprovider.MockCapaci import org.apache.helix.controller.rebalancer.constraint.dataprovider.MockPartitionWeightProvider; import org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedCapacityProvider; import org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedPartitionWeightProvider; -import org.apache.helix.integration.common.ZkIntegrationTestBase; +import org.apache.helix.common.ZkTestBase; import org.apache.helix.model.*; -import org.apache.helix.tools.ClusterSetup; import org.apache.helix.util.WeightAwareRebalanceUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,10 +28,9 @@ import java.util.*; import static org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedPartitionWeightProvider.DEFAULT_WEIGHT_VALUE; -public class TestWeightBasedRebalanceUtil extends ZkIntegrationTestBase { +public class TestWeightBasedRebalanceUtil extends ZkTestBase { private static Logger _logger = LoggerFactory.getLogger(TestWeightBasedRebalanceUtil.class); private static String CLUSTER_NAME; - private static ClusterSetup _setupTool; final String resourceNamePrefix = "resource"; final int nParticipants = 40; @@ -80,19 +78,13 @@ public class TestWeightBasedRebalanceUtil extends ZkIntegrationTestBase { setupMockCluster(); - String namespace = "/" + CLUSTER_NAME; - if (_gZkClient.exists(namespace)) { - _gZkClient.deleteRecursive(namespace); - } - _setupTool = new ClusterSetup(ZK_ADDR); - // setup storage cluster - _setupTool.addCluster(CLUSTER_NAME, true); + _gSetupTool.addCluster(CLUSTER_NAME, true); } @AfterClass public void afterClass() { - _setupTool.deleteCluster(CLUSTER_NAME); + _gSetupTool.deleteCluster(CLUSTER_NAME); } private void setupMockCluster() { http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java index 319f540..c6a795e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java @@ -12,6 +12,8 @@ import org.apache.helix.integration.task.MockTask; import org.apache.helix.integration.task.TaskTestBase; import org.apache.helix.integration.task.TaskTestUtil; import org.apache.helix.integration.task.WorkflowGenerator; +import org.apache.helix.manager.zk.ZNRecordSerializer; +import org.apache.helix.manager.zk.ZkClient; import org.apache.helix.task.JobConfig; import org.apache.helix.task.JobQueue; import org.apache.helix.task.TaskState; @@ -22,6 +24,7 @@ import org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; +import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -37,22 +40,21 @@ public class TestZkConnectionLost extends TaskTestBase { private final AtomicReference<ZkServer> _zkServerRef = new AtomicReference<>(); private String _zkAddr = "localhost:2189"; + ClusterSetup _setupTool; + ZkClient _zkClient; + @BeforeClass public void beforeClass() throws Exception { ZkServer zkServer = TestHelper.startZkServer(_zkAddr); _zkServerRef.set(zkServer); - + _zkClient = new ZkClient(_zkAddr); + _zkClient.setZkSerializer(new ZNRecordSerializer()); + _setupTool = new ClusterSetup(_zkClient); _participants = new MockParticipantManager[_numNodes]; - String namespace = "/" + CLUSTER_NAME; - if (_gZkClient.exists(namespace)) { - _gZkClient.deleteRecursively(namespace); - } - - _setupTool = new ClusterSetup(_zkAddr); _setupTool.addCluster(CLUSTER_NAME, true); - setupParticipants(); - setupDBs(); + setupParticipants(_setupTool); + setupDBs(_setupTool); createManagers(_zkAddr, CLUSTER_NAME); // start controller @@ -65,6 +67,29 @@ public class TestZkConnectionLost extends TaskTestBase { Assert.assertTrue(clusterVerifier.verify()); } + @AfterClass + public void afterClass() throws Exception { + if (_controller != null && _controller.isConnected()) { + _controller.syncStop(); + } + if (_manager != null && _manager.isConnected()) { + _manager.disconnect(); + } + stopParticipants(); + + String namespace = "/" + CLUSTER_NAME; + if (_zkClient.exists(namespace)) { + try { + _setupTool.deleteCluster(CLUSTER_NAME); + } catch (Exception ex) { + System.err.println( + "Failed to delete cluster " + CLUSTER_NAME + ", error: " + ex.getLocalizedMessage()); + } + } + _zkClient.close(); + TestHelper.stopZkServer(_zkServerRef.get()); + } + @Test public void testLostZkConnection() throws Exception { System.setProperty(SystemPropertyKeys.ZK_WAIT_CONNECTED_TIMEOUT, "1000"); http://git-wip-us.apache.org/repos/asf/helix/blob/c0d5792b/helix-core/src/test/java/org/apache/helix/integration/common/IntegrationTest.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/integration/common/IntegrationTest.java b/helix-core/src/test/java/org/apache/helix/integration/common/IntegrationTest.java deleted file mode 100644 index c2882e4..0000000 --- a/helix-core/src/test/java/org/apache/helix/integration/common/IntegrationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.helix.integration.common; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is dist_hdlrFtyRegistryributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Date; - -import org.testng.annotations.Test; - -/** - * This is a simple integration test. We will use this until we have framework - * which helps us write integration tests easily - */ - -public class IntegrationTest extends ZkStandAloneCMTestBase { - @Test - public void integrationTest() throws Exception { - System.out.println("START IntegrationTest at " + new Date(System.currentTimeMillis())); - // Thread.currentThread().join(); - System.out.println("END IntegrationTest at " + new Date(System.currentTimeMillis())); - } -}
