http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
index 00537a4..08af37b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
@@ -109,11 +109,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
// System.out.println("participant watch paths: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher. MESSAGES->HelixTaskExecutor");
// check HelixManager#_handlers
// printHandlers(controllerManager);
@@ -122,8 +122,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
int particHandlerNb = participantManagerToExpire.getHandlers().size();
Assert.assertEquals(controllerHandlerNb, 9,
"HelixController should have 9 (5+2n) callback handlers for 2 (n) participant");
- Assert.assertEquals(particHandlerNb, 2,
- "HelixParticipant should have 2 (msg+cur-state) callback handlers");
+ Assert.assertEquals(particHandlerNb, 1,
+ "HelixParticipant should have 1 (msg->HelixTaskExecutor) callback handlers");
// expire the session of participant
System.out.println("Expiring participant session...");
@@ -164,11 +164,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
// System.out.println("participant watch paths after session expiry: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher after session expiry.");
// check handlers
// printHandlers(controllerManager);
@@ -249,8 +249,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(controllerHandlerNb, 9,
"HelixController should have 9 (5+2n) callback handlers for 2 participant, but was
"
+ controllerHandlerNb + ", " + printHandlers(controller));
- Assert.assertEquals(particHandlerNb, 2,
- "HelixParticipant should have 2 (msg+cur-state) callback handlers, but was "
+ Assert.assertEquals(particHandlerNb, 1,
+ "HelixParticipant should have 1 (msg->HelixTaskExecutor) callback handler, but
was "
+ particHandlerNb + ", " + printHandlers(participantManager));
// expire controller
@@ -292,11 +292,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManager.getSessionId());
// System.out.println("participant watch paths after session expiry: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher after session expiry.");
// check HelixManager#_handlers
// printHandlers(controllerManager);
@@ -370,8 +370,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
PropertyKey.Builder keyBuilder = new PropertyKey.Builder(clusterName);
// check manager#hanlders
- Assert.assertEquals(participantToExpire.getHandlers().size(), 3,
- "Should have 3 handlers: CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES");
+ Assert.assertEquals(participantToExpire.getHandlers().size(), 2,
+ "Should have 2 handlers: CURRENTSTATE/{sessionId}, and MESSAGES");
// check zkclient#listeners
Map<String, Set<IZkDataListener>> dataListeners =
@@ -387,10 +387,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(dataListeners.get(path).size(), 1, "Should have 1 data-listeners
on path: "
+ path);
Assert
- .assertEquals(
- childListeners.size(),
- 3,
- "Should have 3 paths (CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES) each
of which has 1 child-listener");
+ .assertEquals(childListeners.size(), 2,
+ "Should have 2 paths (CURRENTSTATE/{sessionId}, and MESSAGES) each of which has
1 child-listener");
path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
@@ -398,20 +396,17 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
path = keyBuilder.controller().getPath();
- Assert.assertEquals(childListeners.get(path).size(), 1,
- "Should have 1 child-listener on path: " + path);
+ Assert.assertNull(childListeners.get(path), "Should have no child-listener on path: "
+ path);
// check zookeeper#watches on client side
Map<String, List<String>> watchPaths =
ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
// System.out.println("localhost_12918 zk-client side watchPaths: " + watchPaths + "\n");
Assert
- .assertEquals(
- watchPaths.get("dataWatches").size(),
- 4,
- "Should have 4 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB,
CONTROLLER, MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 3,
- "Should have 3 child-watches: CONTROLLER, MESSAGES, and CURRENTSTATE/{sessionId}");
+ .assertEquals(watchPaths.get("dataWatches").size(), 3,
+ "Should have 3 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB,
MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
+ "Should have 2 child-watches: MESSAGES, and CURRENTSTATE/{sessionId}");
// expire localhost_12918
System.out.println("Expire participant: " + participantToExpire.getInstanceName()
@@ -430,8 +425,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
participantToExpire.getHandlers().size(),
- 2,
- "Should have 2 handlers: CONTROLLER and MESSAGES. CURRENTSTATE/{sessionId} handler
should be removed by CallbackHandler#handleChildChange()");
+ 1,
+ "Should have 1 handlers: MESSAGES. CURRENTSTATE/{sessionId} handler should be
removed by CallbackHandler#handleChildChange()");
// check zkclient#listeners
dataListeners = ZkTestHelper.getZkDataListener(participantToExpire.getZkClient());
@@ -441,8 +436,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
childListeners.size(),
- 3,
- "Should have 3 paths (CURRENTSTATE/{oldSessionId}, CONTROLLER, and MESSAGES).
"
+ 2,
+ "Should have 2 paths (CURRENTSTATE/{oldSessionId}, and MESSAGES). "
+ "CONTROLLER and MESSAGE has 1 child-listener each. CURRENTSTATE/{oldSessionId}
doesn't have listener (ZkClient doesn't remove empty childListener set. probably a ZkClient
bug. see ZkClient#unsubscribeChildChange())");
path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
Assert.assertEquals(childListeners.get(path).size(), 0,
@@ -451,16 +446,16 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
path = keyBuilder.controller().getPath();
- Assert.assertEquals(childListeners.get(path).size(), 1,
- "Should have 1 child-listener on path: " + path);
+ Assert.assertNull(childListeners.get(path),
+ "Should have no child-listener on path: " + path);
// check zookeeper#watches on client side
watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
// System.out.println("localhost_12918 zk-client side watchPaths: " + watchPaths + "\n");
- Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
- "Should have 2 data-watches: CONTROLLER and MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
- "Should have 2 child-watches: CONTROLLER and MESSAGES");
+ Assert.assertEquals(watchPaths.get("dataWatches").size(), 1,
+ "Should have 1 data-watches: MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 1,
+ "Should have 1 child-watches: MESSAGES");
Assert
.assertEquals(watchPaths.get("existWatches").size(), 2,
"Should have 2 exist-watches: CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0");
@@ -479,10 +474,10 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
// check zookeeper#watches on client side
watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
// System.out.println("localhost_12918 zk-client side watchPaths: " + watchPaths + "\n");
- Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
- "Should have 2 data-watches: CONTROLLER and MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
- "Should have 2 child-watches: CONTROLLER and MESSAGES");
+ Assert.assertEquals(watchPaths.get("dataWatches").size(), 1,
+ "Should have 1 data-watches: MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 1,
+ "Should have 1 child-watches: MESSAGES");
Assert
.assertEquals(
watchPaths.get("existWatches").size(),
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
b/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
deleted file mode 100644
index e065ee3..0000000
--- a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.helix.integration;
-
-/*
- * 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 distributed 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.List;
-
-import org.apache.helix.HelixDataAccessor;
-import org.apache.helix.PropertyKey.Builder;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.controller.restlet.ZKPropertyTransferServer;
-import org.apache.helix.controller.restlet.ZkPropertyTransferClient;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.helix.manager.zk.ZkBaseDataAccessor;
-import org.apache.helix.model.StatusUpdate;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-/**
- * setup a storage cluster and start a zk-based cluster controller in stand-alone mode
- * start 5 dummy participants verify the current states at end
- */
-
-public class ZkStandAloneCMTestBaseWithPropertyServerCheck extends ZkStandAloneCMTestBase
{
- @Override
- @BeforeClass
- public void beforeClass() throws Exception {
- ZKPropertyTransferServer.PERIOD = 500;
- ZkPropertyTransferClient.SEND_PERIOD = 500;
- ZKPropertyTransferServer.getInstance().init(19999, ZK_ADDR);
- super.beforeClass();
-
- Thread.sleep(1000);
- HelixDataAccessor accessor =
- new ZKHelixDataAccessor(CLUSTER_NAME, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
- Builder kb = accessor.keyBuilder();
-
- for (int i = 0; i < NODE_NR; i++) {
- String instanceName = _participants[i].getInstanceName();
- List<StatusUpdate> statusUpdates =
- accessor.getChildValues(kb.stateTransitionStatus(instanceName,
- _participants[i].getSessionId(), TEST_DB));
-
- for (int j = 0; j < 10; j++) {
- statusUpdates =
- accessor.getChildValues(kb.stateTransitionStatus(instanceName,
- _participants[i].getSessionId(), TEST_DB));
- if (statusUpdates.size() == 0) {
- Thread.sleep(500);
- } else {
- break;
- }
- }
- Assert.assertTrue(statusUpdates.size() > 0);
- for (StatusUpdate update : statusUpdates) {
- Assert.assertTrue(update.getRecord()
- .getSimpleField(ZkPropertyTransferClient.USE_PROPERTYTRANSFER).equals("true"));
- Assert
- .assertTrue(update.getRecord().getSimpleField(ZKPropertyTransferServer.SERVER)
!= null);
- }
- }
- }
-
- @Override
- @AfterClass
- public void afterClass() throws Exception {
- super.afterClass();
- ZKPropertyTransferServer.getInstance().shutdown();
- ZKPropertyTransferServer.getInstance().reset();
- }
-}
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
index 8bff2fb..69448dc 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java
@@ -243,8 +243,8 @@ public class TestConsecutiveZkSessionExpiry extends ZkUnitTestBase {
Assert
.assertEquals(
handlers.size(),
- 2,
- "Distributed controller should have 2 handlers (message and data-accessor) after
lose leadership, but was "
+ 1,
+ "Distributed controller should have 1 handler (message) after lose leadership,
but was "
+ handlers.size());
// clean up
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
index aa00a8d..f797d1b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java
@@ -146,8 +146,8 @@ public class TestDistributedControllerManager extends ZkIntegrationTestBase
{
Assert
.assertEquals(
handlers.size(),
- 2,
- "Distributed controller should have 2 handlers (message and data-accessor) after
lose leadership, but was "
+ 1,
+ "Distributed controller should have 1 handler (message) after lose leadership,
but was "
+ handlers.size());
}
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
b/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
index 59a3fd9..9b3c32f 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestZkCallbackHandlerLeak.java
@@ -107,11 +107,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
LOG.debug("participant watch paths: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher.");
// check HelixManager#_handlers
// printHandlers(controllerManager);
@@ -120,8 +120,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
int particHandlerNb = participantManagerToExpire.getHandlers().size();
Assert.assertEquals(controllerHandlerNb, (5 + 2 * n),
"HelixController should have 9 (5+2n) callback handlers for 2 (n) participant");
- Assert.assertEquals(particHandlerNb, 2,
- "HelixParticipant should have 2 (msg+cur-state) callback handlers");
+ Assert.assertEquals(particHandlerNb, 1,
+ "HelixParticipant should have 1 (msg->HelixTaskExecutor) callback handlers");
// expire the session of participant
LOG.debug("Expiring participant session...");
@@ -162,11 +162,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManagerToExpire.getSessionId());
LOG.debug("participant watch paths after session expiry: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher after session expiry.");
// check handlers
// printHandlers(controllerManager);
@@ -239,8 +239,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(controllerHandlerNb, (5 + 2 * n),
"HelixController should have 9 (5+2n) callback handlers for 2 participant, but was
"
+ controllerHandlerNb + ", " + TestHelper.printHandlers(controller));
- Assert.assertEquals(particHandlerNb, 2,
- "HelixParticipant should have 2 (msg+cur-state) callback handlers, but was "
+ Assert.assertEquals(particHandlerNb, 1,
+ "HelixParticipant should have 1 (msg->HelixTaskExecutor) callback handler, but
was "
+ particHandlerNb + ", " + TestHelper.printHandlers(participantManager));
// expire controller
@@ -283,11 +283,11 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Set<String> watchPaths = watchers.get("0x" + participantManager.getSessionId());
LOG.debug("participant watch paths after session expiry: " + watchPaths);
- // participant should have 2 zk-watchers: 1 for MESSAGE and 1 for CONTROLLER
- return watchPaths.size() == 2;
+ // participant should have 1 zk-watcher: 1 for MESSAGE
+ return watchPaths.size() == 1;
}
}, 500);
- Assert.assertTrue(result, "Participant should have 2 zk-watchers after session expiry.");
+ Assert.assertTrue(result, "Participant should have 1 zk-watcher after session expiry.");
// check HelixManager#_handlers
// printHandlers(controllerManager);
@@ -354,8 +354,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
PropertyKey.Builder keyBuilder = new PropertyKey.Builder(clusterName);
// check manager#hanlders
- Assert.assertEquals(participantToExpire.getHandlers().size(), 3,
- "Should have 3 handlers: CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES");
+ Assert.assertEquals(participantToExpire.getHandlers().size(), 2,
+ "Should have 2 handlers: CURRENTSTATE/{sessionId}, and MESSAGES");
// check zkclient#listeners
Map<String, Set<IZkDataListener>> dataListeners =
@@ -373,8 +373,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
childListeners.size(),
- 3,
- "Should have 3 paths (CURRENTSTATE/{sessionId}, CONTROLLER, and MESSAGES) each
of which has 1 child-listener");
+ 2,
+ "Should have 2 paths (CURRENTSTATE/{sessionId}, and MESSAGES) each of which has
1 child-listener");
path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
@@ -382,8 +382,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
path = keyBuilder.controller().getPath();
- Assert.assertEquals(childListeners.get(path).size(), 1,
- "Should have 1 child-listener on path: " + path);
+ Assert.assertNull(childListeners.get(path),
+ "Should have no child-listener on path: " + path);
// check zookeeper#watches on client side
Map<String, List<String>> watchPaths =
@@ -392,10 +392,10 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
watchPaths.get("dataWatches").size(),
- 4,
- "Should have 4 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB,
CONTROLLER, MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 3,
- "Should have 3 child-watches: CONTROLLER, MESSAGES, and CURRENTSTATE/{sessionId}");
+ 3,
+ "Should have 3 data-watches: CURRENTSTATE/{sessionId}, CURRENTSTATE/{sessionId}/TestDB,
MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
+ "Should have 2 child-watches: MESSAGES, and CURRENTSTATE/{sessionId}");
// expire localhost_12918
System.out.println("Expire participant: " + participantToExpire.getInstanceName()
@@ -414,8 +414,8 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
participantToExpire.getHandlers().size(),
- 2,
- "Should have 2 handlers: CONTROLLER and MESSAGES. CURRENTSTATE/{sessionId} handler
should be removed by CallbackHandler#handleChildChange()");
+ 1,
+ "Should have 1 handler: MESSAGES. CURRENTSTATE/{sessionId} handler should be
removed by CallbackHandler#handleChildChange()");
// check zkclient#listeners
dataListeners = ZkTestHelper.getZkDataListener(participantToExpire.getZkClient());
@@ -425,9 +425,9 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert
.assertEquals(
childListeners.size(),
- 3,
- "Should have 3 paths (CURRENTSTATE/{oldSessionId}, CONTROLLER, and MESSAGES).
"
- + "CONTROLLER and MESSAGE has 1 child-listener each. CURRENTSTATE/{oldSessionId}
doesn't have listener (ZkClient doesn't remove empty childListener set. probably a ZkClient
bug. see ZkClient#unsubscribeChildChange())");
+ 2,
+ "Should have 2 paths (CURRENTSTATE/{oldSessionId}, and MESSAGES). "
+ + "MESSAGE has 1 child-listener each. CURRENTSTATE/{oldSessionId} doesn't
have listener (ZkClient doesn't remove empty childListener set. probably a ZkClient bug. see
ZkClient#unsubscribeChildChange())");
path = keyBuilder.currentStates(participantToExpire.getInstanceName(), oldSessionId).getPath();
Assert.assertEquals(childListeners.get(path).size(), 0,
"Should have no child-listener on path: " + path);
@@ -435,16 +435,16 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
Assert.assertEquals(childListeners.get(path).size(), 1,
"Should have 1 child-listener on path: " + path);
path = keyBuilder.controller().getPath();
- Assert.assertEquals(childListeners.get(path).size(), 1,
- "Should have 1 child-listener on path: " + path);
+ Assert.assertNull(childListeners.get(path),
+ "Should have no child-listener on path: " + path);
// check zookeeper#watches on client side
watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
LOG.debug("localhost_12918 zk-client side watchPaths: " + watchPaths);
- Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
- "Should have 2 data-watches: CONTROLLER and MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
- "Should have 2 child-watches: CONTROLLER and MESSAGES");
+ Assert.assertEquals(watchPaths.get("dataWatches").size(), 1,
+ "Should have 1 data-watch: MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 1,
+ "Should have 1 child-watch: MESSAGES");
Assert
.assertEquals(watchPaths.get("existWatches").size(), 2,
"Should have 2 exist-watches: CURRENTSTATE/{oldSessionId} and CURRENTSTATE/{oldSessionId}/TestDB0");
@@ -463,10 +463,10 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
// check zookeeper#watches on client side
watchPaths = ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
LOG.debug("localhost_12918 zk-client side watchPaths: " + watchPaths);
- Assert.assertEquals(watchPaths.get("dataWatches").size(), 2,
- "Should have 2 data-watches: CONTROLLER and MESSAGES");
- Assert.assertEquals(watchPaths.get("childWatches").size(), 2,
- "Should have 2 child-watches: CONTROLLER and MESSAGES");
+ Assert.assertEquals(watchPaths.get("dataWatches").size(), 1,
+ "Should have 1 data-watch: MESSAGES");
+ Assert.assertEquals(watchPaths.get("childWatches").size(), 1,
+ "Should have 1 child-watch: MESSAGES");
Assert
.assertEquals(
watchPaths.get("existWatches").size(),
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/manager/zk/TestLiveInstanceBounce.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestLiveInstanceBounce.java
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestLiveInstanceBounce.java
index 547e863..c2982b2 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestLiveInstanceBounce.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestLiveInstanceBounce.java
@@ -19,13 +19,13 @@ package org.apache.helix.manager.zk;
* under the License.
*/
-import org.apache.helix.integration.ZkStandAloneCMTestBaseWithPropertyServerCheck;
+import org.apache.helix.integration.ZkStandAloneCMTestBase;
import org.apache.helix.integration.manager.MockParticipantManager;
import org.apache.helix.tools.ClusterStateVerifier;
import org.testng.Assert;
import org.testng.annotations.Test;
-public class TestLiveInstanceBounce extends ZkStandAloneCMTestBaseWithPropertyServerCheck
{
+public class TestLiveInstanceBounce extends ZkStandAloneCMTestBase {
@Test
public void testInstanceBounce() throws Exception {
int handlerSize = _controller.getHandlers().size();
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKPropertyTransferServer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKPropertyTransferServer.java
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKPropertyTransferServer.java
deleted file mode 100644
index e01dd07..0000000
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKPropertyTransferServer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.helix.manager.zk;
-
-/*
- * 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 distributed 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 org.apache.helix.HelixDataAccessor;
-import org.apache.helix.controller.restlet.ZKPropertyTransferServer;
-import org.apache.helix.integration.ZkStandAloneCMTestBaseWithPropertyServerCheck;
-import org.apache.helix.integration.manager.ClusterControllerManager;
-import org.apache.helix.manager.zk.ZKHelixDataAccessor;
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class TestZKPropertyTransferServer extends ZkStandAloneCMTestBaseWithPropertyServerCheck
{
- private static Logger LOG = Logger.getLogger(TestZKPropertyTransferServer.class);
-
- @Test
- public void TestControllerChange() throws Exception {
- String controllerName = CONTROLLER_PREFIX + "_0";
- _controller.syncStop();
-
- Thread.sleep(1000);
-
- // kill controller, participant should not know about the svc url
- for (int i = 0; i < NODE_NR; i++) {
- HelixDataAccessor accessor = _participants[i].getHelixDataAccessor();
- ZKHelixDataAccessor zkAccessor = (ZKHelixDataAccessor) accessor;
- Assert.assertTrue(zkAccessor._zkPropertyTransferSvcUrl == null
- || zkAccessor._zkPropertyTransferSvcUrl.equals(""));
- }
-
- _controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
- _controller.syncStart();
-
- Thread.sleep(1000);
-
- // create controller again, the svc url is notified to the participants
- for (int i = 0; i < NODE_NR; i++) {
- HelixDataAccessor accessor = _participants[i].getHelixDataAccessor();
- ZKHelixDataAccessor zkAccessor = (ZKHelixDataAccessor) accessor;
- Assert.assertTrue(zkAccessor._zkPropertyTransferSvcUrl.equals(ZKPropertyTransferServer
- .getInstance().getWebserviceUrl()));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/helix/blob/85277291/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkStateChangeListener.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkStateChangeListener.java
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkStateChangeListener.java
index aeb32f9..a9c028c 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkStateChangeListener.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkStateChangeListener.java
@@ -19,12 +19,11 @@ package org.apache.helix.manager.zk;
* under the License.
*/
-import org.apache.helix.integration.ZkStandAloneCMTestBaseWithPropertyServerCheck;
+import org.apache.helix.integration.ZkStandAloneCMTestBase;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.testng.Assert;
-import org.testng.annotations.Test;
-public class TestZkStateChangeListener extends ZkStandAloneCMTestBaseWithPropertyServerCheck
{
+public class TestZkStateChangeListener extends ZkStandAloneCMTestBase {
// TODO this test has been covered by TestZkFlapping. check if still needed
// @Test
public void testDisconnectHistory() throws Exception {
|