Removed useless znodes to resolve dependency between test methods in TestZKUtil (#693)
Removed useless znodes to resolve dependency between test methods in TestZKUtil
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
index 7974776..9c0c60a 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
@@ -34,9 +34,11 @@
import org.slf4j.LoggerFactory;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+
public class TestZKUtil extends ZkUnitTestBase {
private static Logger LOG = LoggerFactory.getLogger(TestZKUtil.class);
@@ -63,6 +65,13 @@
deleteCluster(clusterName);
}
+ @AfterMethod()
+ public void afterMethod() {
+ String path = PropertyPathBuilder.instanceConfig(clusterName);
+ _gZkClient.deleteRecursively(path);
+ _gZkClient.createPersistent(path);
+ }
+
@Test()
public void testIsClusterSetup() {
boolean result = ZKUtil.isClusterSetup(clusterName, _gZkClient);
@@ -134,14 +143,18 @@
record = _gZkClient.readData(path);
AssertJUnit.assertEquals(Arrays.asList("value1", "value2"), record.getListField("list"));
- Map<String, String> map = new HashMap<String, String>() {{put("k1", "v1");}};
+ Map<String, String> map = new HashMap<String, String>() {{
+ put("k1", "v1");
+ }};
record.setMapField("map", map);
ZKUtil.createOrMerge(_gZkClient, path, record, true, true);
record = _gZkClient.readData(path);
AssertJUnit.assertEquals(map, record.getMapField("map"));
record = new ZNRecord("id7");
- Map<String, String> map2 = new HashMap<String, String>() {{put("k2", "v2");}};
+ Map<String, String> map2 = new HashMap<String, String>() {{
+ put("k2", "v2");
+ }};
record.setMapField("map", map2);
ZKUtil.createOrMerge(_gZkClient, path, record, true, true);
record = _gZkClient.readData(path);
@@ -186,15 +199,18 @@
record = _gZkClient.readData(path);
AssertJUnit.assertEquals(list2, record.getListField("list"));
-
- Map<String, String> map = new HashMap<String, String>() {{put("k1", "v1");}};
+ Map<String, String> map = new HashMap<String, String>() {{
+ put("k1", "v1");
+ }};
record.setMapField("map", map);
ZKUtil.createOrUpdate(_gZkClient, path, record, true, true);
record = _gZkClient.readData(path);
AssertJUnit.assertEquals(map, record.getMapField("map"));
record = new ZNRecord("id9");
- Map<String, String> map2 = new HashMap<String, String>() {{put("k2", "v2");}};
+ Map<String, String> map2 = new HashMap<String, String>() {{
+ put("k2", "v2");
+ }};
record.setMapField("map", map2);
ZKUtil.createOrUpdate(_gZkClient, path, record, true, true);
record = _gZkClient.readData(path);