You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ki...@apache.org on 2012/10/25 00:26:41 UTC

[40/47] Refactoring from com.linkedin.helix to org.apache.helix

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/josql/TestJosqlProcessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/josql/TestJosqlProcessor.java b/helix-core/src/test/java/com/linkedin/helix/josql/TestJosqlProcessor.java
deleted file mode 100644
index d320769..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/josql/TestJosqlProcessor.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.josql;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.HelixManager;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.integration.ZkStandAloneCMTestBase;
-import com.linkedin.helix.model.LiveInstance.LiveInstanceProperty;
-
-public class TestJosqlProcessor extends ZkStandAloneCMTestBase
-{
-  @Test (groups = {"integrationTest"})
-  public void testJosqlQuery() throws Exception
-  {
-    HelixManager manager = ((TestHelper.StartCMResult) (_startCMResultMap.values().toArray()[0]))._manager;
-    
-    // Find the instance name that contains partition TestDB_2 and state is 'MASTER'
-    String SQL = "SELECT id  " + 
-        "FROM LIVEINSTANCES " + 
-        "WHERE getMapFieldValue( getZNRecordFromMap(:IDEALSTATES , 'TestDB'), :partitionName, :_currObj.id)='MASTER'";
-    Map<String, Object> bindVariables = new HashMap<String, Object>();
-    bindVariables.put("partitionName", "TestDB_2");
-    
-    ClusterJosqlQueryProcessor p = new ClusterJosqlQueryProcessor(manager);
-    List<Object> result = p.runJoSqlQuery(SQL, bindVariables, null);
-    
-    Assert.assertEquals(result.size(), 1);
-    List<Object> firstList = (List<Object>) result.get(0);
-    Assert.assertTrue(((String)(firstList.get(0))).equalsIgnoreCase("localhost_12921"));
-    
-    // Find the live instances names that hosts Partition TestDB_10 according to idealstate
-    
-    SQL = "SELECT id  " + 
-        "FROM LIVEINSTANCES " + 
-        "WHERE hasMapFieldKey( getZNRecordFromMap(:IDEALSTATES, 'TestDB'), :partitionName, :_currObj.id)='true'";
-    p = new ClusterJosqlQueryProcessor(manager);
-    bindVariables.put("partitionName", "TestDB_10");
-    result = p.runJoSqlQuery(SQL, bindVariables, null);
-    
-    Assert.assertEquals(result.size(), 3);
-    Set<String> hosts = new HashSet<String>();
-    for(Object o : result)
-    {
-      String val = (String) ((List<Object>)o).get(0);
-      hosts.add(val);
-    }
-    Assert.assertTrue(hosts.contains("localhost_12918"));
-    Assert.assertTrue(hosts.contains("localhost_12920"));
-    Assert.assertTrue(hosts.contains("localhost_12921"));
-    
-    // Find the partitions on host localhost_12919 and is on MASTER state
-    SQL = "SELECT id  " + 
-        "FROM PARTITIONS " + 
-        "WHERE getMapFieldValue( getZNRecordFromMap(:EXTERNALVIEW, 'TestDB'), id, :instanceName)='MASTER'";
-    p = new ClusterJosqlQueryProcessor(manager);
-    bindVariables.clear();
-    bindVariables.put("instanceName", "localhost_12919");
-    result = p.runJoSqlQuery(SQL, bindVariables, null);
-    
-    Assert.assertEquals(result.size(), 4);
-    Set<String> partitions = new HashSet<String>();
-    for(Object o : result)
-    {
-      String val = (String) ((List<Object>)o).get(0);
-      partitions.add(val);
-    }
-    Assert.assertTrue(partitions.contains("TestDB_6"));
-    Assert.assertTrue(partitions.contains("TestDB_7"));
-    Assert.assertTrue(partitions.contains("TestDB_9"));
-    Assert.assertTrue(partitions.contains("TestDB_14"));
-
-    // Find the partitions on host localhost_12919 and is on MASTER state
-    // Same as above but according to currentstates
-    SQL = "SELECT id  " + 
-        "FROM PARTITIONS " + 
-        "WHERE getMapFieldValue( getZNRecordFromMap(:CURRENTSTATES, :instanceName, 'TestDB'), :_currObj.id, :mapFieldKey)=:partitionState";
-    
-    p = new ClusterJosqlQueryProcessor(manager);
-    bindVariables.clear();
-    bindVariables.put("instanceName", "localhost_12919");
-    bindVariables.put("mapFieldKey", "CURRENT_STATE");
-    bindVariables.put("partitionState", "MASTER");
-    
-    result = p.runJoSqlQuery(SQL,  bindVariables, null);
-    
-    Assert.assertEquals(result.size(), 4);
-    partitions.clear();
-    partitions = new HashSet<String>();
-    for(Object o : result)
-    {
-      String val = (String) ((List<Object>)o).get(0);
-      partitions.add(val);
-    }
-    Assert.assertTrue(partitions.contains("TestDB_6"));
-    Assert.assertTrue(partitions.contains("TestDB_7"));
-    Assert.assertTrue(partitions.contains("TestDB_9"));
-    Assert.assertTrue(partitions.contains("TestDB_14"));
-    
-    // get node name that hosts a certain partition with certain state
-    
-    SQL = "SELECT id  " + 
-        "FROM LIVEINSTANCES " + 
-        "WHERE getMapFieldValue( getZNRecordFromMap(:CURRENTSTATES, id, 'TestDB'), :partitionName, :mapFieldKey)=:partitionState";
-    
-    p = new ClusterJosqlQueryProcessor(manager);
-    bindVariables.clear();
-    bindVariables.put("partitionName", "TestDB_8");
-    bindVariables.put("mapFieldKey", "CURRENT_STATE");
-    bindVariables.put("partitionState", "SLAVE");
-    
-    result = p.runJoSqlQuery(SQL,  bindVariables, null);
-    
-    Assert.assertEquals(result.size(), 2);
-    partitions.clear();
-    partitions = new HashSet<String>();
-    for(Object o : result)
-    {
-      String val = (String) ((List<Object>)o).get(0);
-      partitions.add(val);
-    }
-    Assert.assertTrue(partitions.contains("localhost_12918"));
-    Assert.assertTrue(partitions.contains("localhost_12922"));
-  }
-  
-  @Test (groups = {"unitTest"})
-  public void parseFromTarget() 
-  {
-    ClusterJosqlQueryProcessor p = new ClusterJosqlQueryProcessor(null);
-    String sql = "SELECT id  " + 
-        "FROM LIVEINSTANCES ";
-    String from = p.parseFromTarget(sql);
-    Assert.assertTrue(from.equals("LIVEINSTANCES"));
-    
-    sql = "SELECT id      " + 
-        "FROM    LIVEINSTANCES  WHERE 1=2";
-    
-    from = p.parseFromTarget(sql);
-    Assert.assertTrue(from.equals("LIVEINSTANCES"));
-    
-    sql = "SELECT id      " + 
-        "FROM LIVEINSTANCES";
-    
-    from = p.parseFromTarget(sql);
-    Assert.assertTrue(from.equals("LIVEINSTANCES"));
-    
-    sql = "SELECT id      " + 
-        " LIVEINSTANCES where tt=00";
-    boolean exceptionThrown = false;
-    try
-    {
-      from = p.parseFromTarget(sql);
-    }
-    catch(HelixException e)
-    {
-      exceptionThrown = true;
-    }
-    Assert.assertTrue(exceptionThrown);
-  }
-  
-  @Test (groups=("unitTest"))
-  public void testOrderby() throws Exception
-  {
-    HelixManager manager = ((TestHelper.StartCMResult) (_startCMResultMap.values().toArray()[0]))._manager;
-    
-    Map<String, ZNRecord> scnMap = new HashMap<String, ZNRecord>();
-    for(int i = 0;i < NODE_NR; i++)
-    {
-      String instance = "localhost_"+(12918+i);
-      ZNRecord metaData = new ZNRecord(instance);
-      metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(),
-          UUID.randomUUID().toString());
-      metaData.setMapField("SCN", new HashMap<String, String>());
-      for(int j = 0;j < _PARTITIONS; j++)
-      {
-        metaData.getMapField("SCN").put(TEST_DB+"_"+j, ""+i);
-      }
-      scnMap.put(instance, metaData);
-    }
-    Map<String, Object> bindVariables = new HashMap<String, Object>();
-    bindVariables.put("scnMap", scnMap);
-    String SQL = 
-        " SELECT DISTINCT mapSubKey AS 'subkey', mapValue AS 'mapValue' , getMapFieldValue(getZNRecordFromMap(:scnMap, mapSubKey), 'SCN', mapKey) AS 'SCN'" +
-        " FROM EXTERNALVIEW.Table " + 
-        " WHERE mapKey LIKE 'TestDB_1' " +
-          " AND mapSubKey LIKE '%' " +
-          " AND mapValue LIKE 'SLAVE' " +
-          " AND mapSubKey IN ((SELECT [*]id FROM :LIVEINSTANCES)) " +
-          " ORDER BY parseInt(getMapFieldValue(getZNRecordFromMap(:scnMap, mapSubKey), 'SCN', mapKey))";
-
-    ClusterJosqlQueryProcessor p = new ClusterJosqlQueryProcessor(manager);
-    List<Object> result = p.runJoSqlQuery(SQL, bindVariables, null);
-    int prevSCN = -1;
-    for(Object row : result)
-    {
-      List<String> stringRow = (List<String>)row;
-      Assert.assertTrue(stringRow.get(1).equals("SLAVE"));
-      int scn = Integer.parseInt(stringRow.get(2));
-      Assert.assertTrue(scn > prevSCN);
-      prevSCN = scn;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/josql/TestZNRecordQueryProcessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/josql/TestZNRecordQueryProcessor.java b/helix-core/src/test/java/com/linkedin/helix/josql/TestZNRecordQueryProcessor.java
deleted file mode 100644
index 5e2e33e..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/josql/TestZNRecordQueryProcessor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package com.linkedin.helix.josql;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ZNRecord;
-public class TestZNRecordQueryProcessor
-{
-  private class TestTupleReader implements ZNRecordQueryProcessor.ZNRecordTupleReader
-  {
-    Map<String, List<ZNRecord>> map = new HashMap<String, List<ZNRecord>>();
-    @Override
-    public List<ZNRecord> get(String path) throws Exception
-    {
-      if(map.containsKey(path))
-      {
-        return map.get(path);
-      }
-      
-      throw new Exception("Unable to read " + path);
-    }
-    
-    public void reset()
-    {
-      map.clear();
-    }
-  }
-  
-  @Test
-  public void testExplodeList() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    ZNRecord record = new ZNRecord("test");
-    record.setListField("foo", Arrays.asList("val1", "val2", "val3"));
-    tupleReader.map.put("test", Arrays.asList(record));
-    String sql = "select * from explodeList(test, foo)";
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    Assert.assertEquals(result.size(), 3);
-    Assert.assertEquals(result.get(0).getSimpleField("listVal"), "val1");
-    Assert.assertEquals(result.get(1).getSimpleField("listVal"), "val2");
-    Assert.assertEquals(result.get(2).getSimpleField("listVal"), "val3");
-  }
-  
-  @Test
-  public void testExplodeMap() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    ZNRecord record = new ZNRecord("test");
-    Map<String, String> map = new HashMap<String, String>();
-    map.put("a", "100");
-    map.put("b", "200");
-    record.setMapField("foo", map);
-    tupleReader.map.put("test", Arrays.asList(record));
-    String sql = "select * from explodeMap(test, foo)";
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    Assert.assertEquals(result.size(), 1);
-    Assert.assertEquals(result.get(0).getSimpleField("a"), "100");
-    Assert.assertEquals(result.get(0).getSimpleField("b"), "200");
-  }
-  
-  @Test
-  public void testJoin() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    List<ZNRecord> t1 = new ArrayList<ZNRecord>();
-    for(int i = 1; i <= 3; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("abc", "world" + i);
-      record.setSimpleField("foo", "val" + i);
-      t1.add(record);
-    }
-    tupleReader.map.put("T1", t1);
-
-    List<ZNRecord> t2 = new ArrayList<ZNRecord>();
-    for(int i = 1; i <= 5; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("bar", "hello" + i);
-      record.setSimpleField("foo", "val" + i);
-      t2.add(record);
-    }
-    tupleReader.map.put("T2", t2);
-
-    
-    String sql = "select T1.abc, T2.bar from T1 join T2 using(T1.foo, T2.foo)";
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    System.out.println(result);
-    for(int i = 0; i < 3; i++)
-    {
-      String a = result.get(i).getSimpleField("T1.abc").replace("world", "");
-      String b = result.get(i).getSimpleField("T2.bar").replace("hello", "");
-      Assert.assertEquals(a, b);
-    }
-    
-    Assert.assertEquals(result.size(), 3);
-  }
-  
-  @Test
-  public void testMultipleJoin() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    List<ZNRecord> t1 = new ArrayList<ZNRecord>();
-    for(int i = 1; i <= 8; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("abc", "world" + i);
-      record.setSimpleField("foo", "val" + i);
-      t1.add(record);
-    }
-    tupleReader.map.put("T1", t1);
-
-    List<ZNRecord> t2 = new ArrayList<ZNRecord>();
-    for(int i = 1; i <= 5; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("bar", "hello" + i);
-      record.setSimpleField("foo", "val" + i);
-      t2.add(record);
-    }
-    tupleReader.map.put("T2", t2);
-    
-    List<ZNRecord> t3 = new ArrayList<ZNRecord>();
-    for(int i = 1; i <= 10; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("xxx", "hey" + i);
-      record.setSimpleField("foo", "val" + i);
-      t3.add(record);
-    }
-    tupleReader.map.put("T3", t3);
-    
-    String sql = "select T1.abc, T2.bar, tt.xxx from T1 join T2 using(T2.foo, T2.foo) join T3 as tt using (T2.foo, tt.foo)";
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    System.out.println(result);
-    
-    for(int i = 0; i < 5; i++)
-    {
-      String a = result.get(i).getSimpleField("T1.abc").replace("world", "");
-      String b = result.get(i).getSimpleField("T2.bar").replace("hello", "");
-      String c = result.get(i).getSimpleField("tt.xxx").replace("hey", "");
-      Assert.assertEquals(a, b);
-    }
-    
-    Assert.assertEquals(result.size(), 5);
-
-  }
-  
-  @Test
-  public void testLargeJoin() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    List<ZNRecord> t1 = new ArrayList<ZNRecord>();
-    for(int i = 0; i < 3000; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("abc", "hello" + i);
-      record.setSimpleField("foo", "val" + i);
-      t1.add(record);
-    }
-    tupleReader.map.put("T1", t1);
-    
-    List<ZNRecord> t2 = new ArrayList<ZNRecord>();
-    for(int i = 0; i < 5000; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("bar", "world" + i);
-      record.setSimpleField("foo", "val" + i);
-      t2.add(record);
-    }
-    tupleReader.map.put("T2", t2);
-    
-    long start = System.currentTimeMillis();
-    String sql = "select T1.abc, T2.bar from T1 join T2 using (T1.foo, T2.foo)";
-    
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    System.out.println("XXX: " + (System.currentTimeMillis() - start));
-    //System.out.println(result);
-    Assert.assertEquals(result.size(), 3000);
-  }
-  
-  @Test
-  public void testSimpleGroupBy() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    List<ZNRecord> t = new ArrayList<ZNRecord>();
-    tupleReader.map.put("T", t);
-    for(int i = 0; i < 5000; i++)
-    {
-      ZNRecord record = new ZNRecord(""+i);
-      record.setSimpleField("k", (i < 2500 ? "foo" : "bar"));
-      record.setSimpleField("v", ""+i);
-      t.add(record);    
-    }
-    String sql = "select k, max(to_number(v)) as maxv from T group by k";
-    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();
-    List<ZNRecord> result = queryProcessor.execute(sql, tupleReader);
-    Assert.assertEquals(result.size(), 2);
-    for(ZNRecord record : result)
-    {
-      if(record.getSimpleField("k").equals("foo"))
-      {
-        Assert.assertEquals(record.getSimpleField("maxv"), "2499");
-      }
-      else
-      {
-        Assert.assertEquals(record.getSimpleField("maxv"), "4999");
-      }
-    }
-  }
-  
-  @Test
-  public void testMultipleGroupBy() throws Exception
-  {
-    TestTupleReader tupleReader = new TestTupleReader();
-    List<ZNRecord> t = new ArrayList<ZNRecord>();
-    tupleReader.map.put("T", t);
-
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/MockListener.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/MockListener.java b/helix-core/src/test/java/com/linkedin/helix/manager/MockListener.java
deleted file mode 100644
index fbff539..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/MockListener.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager;
-
-import java.util.List;
-
-import com.linkedin.helix.ConfigChangeListener;
-import com.linkedin.helix.ControllerChangeListener;
-import com.linkedin.helix.CurrentStateChangeListener;
-import com.linkedin.helix.ExternalViewChangeListener;
-import com.linkedin.helix.IdealStateChangeListener;
-import com.linkedin.helix.LiveInstanceChangeListener;
-import com.linkedin.helix.MessageListener;
-import com.linkedin.helix.NotificationContext;
-import com.linkedin.helix.model.CurrentState;
-import com.linkedin.helix.model.ExternalView;
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.model.InstanceConfig;
-import com.linkedin.helix.model.LiveInstance;
-import com.linkedin.helix.model.Message;
-
-public class MockListener implements IdealStateChangeListener, LiveInstanceChangeListener,
-    ConfigChangeListener, CurrentStateChangeListener, ExternalViewChangeListener,
-    ControllerChangeListener, MessageListener
-
-{
-  public boolean isIdealStateChangeListenerInvoked = false;
-  public boolean isLiveInstanceChangeListenerInvoked = false;
-  public boolean isCurrentStateChangeListenerInvoked = false;
-  public boolean isMessageListenerInvoked = false;
-  public boolean isConfigChangeListenerInvoked = false;
-  public boolean isExternalViewChangeListenerInvoked = false;
-  public boolean isControllerChangeListenerInvoked = false;
-
-  public void reset()
-  {
-    isIdealStateChangeListenerInvoked = false;
-    isLiveInstanceChangeListenerInvoked = false;
-    isCurrentStateChangeListenerInvoked = false;
-    isMessageListenerInvoked = false;
-    isConfigChangeListenerInvoked = false;
-    isExternalViewChangeListenerInvoked = false;
-    isControllerChangeListenerInvoked = false;
-  }
-
-  @Override
-  public void onIdealStateChange(List<IdealState> idealState, NotificationContext changeContext)
-  {
-    isIdealStateChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onLiveInstanceChange(List<LiveInstance> liveInstances, NotificationContext changeContext)
-  {
-    isLiveInstanceChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onConfigChange(List<InstanceConfig> configs, NotificationContext changeContext)
-  {
-    isConfigChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onStateChange(String instanceName,
-                            List<CurrentState> statesInfo,
-                            NotificationContext changeContext)
-  {
-    isCurrentStateChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onExternalViewChange(List<ExternalView> externalViewList,
-                                   NotificationContext changeContext)
-  {
-    isExternalViewChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onControllerChange(NotificationContext changeContext)
-  {
-    isControllerChangeListenerInvoked = true;
-  }
-
-  @Override
-  public void onMessage(String instanceName,
-                        List<Message> messages,
-                        NotificationContext changeContext)
-  {
-    isMessageListenerInvoked = true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/file/MockFileHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/file/MockFileHelixManager.java b/helix-core/src/test/java/com/linkedin/helix/manager/file/MockFileHelixManager.java
deleted file mode 100644
index 0df4a45..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/file/MockFileHelixManager.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.file;
-
-import com.linkedin.helix.ClusterMessagingService;
-import com.linkedin.helix.ConfigAccessor;
-import com.linkedin.helix.ConfigChangeListener;
-import com.linkedin.helix.ControllerChangeListener;
-import com.linkedin.helix.CurrentStateChangeListener;
-import com.linkedin.helix.DataAccessor;
-import com.linkedin.helix.ExternalViewChangeListener;
-import com.linkedin.helix.HealthStateChangeListener;
-import com.linkedin.helix.HelixAdmin;
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.HelixManager;
-import com.linkedin.helix.IdealStateChangeListener;
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.LiveInstanceChangeListener;
-import com.linkedin.helix.MessageListener;
-import com.linkedin.helix.PreConnectCallback;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.healthcheck.ParticipantHealthReportCollector;
-import com.linkedin.helix.participant.StateMachineEngine;
-import com.linkedin.helix.store.PropertyStore;
-import com.linkedin.helix.store.file.FilePropertyStore;
-import com.linkedin.helix.store.zk.ZkHelixPropertyStore;
-
-public class MockFileHelixManager implements HelixManager
-{
-//  private final FileDataAccessor _accessor;
-  private final HelixDataAccessor _accessor;
-  private final String _instanceName;
-  private final String _clusterName;
-  private final InstanceType _type;
-
-  public MockFileHelixManager(String clusterName, String instanceName, InstanceType type,
-                              FilePropertyStore<ZNRecord> store)
-  {
-    _instanceName = instanceName;
-    _clusterName = clusterName;
-    _type = type;
-//    _accessor = new FileDataAccessor(store, clusterName);
-    _accessor = new FileHelixDataAccessor(store, clusterName);
-  }
-
-  @Override
-  public void connect() throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public boolean isConnected()
-  {
-    // TODO Auto-generated method stub
-    return false;
-  }
-
-  @Override
-  public void disconnect()
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addIdealStateChangeListener(IdealStateChangeListener listener) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addLiveInstanceChangeListener(LiveInstanceChangeListener listener) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addConfigChangeListener(ConfigChangeListener listener) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addMessageListener(MessageListener listener, String instanceName) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addCurrentStateChangeListener(CurrentStateChangeListener listener,
-                                            String instanceName,
-                                            String sessionId) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void addExternalViewChangeListener(ExternalViewChangeListener listener) throws Exception
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public boolean removeListener(Object listener)
-  {
-    // TODO Auto-generated method stub
-    return false;
-  }
-
-  @Override
-  public DataAccessor getDataAccessor()
-  {
-    return null;
-  }
-
-  @Override
-  public String getClusterName()
-  {
-    return _clusterName;
-  }
-
-  @Override
-  public String getInstanceName()
-  {
-    return _instanceName;
-  }
-
-  @Override
-  public String getSessionId()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public long getLastNotificationTime()
-  {
-    // TODO Auto-generated method stub
-    return 0;
-  }
-
-  @Override
-  public void addControllerListener(ControllerChangeListener listener)
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public HelixAdmin getClusterManagmentTool()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public PropertyStore<ZNRecord> getPropertyStore()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public ClusterMessagingService getMessagingService()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public ParticipantHealthReportCollector getHealthReportCollector()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public InstanceType getInstanceType()
-  {
-    return _type;
-  }
-
-
-  @Override
-  public void addHealthStateChangeListener(HealthStateChangeListener listener,
-  		String instanceName) throws Exception {
-  	// TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public String getVersion()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public StateMachineEngine getStateMachineEngine()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public boolean isLeader()
-  {
-    // TODO Auto-generated method stub
-    return false;
-  }
-
-  @Override
-  public ConfigAccessor getConfigAccessor()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public void startTimerTasks()
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public void stopTimerTasks()
-  {
-    // TODO Auto-generated method stub
-
-  }
-
-  @Override
-  public HelixDataAccessor getHelixDataAccessor()
-  {
-    return _accessor;
-  }
-
-  @Override
-  public void addPreConnectCallback(PreConnectCallback callback)
-  {
-    // TODO Auto-generated method stub
-    
-  }
-
-  @Override
-  public ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore()
-  {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileCallbackHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileCallbackHandler.java b/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileCallbackHandler.java
deleted file mode 100644
index 0243b6a..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileCallbackHandler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.file;
-
-import org.testng.annotations.Test;
-import org.testng.AssertJUnit;
-import org.apache.zookeeper.Watcher.Event.EventType;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.HelixConstants.ChangeType;
-import com.linkedin.helix.manager.MockListener;
-import com.linkedin.helix.manager.file.FileCallbackHandler;
-import com.linkedin.helix.store.PropertyJsonComparator;
-import com.linkedin.helix.store.PropertyJsonSerializer;
-import com.linkedin.helix.store.PropertyStoreException;
-import com.linkedin.helix.store.file.FilePropertyStore;
-
-public class TestFileCallbackHandler
-{
-  @Test(groups = { "unitTest" })
-  public void testFileCallbackHandler()
-  {
-    final String clusterName = "TestFileCallbackHandler";
-    final String rootNamespace = "/tmp/" + clusterName;
-    final String instanceName = "controller_0";
-    MockListener listener = new MockListener();
-
-    PropertyJsonSerializer<ZNRecord> serializer =
-        new PropertyJsonSerializer<ZNRecord>(ZNRecord.class);
-    PropertyJsonComparator<ZNRecord> comparator =
-        new PropertyJsonComparator<ZNRecord>(ZNRecord.class);
-    FilePropertyStore<ZNRecord> store =
-        new FilePropertyStore<ZNRecord>(serializer, rootNamespace, comparator);
-    try
-    {
-      store.removeRootNamespace();
-    }
-    catch (PropertyStoreException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-
-    listener.reset();
-    MockFileHelixManager manager =
-        new MockFileHelixManager(clusterName, instanceName, InstanceType.CONTROLLER, store);
-    FileCallbackHandler handler =
-        new FileCallbackHandler(manager,
-                                   rootNamespace,
-                                   listener,
-                                   new EventType[] { EventType.NodeChildrenChanged,
-                                       EventType.NodeDeleted, EventType.NodeCreated },
-                                   ChangeType.CONFIG);
-    AssertJUnit.assertEquals(listener, handler.getListener());
-    AssertJUnit.assertEquals(rootNamespace, handler.getPath());
-    AssertJUnit.assertTrue(listener.isConfigChangeListenerInvoked);
-
-    handler =
-        new FileCallbackHandler(manager,
-                                   rootNamespace,
-                                   listener,
-                                   new EventType[] { EventType.NodeChildrenChanged,
-                                       EventType.NodeDeleted, EventType.NodeCreated },
-                                   ChangeType.EXTERNAL_VIEW);
-    AssertJUnit.assertTrue(listener.isExternalViewChangeListenerInvoked);
-
-    EventType[] eventTypes = new EventType[] { EventType.NodeChildrenChanged,
-        EventType.NodeDeleted, EventType.NodeCreated };
-    handler =
-        new FileCallbackHandler(manager,
-                                   rootNamespace,
-                                   listener,
-                                   eventTypes,
-                                   ChangeType.CONTROLLER);
-    AssertJUnit.assertEquals(handler.getEventTypes(), eventTypes);
-    AssertJUnit.assertTrue(listener.isControllerChangeListenerInvoked);
-    
-    listener.reset();
-    handler.reset();
-    AssertJUnit.assertTrue(listener.isControllerChangeListenerInvoked);
-
-    listener.reset();
-    handler.onPropertyChange(rootNamespace);
-    AssertJUnit.assertTrue(listener.isControllerChangeListenerInvoked);
-
-    store.stop();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileDataAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileDataAccessor.java b/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileDataAccessor.java
deleted file mode 100644
index 731885f..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestFileDataAccessor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.file;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ConfigScope.ConfigScopeProperty;
-import com.linkedin.helix.DataAccessor;
-import com.linkedin.helix.PropertyType;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.model.InstanceConfig;
-import com.linkedin.helix.model.LiveInstance;
-import com.linkedin.helix.store.PropertyJsonComparator;
-import com.linkedin.helix.store.PropertyJsonSerializer;
-import com.linkedin.helix.store.PropertyStoreException;
-import com.linkedin.helix.store.file.FilePropertyStore;
-
-public class TestFileDataAccessor
-{
-  @Test()
-  public void testFileDataAccessor()
-  {
-    final String clusterName = "TestFileDataAccessor";
-    String rootNamespace = "/tmp/" + clusterName;
-    PropertyJsonSerializer<ZNRecord> serializer = new PropertyJsonSerializer<ZNRecord>(
-        ZNRecord.class);
-    PropertyJsonComparator<ZNRecord> comparator = new PropertyJsonComparator<ZNRecord>(
-        ZNRecord.class);
-    FilePropertyStore<ZNRecord> store = new FilePropertyStore<ZNRecord>(serializer, rootNamespace,
-        comparator);
-    try
-    {
-      store.removeRootNamespace();
-    } catch (PropertyStoreException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-    DataAccessor accessor = new FileDataAccessor(store, clusterName);
-
-    InstanceConfig config = new InstanceConfig("id0");
-    accessor.setProperty(PropertyType.CONFIGS, config, ConfigScopeProperty.PARTICIPANT.toString(),
-        "key0");
-    config = accessor.getProperty(InstanceConfig.class, PropertyType.CONFIGS,
-        ConfigScopeProperty.PARTICIPANT.toString(), "key0");
-    AssertJUnit.assertEquals("id0", config.getId());
-
-    InstanceConfig newConfig = new InstanceConfig("id1");
-    accessor.updateProperty(PropertyType.CONFIGS, newConfig,
-        ConfigScopeProperty.PARTICIPANT.toString(),
-        "key0");
-    config = accessor.getProperty(InstanceConfig.class, PropertyType.CONFIGS,
-        ConfigScopeProperty.PARTICIPANT.toString(), "key0");
-    AssertJUnit.assertEquals("id1", config.getId());
-
-    accessor.removeProperty(PropertyType.CONFIGS, ConfigScopeProperty.PARTICIPANT.toString(),
-        "key0");
-    config = accessor.getProperty(InstanceConfig.class, PropertyType.CONFIGS,
-        ConfigScopeProperty.PARTICIPANT.toString(), "key0");
-    AssertJUnit.assertNull(config);
-
-    LiveInstance leader = new LiveInstance("id2");
-    accessor.updateProperty(PropertyType.LEADER, leader);
-    LiveInstance nullLeader = accessor.getProperty(LiveInstance.class, PropertyType.LEADER);
-    AssertJUnit.assertNull(nullLeader);
-
-    accessor.setProperty(PropertyType.LEADER, leader);
-    LiveInstance newLeader = new LiveInstance("id3");
-    accessor.updateProperty(PropertyType.LEADER, newLeader);
-    leader = accessor.getProperty(LiveInstance.class, PropertyType.LEADER);
-    AssertJUnit.assertEquals("id3", leader.getId());
-
-    // List<ZNRecord> childs = accessor.getChildValues(PropertyType.HISTORY);
-    // AssertJUnit.assertEquals(childs.size(), 0);
-
-    store.stop();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/file/TestStaticFileCM.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestStaticFileCM.java b/helix-core/src/test/java/com/linkedin/helix/manager/file/TestStaticFileCM.java
deleted file mode 100644
index 999edbc..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/file/TestStaticFileCM.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.file;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ClusterView;
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.manager.MockListener;
-import com.linkedin.helix.manager.file.StaticFileHelixManager;
-import com.linkedin.helix.manager.file.StaticFileHelixManager.DBParam;
-import com.linkedin.helix.tools.ClusterViewSerializer;
-
-public class TestStaticFileCM
-{
-  @Test()
-  public void testStaticFileCM()
-  {
-    final String clusterName = "TestSTaticFileCM";
-    final String controllerName = "controller_0";
-
-    ClusterView view;
-    String[] illegalNodesInfo = {"localhost_8900", "localhost_8901"};
-    List<DBParam> dbParams = new ArrayList<DBParam>();
-    dbParams.add(new DBParam("TestDB0", 10));
-    dbParams.add(new DBParam("TestDB1", 10));
-
-    boolean exceptionCaught = false;
-    try
-    {
-      view = StaticFileHelixManager.generateStaticConfigClusterView(illegalNodesInfo, dbParams, 3);
-    } catch (IllegalArgumentException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-    String[] nodesInfo = {"localhost:8900", "localhost:8901", "localhost:8902"};
-    view = StaticFileHelixManager.generateStaticConfigClusterView(nodesInfo, dbParams, 2);
-
-    String configFile = "/tmp/" + clusterName;
-    ClusterViewSerializer.serialize(view, new File(configFile));
-    ClusterView restoredView = ClusterViewSerializer.deserialize(new File(configFile));
-    // System.out.println(restoredView);
-    // byte[] bytes = ClusterViewSerializer.serialize(restoredView);
-    // System.out.println(new String(bytes));
-
-    StaticFileHelixManager.verifyFileBasedClusterStates("localhost_8900",
-                                       configFile, configFile);
-
-    StaticFileHelixManager controller = new StaticFileHelixManager(clusterName, controllerName,
-                                                     InstanceType.CONTROLLER, configFile);
-    controller.disconnect();
-    AssertJUnit.assertFalse(controller.isConnected());
-    controller.connect();
-    AssertJUnit.assertTrue(controller.isConnected());
-
-    String sessionId = controller.getSessionId();
-//    AssertJUnit.assertEquals(DynamicFileClusterManager._sessionId, sessionId);
-    AssertJUnit.assertEquals(clusterName, controller.getClusterName());
-    AssertJUnit.assertEquals(0, controller.getLastNotificationTime());
-    AssertJUnit.assertEquals(InstanceType.CONTROLLER, controller.getInstanceType());
-    AssertJUnit.assertNull(controller.getPropertyStore());
-    AssertJUnit.assertNull(controller.getHealthReportCollector());
-    AssertJUnit.assertEquals(controllerName, controller.getInstanceName());
-    AssertJUnit.assertNull(controller.getClusterManagmentTool());
-    AssertJUnit.assertNull(controller.getMessagingService());
-
-    MockListener controllerListener = new MockListener();
-    AssertJUnit.assertFalse(controller.removeListener(controllerListener));
-    controllerListener.reset();
-
-    controller.addIdealStateChangeListener(controllerListener);
-    AssertJUnit.assertTrue(controllerListener.isIdealStateChangeListenerInvoked);
-
-    controller.addMessageListener(controllerListener, "localhost_8900");
-    AssertJUnit.assertTrue(controllerListener.isMessageListenerInvoked);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addLiveInstanceChangeListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addCurrentStateChangeListener(controllerListener, "localhost_8900", sessionId);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addConfigChangeListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addExternalViewChangeListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addControllerListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/file/UnitTestDynFileClusterMgr.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/file/UnitTestDynFileClusterMgr.java b/helix-core/src/test/java/com/linkedin/helix/manager/file/UnitTestDynFileClusterMgr.java
deleted file mode 100644
index 563fe48..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/file/UnitTestDynFileClusterMgr.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.file;
-
-import java.util.List;
-
-import org.testng.Assert;
-import org.testng.AssertJUnit;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ClusterMessagingService;
-import com.linkedin.helix.HelixAdmin;
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.manager.MockListener;
-import com.linkedin.helix.mock.storage.DummyProcess;
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.model.IdealState.IdealStateModeProperty;
-import com.linkedin.helix.model.InstanceConfig;
-import com.linkedin.helix.store.PropertyJsonComparator;
-import com.linkedin.helix.store.PropertyJsonSerializer;
-import com.linkedin.helix.store.PropertyStore;
-import com.linkedin.helix.store.PropertyStoreException;
-import com.linkedin.helix.store.file.FilePropertyStore;
-
-public class UnitTestDynFileClusterMgr
-{
-  final String className = "UnitTestDynFileClusterMgr";
-  final String _rootNamespace = "/tmp/" + className;
-  final String instanceName = "localhost_12918";
-
-  FilePropertyStore<ZNRecord> _store;
-  HelixAdmin _mgmtTool;
-
-  @BeforeClass
-  public void beforeClass()
-  {
-    _store = new FilePropertyStore<ZNRecord>(new PropertyJsonSerializer<ZNRecord>(ZNRecord.class),
-        _rootNamespace, new PropertyJsonComparator<ZNRecord>(ZNRecord.class));
-    try
-    {
-      _store.removeRootNamespace();
-    } catch (PropertyStoreException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-
-    _mgmtTool = new FileHelixAdmin(_store);
-  }
-
-  @Test()
-  public void testBasic() throws PropertyStoreException
-  {
-    final String clusterName = className + "_basic";
-    String controllerName = "controller_0";
-    DynamicFileHelixManager controller = new DynamicFileHelixManager(clusterName,
-        controllerName, InstanceType.CONTROLLER, _store);
-
-    _mgmtTool.addCluster(clusterName, true);
-    _mgmtTool.addInstance(clusterName, new InstanceConfig(instanceName));
-
-    DynamicFileHelixManager participant = new DynamicFileHelixManager(clusterName,
-        instanceName, InstanceType.PARTICIPANT, _store);
-
-    AssertJUnit.assertEquals(instanceName, participant.getInstanceName());
-
-    controller.disconnect();
-    AssertJUnit.assertFalse(controller.isConnected());
-    controller.connect();
-    AssertJUnit.assertTrue(controller.isConnected());
-
-    String sessionId = controller.getSessionId();
-    // AssertJUnit.assertEquals(DynamicFileClusterManager._sessionId,
-    // sessionId);
-    AssertJUnit.assertEquals(clusterName, controller.getClusterName());
-    AssertJUnit.assertEquals(0, controller.getLastNotificationTime());
-    AssertJUnit.assertEquals(InstanceType.CONTROLLER, controller.getInstanceType());
-
-    // AssertJUnit.assertNull(controller.getPropertyStore());
-    PropertyStore<ZNRecord> propertyStore = controller.getPropertyStore();
-    AssertJUnit.assertNotNull(propertyStore);
-    propertyStore.setProperty("testKey", new ZNRecord("testValue"));
-    ZNRecord record = propertyStore.getProperty("testKey");
-    Assert.assertEquals(record.getId(), "testValue");
-
-    AssertJUnit.assertNull(controller.getHealthReportCollector());
-
-    MockListener controllerListener = new MockListener();
-    controllerListener.reset();
-
-    controller.addIdealStateChangeListener(controllerListener);
-    AssertJUnit.assertTrue(controllerListener.isIdealStateChangeListenerInvoked);
-
-    controller.addLiveInstanceChangeListener(controllerListener);
-    AssertJUnit.assertTrue(controllerListener.isLiveInstanceChangeListenerInvoked);
-
-    controller.addCurrentStateChangeListener(controllerListener, controllerName, sessionId);
-    AssertJUnit.assertTrue(controllerListener.isCurrentStateChangeListenerInvoked);
-
-    boolean exceptionCaught = false;
-    try
-    {
-      controller.addConfigChangeListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addExternalViewChangeListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addControllerListener(controllerListener);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    AssertJUnit.assertFalse(controller.removeListener(controllerListener));
-
-    exceptionCaught = false;
-    try
-    {
-      controller.addIdealStateChangeListener(null);
-    } catch (HelixException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    // test message service
-    ClusterMessagingService msgService = controller.getMessagingService();
-
-    // test file management tool
-    HelixAdmin tool = controller.getClusterManagmentTool();
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getClusters();
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getResourcesInCluster(clusterName);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.addResource(clusterName, "resource", 10, "MasterSlave",
-          IdealStateModeProperty.AUTO.toString());
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getStateModelDefs(clusterName);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getInstanceConfig(clusterName, instanceName);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getStateModelDef(clusterName, "MasterSlave");
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.getResourceExternalView(clusterName, "resource");
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    exceptionCaught = false;
-    try
-    {
-      tool.enableInstance(clusterName, "resource", false);
-    } catch (UnsupportedOperationException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    tool.addCluster(clusterName, true);
-    tool.addResource(clusterName, "resource", 10, "MasterSlave");
-    InstanceConfig config = new InstanceConfig("nodeConfig");
-    tool.addInstance(clusterName, config);
-    List<String> instances = tool.getInstancesInCluster(clusterName);
-    AssertJUnit.assertEquals(1, instances.size());
-    tool.dropInstance(clusterName, config);
-
-    IdealState idealState = new IdealState("idealState");
-    tool.setResourceIdealState(clusterName, "resource", idealState);
-    idealState = tool.getResourceIdealState(clusterName, "resource");
-    AssertJUnit.assertEquals(idealState.getId(), "idealState");
-
-    tool.dropResource(clusterName, "resource");
-    _store.stop();
-  }
-
-  @Test
-  public void testStartInstanceBeforeAdd()
-  {
-    final String clusterName = className + "_startInsB4Add";
-    _mgmtTool.addCluster(clusterName, true);
-
-    try
-    {
-      new DummyProcess(null, clusterName, instanceName, "dynamic-file", null, 0, _store).start();
-      Assert.fail("Should fail since instance is not configured");
-    } catch (HelixException e)
-    {
-      // OK
-    } catch (Exception e)
-    {
-      Assert.fail("Should not fail on exceptions other than ClusterManagerException");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java b/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java
deleted file mode 100644
index cf1ed2c..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.zk;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.NotificationContext;
-import com.linkedin.helix.manager.zk.DefaultControllerMessageHandlerFactory;
-import com.linkedin.helix.manager.zk.DefaultControllerMessageHandlerFactory.DefaultControllerMessageHandler;
-import com.linkedin.helix.messaging.handling.MessageHandler;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.model.Message.MessageType;
-
-public class TestDefaultControllerMsgHandlerFactory
-{
-  @Test()
-  public void testDefaultControllerMsgHandlerFactory()
-  {
-  	System.out.println("START TestDefaultControllerMsgHandlerFactory at " + new Date(System.currentTimeMillis()));
-
-    DefaultControllerMessageHandlerFactory facotry = new DefaultControllerMessageHandlerFactory();
-
-    Message message = new Message(MessageType.NO_OP, "0");
-    NotificationContext context = new NotificationContext(null);
-
-    boolean exceptionCaught = false;
-    try
-    {
-      MessageHandler handler = facotry.createHandler(message, context);
-    } catch (HelixException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    message = new Message(MessageType.CONTROLLER_MSG, "1");
-    exceptionCaught = false;
-    try
-    {
-      MessageHandler handler = facotry.createHandler(message, context);
-    } catch (HelixException e)
-    {
-      exceptionCaught = true;
-    }
-    AssertJUnit.assertFalse(exceptionCaught);
-
-    Map<String, String> resultMap = new HashMap<String, String>();
-    message = new Message(MessageType.NO_OP, "3");
-    DefaultControllerMessageHandler defaultHandler = new DefaultControllerMessageHandler(message, context);
-    try
-    {
-      defaultHandler.handleMessage();
-    } catch (HelixException e)
-    {
-      exceptionCaught = true;
-    }
-    catch (InterruptedException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-    AssertJUnit.assertTrue(exceptionCaught);
-
-    message = new Message(MessageType.CONTROLLER_MSG, "4");
-    defaultHandler = new DefaultControllerMessageHandler(message, context);
-    exceptionCaught = false;
-    try
-    {
-      defaultHandler.handleMessage();
-    } catch (HelixException e)
-    {
-      exceptionCaught = true;
-    }
-    catch (InterruptedException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-    AssertJUnit.assertFalse(exceptionCaught);
-    System.out.println("END TestDefaultControllerMsgHandlerFactory at " + new Date(System.currentTimeMillis()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestHandleNewSession.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestHandleNewSession.java b/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestHandleNewSession.java
deleted file mode 100644
index d8f539c..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestHandleNewSession.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.linkedin.helix.manager.zk;
-
-import java.util.Date;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.ZkTestHelper;
-import com.linkedin.helix.integration.ZkIntegrationTestBase;
-
-public class TestHandleNewSession extends ZkIntegrationTestBase
-{
-  @Test
-  public void testHandleNewSession() throws Exception
-  {
-    // Logger.getRootLogger().setLevel(Level.INFO);
-    String className = TestHelper.getTestClassName();
-    String methodName = TestHelper.getTestMethodName();
-    String clusterName = className + "_" + methodName;
-    
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-    
-    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
-                            "localhost", // participant name prefix
-                            "TestDB", // resource name prefix
-                            1, // resources
-                            10, // partitions per resource
-                            5, // number of nodes
-                            3, // replicas
-                            "MasterSlave",
-                            true); // do rebalance
-
-    ZKHelixManager manager =
-        new ZKHelixManager(clusterName,
-                               "localhost_12918",
-                               InstanceType.PARTICIPANT,
-                               ZK_ADDR);
-    manager.connect();
-   
-    // Logger.getRootLogger().setLevel(Level.INFO);
-    String lastSessionId = manager.getSessionId();
-    for (int i = 0; i < 3; i++)
-    {
-      // System.err.println("curSessionId: " + lastSessionId);
-      ZkTestHelper.expireSession(manager._zkClient);
-
-      String sessionId = manager.getSessionId();
-      Assert.assertTrue(sessionId.compareTo(lastSessionId) > 0, "Session id should be increased after expiry");
-      lastSessionId = sessionId;
-
-      // make sure session id is not 0
-      Assert.assertFalse(sessionId.equals("0"),
-                         "Hit race condition in zhclient.handleNewSession(). sessionId is not returned yet.");
-      
-      // TODO: need to test session expiry during handleNewSession()
-    }
-
-    // Logger.getRootLogger().setLevel(Level.INFO);
-    System.out.println("Disconnecting ...");
-    manager.disconnect();
-    
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestLiveInstanceBounce.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestLiveInstanceBounce.java b/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestLiveInstanceBounce.java
deleted file mode 100644
index 94d4988..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestLiveInstanceBounce.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed 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.
- */
-package com.linkedin.helix.manager.zk;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.TestHelper.StartCMResult;
-import com.linkedin.helix.integration.ZkStandAloneCMTestBase;
-import com.linkedin.helix.integration.ZkStandAloneCMTestBaseWithPropertyServerCheck;
-import com.linkedin.helix.tools.ClusterStateVerifier;
-
-public class TestLiveInstanceBounce extends ZkStandAloneCMTestBaseWithPropertyServerCheck
-{
-  @Test
-  public void testInstanceBounce() throws Exception
-  {
-    String controllerName = CONTROLLER_PREFIX + "_0";
-    StartCMResult controllerResult = _startCMResultMap.get(controllerName);
-    ZKHelixManager controller = (ZKHelixManager) controllerResult._manager;
-    int handlerSize = controller.getHandlers().size();
-
-    for (int i = 0; i < 2; i++)
-    {
-      String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
-      // kill 2 participants
-      _startCMResultMap.get(instanceName)._manager.disconnect();
-      _startCMResultMap.get(instanceName)._thread.interrupt();
-      try
-      {
-        Thread.sleep(1000);
-      }
-      catch (InterruptedException e)
-      {
-        e.printStackTrace();
-      }
-      // restart the participant
-      StartCMResult result = TestHelper.startDummyProcess(ZK_ADDR, CLUSTER_NAME, instanceName);
-      _startCMResultMap.put(instanceName, result);
-      Thread.sleep(100);
-    }
-    Thread.sleep(2000);
-
-    boolean result = ClusterStateVerifier.verifyByPolling(
-        new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, CLUSTER_NAME), 50 * 1000);
-    Assert.assertTrue(result);
-    // When a new live instance is created, we still add current state listener to it thus number should increase by 2
-    Assert.assertEquals( controller.getHandlers().size(), handlerSize + 2);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java b/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java
deleted file mode 100644
index dde5ac5..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java
+++ /dev/null
@@ -1,276 +0,0 @@
-package com.linkedin.helix.manager.zk;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import org.I0Itec.zkclient.DataUpdater;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.AccessOption;
-import com.linkedin.helix.PropertyPathConfig;
-import com.linkedin.helix.PropertyType;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.ZNRecordUpdater;
-import com.linkedin.helix.ZkUnitTestBase;
-
-public class TestWtCacheAsyncOpMultiThread extends ZkUnitTestBase
-{
-  class TestCreateZkCacheBaseDataAccessor implements Callable<Boolean>
-  {
-    final ZkCacheBaseDataAccessor<ZNRecord> _accessor;
-    final String                         _clusterName;
-    final int _id;
-
-    public TestCreateZkCacheBaseDataAccessor(ZkCacheBaseDataAccessor<ZNRecord> accessor, String clusterName, int id)
-    {
-      _accessor = accessor;
-      _clusterName = clusterName;
-      _id = id;
-    }
-
-    @Override
-    public Boolean call() throws Exception
-    {
-      // create 10 current states in 2 steps
-      List<String> paths = new ArrayList<String>();
-      List<ZNRecord> records = new ArrayList<ZNRecord>();
-      for (int j = 0; j < 2; j++)
-      {
-        paths.clear();
-        records.clear();
-
-        if (_id == 1 && j == 0)
-        {
-          // let thread_0 create 0-4
-          Thread.sleep(30);
-        }
-
-        if (_id == 0 && j == 1)
-        {
-          // let thread_1 create 5-9
-          Thread.sleep(100);
-        }
-        
-        
-        for (int i = 0; i < 5; i++)
-        {
-          int k = j * 5 + i;
-          String path =
-              PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                         _clusterName,
-                                         "localhost_8901",
-                                         "session_0",
-                                         "TestDB" + k);
-          ZNRecord record = new ZNRecord("TestDB" + k);
-
-          paths.add(path);
-          records.add(record);
-        }
-        
-        boolean[] success = _accessor.createChildren(paths, records, AccessOption.PERSISTENT);
-        // System.out.println("thread-" + _id + " creates " + j  + ": " + Arrays.toString(success));
-        
-        // create all all sync'ed, so we shall see either all true or all false
-        for (int i = 1; i < 5; i++)
-        {
-          Assert.assertEquals(success[i], success[0], "Should be either all succeed of all fail");
-        }
-      }
-
-      return true;
-    }
-  }
-  
-  class TestUpdateZkCacheBaseDataAccessor implements Callable<Boolean>
-  {
-    final ZkCacheBaseDataAccessor<ZNRecord> _accessor;
-    final String                         _clusterName;
-    final int _id;
-
-    public TestUpdateZkCacheBaseDataAccessor(ZkCacheBaseDataAccessor<ZNRecord> accessor, String clusterName, int id)
-    {
-      _accessor = accessor;
-      _clusterName = clusterName;
-      _id = id;
-    }
-
-    @Override
-    public Boolean call() throws Exception
-    {
-      // create 10 current states in 2 steps
-      List<String> paths = new ArrayList<String>();
-      List<DataUpdater<ZNRecord>> updaters = new ArrayList<DataUpdater<ZNRecord>>();
-      for (int j = 0; j < 10; j++)
-      {
-        paths.clear();
-        updaters.clear();
-
-        for (int i = 0; i < 10; i++)
-        {
-          String path =
-              PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                         _clusterName,
-                                         "localhost_8901",
-                                         "session_0",
-                                         "TestDB" + i);
-          
-          ZNRecord newRecord = new ZNRecord("TestDB" + i);
-          newRecord.setSimpleField("" + j, "" + j);
-          DataUpdater<ZNRecord> updater = new ZNRecordUpdater(newRecord);
-          paths.add(path);
-          updaters.add(updater);
-        }
-        
-        boolean[] success = _accessor.updateChildren(paths, updaters, AccessOption.PERSISTENT);
-        // System.out.println("thread-" + _id + " updates " + j + ": " + Arrays.toString(success));
-        
-        for (int i = 0; i < 10; i++)
-        {
-          Assert.assertEquals(success[i], true, "Should be all succeed");
-        }
-      }
-
-      return true;
-    }
-  }
-  
-  class TestSetZkCacheBaseDataAccessor implements Callable<Boolean>
-  {
-    final ZkCacheBaseDataAccessor<ZNRecord> _accessor;
-    final String                         _clusterName;
-    final int _id;
-
-    public TestSetZkCacheBaseDataAccessor(ZkCacheBaseDataAccessor<ZNRecord> accessor, String clusterName, int id)
-    {
-      _accessor = accessor;
-      _clusterName = clusterName;
-      _id = id;
-    }
-
-    @Override
-    public Boolean call() throws Exception
-    {
-      // create 10 current states in 2 steps
-      List<String> paths = new ArrayList<String>();
-      List<ZNRecord> records = new ArrayList<ZNRecord>();
-      for (int j = 0; j < 2; j++)
-      {
-        paths.clear();
-        records.clear();
-
-        if (_id == 1 && j == 0)
-        {
-          // let thread_0 create 0-4
-          Thread.sleep(30);
-        }
-
-        if (_id == 0 && j == 1)
-        {
-          // let thread_1 create 5-9
-          Thread.sleep(100);
-        }
-
-        for (int i = 0; i < 5; i++)
-        {
-          int k = j * 5 + i;
-          String path =
-              PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, _clusterName, "TestDB" + k);
-          ZNRecord record = new ZNRecord("TestDB" + k);
-
-          paths.add(path);
-          records.add(record);
-        }
-        boolean[] success = _accessor.setChildren(paths, records, AccessOption.PERSISTENT);
-        // System.out.println("thread-" + _id + " sets " + j  + ": " + Arrays.toString(success));
-        
-        for (int i = 0; i < 5; i++)
-        {
-          Assert.assertEquals(success[i], true);
-        }
-      }
-
-      return true;
-    }
-  }
-  
-  @Test
-  public void testHappyPathZkCacheBaseDataAccessor()
-  {
-    String className = TestHelper.getTestClassName();
-    String methodName = TestHelper.getTestMethodName();
-    String clusterName = className + "_" + methodName;
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-    // init zkCacheDataAccessor
-    String curStatePath =
-        PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                   clusterName,
-                                   "localhost_8901");
-    String extViewPath =
-        PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, clusterName);
-
-    ZkBaseDataAccessor<ZNRecord> baseAccessor =
-        new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
-
-    baseAccessor.create(curStatePath, null, AccessOption.PERSISTENT);
-
-    List<String> cachePaths = Arrays.asList(curStatePath, extViewPath);
-    ZkCacheBaseDataAccessor<ZNRecord> accessor =
-        new ZkCacheBaseDataAccessor<ZNRecord>(baseAccessor,
-                                           null,
-                                           cachePaths,
-                                           null);
-
-    // TestHelper.printCache(accessor._wtCache);
-    boolean ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-    // create 10 current states using 2 threads
-    List<Callable<Boolean>> threads = new ArrayList<Callable<Boolean>>();
-    for (int i = 0; i < 2; i++)
-    {
-      threads.add(new TestCreateZkCacheBaseDataAccessor(accessor, clusterName, i));
-    }
-    TestHelper.startThreadsConcurrently(threads, 1000);
-
-    // verify wtCache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-    
-    // update 10 current states 10 times using 2 threads
-    threads.clear();
-    for (int i = 0; i < 2; i++)
-    {
-      threads.add(new TestUpdateZkCacheBaseDataAccessor(accessor, clusterName, i));
-    }
-    TestHelper.startThreadsConcurrently(threads, 1000);
-    
-    // verify wtCache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-    // set 10 external views using 2 threads
-    threads.clear();
-    for (int i = 0; i < 2; i++)
-    {
-      threads.add(new TestSetZkCacheBaseDataAccessor(accessor, clusterName, i));
-    }
-    TestHelper.startThreadsConcurrently(threads, 1000);
-    
-    // verify wtCache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-    
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java b/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java
deleted file mode 100644
index 73dbe5c..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package com.linkedin.helix.manager.zk;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.I0Itec.zkclient.DataUpdater;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.AccessOption;
-import com.linkedin.helix.PropertyPathConfig;
-import com.linkedin.helix.PropertyType;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.ZNRecordUpdater;
-import com.linkedin.helix.ZkUnitTestBase;
-
-public class TestWtCacheAsyncOpSingleThread extends ZkUnitTestBase
-{
-  @Test
-  public void testHappyPathZkCacheBaseDataAccessor()
-  {
-    String className = TestHelper.getTestClassName();
-    String methodName = TestHelper.getTestMethodName();
-    String clusterName = className + "_" + methodName;
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-    // init zkCacheDataAccessor
-    String curStatePath =
-        PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                   clusterName,
-                                   "localhost_8901");
-    String extViewPath =
-        PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, clusterName);
-
-    ZkBaseDataAccessor<ZNRecord> baseAccessor =
-        new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
-
-    baseAccessor.create(curStatePath, null, AccessOption.PERSISTENT);
-
-    List<String> cachePaths = Arrays.asList(curStatePath, extViewPath);
-    ZkCacheBaseDataAccessor<ZNRecord> accessor =
-        new ZkCacheBaseDataAccessor<ZNRecord>(baseAccessor,
-                                           null,
-                                           cachePaths,
-                                           null);
-
-    boolean ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-
-    // create 10 current states
-    List<String> paths = new ArrayList<String>();
-    List<ZNRecord> records = new ArrayList<ZNRecord>();
-    for (int i = 0; i < 10; i++)
-    {
-      String path =
-          PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                     clusterName,
-                                     "localhost_8901",
-                                     "session_0",
-                                     "TestDB" + i);
-      ZNRecord record = new ZNRecord("TestDB" + i);
-
-      paths.add(path);
-      records.add(record);
-    }
-
-    boolean[] success = accessor.createChildren(paths, records, AccessOption.PERSISTENT);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertTrue(success[i], "Should succeed in create: " + paths.get(i));
-    }
-
-    // verify wtCache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-
-    // update each current state 10 times
-    List<DataUpdater<ZNRecord>> updaters = new ArrayList<DataUpdater<ZNRecord>>();
-    for (int j = 0; j < 10; j++)
-    {
-      paths.clear();
-      updaters.clear();
-      for (int i = 0; i < 10; i++)
-      {
-        String path = curStatePath + "/session_0/TestDB" + i;
-        ZNRecord newRecord = new ZNRecord("TestDB" + i);
-        newRecord.setSimpleField("" + j, "" + j);
-        DataUpdater<ZNRecord> updater = new ZNRecordUpdater(newRecord);
-        paths.add(path);
-        updaters.add(updater);
-      }
-      success = accessor.updateChildren(paths, updaters, AccessOption.PERSISTENT);
-
-      for (int i = 0; i < 10; i++)
-      {
-        Assert.assertTrue(success[i], "Should succeed in update: " + paths.get(i));
-      }
-    }
-
-    // verify cache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-
-    // set 10 external views
-    paths.clear();
-    records.clear();
-    for (int i = 0; i < 10; i++)
-    {
-      String path =
-          PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, clusterName, "TestDB" + i);
-      ZNRecord record = new ZNRecord("TestDB" + i);
-
-      paths.add(path);
-      records.add(record);
-    }
-    success = accessor.setChildren(paths, records, AccessOption.PERSISTENT);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertTrue(success[i], "Should succeed in set: " + paths.get(i));
-    }
-
-    // verify wtCache
-    // TestHelper.printCache(accessor._wtCache);
-    ret = TestHelper.verifyZkCache(cachePaths, accessor._wtCache._cache, _gZkClient, false);
-    Assert.assertTrue(ret, "wtCache doesn't match data on Zk");
-
-
-    // get 10 external views
-    paths.clear();
-    records.clear();
-    for (int i = 0; i < 10; i++)
-    {
-      String path =
-          PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, clusterName, "TestDB" + i);
-      paths.add(path);
-    }
-
-    records = accessor.get(paths, null, 0);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertEquals(records.get(i).getId(), "TestDB" + i);
-    }
-
-    // getChildren
-    records.clear();
-    records = accessor.getChildren(extViewPath, null, 0);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertEquals(records.get(i).getId(), "TestDB" + i);
-    }
-
-    // exists
-    paths.clear();
-    for (int i = 0; i < 10; i++)
-    {
-      String path =
-          PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                     clusterName,
-                                     "localhost_8901",
-                                     "session_0",
-                                     "TestDB" + i);
-      paths.add(path);
-    }
-    success = accessor.exists(paths, 0);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertTrue(success[i], "Should exits: TestDB" + i);
-    }
-
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-  }
-  
-  @Test
-  public void testCreateFailZkCacheBaseAccessor()
-  {
-    String className = TestHelper.getTestClassName();
-    String methodName = TestHelper.getTestMethodName();
-    String clusterName = className + "_" + methodName;
-    System.out.println("START " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-    // init zkCacheDataAccessor
-    String curStatePath =
-        PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                   clusterName,
-                                   "localhost_8901");
-    String extViewPath =
-        PropertyPathConfig.getPath(PropertyType.EXTERNALVIEW, clusterName);
-
-    ZkBaseDataAccessor<ZNRecord> baseAccessor =
-        new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
-
-    baseAccessor.create(curStatePath, null, AccessOption.PERSISTENT);
-
-    ZkCacheBaseDataAccessor<ZNRecord> accessor =
-        new ZkCacheBaseDataAccessor<ZNRecord>(baseAccessor,
-                                           null,
-                                           Arrays.asList(curStatePath, extViewPath),
-                                           null);
-
-    Assert.assertEquals(accessor._wtCache._cache.size(), 1, "Should contain only:\n"
-        + curStatePath);
-    Assert.assertTrue(accessor._wtCache._cache.containsKey(curStatePath));
-
-    // create 10 current states
-    List<String> paths = new ArrayList<String>();
-    List<ZNRecord> records = new ArrayList<ZNRecord>();
-    for (int i = 0; i < 10; i++)
-    {
-      String path =
-          PropertyPathConfig.getPath(PropertyType.CURRENTSTATES,
-                                     clusterName,
-                                     "localhost_8901",
-                                     "session_1",
-                                     "TestDB" + i);
-      ZNRecord record = new ZNRecord("TestDB" + i);
-
-      paths.add(path);
-      records.add(record);
-    }
-
-    boolean[] success = accessor.createChildren(paths, records, AccessOption.PERSISTENT);
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertTrue(success[i], "Should succeed in create: " + paths.get(i));
-    }
-    
-    
-    // create same 10 current states again, should fail on NodeExists
-    success = accessor.createChildren(paths, records, AccessOption.PERSISTENT);
-    // System.out.println(Arrays.toString(success));
-    for (int i = 0; i < 10; i++)
-    {
-      Assert.assertFalse(success[i], "Should fail on create: " + paths.get(i));
-    }
-    
-    System.out.println("END " + clusterName + " at "
-        + new Date(System.currentTimeMillis()));
-
-  }
-}