helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kisho...@apache.org
Subject [33/47] Refactoring from com.linkedin.helix to org.apache.helix
Date Wed, 24 Oct 2012 22:26:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/alerts/TestArrivingParticipantStats.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/alerts/TestArrivingParticipantStats.java b/helix-core/src/test/java/com/linkedin/helix/alerts/TestArrivingParticipantStats.java
deleted file mode 100644
index 861e6b3..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/alerts/TestArrivingParticipantStats.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.alerts;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.Mocks.MockManager;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.controller.stages.HealthDataCache;
-
-public class TestArrivingParticipantStats
-{
-  protected static final String CLUSTER_NAME = "TestCluster";
-
-  MockManager                   _helixManager;
-  StatsHolder                   _statsHolder;
-
-  @BeforeMethod(groups = { "unitTest" })
-  public void setup()
-  {
-    _helixManager = new MockManager(CLUSTER_NAME);
-    _statsHolder = new StatsHolder(_helixManager, new HealthDataCache());
-  }
-
-  public Map<String, String> getStatFields(String value, String timestamp)
-  {
-    Map<String, String> statMap = new HashMap<String, String>();
-    statMap.put(StatsHolder.VALUE_NAME, value);
-    statMap.put(StatsHolder.TIMESTAMP_NAME, timestamp);
-    return statMap;
-  }
-
-  public boolean statRecordContains(ZNRecord rec, String statName)
-  {
-    Map<String, Map<String, String>> stats = rec.getMapFields();
-    return stats.containsKey(statName);
-  }
-
-  public boolean statRecordHasValue(ZNRecord rec, String statName, String value)
-  {
-    Map<String, Map<String, String>> stats = rec.getMapFields();
-    Map<String, String> statFields = stats.get(statName);
-    return (statFields.get(StatsHolder.VALUE_NAME).equals(value));
-  }
-
-  public boolean statRecordHasTimestamp(ZNRecord rec, String statName, String timestamp)
-  {
-    Map<String, Map<String, String>> stats = rec.getMapFields();
-    Map<String, String> statFields = stats.get(statName);
-    return (statFields.get(StatsHolder.TIMESTAMP_NAME).equals(timestamp));
-  }
-
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testAddFirstParticipantStat() throws Exception
-  {
-    // add a persistent stat
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    _statsHolder.addStat(persistentStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
-  }
-
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testAddRepeatParticipantStat() throws Exception
-  {
-    // add a persistent stat
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    _statsHolder.addStat(persistentStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    // apply stat once and then again
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "1.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
-  }
-
-  // test to ensure backdated stats not applied
-  @Test(groups = { "unitTest" })
-  public void testBackdatedParticipantStat() throws Exception
-  {
-    // add a persistent stat
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    _statsHolder.addStat(persistentStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    // apply stat once and then again
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    statFields = getStatFields("5", "15");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "6.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "15.0"));
-  }
-
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testAddFirstParticipantStatToWildCard() throws Exception
-  {
-    // add a persistent stat
-    String persistentWildcardStat = "accumulate()(dbFoo.partition*.latency)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
-  }
-
-  // test to add 2nd report to same stat
-  @Test(groups = { "unitTest" })
-  public void testAddSecondParticipantStatToWildCard() throws Exception
-  {
-    // add a persistent stat
-    String persistentWildcardStat = "accumulate()(dbFoo.partition*.latency)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("1", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "2.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
-  }
-
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testAddParticipantStatToDoubleWildCard() throws Exception
-  {
-    // add a persistent stat
-    String persistentWildcardStat = "accumulate()(db*.partition*.latency)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
-  }
-
-  @Test(groups = { "unitTest" })
-  public void testAddWildcardInFirstStatToken() throws Exception
-  {
-    String persistentWildcardStat = "accumulate()(instance*.reportingage)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "instance10.reportingage";
-    Map<String, String> statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "accumulate()(instance10.reportingage)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "1.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
-
-  }
-
-  // test to add report to same wildcard stat, different actual stat
-  @Test(groups = { "unitTest" })
-  public void testAddTwoDistinctParticipantStatsToSameWildCard() throws Exception
-  {
-    // add a persistent stat
-    String persistentWildcardStat = "accumulate()(dbFoo.partition*.latency)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("1", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    incomingStatName = "dbFoo.partition11.latency";
-    statFields = getStatFields("5", "10");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "1.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
-    persistentStat = "accumulate()(dbFoo.partition11.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "5.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
-  }
-
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testWindowStat() throws Exception
-  {
-    // add a persistent stat
-    String persistentWildcardStat = "window(3)(dbFoo.partition*.latency)";
-    _statsHolder.addStat(persistentWildcardStat);
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    String persistentStat = "window(3)(dbFoo.partition10.latency)";
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
-
-    // add 2nd stat
-    statFields = getStatFields("10", "1");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0"));
-
-    // add 3rd stat
-    statFields = getStatFields("20", "2");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-    
-    rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
-
-  }
-
-  @Test(groups = { "unitTest" })
-  public void testWindowStatExpiration() throws Exception
-  {
-    String persistentWildcardStat = "window(3)(dbFoo.partition*.latency)";
-    String persistentStat = "window(3)(dbFoo.partition10.latency)";
-    // init with 3 elements
-    testWindowStat();
-
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("30", "3");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "10.0,20.0,30.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "1.0,2.0,3.0"));
-  }
-
-  @Test(groups = { "unitTest" })
-  public void testWindowStatStale() throws Exception
-  {
-    String persistentWildcardStat = "window(3)(dbFoo.partition*.latency)";
-    String persistentStat = "window(3)(dbFoo.partition10.latency)";
-    // init with 3 elements
-    testWindowStat();
-
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("10", "1");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
-  }
-
-  // test that has 2 agg stats for same raw stat
-  // Exact matching persistent stat, but has no values yet
-  @Test(groups = { "unitTest" })
-  public void testAddStatForTwoAggTypes() throws Exception
-  {
-    // add a persistent stat
-    String persistentStatOne = "accumulate()(dbFoo.partition10.latency)";
-    String persistentStatTwo = "window(3)(dbFoo.partition10.latency)";
-    _statsHolder.addStat(persistentStatOne);
-    _statsHolder.persistStats();
-    _statsHolder.addStat(persistentStatTwo);
-    _statsHolder.persistStats();
-
-    // generate incoming stat
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("0", "0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStatOne, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStatOne, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStatTwo, "0.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStatTwo, "0.0"));
-  }
-
-  // test merging 2 window stats, new is applied
-  @Test(groups = { "unitTest" })
-  public void testMergeTwoWindowsYesMerge() throws Exception
-  {
-    String persistentWildcardStat = "window(3)(dbFoo.partition*.latency)";
-    String persistentStat = "window(3)(dbFoo.partition10.latency)";
-    String incomingStatName = "dbFoo.partition10.latency";
-    // init with 3 elements
-    testWindowStat();
-
-    // create a two tuples, value and time
-    Tuple<String> valTuple = new Tuple<String>();
-    Tuple<String> timeTuple = new Tuple<String>();
-    valTuple.add("30.0");
-    valTuple.add("40.0");
-    timeTuple.add("3.0");
-    timeTuple.add("4.0");
-    Map<String, String> statFields =
-        getStatFields(valTuple.toString(), timeTuple.toString());
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "20.0,30.0,40.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "2.0,3.0,4.0"));
-  }
-
-  // test merging 2 window stats, new is ignored
-  @Test(groups = { "unitTest" })
-  public void testMergeTwoWindowsNoMerge() throws Exception
-  {
-    String persistentWildcardStat = "window(3)(dbFoo.partition*.latency)";
-    String persistentStat = "window(3)(dbFoo.partition10.latency)";
-    String incomingStatName = "dbFoo.partition10.latency";
-    // init with 3 elements
-    testWindowStat();
-
-    // create a two tuples, value and time
-    Tuple<String> valTuple = new Tuple<String>();
-    Tuple<String> timeTuple = new Tuple<String>();
-    valTuple.add("0.0");
-    valTuple.add("40.0");
-    timeTuple.add("0.0");
-    timeTuple.add("4.0");
-    Map<String, String> statFields =
-        getStatFields(valTuple.toString(), timeTuple.toString());
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-
-    // check persistent stats
-    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
-    Builder keyBuilder = accessor.keyBuilder();
-
-    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
-    System.out.println("rec: " + rec.toString());
-    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
-    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/alerts/TestBaseStatsValidation.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/alerts/TestBaseStatsValidation.java b/helix-core/src/test/java/com/linkedin/helix/alerts/TestBaseStatsValidation.java
deleted file mode 100644
index f2f4bad..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/alerts/TestBaseStatsValidation.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.alerts;
-
-import org.testng.annotations.Test;
-import org.testng.AssertJUnit;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.alerts.ExpressionOperatorType;
-import com.linkedin.helix.alerts.ExpressionParser;
-
-@Test
-public class TestBaseStatsValidation {
-	
-	 @Test
-	  public void testParseSingletonExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String statName = "window(5)(dbFoo.partition10.latency)";
-	    try {
-			actual = ExpressionParser.getBaseStats(statName);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals(statName, actual[0]);
-	  }
-	 
-	 @Test
-	  public void testExtraParen()
-	  {
-	    String[] actual = null;
-	    
-	    String statName = "window(5)(dbFoo.partition10.latency)()";
-	    boolean caughtException = false;
-	    try {
-			actual = ExpressionParser.getBaseStats(statName);
-		} catch (HelixException e) {		
-			caughtException = true;
-			//e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals(true, caughtException);
-	  }
-	 
-	 
-	 @Test
-	  public void testParseSingletonWildcardExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String statName = "accumulate()(dbFoo.partition*.latency)";
-	    try {
-			actual = ExpressionParser.getBaseStats(statName);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals(statName, actual[0]);
-	  }
-	 
-	 @Test
-	  public void testParsePairOfExpressions()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "accumulate()(dbFoo.partition10.latency, dbFoo.partition10.count)";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition10.latency)",actual[0]);
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition10.count)",actual[1]);
-	  }
-	 
-
-	/*
-	 * SUM is not to be persisted, so pull out the pieces
-	 */
-	 @Test
-	  public void testSUMExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "accumulate()(dbFoo.partition*.latency)|SUM";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition*.latency)", actual[0]);
-	  }
-	 
-	 @Test
-	  public void testSumPairExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "window(5)(dbFoo.partition10.latency, dbFoo.partition11.latency)|SUM";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("window(5)(dbFoo.partition10.latency)", actual[0]);
-	    AssertJUnit.assertEquals("window(5)(dbFoo.partition11.latency)", actual[1]);
-	  }
-	 
-	 @Test
-	  public void testEachPairExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "accumulate()(dbFoo.partition*.latency, dbFoo.partition*.count)|EACH";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition*.latency)", actual[0]);
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition*.count)", actual[1]);
-	  }
-	 
-	 @Test
-	  public void testAccumulateExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "accumulate()(dbFoo.partition10.latency)|ACCUMULATE";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition10.latency)", actual[0]);
-	  }
-	 
-	 @Test
-	  public void testAccumulateEachExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "window(5)(dbFoo.partition*.latency)|EACH|ACCUMULATE";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("window(5)(dbFoo.partition*.latency)", actual[0]);
-	  }
-
-	 @Test
-	  public void testAccumulateEachPairExpression()
-	  {
-	    String[] actual = null;
-	    
-	    String expression = "accumulate()(dbFoo.partition*.latency, dbFoo.partition*.count)|EACH|ACCUMULATE|DIVIDE";
-	    try {
-			actual = ExpressionParser.getBaseStats(expression);
-		} catch (HelixException e) {		
-			e.printStackTrace();
-		}
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition*.latency)", actual[0]);
-	    AssertJUnit.assertEquals("accumulate()(dbFoo.partition*.count)", actual[1]);
-	  }
-	 
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/alerts/TestEvaluateAlerts.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/alerts/TestEvaluateAlerts.java b/helix-core/src/test/java/com/linkedin/helix/alerts/TestEvaluateAlerts.java
deleted file mode 100644
index bdaeb5f..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/alerts/TestEvaluateAlerts.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.alerts;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.Mocks.MockManager;
-import com.linkedin.helix.controller.stages.HealthDataCache;
-
-public class TestEvaluateAlerts {
-  protected static final String CLUSTER_NAME = "TestCluster";
-
-  MockManager _helixManager;
-  AlertsHolder _alertsHolder;
-  StatsHolder _statsHolder;
-
-  public final String EXP = AlertParser.EXPRESSION_NAME;
-  public final String CMP = AlertParser.COMPARATOR_NAME;
-  public final String CON = AlertParser.CONSTANT_NAME;
-
-  @BeforeMethod (groups = {"unitTest"})
-  public void setup()
-  {
-    HealthDataCache cache = new HealthDataCache();
-    _helixManager = new MockManager(CLUSTER_NAME);
-    _alertsHolder = new AlertsHolder(_helixManager, cache);
-    _statsHolder = _alertsHolder._statsHolder;
-  }
-
-  public Map<String,String> getStatFields(String value, String timestamp)
-  {
-    Map<String, String> statMap = new HashMap<String,String>();
-    statMap.put(StatsHolder.VALUE_NAME, value);
-    statMap.put(StatsHolder.TIMESTAMP_NAME, timestamp);
-    return statMap;
-  }
-
-  public String getSimpleStat() throws HelixException
-  {
-    String stat = "accumulate()(dbFoo.partition10.latency)";
-    //_statsHolder.addStat(stat);
-    return stat;
-  }
-
-  public String addPairOfStats() throws HelixException
-  {
-    String stat = "accumulate()(dbFoo.partition10.latency, dbFoo.partition11.latency)";
-    _statsHolder.addStat(stat);
-    _statsHolder.persistStats();
-    return stat;
-  }
-
-  public String getWildcardStat() throws HelixException
-  {
-    String stat = "accumulate()(dbFoo.partition*.latency)";
-    //_statsHolder.addStat(stat);
-    return stat;
-  }
-
-  public String addSimpleAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition10.latency))"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.latency))"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addTwoWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.put*))"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-
-  public String addExpandWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.latency)|EXPAND)"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addExpandSumAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition10.latency,dbFoo.partition11.latency)|EXPAND|SUM)"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addExpandSumWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.success,dbFoo.partition*.failure)|EXPAND|SUM)"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addExpandSumEachWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.success,dbFoo.partition*.failure)|EXPAND|SUMEACH)"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addExpandSumEachSumWildcardAlert() throws HelixException
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.success,dbFoo.partition*.failure)|EXPAND|SUMEACH|SUM)"
-        + CMP + "(GREATER)" + CON + "(100)";
-       _alertsHolder.addAlert(alert);
-       return alert;
-  }
-
-  public String addArrivingSimpleStat() throws HelixException
-  {
-    _statsHolder.refreshStats();
-    String incomingStatName = "dbFoo.partition10.latency";
-    Map<String, String> statFields = getStatFields("110","0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-    return incomingStatName;
-  }
-
-  public String addArrivingPairOfStats() throws HelixException
-  {
-    _statsHolder.refreshStats();
-    String incomingStatName1 = "dbFoo.partition10.latency";
-    String incomingStatName2 = "dbFoo.partition11.latency";
-    Map<String, String> statFields = getStatFields("50","0");
-    _statsHolder.applyStat(incomingStatName1, statFields);
-    statFields = getStatFields("51","0");
-    _statsHolder.applyStat(incomingStatName2, statFields);
-    _statsHolder.persistStats();
-    return null;
-  }
-
-  @Test (groups = {"unitTest"})
-  public void testSimpleAlertFires()
-  {
-    String alert = addSimpleAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    _statsHolder.refreshStats(); //need to refresh since not triggered by stats aggregation stage
-    addArrivingSimpleStat();
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    boolean alertFired = alertResult.get(alert).get(AlertProcessor.noWildcardAlertKey).isFired();
-     AssertJUnit.assertTrue(alertFired);
-  }
-
-  @Test (groups = {"unitTest"})
-  public void testSimpleAlertNoStatArrivesFires()
-  {
-    String alert = addSimpleAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    AssertJUnit.assertEquals(null, alertResult.get(AlertProcessor.noWildcardAlertKey));
-  }
-
-  @Test (groups = {"unitTest"})
-  public void testWildcardAlertFires()
-  {
-    String alert = addWildcardAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    String incomingStatName = addArrivingSimpleStat();
-
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    String wildcardBinding = incomingStatName;
-    boolean alertFired = alertResult.get(alert).get(wildcardBinding).isFired();
-    AssertJUnit.assertTrue(alertFired);
-  }
-
-  @Test (groups = {"unitTest"})
-  public void testExpandOperatorWildcardAlertFires()
-  {
-    String alert = addExpandWildcardAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    String incomingStatName = addArrivingSimpleStat();
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    String wildcardBinding = incomingStatName;
-    boolean alertFired = alertResult.get(alert).get(wildcardBinding).isFired();
-    AssertJUnit.assertTrue(alertFired);
-  }
-
-  @Test (groups = {"unitTest"})
-  public void testExpandSumOperatorAlertFires()
-  {
-    String alert = addExpandSumAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    addArrivingPairOfStats();
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    boolean alertFired = alertResult.get(alert).get(AlertProcessor.noWildcardAlertKey).isFired();
-    AssertJUnit.assertTrue(alertFired);
-  }
-/**
- *
- * We need to re-decide how to support the feature to specify more than one stats in
- * an alert.
- *
- * Probabaly instead of
- * "(dbFoo.partition*.success,dbFoo.partition*.failure)", use the form
- * "(dbFoo.partition*.(success, failure))" as it seems that the stat source is always the
- * same.
- *
-  //@Test (groups = {"unitTest"})
-  public void testExpandSumOperatorWildcardAlert()
-  {
-    String alert = addExpandSumWildcardAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    String part10SuccStat = "dbFoo.partition10.success";
-    String part10FailStat = "dbFoo.partition10.failure";
-    String part11SuccStat = "dbFoo.partition11.success";
-    String part11FailStat = "dbFoo.partition11.failure";
-
-
-    Map<String, String> statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part10SuccStat, statFields);
-    statFields = getStatFields("51","0");
-    _statsHolder.applyStat(part10FailStat, statFields);
-    statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part11SuccStat, statFields);
-    statFields = getStatFields("49","0");
-    _statsHolder.applyStat(part11FailStat, statFields);
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    boolean alertFired = alertResult.get(alert).get("10").isFired(); //10 should fire
-    AssertJUnit.assertTrue(alertFired);
-    alertFired = alertResult.get(alert).get("11").isFired(); //11 should not fire
-    AssertJUnit.assertFalse(alertFired);
-  }
-
-  //@Test (groups = {"unitTest"})
-  public void testExpandSumEachSumOperatorWildcardAlert()
-  {
-    String alert = addExpandSumEachSumWildcardAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    String part10SuccStat = "dbFoo.partition10.success";
-    String part10FailStat = "dbFoo.partition10.failure";
-    String part11SuccStat = "dbFoo.partition11.success";
-    String part11FailStat = "dbFoo.partition11.failure";
-
-
-    Map<String, String> statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part10SuccStat, statFields);
-    statFields = getStatFields("51","0");
-    _statsHolder.applyStat(part10FailStat, statFields);
-    statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part11SuccStat, statFields);
-    statFields = getStatFields("49","0");
-    _statsHolder.applyStat(part11FailStat, statFields);
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    boolean alertFired = alertResult.get(alert).get(_statsHolder.getStatsList().get(0)).isFired(); //10 should fire
-    AssertJUnit.assertTrue(alertFired);
-  }
-
-  //@Test (groups = {"unitTest"})
-  public void testTwoAlerts()
-  {
-    //alert 1
-    String alert1 = addSimpleAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert1);
-    addArrivingSimpleStat();
-
-    //alert 2
-    String alert2 = addExpandSumWildcardAlert();
-    stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert2);
-    String part10SuccStat = "dbFoo.partition10.success";
-    String part10FailStat = "dbFoo.partition10.failure";
-    String part11SuccStat = "dbFoo.partition11.success";
-    String part11FailStat = "dbFoo.partition11.failure";
-
-
-    Map<String, String> statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part10SuccStat, statFields);
-    statFields = getStatFields("51","0");
-    _statsHolder.applyStat(part10FailStat, statFields);
-    statFields = getStatFields("50","0");
-    _statsHolder.applyStat(part11SuccStat, statFields);
-    statFields = getStatFields("49","0");
-    _statsHolder.applyStat(part11FailStat, statFields);
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-
-    //alert 1 check
-    boolean alertFired = alertResult.get(alert1).get(AlertProcessor.noWildcardAlertKey).isFired();
-    AssertJUnit.assertTrue(alertFired);
-
-    //alert 2 check
-    alertFired = alertResult.get(alert2).get("10").isFired(); //10 should fire
-    AssertJUnit.assertTrue(alertFired);
-    alertFired = alertResult.get(alert2).get("11").isFired(); //11 should not fire
-    AssertJUnit.assertFalse(alertFired);
-
-  }
-*/
-  @Test (groups = {"unitTest"})
-    public void testAddWildcardInFirstStatToken() throws Exception
-    {
-    String alert = "EXP(decay(1)(instance*.reportingage))CMP(GREATER)CON(300)";
-     _alertsHolder.addAlert(alert);
-     _statsHolder.persistStats();
-     
-     _statsHolder.refreshStats();
-     //generate incoming stat
-     String incomingStatName = "instance10.reportingage";
-     Map<String, String> statFields = getStatFields("301","10");
-     _statsHolder.refreshStats();
-     
-     _statsHolder.applyStat(incomingStatName, statFields);
-     _statsHolder.persistStats();
-
-     Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-     String wildcardBinding = incomingStatName;
-     boolean alertFired = alertResult.get(alert).get(wildcardBinding).isFired();
-     AssertJUnit.assertTrue(alertFired);
-    }
-
-  @Test (groups = {"unitTest"})
-  public void testTwoWildcardAlertFires()
-  {
-    //error is with * and )
-    String alert = addTwoWildcardAlert();
-    String stat = AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert);
-    String incomingStatName = "dbFoo.partition10.putCount";
-    Map<String, String> statFields = getStatFields("110","0");
-    _statsHolder.refreshStats();
-    _statsHolder.applyStat(incomingStatName, statFields);
-    _statsHolder.persistStats();
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    String wildcardBinding = incomingStatName; //XXX: this is not going to work...need "Count" in here too.
-    boolean alertFired = alertResult.get(alert).get(wildcardBinding).isFired();
-    AssertJUnit.assertTrue(alertFired);
-  }
-
-  /* only supporting wildcards at end of components right now
-  @Test (groups = {"unitTest"})
-  public void testTwoWildcardsNotAtEndFires()
-  {
-    String alert = EXP + "(accumulate()(dbFoo.partition*.*Count))"
-        + CMP + "(GREATER)" + CON + "(100)";
-    _alertsHolder.addAlert(alert);
-    String incomingStatName = "dbFoo.partition10.putCount";
-    Map<String, String> statFields = getStatFields("110","0");
-    _statsHolder.applyStat(incomingStatName, statFields);
-    Map<String, Map<String, AlertValueAndStatus>> alertResult = AlertProcessor.executeAllAlerts(_alertsHolder.getAlertList(), _statsHolder.getStatsList());
-    String wildcardBinding = "10,put"; //XXX: this is not going to work...need "Count" in here too.
-    boolean alertFired = alertResult.get(alert).get(wildcardBinding).isFired();
-    AssertJUnit.assertTrue(alertFired);
-  }
-  */
-
-  //test using sumall
-  //test using rows where some tuples are null (no stat sent)
-  //test with window tuples where some windows are different lengths
-  //anything else, look around at the code
-
-  //next: review all older tests
-  //next: actually write the fired alerts to ZK
-
-}
\ 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/alerts/TestOperators.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/alerts/TestOperators.java b/helix-core/src/test/java/com/linkedin/helix/alerts/TestOperators.java
deleted file mode 100644
index 0b84554..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/alerts/TestOperators.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.alerts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.alerts.SumEachOperator;
-import com.linkedin.helix.alerts.SumOperator;
-import com.linkedin.helix.alerts.Tuple;
-
-
-public class TestOperators {
-	
-	SumOperator _sumOp;
-	SumEachOperator _sumEachOp;
-	
-	@BeforeMethod (groups = {"unitTest"})
-	public void setup()
-	{
-		_sumOp = new SumOperator();
-		_sumEachOp = new SumEachOperator();
-	}
-	
-	
-	@Test (groups = {"unitTest"})
-	public void testTwoNulls()
-	{
-		Tuple<String> tup1 = null;
-		Tuple<String> tup2 = null;
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals(null, resultTup);
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testOneNullLeft()
-	{
-		Tuple<String> tup1 = null;
-		Tuple<String> tup2 = new Tuple<String>();
-		tup2.add("1.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals("1.0", resultTup.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testOneNullRight()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = null;
-		tup1.add("1.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals("1.0", resultTup.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testTwoSingeltons()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = new Tuple<String>();
-		tup1.add("1.0");
-		tup2.add("2.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals("3.0", resultTup.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testThreeSingeltons()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = new Tuple<String>();
-		Tuple<String> tup3 = new Tuple<String>();
-		tup1.add("1.0");
-		tup2.add("2.0");
-		tup3.add("3.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup3List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		tup3List.add(tup3);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		tupsList.add(tup3List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals("6.0", resultTup.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testThreeTriples()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = new Tuple<String>();
-		Tuple<String> tup3 = new Tuple<String>();
-		tup1.add("1.0"); tup1.add("2.0"); tup1.add("3.0");
-		tup2.add("4.0"); tup2.add("5.0"); tup2.add("6.0");
-		tup3.add("7.0"); tup3.add("8.0"); tup3.add("9.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup3List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		tup3List.add(tup3);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		tupsList.add(tup3List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		AssertJUnit.assertEquals("12.0,15.0,18.0", resultTup.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testThreeTriplesOneMissing()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = new Tuple<String>();
-		Tuple<String> tup3 = new Tuple<String>();
-		tup1.add("1.0"); tup1.add("2.0"); tup1.add("3.0");
-		tup2.add("5.0"); tup2.add("6.0");
-		tup3.add("7.0"); tup3.add("8.0"); tup3.add("9.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup3List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1);
-		tup2List.add(tup2);
-		tup3List.add(tup3);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		tupsList.add(tup3List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup = resultIter.next();
-		//tuple 2 missing 1 entry, other 2 get bumped to right
-		AssertJUnit.assertEquals("8.0,15.0,18.0", resultTup.toString());
-	}
-
-	//test multiple rows
-	@Test (groups = {"unitTest"})
-	public void testThreeTriplesOneMissingTwoRows()
-	{
-		Tuple<String> tup1Dot1 = new Tuple<String>();
-		Tuple<String> tup2Dot1 = new Tuple<String>();
-		Tuple<String> tup3Dot1 = new Tuple<String>();
-		Tuple<String> tup1Dot2 = new Tuple<String>();
-		Tuple<String> tup2Dot2 = new Tuple<String>();
-		Tuple<String> tup3Dot2 = new Tuple<String>();
-		tup1Dot1.add("1.0"); tup1Dot1.add("2.0"); tup1Dot1.add("3.0");
-		tup2Dot1.add("5.0"); tup2Dot1.add("6.0");
-		tup3Dot1.add("7.0"); tup3Dot1.add("8.0"); tup3Dot1.add("9.0");
-		tup1Dot2.add("10.0"); tup1Dot2.add("11.0"); tup1Dot2.add("12.0");
-		tup2Dot2.add("13.0"); tup2Dot2.add("14.0"); tup2Dot2.add("15.0");
-		tup3Dot2.add("16.0"); tup3Dot2.add("17.0"); tup3Dot2.add("18.0");
-		List<Tuple<String>> tup1List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup2List = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> tup3List = new ArrayList<Tuple<String>>();
-		tup1List.add(tup1Dot1);
-		tup2List.add(tup2Dot1);
-		tup3List.add(tup3Dot1);
-		tup1List.add(tup1Dot2);
-		tup2List.add(tup2Dot2);
-		tup3List.add(tup3Dot2);
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(tup1List.iterator());
-		tupsList.add(tup2List.iterator());
-		tupsList.add(tup3List.iterator());
-		List<Iterator<Tuple<String>>> result = _sumOp.execute(tupsList);
-		AssertJUnit.assertEquals(1, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup1 = resultIter.next();
-		//tuple 2 missing 1 entry, other 2 get bumped to right
-		AssertJUnit.assertEquals("8.0,15.0,18.0", resultTup1.toString());
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup2 = resultIter.next();
-		AssertJUnit.assertEquals("39.0,42.0,45.0", resultTup2.toString());
-	}
-	
-	@Test (groups = {"unitTest"})
-	public void testSumAll()
-	{
-		Tuple<String> tup1 = new Tuple<String>();
-		Tuple<String> tup2 = new Tuple<String>();
-		Tuple<String> tup3 = new Tuple<String>();
-		Tuple<String> tup4 = new Tuple<String>();
-		Tuple<String> tup5 = new Tuple<String>();
-		Tuple<String> tup6 = new Tuple<String>();
-		tup1.add("1.0"); tup2.add("2.0"); tup3.add("3.0");
-		tup4.add("4.0"); tup5.add("5.0"); tup6.add("6.0");
-		List<Tuple<String>> list1 = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> list2 = new ArrayList<Tuple<String>>();
-		List<Tuple<String>> list3 = new ArrayList<Tuple<String>>();
-		list1.add(tup1); list1.add(tup4); 
-		list2.add(tup2); list2.add(tup5);
-		list3.add(tup3); list3.add(tup6);
-		
-		List<Iterator<Tuple<String>>> tupsList = new ArrayList<Iterator<Tuple<String>>>();
-		tupsList.add(list1.iterator());
-		tupsList.add(list2.iterator());
-		tupsList.add(list3.iterator());
-		List<Iterator<Tuple<String>>> result = _sumEachOp.execute(tupsList);
-		AssertJUnit.assertEquals(3, result.size()); //should be just 1 iter
-		Iterator<Tuple<String>> resultIter = result.get(0);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		Tuple<String>resultTup1 = resultIter.next();
-		AssertJUnit.assertEquals("5.0", resultTup1.toString());
-		resultIter = result.get(1);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		resultTup1 = resultIter.next();
-		AssertJUnit.assertEquals("7.0", resultTup1.toString());
-		resultIter = result.get(2);
-		AssertJUnit.assertTrue(resultIter.hasNext());
-		resultTup1 = resultIter.next();
-		AssertJUnit.assertEquals("9.0", resultTup1.toString());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/alerts/TestStatsMatch.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/alerts/TestStatsMatch.java b/helix-core/src/test/java/com/linkedin/helix/alerts/TestStatsMatch.java
deleted file mode 100644
index ba0b35f..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/alerts/TestStatsMatch.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.alerts;
-
-import org.testng.annotations.Test;
-import org.testng.AssertJUnit;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.alerts.ExpressionParser;
-
-@Test
-public class TestStatsMatch {
-
-	@Test
-	  public void testExactMatch()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition10.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    AssertJUnit.assertTrue(ExpressionParser.isIncomingStatExactMatch(persistedStatName, incomingStatName));
-	  }
-	
-	@Test
-	  public void testSingleWildcardMatch()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition*.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    AssertJUnit.assertTrue(ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName));
-	  }
-	
-	@Test
-	  public void testDoubleWildcardMatch()
-	  {
-	    
-	    String persistedStatName = "window(5)(db*.partition*.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    AssertJUnit.assertTrue(ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName));
-	  }
-	
-	@Test
-	  public void testWildcardMatchNoWildcard()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition10.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    AssertJUnit.assertFalse(ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName));
-	  }
-	
-	@Test
-	  public void testWildcardMatchTooManyFields()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition*.latency)";
-	    String incomingStatName = "dbFoo.tableBar.partition10.latency";
-	    AssertJUnit.assertFalse(ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName));
-	  }
-	
-	@Test
-	  public void testWildcardMatchTooFewFields()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition*.latency)";
-	    String incomingStatName = "dbFoo.latency";
-	    AssertJUnit.assertFalse(ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName));
-	  }
-	
-
-	@Test
-	  public void testBadWildcardRepeated()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.partition**4.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    boolean match = ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName);
-	    
-	    AssertJUnit.assertFalse(match);
-	  }
-	
-	@Test
-	  public void testBadWildcardNotAtEnd()
-	  {
-	    
-	    String persistedStatName = "window(5)(dbFoo.*partition.latency)";
-	    String incomingStatName = "dbFoo.partition10.latency";
-	    boolean match = ExpressionParser.isIncomingStatWildcardMatch(persistedStatName, incomingStatName);
-	    
-	    AssertJUnit.assertFalse(match);
-	  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimer.java b/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimer.java
deleted file mode 100644
index d86fd0d..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimer.java
+++ /dev/null
@@ -1,286 +0,0 @@
-package com.linkedin.helix.controller;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.TestHelper.StartCMResult;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.integration.ZkStandAloneCMTestBase;
-import com.linkedin.helix.josql.JsqlQueryListProcessor;
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.manager.zk.ZkClient;
-import com.linkedin.helix.model.ExternalView;
-import com.linkedin.helix.model.HealthStat;
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.model.IdealState.IdealStateProperty;
-import com.linkedin.helix.tools.ClusterSetup;
-import com.linkedin.helix.tools.ClusterStateVerifier;
-import com.linkedin.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
-import com.linkedin.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
-
-public class TestControllerRebalancingTimer extends ZkStandAloneCMTestBase
-{
-  private static Logger                LOG               =
-      Logger.getLogger(TestControllerRebalancingTimer.class);
-
-  @Override
-  @BeforeClass
-  public void beforeClass() throws Exception
-  {
-//    Logger.getRootLogger().setLevel(Level.INFO);
-    System.out.println("START " + CLASS_NAME + " at "
-        + new Date(System.currentTimeMillis()));
-
-    _zkClient = new ZkClient(ZK_ADDR);
-    _zkClient.setZkSerializer(new ZNRecordSerializer());
-    String namespace = "/" + CLUSTER_NAME;
-    if (_zkClient.exists(namespace))
-    {
-      _zkClient.deleteRecursive(namespace);
-    }
-    _setupTool = new ClusterSetup(ZK_ADDR);
-
-    // setup storage cluster
-    _setupTool.addCluster(CLUSTER_NAME, true);
-    _setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
-    for (int i = 0; i < NODE_NR; i++)
-    {
-      String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
-      _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
-    }
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
-    IdealState idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB);
-    idealState.getRecord().setSimpleField(IdealStateProperty.REBALANCE_TIMER_PERIOD.toString(), "500");
-
-    String scnTableQuery = "SELECT T1.instance as instance, T1.mapField as partition, T1.gen as gen, T1.seq as seq " +
-        "FROM explodeMap(`INSTANCES/*/HEALTHREPORT/scnTable`) AS T1" +
-        " JOIN LIVEINSTANCES as T2 using (T1.instance, T2.id)";
-
-    String rankQuery = "SELECT instance, partition, gen, seq, T1.listIndex AS instanceRank " +
-            " FROM scnTable JOIN explodeList(`IDEALSTATES/" + TEST_DB + "`) AS T1 " +
-                    "USING (scnTable.instance, T1.listVal) WHERE scnTable.partition=T1.listField";
-
-    String masterSelectionQuery = "SELECT instance, partition, instanceRank, gen, (T.maxSeq-seq) AS seqDiff, seq FROM rankTable JOIN " +
-            " (SELECT partition, max(to_number(seq)) AS maxSeq FROM rankTable GROUP BY partition) AS T USING(rankTable.partition, T.partition) " +
-            " WHERE to_number(seqDiff) < 10 " +
-            " ORDER BY partition, to_number(gen) desc, to_number(instanceRank), to_number(seqDiff)";
-
-    StringBuffer combinedQueryStringList = new StringBuffer();
-    combinedQueryStringList.append(scnTableQuery + JsqlQueryListProcessor.SEPARATOR+"scnTable;");
-    combinedQueryStringList.append(rankQuery + JsqlQueryListProcessor.SEPARATOR+"rankTable;");
-    combinedQueryStringList.append(masterSelectionQuery);
-
-    String command = "-zkSvr " + ZK_ADDR + " -addResourceProperty "+ CLUSTER_NAME + " " + TEST_DB + " " + IdealState.QUERY_LIST.toString() + " "
-        ;//+ "\""+ combinedQueryStringList.toString() +"\"";
-    String[] args = command.split(" ");
-
-    List<String> argsList = new ArrayList<String>();
-    argsList.addAll(Arrays.asList(args));
-    argsList.add("\""+ combinedQueryStringList.toString() +"\"");
-    String[] allArgs = new String[argsList.size()];
-    argsList.toArray(allArgs);
-    ClusterSetup.processCommandLineArgs(allArgs);
-
-    command = "-zkSvr " + ZK_ADDR + " -addResourceProperty "+ CLUSTER_NAME + " " + TEST_DB + " " + IdealState.IdealStateProperty.REBALANCE_TIMER_PERIOD.toString() + " 500";
-
-    ClusterSetup.processCommandLineArgs(command.split(" "));
-
-
-    // start dummy participants
-    for (int i = 0; i < NODE_NR; i++)
-    {
-      String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
-      if (_startCMResultMap.get(instanceName) != null)
-      {
-        LOG.error("fail to start particpant:" + instanceName
-            + "(participant with same name already exists)");
-      }
-      else
-      {
-        StartCMResult result =
-            TestHelper.startDummyProcess(ZK_ADDR, CLUSTER_NAME, instanceName);
-        _startCMResultMap.put(instanceName, result);
-      }
-    }
-
-    // start controller
-    String controllerName = CONTROLLER_PREFIX + "_0";
-    StartCMResult startResult =
-        TestHelper.startController(CLUSTER_NAME,
-                                   controllerName,
-                                   ZK_ADDR,
-                                   HelixControllerMain.STANDALONE);
-    _startCMResultMap.put(controllerName, startResult);
-
-    boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
-                                                                              CLUSTER_NAME));
-
-    result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 CLUSTER_NAME));
-    Assert.assertTrue(result);
-  }
-
-  @Test
-  public void testMasterSelectionBySCN() throws Exception
-  {
-    String controllerName = CONTROLLER_PREFIX + "_0";
-    StartCMResult startResult =
-    _startCMResultMap.get(controllerName);
-    HelixDataAccessor accessor = startResult._manager.getHelixDataAccessor();
-
-    IdealState idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB);
-    Map<String, ZNRecord> scnTableMap = new HashMap<String, ZNRecord>();
-    for (int i = 0; i < NODE_NR; i++)
-    {
-      String instance = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
-      ZNRecord scnRecord = new ZNRecord("scnTable");
-      scnRecord.setSimpleField("instance", instance);
-      scnTableMap.put(instance, scnRecord);
-    }
-    String instanceDead = PARTICIPANT_PREFIX + "_" + (START_PORT + 0);
-    for(int j = 0; j < _PARTITIONS; j++)
-    {
-      int seq = 50;
-      String partition = TEST_DB + "_" + j;
-      List<String> idealStatePrefList =
-          idealState.getPreferenceList(partition);
-      String idealStateMaster = idealStatePrefList.get(0);
-      // Switch the scn order of the partitions mastered on instanceDead
-      if(idealStateMaster.equals(instanceDead))
-      {
-        for(int x = 0; x < idealStatePrefList.size(); x++)
-        {
-          String instance = idealStatePrefList.get(x);
-          ZNRecord scnRecord = scnTableMap.get(instance);
-          if(!scnRecord.getMapFields().containsKey(partition))
-          {
-            scnRecord.setMapField(partition, new HashMap<String, String>());
-          }
-          Map<String, String> scnDetails = scnRecord.getMapField(partition);
-          scnDetails.put("gen", "4");
-          if(x > 0)
-          {
-            scnDetails.put("seq", "" + (seq - 22 + 11 *(x)));
-          }
-          else
-          {
-            scnDetails.put("seq", "100");
-          }
-        }
-      }
-    }
-
-    for(String instanceName : scnTableMap.keySet())
-    {
-      Builder kb = accessor.keyBuilder();
-      accessor.setProperty(kb.healthReport(instanceName, "scnTable"), new HealthStat(scnTableMap.get(instanceName)));
-    }
-
-    // kill a node, after a while the master should be the last one in the ideal state pref list
-    
-    _startCMResultMap.get(instanceDead)._manager.disconnect();
-    _startCMResultMap.get(instanceDead)._thread.interrupt();
-    
-    Thread.sleep(1000);
-    
-    boolean verifyResult =
-        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
-                                                                              CLUSTER_NAME));
-    Assert.assertTrue(verifyResult);
-    Builder kb = accessor.keyBuilder();
-    ExternalView ev = accessor.getProperty(kb.externalView(TEST_DB));
-    for(String partitionName : idealState.getPartitionSet())
-    {
-      List<String> prefList = idealState.getPreferenceList(partitionName);
-      if(prefList.get(0).equals(instanceDead))
-      {
-        String last = prefList.get(prefList.size() - 1);
-        Assert.assertTrue(ev.getStateMap(partitionName).get(last).equals("MASTER"));
-      }
-    }
-    
-    // Bring up the previous dead node, but as the SCN is the last for all the 
-    // master partitions on it, the master partitions should be still on the last if the prefList
-    StartCMResult result =
-        TestHelper.startDummyProcess(ZK_ADDR, CLUSTER_NAME, instanceDead);
-    _startCMResultMap.put(instanceDead, result);
-
-    Thread.sleep(1000);
-    verifyResult =
-        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
-                                                                              CLUSTER_NAME));
-    Assert.assertTrue(verifyResult);
-    for(String partitionName : idealState.getPartitionSet())
-    {
-      List<String> prefList = idealState.getPreferenceList(partitionName);
-      if(prefList.get(0).equals(instanceDead))
-      {
-        String last = prefList.get(prefList.size() - 1);
-        Assert.assertTrue(ev.getStateMap(partitionName).get(last).equals("MASTER"));
-      }
-    }
-    // Reset the scn of the partitions
-    for(int j = 0; j < _PARTITIONS; j++)
-    {
-      String partition = TEST_DB + "_" + j;
-      List<String> idealStatePrefList =
-          idealState.getPreferenceList(partition);
-      String idealStateMaster = idealStatePrefList.get(0);
-      // Switch back the scn to the same
-      if(idealStateMaster.equals(instanceDead))
-      {
-        for(int x = 0; x < idealStatePrefList.size(); x++)
-        {
-          String instance = idealStatePrefList.get(x);
-          ZNRecord scnRecord = scnTableMap.get(instance);
-          if(!scnRecord.getMapFields().containsKey(partition))
-          {
-            scnRecord.setMapField(partition, new HashMap<String, String>());
-          }
-          Map<String, String> scnDetails = scnRecord.getMapField(partition);
-          scnDetails.put("gen", "4");
-          scnDetails.put("seq", "100");
-        }
-      }
-    }
-    // set the scn to normal -- same order as the priority list
-    for(String instanceName : scnTableMap.keySet())
-    {
-      kb = accessor.keyBuilder();
-      accessor.setProperty(kb.healthReport(instanceName, "scnTable"), new HealthStat(scnTableMap.get(instanceName)));
-    }
-    Thread.sleep(1000);
-    verifyResult =
-        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
-                                                                              CLUSTER_NAME));
-    Assert.assertTrue(verifyResult);
-    // should be reverted to normal
-    ev = accessor.getProperty(kb.externalView(TEST_DB));
-    for(String partitionName : idealState.getPartitionSet())
-    {
-      List<String> prefList = idealState.getPreferenceList(partitionName);
-      if(prefList.get(0).equals(instanceDead))
-      {
-        String last = prefList.get(prefList.size() - 1);
-        Assert.assertTrue(ev.getStateMap(partitionName).get(last).equals("SLAVE"));
-        Assert.assertTrue(ev.getStateMap(partitionName).get(prefList.get(1)).equals("SLAVE"));
-        Assert.assertTrue(ev.getStateMap(partitionName).get(prefList.get(0)).equals("MASTER"));
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimerPeriod.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimerPeriod.java b/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimerPeriod.java
deleted file mode 100644
index 2a2c856..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/controller/TestControllerRebalancingTimerPeriod.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package com.linkedin.helix.controller;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.HelixException;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.TestHelper;
-import com.linkedin.helix.TestHelper.StartCMResult;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.integration.ZkStandAloneCMTestBase;
-import com.linkedin.helix.josql.JsqlQueryListProcessor;
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.manager.zk.ZkClient;
-import com.linkedin.helix.model.ExternalView;
-import com.linkedin.helix.model.HealthStat;
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.model.IdealState.IdealStateProperty;
-import com.linkedin.helix.tools.ClusterSetup;
-import com.linkedin.helix.tools.ClusterStateVerifier;
-import com.linkedin.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
-import com.linkedin.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
-
-public class TestControllerRebalancingTimerPeriod extends ZkStandAloneCMTestBase
-{
-  private static Logger                LOG               =
-      Logger.getLogger(TestControllerRebalancingTimerPeriod.class);
-
-  @Override
-  @BeforeClass
-  public void beforeClass() throws Exception
-  {
-//    Logger.getRootLogger().setLevel(Level.INFO);
-    System.out.println("START " + CLASS_NAME + " at "
-        + new Date(System.currentTimeMillis()));
-
-    _zkClient = new ZkClient(ZK_ADDR);
-    _zkClient.setZkSerializer(new ZNRecordSerializer());
-    String namespace = "/" + CLUSTER_NAME;
-    if (_zkClient.exists(namespace))
-    {
-      _zkClient.deleteRecursive(namespace);
-    }
-    _setupTool = new ClusterSetup(ZK_ADDR);
-
-    // setup storage cluster
-    _setupTool.addCluster(CLUSTER_NAME, true);
-    _setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
-    for (int i = 0; i < NODE_NR; i++)
-    {
-      String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
-      _setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
-    }
-    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
-    IdealState idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB);
-    idealState.getRecord().setSimpleField(IdealStateProperty.REBALANCE_TIMER_PERIOD.toString(), "500");
-
-    String scnTableQuery = "SELECT T1.instance as instance, T1.mapField as partition, T1.gen as gen, T1.seq as seq " +
-        "FROM explodeMap(`INSTANCES/*/HEALTHREPORT/scnTable`) AS T1" +
-        " JOIN LIVEINSTANCES as T2 using (T1.instance, T2.id)";
-
-    String rankQuery = "SELECT instance, partition, gen, seq, T1.listIndex AS instanceRank " +
-            " FROM scnTable JOIN explodeList(`IDEALSTATES/" + TEST_DB + "`) AS T1 " +
-                    "USING (scnTable.instance, T1.listVal) WHERE scnTable.partition=T1.listField";
-
-    String masterSelectionQuery = "SELECT instance, partition, instanceRank, gen, (T.maxSeq-seq) AS seqDiff, seq FROM rankTable JOIN " +
-            " (SELECT partition, max(to_number(seq)) AS maxSeq FROM rankTable GROUP BY partition) AS T USING(rankTable.partition, T.partition) " +
-            " WHERE to_number(seqDiff) < 10 " +
-            " ORDER BY partition, to_number(gen) desc, to_number(instanceRank), to_number(seqDiff)";
-
-    StringBuffer combinedQueryStringList = new StringBuffer();
-    combinedQueryStringList.append(scnTableQuery + JsqlQueryListProcessor.SEPARATOR+"scnTable;");
-    combinedQueryStringList.append(rankQuery + JsqlQueryListProcessor.SEPARATOR+"rankTable;");
-    combinedQueryStringList.append(masterSelectionQuery);
-
-    String command = "-zkSvr " + ZK_ADDR + " -addResourceProperty "+ CLUSTER_NAME + " " + TEST_DB + " " + IdealState.QUERY_LIST.toString() + " "
-        ;//+ "\""+ combinedQueryStringList.toString() +"\"";
-    String[] args = command.split(" ");
-
-    List<String> argsList = new ArrayList<String>();
-    argsList.addAll(Arrays.asList(args));
-    argsList.add("\""+ combinedQueryStringList.toString() +"\"");
-    String[] allArgs = new String[argsList.size()];
-    argsList.toArray(allArgs);
-    ClusterSetup.processCommandLineArgs(allArgs);
-
-    command = "-zkSvr " + ZK_ADDR + " -addResourceProperty "+ CLUSTER_NAME + " " + TEST_DB + " " + IdealState.IdealStateProperty.REBALANCE_TIMER_PERIOD.toString() + " 500";
-
-    ClusterSetup.processCommandLineArgs(command.split(" "));
-
-
-    // start dummy participants
-    for (int i = 0; i < NODE_NR; i++)
-    {
-      String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
-      if (_startCMResultMap.get(instanceName) != null)
-      {
-        LOG.error("fail to start particpant:" + instanceName
-            + "(participant with same name already exists)");
-      }
-      else
-      {
-        StartCMResult result =
-            TestHelper.startDummyProcess(ZK_ADDR, CLUSTER_NAME, instanceName);
-        _startCMResultMap.put(instanceName, result);
-      }
-    }
-
-    // start controller
-    String controllerName = CONTROLLER_PREFIX + "_0";
-    StartCMResult startResult =
-        TestHelper.startController(CLUSTER_NAME,
-                                   controllerName,
-                                   ZK_ADDR,
-                                   HelixControllerMain.STANDALONE);
-    _startCMResultMap.put(controllerName, startResult);
-
-    boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
-                                                                              CLUSTER_NAME));
-
-    result =
-        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,
-                                                                                 CLUSTER_NAME));
-    Assert.assertTrue(result);
-  }
-
-  @Test
-  public void TestRebalancingTimer() throws Exception
-  {
-    String controllerName = CONTROLLER_PREFIX + "_0";
-    GenericHelixController controller = new GenericHelixController();
-    _startCMResultMap.get(controllerName)._manager.addIdealStateChangeListener(controller);
-
-    Assert.assertTrue(controller._rebalanceTimer != null);
-    Assert.assertEquals(controller._timerPeriod, 500);
-
-    String command = "-zkSvr " + ZK_ADDR + " -addResourceProperty "+ CLUSTER_NAME + " " + TEST_DB + " " + IdealState.IdealStateProperty.REBALANCE_TIMER_PERIOD.toString() + " 200";
-
-    ClusterSetup.processCommandLineArgs(command.split(" "));
-
-    Thread.sleep(1000);
-    Assert.assertTrue(controller._rebalanceTimer != null);
-    Assert.assertEquals(controller._timerPeriod, 200);
-    _startCMResultMap.get(controllerName)._manager.disconnect();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/controller/stages/BaseStageTest.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/controller/stages/BaseStageTest.java b/helix-core/src/test/java/com/linkedin/helix/controller/stages/BaseStageTest.java
deleted file mode 100644
index 47b5501..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/controller/stages/BaseStageTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <opensource@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.controller.stages;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.HelixManager;
-import com.linkedin.helix.Mocks;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.controller.pipeline.Stage;
-import com.linkedin.helix.controller.pipeline.StageContext;
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.model.IdealState.IdealStateModeProperty;
-import com.linkedin.helix.model.LiveInstance;
-import com.linkedin.helix.model.Resource;
-import com.linkedin.helix.model.StateModelDefinition;
-import com.linkedin.helix.tools.StateModelConfigGenerator;
-
-public class BaseStageTest
-{
-  protected HelixManager manager;
-  protected HelixDataAccessor accessor;
-  protected ClusterEvent event;
-
-  @BeforeClass()
-  public void beforeClass()
-  {
-    String className = this.getClass().getName();
-    System.out.println("START " + className.substring(className.lastIndexOf('.') + 1)
-                       + " at "+ new Date(System.currentTimeMillis()));
-  }
-
-  @AfterClass()
-  public void afterClass()
-  {
-    String className = this.getClass().getName();
-    System.out.println("END " + className.substring(className.lastIndexOf('.') + 1)
-                       + " at "+ new Date(System.currentTimeMillis()));
-  }
-
-  @BeforeMethod()
-  public void setup()
-  {
-    String clusterName = "testCluster-" + UUID.randomUUID().toString();
-    manager = new Mocks.MockManager(clusterName);
-    accessor = manager.getHelixDataAccessor();
-    event = new ClusterEvent("sampleEvent");
-  }
-
-  protected List<IdealState> setupIdealState(int nodes, String[] resources,
-                                             int partitions, int replicas)
-  {
-    List<IdealState> idealStates = new ArrayList<IdealState>();
-    List<String> instances = new ArrayList<String>();
-    for (int i = 0; i < nodes; i++)
-    {
-      instances.add("localhost_" + i);
-    }
-
-    for (int i = 0; i < resources.length; i++)
-    {
-      String resourceName = resources[i];
-      ZNRecord record = new ZNRecord(resourceName);
-      for (int p = 0; p < partitions; p++)
-      {
-        List<String> value = new ArrayList<String>();
-        for (int r = 0; r < replicas; r++)
-        {
-          value.add("localhost_" + (p + r + 1) % nodes);
-        }
-        record.setListField(resourceName + "_" + p, value);
-      }
-      IdealState idealState = new IdealState(record);
-      idealState.setStateModelDefRef("MasterSlave");
-      idealState.setIdealStateMode(IdealStateModeProperty.AUTO.toString());
-      idealState.setNumPartitions(partitions);
-      idealStates.add(idealState);
-
-//      System.out.println(idealState);
-
-      Builder keyBuilder = accessor.keyBuilder();
-
-      accessor.setProperty(keyBuilder.idealStates(resourceName), idealState);
-    }
-    return idealStates;
-  }
-
-  protected void setupLiveInstances(int numLiveInstances)
-  {
-    // setup liveInstances
-    for (int i = 0; i < numLiveInstances; i++)
-    {
-      LiveInstance liveInstance = new LiveInstance("localhost_" + i);
-      liveInstance.setSessionId("session_" + i);
-      
-      Builder keyBuilder = accessor.keyBuilder();
-      accessor.setProperty(keyBuilder.liveInstance("localhost_" + i), liveInstance);
-    }
-  }
-
-  protected void runStage(ClusterEvent event, Stage stage)
-  {
-    event.addAttribute("helixmanager", manager);
-    StageContext context = new StageContext();
-    stage.init(context);
-    stage.preProcess();
-    try
-    {
-      stage.process(event);
-    } catch (Exception e)
-    {
-      e.printStackTrace();
-    }
-    stage.postProcess();
-  }
-
-  protected void setupStateModel()
-  {
-    ZNRecord masterSlave = new StateModelConfigGenerator()
-        .generateConfigForMasterSlave();
-    
-    Builder keyBuilder = accessor.keyBuilder();
-    accessor.setProperty(keyBuilder.stateModelDef(masterSlave.getId()), new StateModelDefinition(masterSlave));
-    
-    ZNRecord leaderStandby = new StateModelConfigGenerator()
-        .generateConfigForLeaderStandby();
-    accessor.setProperty(keyBuilder.stateModelDef(leaderStandby.getId()), new StateModelDefinition(leaderStandby));
-
-    ZNRecord onlineOffline = new StateModelConfigGenerator()
-        .generateConfigForOnlineOffline();
-    accessor.setProperty(keyBuilder.stateModelDef(onlineOffline.getId()), new StateModelDefinition(onlineOffline));
-  }
-
-  protected Map<String, Resource> getResourceMap()
-  {
-    Map<String, Resource> resourceMap = new HashMap<String, Resource>();
-    Resource testResource = new Resource("testResourceName");
-    testResource.setStateModelDefRef("MasterSlave");
-    testResource.addPartition("testResourceName_0");
-    testResource.addPartition("testResourceName_1");
-    testResource.addPartition("testResourceName_2");
-    testResource.addPartition("testResourceName_3");
-    testResource.addPartition("testResourceName_4");
-    resourceMap.put("testResourceName", testResource);
-
-    return resourceMap;
-  }
-}


Mime
View raw message