helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kisho...@apache.org
Subject [30/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/main/scripts/integration-test/script/driver_cmd_dict.py
----------------------------------------------------------------------
diff --git a/helix-core/src/main/scripts/integration-test/script/driver_cmd_dict.py b/helix-core/src/main/scripts/integration-test/script/driver_cmd_dict.py
index 1be9209..3968c86 100644
--- a/helix-core/src/main/scripts/integration-test/script/driver_cmd_dict.py
+++ b/helix-core/src/main/scripts/integration-test/script/driver_cmd_dict.py
@@ -147,7 +147,7 @@ cmd_direct_call={
       ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
       ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
 ]+cm_jar_files
-  ,"class_name":"com.linkedin.helix.tools.ClusterSetup"
+  ,"class_name":"org.apache.helix.tools.ClusterSetup"
   ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
    }
 
@@ -168,7 +168,7 @@ cmd_direct_call={
       ,"IVY_DIR/org/apache/commons/commons-math/2.1/commons-math-2.1.jar"
 ]+cm_jar_files
 
-  ,"class_name":"com.linkedin.helix.mock.storage.DummyProcess"
+  ,"class_name":"org.apache.helix.mock.storage.DummyProcess"
   ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
    }
 
@@ -191,7 +191,7 @@ cmd_direct_call={
       ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
 ]+cm_jar_files
 
-  ,"class_name":"com.linkedin.helix.mock.storage.MockHealthReportParticipant"
+  ,"class_name":"org.apache.helix.mock.storage.MockHealthReportParticipant"
   ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
    }
 
@@ -213,7 +213,7 @@ cmd_direct_call={
       ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
       ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
 ]+cm_jar_files
-  ,"class_name":"com.linkedin.helix.controller.HelixControllerMain"
+  ,"class_name":"org.apache.helix.controller.HelixControllerMain"
   ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
    }
 
@@ -234,7 +234,7 @@ cmd_direct_call={
       ,"IVY_DIR/org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar"
       ,"IVY_DIR/com/noelios/restlet/com.noelios.restlet/1.1.10/com.noelios.restlet-1.1.10.jar"
 ]+cm_jar_files
-  ,"class_name":"com.linkedin.helix.tools.ClusterStateVerifier"
+  ,"class_name":"org.apache.helix.tools.ClusterStateVerifier"
   ,"before_cmd":"../../../mvn package -Dmaven.test.skip.exec=true"  # build jar first
    }
 
@@ -246,7 +246,7 @@ cmd_direct_call={
      ,"IVY_DIR/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"
      ,"IVY_DIR/commons-math/commons-math/2.1/commons-math-2.1.jar"
 ]+cm_jar_files
-  ,"class_name":"com.linkedin.helix.mock.storage.MockStorageProcess"
+  ,"class_name":"org.apache.helix.mock.storage.MockStorageProcess"
    }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/conf/testng.xml
----------------------------------------------------------------------
diff --git a/helix-core/src/test/conf/testng.xml b/helix-core/src/test/conf/testng.xml
index 1455d97..ec58b3a 100644
--- a/helix-core/src/test/conf/testng.xml
+++ b/helix-core/src/test/conf/testng.xml
@@ -20,21 +20,21 @@
 <suite name="Suite" parallel="none">
   <test name="Test" preserve-order="true">
     <packages>
-    	<package name="com.linkedin.helix.*"/>
+    	<package name="org.apache.helix.*"/>
     <!--
-      <package name="com.linkedin.helix.messaging.handling"/>
-      <package name="com.linkedin.helix.agent.file"/>
-      <package name="com.linkedin.helix.monitoring"/>
-      <package name="com.linkedin.helix.store.zk"/>
-      <package name="com.linkedin.helix.messaging"/>
-      <package name="com.linkedin.helix.controller.stages"/>
-      <package name="com.linkedin.helix.store.file"/>
-      <package name="com.linkedin.helix.store"/>
-      <package name="com.linkedin.helix.monitoring.mbeans"/>
-      <package name="com.linkedin.helix.participant"/>
-      <package name="com.linkedin.helix"/>
-      <package name="com.linkedin.helix.agent.zk"/>
-      <package name="com.linkedin.helix.integration"/>
+      <package name="org.apache.helix.messaging.handling"/>
+      <package name="org.apache.helix.agent.file"/>
+      <package name="org.apache.helix.monitoring"/>
+      <package name="org.apache.helix.store.zk"/>
+      <package name="org.apache.helix.messaging"/>
+      <package name="org.apache.helix.controller.stages"/>
+      <package name="org.apache.helix.store.file"/>
+      <package name="org.apache.helix.store"/>
+      <package name="org.apache.helix.monitoring.mbeans"/>
+      <package name="org.apache.helix.participant"/>
+      <package name="org.apache.helix"/>
+      <package name="org.apache.helix.agent.zk"/>
+      <package name="org.apache.helix.integration"/>
       -->
     </packages>
   </test>

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/AppTest.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/AppTest.java b/helix-core/src/test/java/com/linkedin/helix/AppTest.java
deleted file mode 100644
index 3a887cb..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/AppTest.java
+++ /dev/null
@@ -1,189 +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;
-
-import org.testng.annotations.Test;
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.I0Itec.zkclient.IDefaultNameSpace;
-import org.I0Itec.zkclient.IZkChildListener;
-import org.I0Itec.zkclient.IZkStateListener;
-import org.I0Itec.zkclient.ZkClient;
-import org.I0Itec.zkclient.ZkServer;
-import org.I0Itec.zkclient.serialize.BytesPushThroughSerializer;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.EventType;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.ACL;
-
-import com.linkedin.helix.model.Message;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
-{
-	/**
-	 * Create the test case
-	 * 
-	 * @param testName
-	 *          name of the test case
-	 */
-	public AppTest(String testName)
-	{
-	}
-
-	@Test(enabled = false)
-  private static void testChrootWithZkClient() throws Exception
-	{
-		ZkClient client = new ZkClient("localhost:2181/foo");
-		IZkStateListener stateChangeListener = new IZkStateListener()
-		{
-
-			@Override
-			public void handleStateChanged(KeeperState state) throws Exception
-			{
-				System.out
-				    .println("AppTest.main(...).new IZkStateListener() {...}.handleStateChanged()"
-				        + state);
-			}
-
-			@Override
-			public void handleNewSession() throws Exception
-			{
-				System.out
-				    .println("AppTest.main(...).new IZkStateListener() {...}.handleNewSession()");
-			}
-		};
-		client.subscribeStateChanges(stateChangeListener);
-		boolean waitUntilConnected = client.waitUntilConnected(10000,
-		    TimeUnit.MILLISECONDS);
-		System.out.println("Connected " + waitUntilConnected);
-		client.waitForKeeperState(KeeperState.Disconnected, 20000,
-		    TimeUnit.MILLISECONDS);
-		// server.start();
-		client.waitUntilConnected();
-		Thread.currentThread().join();
-	}
-
-	@Test(enabled = false)
-  private static void testChroot() throws Exception
-	{
-		Watcher watcher = new Watcher()
-		{
-			@Override
-			public void process(WatchedEvent event)
-			{
-				System.out.println("Event:" + event);
-			}
-		};
-		ZooKeeper zk = new ZooKeeper("localhost:2181/foo", 6000, watcher);
-		// uncommenting this line will not cause infinite connect/disconnect
-		// zk.create("/", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-
-		zk.exists("/", true);
-		System.out
-		    .println("Stop the server and restart it when you see this message");
-		Thread.currentThread().join();
-	}
-
-	@Test(enabled = false)
-  private static void testZKClient() throws InterruptedException
-	{
-		IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace()
-		{
-			@Override
-			public void createDefaultNameSpace(ZkClient zkClient)
-			{
-			}
-		};
-		String dataDir = "/tmp/dataDir";
-		String logDir = "/tmp/logDir";
-		// ZkServer server = new ZkServer(dataDir, logDir, defaultNameSpace, 2181);
-		// server.start();
-
-		ZkClient client = new ZkClient("localhost:2181/foo");
-		IZkStateListener stateChangeListener = new IZkStateListener()
-		{
-
-			@Override
-			public void handleStateChanged(KeeperState state) throws Exception
-			{
-				System.out
-				    .println("AppTest.main(...).new IZkStateListener() {...}.handleStateChanged()"
-				        + state);
-			}
-
-			@Override
-			public void handleNewSession() throws Exception
-			{
-				System.out
-				    .println("AppTest.main(...).new IZkStateListener() {...}.handleNewSession()");
-			}
-		};
-		client.subscribeStateChanges(stateChangeListener);
-		boolean waitUntilConnected = client.waitUntilConnected(10000,
-		    TimeUnit.MILLISECONDS);
-		System.out.println("Connected " + waitUntilConnected);
-		IZkChildListener listener1 = new IZkChildListener()
-		{
-
-			@Override
-			public void handleChildChange(String parentPath,
-			    List<String> currentChilds) throws Exception
-			{
-				System.out.println("listener 1 Change at path:" + parentPath);
-			}
-		};
-		IZkChildListener listener2 = new IZkChildListener()
-		{
-			@Override
-			public void handleChildChange(String parentPath,
-			    List<String> currentChilds) throws Exception
-			{
-				System.out.println("listener2 Change at path:" + parentPath);
-			}
-		};
-
-		client.subscribeChildChanges("/", listener1);
-		client.subscribeChildChanges("/foo", listener2);
-
-		// server.shutdown();
-		client.waitForKeeperState(KeeperState.Disconnected, 20000,
-		    TimeUnit.MILLISECONDS);
-		// server.start();
-		client.waitUntilConnected();
-
-		Thread.sleep(1000);
-		client.setZkSerializer(new BytesPushThroughSerializer());
-		client.create("/test", new byte[0], CreateMode.EPHEMERAL);
-		Thread.sleep(1000);
-	}
-
-	public static void main(String[] args) throws Exception
-	{
-		//testChroot();
-		// testZKClient();
-		// testChrootWithZkClient();
-
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/DummyProcessThread.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/DummyProcessThread.java b/helix-core/src/test/java/com/linkedin/helix/DummyProcessThread.java
deleted file mode 100644
index c61d287..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/DummyProcessThread.java
+++ /dev/null
@@ -1,75 +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;
-
-import org.apache.log4j.Logger;
-
-import com.linkedin.helix.mock.storage.DummyProcess.DummyLeaderStandbyStateModelFactory;
-import com.linkedin.helix.mock.storage.DummyProcess.DummyOnlineOfflineStateModelFactory;
-import com.linkedin.helix.mock.storage.DummyProcess.DummyStateModelFactory;
-import com.linkedin.helix.participant.StateMachineEngine;
-
-public class DummyProcessThread implements Runnable
-{
-  private static final Logger LOG = Logger.getLogger(DummyProcessThread.class);
-
-  HelixManager _manager;
-  String _instanceName;
-
-  public DummyProcessThread(HelixManager manager, String instanceName)
-  {
-    _manager = manager;
-    _instanceName = instanceName;
-  }
-
-  @Override
-  public void run()
-  {
-    try
-    {
-      DummyStateModelFactory stateModelFactory = new DummyStateModelFactory(0);
-//      StateMachineEngine genericStateMachineHandler =
-//          new StateMachineEngine();
-      StateMachineEngine stateMach = _manager.getStateMachineEngine();
-      stateMach.registerStateModelFactory("MasterSlave", stateModelFactory);
-
-      DummyLeaderStandbyStateModelFactory stateModelFactory1 = new DummyLeaderStandbyStateModelFactory(10);
-      DummyOnlineOfflineStateModelFactory stateModelFactory2 = new DummyOnlineOfflineStateModelFactory(10);
-      stateMach.registerStateModelFactory("LeaderStandby", stateModelFactory1);
-      stateMach.registerStateModelFactory("OnlineOffline", stateModelFactory2);
-//      _manager.getMessagingService()
-//              .registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),
-//                                             genericStateMachineHandler);
-
-      _manager.connect();
-      Thread.currentThread().join();
-    }
-    catch (InterruptedException e)
-    {
-      String msg =
-          "participant:" + _instanceName + ", " + Thread.currentThread().getName()
-              + " interrupted";
-      LOG.info(msg);
-      // System.err.println(msg);
-    }
-    catch (Exception e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/ExternalCommand.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/ExternalCommand.java b/helix-core/src/test/java/com/linkedin/helix/ExternalCommand.java
deleted file mode 100644
index 0a19f2c..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/ExternalCommand.java
+++ /dev/null
@@ -1,389 +0,0 @@
-package com.linkedin.helix;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.log4j.Logger;
-
-/**
-* This class encapsulates a java <code>Process</code> to handle properly
-* output and error and preventing potential deadlocks. The idea is that the
-* command is executed and you can get the error or output. Simple to use.
-* Should not be used for big outputs because they are buffered internally.
-*
-* @author ypujante@linkedin.com
-*/
-public class ExternalCommand
-{
-  public static final String MODULE = ExternalCommand.class.getName();
-  public static final Logger LOG = Logger.getLogger(MODULE);
-
-  private final ProcessBuilder _processBuilder;
-
-  private Process _process;
-  private InputReader _out;
-  private InputReader _err;
-
-  private static class InputReader extends Thread
-  {
-    private static final int BUFFER_SIZE = 2048;
-
-    private final InputStream _in;
-    private final ByteArrayOutputStream _out;
-    private boolean _running = false;
-
-    InputReader(InputStream in)
-    {
-      _in = in;
-      _out = new ByteArrayOutputStream();
-    }
-
-    @Override
-    public void run()
-    {
-      _running = true;
-
-      byte[] buf = new byte[BUFFER_SIZE];
-      int n = 0;
-      try
-      {
-        while((n = _in.read(buf)) != -1)
-          _out.write(buf, 0, n);
-      }
-      catch(IOException e)
-      {
-        LOG.error("error while reading external command", e);
-      }
-
-      _running = false;
-    }
-
-    public byte[] getOutput()
-    {
-      if(_running)
-        throw new IllegalStateException("wait for process to be completed");
-
-      return _out.toByteArray();
-    }
-  }
-  /**
-* Constructor */
-  public ExternalCommand(ProcessBuilder processBuilder)
-  {
-    _processBuilder = processBuilder;
-  }
-
-  /**
-* After creating the command, you have to start it...
-*
-* @throws IOException
-*/
-  public void start() throws IOException
-  {
-    _process = _processBuilder.start();
-    _out = new InputReader(new BufferedInputStream(_process.getInputStream()));
-    _err = new InputReader(new BufferedInputStream(_process.getErrorStream()));
-
-    _out.start();
-    _err.start();
-  }
-
-  /**
-* @see ProcessBuilder
-*/
-  public Map<String, String> getEnvironment()
-  {
-    return _processBuilder.environment();
-  }
-
-  /**
-* @see ProcessBuilder
-*/
-  public File getWorkingDirectory()
-  {
-    return _processBuilder.directory();
-  }
-
-  /**
-* @see ProcessBuilder
-*/
-  public void setWorkingDirectory(File directory)
-  {
-    _processBuilder.directory(directory);
-  }
-
-  /**
-* @see ProcessBuilder
-*/
-  public boolean getRedirectErrorStream()
-  {
-    return _processBuilder.redirectErrorStream();
-  }
-
-  /**
-* @see ProcessBuilder
-*/
-  public void setRedirectErrorStream(boolean redirectErrorStream)
-  {
-    _processBuilder.redirectErrorStream(redirectErrorStream);
-  }
-
-  public byte[] getOutput() throws InterruptedException
-  {
-    waitFor();
-    return _out.getOutput();
-  }
-
-  public byte[] getError() throws InterruptedException
-  {
-    waitFor();
-    return _err.getOutput();
-  }
-
-  /**
-* Returns the output as a string.
-*
-* @param encoding
-* @return encoded string
-* @throws InterruptedException
-* @throws UnsupportedEncodingException
-*/
-  public String getStringOutput(String encoding) throws InterruptedException,
-                                                        UnsupportedEncodingException
-  {
-    return new String(getOutput(), encoding);
-  }
-
-  /**
-* Returns the output as a string. Uses encoding "UTF-8".
-*
-* @return utf8 encoded string
-* @throws InterruptedException
-*/
-  public String getStringOutput() throws InterruptedException
-  {
-    try
-    {
-      return getStringOutput("UTF-8");
-    }
-    catch(UnsupportedEncodingException e)
-    {
-      // should not happen
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-* Returns the error as a string.
-*
-* @param encoding
-* @return error as string
-* @throws InterruptedException
-* @throws UnsupportedEncodingException
-*/
-  public String getStringError(String encoding) throws InterruptedException,
-                                                       UnsupportedEncodingException
-  {
-    return new String(getError(), encoding);
-  }
-
-  /**
-* Returns the error as a string. Uses encoding "UTF-8".
-*
-* @return error as string
-* @throws InterruptedException
-*/
-  public String getStringError() throws InterruptedException
-  {
-    try
-    {
-      return getStringError("UTF-8");
-    }
-    catch(UnsupportedEncodingException e)
-    {
-      // should not happen
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-* Properly waits until everything is complete: joins on the thread that
-* reads the output, joins on the thread that reads the error and finally
-* wait for the process to be finished.
-* @return the status code of the process.
-*
-* @throws InterruptedException
-*/
-  public int waitFor() throws InterruptedException
-  {
-    if(_process == null)
-      throw new IllegalStateException("you must call start first");
-
-    _out.join();
-    _err.join();
-    return _process.waitFor();
-  }
-
-  /**
-* Properly waits until everything is complete: joins on the thread that
-* reads the output, joins on the thread that reads the error and finally
-* wait for the process to be finished.
-* If the process has not completed before the timeout, throws a
-* {@link TimeoutException}
-* @return the status code of the process.
-*
-* @throws TimeoutException
-* @throws InterruptedException
-*/
-  public int waitFor(long timeout) throws InterruptedException, TimeoutException
-  {
-    if(_process == null)
-      throw new IllegalStateException("you must call start first");
-
-//    Chronos c = new Chronos();
-    _out.join(timeout);
-//    timeout -= c.tick();
-    if (timeout <= 0)
-      throw new TimeoutException("Wait timed out");
-    _err.join(timeout);
-//    timeout -= c.tick();
-    if (timeout <= 0)
-      throw new TimeoutException("Wait timed out");
-
-    // there is no timeout in this API, not much we can do here
-    // waiting on the other two threads should give us some safety
-    return _process.waitFor();
-  }
-
-  public int exitValue()
-  {
-    if(_process == null)
-      throw new IllegalStateException("you must call start first");
-
-    return _process.exitValue();
-  }
-
-  public void destroy()
-  {
-    if(_process == null)
-      throw new IllegalStateException("you must call start first");
-
-    _process.destroy();
-  }
-
-  /**
-* Creates an external process from the command. It is not started and you have to call
-* start on it!
-*
-* @param commands the command to execute
-* @return the process */
-  public static ExternalCommand create(String... commands)
-  {
-    ExternalCommand ec = new ExternalCommand(new ProcessBuilder(commands));
-    return ec;
-  }
-
-  /**
-* Creates an external process from the command. It is not started and you have to call
-* start on it!
-*
-* @param commands the command to execute
-* @return the process */
-  public static ExternalCommand create(List<String> commands)
-  {
-    ExternalCommand ec = new ExternalCommand(new ProcessBuilder(commands));
-    return ec;
-  }
-
-  /**
-* Creates an external process from the command. The command is executed.
-*
-* @param commands the commands to execute
-* @return the process
-* @throws IOException if there is an error */
-  public static ExternalCommand start(String... commands) throws IOException
-  {
-    ExternalCommand ec = new ExternalCommand(new ProcessBuilder(commands));
-    ec.start();
-    return ec;
-  }
-
-  /**
-* Executes the external command in the given working directory and waits for it to be
-* finished.
-*
-* @param workingDirectory the root directory from where to run the command
-* @param command the command to execute (should be relative to the working directory
-* @param args the arguments to the command
-* @return the process */
-  public static ExternalCommand execute(File workingDirectory,
-                                        String command,
-                                        String... args)
-      throws IOException, InterruptedException
-  {
-    try
-    {
-      return executeWithTimeout(workingDirectory, command, 0, args);
-    }
-    catch (TimeoutException e)
-    {
-      // Can't happen!
-      throw new IllegalStateException(MODULE + ".execute: Unexpected timeout occurred!");
-    }
-  }
-
-/**
-* Executes the external command in the given working directory and waits (until timeout
-* is elapsed) for it to be finished.
-*
-* @param workingDirectory
-* the root directory from where to run the command
-* @param command
-* the command to execute (should be relative to the working directory
-* @param timeout
-* the maximum amount of time to wait for this external command (in ms). If
-* this value is less than or equal to 0, timeout is ignored
-* @param args
-* the arguments to the command
-* @return the process
-*/
-  public static ExternalCommand executeWithTimeout(File workingDirectory,
-                                                   String command,
-                                                   long timeout,
-                                                   String... args)
-      throws IOException, InterruptedException, TimeoutException
-  {
-    List<String> arguments = new ArrayList<String>(args.length + 1);
-
-    arguments.add(new File(workingDirectory, command).getAbsolutePath());
-    arguments.addAll(Arrays.asList(args));
-
-    ExternalCommand cmd = ExternalCommand.create(arguments);
-
-    cmd.setWorkingDirectory(workingDirectory);
-
-    cmd.setRedirectErrorStream(true);
-
-    cmd.start();
-
-    /* Use timeout if it is a valid value! */
-    if (timeout <= 0)
-      cmd.waitFor();
-    else
-      cmd.waitFor(timeout);
-
-    if (LOG.isDebugEnabled())
-      LOG.debug(cmd.getStringOutput());
-
-    return cmd;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/Mocks.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/Mocks.java b/helix-core/src/test/java/com/linkedin/helix/Mocks.java
deleted file mode 100644
index 8cf0fc8..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/Mocks.java
+++ /dev/null
@@ -1,765 +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;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.Future;
-
-import org.I0Itec.zkclient.DataUpdater;
-import org.I0Itec.zkclient.IZkChildListener;
-import org.I0Itec.zkclient.IZkDataListener;
-import org.apache.zookeeper.data.Stat;
-
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.healthcheck.HealthReportProvider;
-import com.linkedin.helix.healthcheck.ParticipantHealthReportCollector;
-import com.linkedin.helix.messaging.AsyncCallback;
-import com.linkedin.helix.messaging.handling.HelixTaskExecutor;
-import com.linkedin.helix.messaging.handling.HelixTaskResult;
-import com.linkedin.helix.messaging.handling.MessageHandlerFactory;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.participant.StateMachineEngine;
-import com.linkedin.helix.participant.statemachine.StateModel;
-import com.linkedin.helix.participant.statemachine.StateModelInfo;
-import com.linkedin.helix.participant.statemachine.Transition;
-import com.linkedin.helix.store.PropertyStore;
-import com.linkedin.helix.store.zk.ZkHelixPropertyStore;
-
-public class Mocks {
-	public static class MockBaseDataAccessor implements BaseDataAccessor<ZNRecord> {
-		Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
-
-		@Override
-		public boolean create(String path, ZNRecord record, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean set(String path, ZNRecord record, int options) {
-			System.err.println("Store.write()" + System.currentTimeMillis());
-			map.put(path, record);
-			try {
-				Thread.sleep(50);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-			return true;
-		}
-
-		@Override
-		public boolean update(String path, DataUpdater<ZNRecord> updater,
-				int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean remove(String path, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean[] createChildren(List<String> paths,
-				List<ZNRecord> records, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] setChildren(List<String> paths,
-				List<ZNRecord> records, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] updateChildren(List<String> paths,
-				List<DataUpdater<ZNRecord>> updaters, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean[] remove(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public ZNRecord get(String path, Stat stat, int options) {
-		    return map.get(path);
-		}
-
-		@Override
-		public List<ZNRecord> get(List<String> paths, List<Stat> stats,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public List<ZNRecord> getChildren(String parentPath, List<Stat> stats,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public List<String> getChildNames(String parentPath, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public boolean exists(String path, int options) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public boolean[] exists(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Stat[] getStats(List<String> paths, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Stat getStat(String path, int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-    @Override
-    public void subscribeDataChanges(String path, IZkDataListener listener)
-    {
-      // TODO Auto-generated method stub
-      
-    }
-
-    @Override
-    public void unsubscribeDataChanges(String path, IZkDataListener listener)
-    {
-      // TODO Auto-generated method stub
-      
-    }
-
-    @Override
-    public List<String> subscribeChildChanges(String path, IZkChildListener listener)
-    {
-      // TODO Auto-generated method stub
-      return null;
-    }
-
-    @Override
-    public void unsubscribeChildChanges(String path, IZkChildListener listener)
-    {
-      // TODO Auto-generated method stub
-      
-    }
-
-    @Override
-    public void reset()
-    {
-      // TODO Auto-generated method stub
-      
-    }
-
-//		@Override
-//		public boolean subscribe(String path, IZkListener listener) {
-//			// TODO Auto-generated method stub
-//			return false;
-//		}
-//
-//		@Override
-//		public boolean unsubscribe(String path, IZkListener listener) {
-//			// TODO Auto-generated method stub
-//			return false;
-//		}
-
-	}
-
-	public static class MockStateModel extends StateModel {
-		boolean stateModelInvoked = false;
-
-		public void onBecomeMasterFromSlave(Message msg,
-				NotificationContext context) {
-			stateModelInvoked = true;
-		}
-
-		public void onBecomeSlaveFromOffline(Message msg,
-				NotificationContext context) {
-			stateModelInvoked = true;
-		}
-	}
-
-	@StateModelInfo(states = "{'OFFLINE','SLAVE','MASTER'}", initialState = "OFFINE")
-	public static class MockStateModelAnnotated extends StateModel {
-		boolean stateModelInvoked = false;
-
-		@Transition(from = "SLAVE", to = "MASTER")
-		public void slaveToMaster(Message msg, NotificationContext context) {
-			stateModelInvoked = true;
-		}
-
-		@Transition(from = "OFFLINE", to = "SLAVE")
-		public void offlineToSlave(Message msg, NotificationContext context) {
-			stateModelInvoked = true;
-		}
-	}
-
-	public static class MockHelixTaskExecutor extends HelixTaskExecutor {
-		boolean completionInvoked = false;
-
-		@Override
-		protected void reportCompletion(Message message) {
-			System.out.println("Mocks.MockCMTaskExecutor.reportCompletion()");
-			completionInvoked = true;
-		}
-
-		public boolean isDone(String taskId) {
-			Future<HelixTaskResult> future = _taskMap.get(taskId);
-			if (future != null) {
-				return future.isDone();
-			}
-			return false;
-		}
-	}
-
-	public static class MockManager implements HelixManager {
-		MockAccessor accessor;
-
-		private final String _clusterName;
-		private final String _sessionId;
-		String _instanceName;
-		ClusterMessagingService _msgSvc;
-		private String _version;
-
-		public MockManager() {
-			this("testCluster-" + Math.random() * 10000 % 999);
-		}
-
-		public MockManager(String clusterName) {
-			_clusterName = clusterName;
-			accessor = new MockAccessor(clusterName);
-			_sessionId = UUID.randomUUID().toString();
-			_instanceName = "testInstanceName";
-			_msgSvc = new MockClusterMessagingService();
-		}
-
-		@Override
-		public void disconnect() {
-
-		}
-
-		@Override
-		public void addIdealStateChangeListener(
-				IdealStateChangeListener listener) throws Exception {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addLiveInstanceChangeListener(
-				LiveInstanceChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addConfigChangeListener(ConfigChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addMessageListener(MessageListener listener,
-				String instanceName) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addCurrentStateChangeListener(
-				CurrentStateChangeListener listener, String instanceName,
-				String sessionId) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public void addExternalViewChangeListener(
-				ExternalViewChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public DataAccessor getDataAccessor() {
-			return null;
-		}
-
-		@Override
-		public String getClusterName() {
-			return _clusterName;
-		}
-
-		@Override
-		public String getInstanceName() {
-			return _instanceName;
-		}
-
-		@Override
-		public void connect() {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public String getSessionId() {
-			return _sessionId;
-		}
-
-		@Override
-		public boolean isConnected() {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public long getLastNotificationTime() {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public void addControllerListener(ControllerChangeListener listener) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public boolean removeListener(Object listener) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public HelixAdmin getClusterManagmentTool() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public ClusterMessagingService getMessagingService() {
-			// TODO Auto-generated method stub
-			return _msgSvc;
-		}
-
-		@Override
-		public ParticipantHealthReportCollector getHealthReportCollector() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public InstanceType getInstanceType() {
-			return InstanceType.PARTICIPANT;
-		}
-
-		@Override
-		public PropertyStore<ZNRecord> getPropertyStore() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public String getVersion() {
-			return _version;
-		}
-
-		public void setVersion(String version) {
-			_version = version;
-		}
-
-		@Override
-		public void addHealthStateChangeListener(
-				HealthStateChangeListener listener, String instanceName)
-				throws Exception {
-			// TODO Auto-generated method stub
-
-		}
-
-		@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;
-    }
-
-	}
-
-	public static class MockAccessor implements HelixDataAccessor // DataAccessor
-	{
-		private final String _clusterName;
-		Map<String, ZNRecord> data = new HashMap<String, ZNRecord>();
-		private final Builder _propertyKeyBuilder;
-
-		public MockAccessor() {
-			this("testCluster-" + Math.random() * 10000 % 999);
-		}
-
-		public MockAccessor(String clusterName) {
-			_clusterName = clusterName;
-			_propertyKeyBuilder = new PropertyKey.Builder(_clusterName);
-		}
-
-		Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
-
-		@Override
-		// public boolean setProperty(PropertyType type, HelixProperty value,
-		// String... keys)
-		public boolean setProperty(PropertyKey key, HelixProperty value) {
-			// return setProperty(type, value.getRecord(), keys);
-			String path = key.getPath();
-			data.put(path, value.getRecord());
-			return true;
-		}
-
-		// @Override
-		// public boolean setProperty(PropertyType type, ZNRecord value,
-		// String... keys)
-		// {
-		// String path = PropertyPathConfig.getPath(type, _clusterName, keys);
-		// data.put(path, value);
-		// return true;
-		// }
-
-		// @Override
-		// public boolean updateProperty(PropertyType type, HelixProperty value,
-		// String... keys)
-		// {
-		// return updateProperty(type, value.getRecord(), keys);
-		// }
-
-		@Override
-		public <T extends HelixProperty> boolean updateProperty(
-				PropertyKey key, T value) {
-			// String path = PropertyPathConfig.getPath(type, _clusterName,
-			// keys);
-			String path = key.getPath();
-			PropertyType type = key.getType();
-			if (type.updateOnlyOnExists) {
-				if (data.containsKey(path)) {
-					if (type.mergeOnUpdate) {
-						ZNRecord znRecord = new ZNRecord(data.get(path));
-						znRecord.merge(value.getRecord());
-						data.put(path, znRecord);
-					} else {
-						data.put(path, value.getRecord());
-					}
-				}
-			} else {
-				if (type.mergeOnUpdate) {
-					if (data.containsKey(path)) {
-						ZNRecord znRecord = new ZNRecord(data.get(path));
-						znRecord.merge(value.getRecord());
-						data.put(path, znRecord);
-					} else {
-						data.put(path, value.getRecord());
-					}
-				} else {
-					data.put(path, value.getRecord());
-				}
-			}
-
-			return true;
-		}
-
-		// @Override
-		// public <T extends HelixProperty> T getProperty(Class<T> clazz,
-		// PropertyType type,
-		// String... keys)
-		// {
-		// ZNRecord record = getProperty(type, keys);
-		// if (record == null)
-		// {
-		// return null;
-		// }
-		// return HelixProperty.convertToTypedInstance(clazz, record);
-		// }
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public <T extends HelixProperty> T getProperty(PropertyKey key)
-		// public ZNRecord getProperty(PropertyType type, String... keys)
-		{
-			// String path = PropertyPathConfig.getPath(type, _clusterName,
-			// keys);
-			String path = key.getPath();
-			return (T) HelixProperty.convertToTypedInstance(key.getTypeClass(),
-					data.get(path));
-		}
-
-		@Override
-		public boolean removeProperty(PropertyKey key)
-		// public boolean removeProperty(PropertyType type, String... keys)
-		{
-			String path = key.getPath(); // PropertyPathConfig.getPath(type,
-											// _clusterName, keys);
-			data.remove(path);
-			return true;
-		}
-
-		@Override
-		public List<String> getChildNames(PropertyKey propertyKey)
-		// public List<String> getChildNames(PropertyType type, String... keys)
-		{
-			List<String> child = new ArrayList<String>();
-			String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
-													// _clusterName, keys);
-			for (String key : data.keySet()) {
-				if (key.startsWith(path)) {
-					String[] keySplit = key.split("\\/");
-					String[] pathSplit = path.split("\\/");
-					if (keySplit.length > pathSplit.length) {
-						child.add(keySplit[pathSplit.length + 1]);
-					}
-				}
-			}
-			return child;
-		}
-
-		// @Override
-		// public <T extends HelixProperty> List<T> getChildValues(Class<T>
-		// clazz, PropertyType type,
-		// String... keys)
-		// {
-		// List<ZNRecord> list = getChildValues(type, keys);
-		// return HelixProperty.convertToTypedList(clazz, list);
-		// }
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public <T extends HelixProperty> List<T> getChildValues(
-				PropertyKey propertyKey)
-		// public List<ZNRecord> getChildValues(PropertyType type, String...
-		// keys)
-		{
-			List<ZNRecord> childs = new ArrayList<ZNRecord>();
-			String path = propertyKey.getPath(); // PropertyPathConfig.getPath(type,
-													// _clusterName, keys);
-			for (String key : data.keySet()) {
-				if (key.startsWith(path)) {
-					String[] keySplit = key.split("\\/");
-					String[] pathSplit = path.split("\\/");
-					if (keySplit.length - pathSplit.length == 1) {
-						ZNRecord record = data.get(key);
-						if (record != null) {
-							childs.add(record);
-						}
-					} else {
-						System.out.println("keySplit:"
-								+ Arrays.toString(keySplit));
-						System.out.println("pathSplit:"
-								+ Arrays.toString(pathSplit));
-					}
-				}
-			}
-			return (List<T>) HelixProperty.convertToTypedList(
-					propertyKey.getTypeClass(), childs);
-		}
-
-		@Override
-		public <T extends HelixProperty> Map<String, T> getChildValuesMap(
-				PropertyKey key)
-		// public <T extends HelixProperty> Map<String, T>
-		// getChildValuesMap(Class<T> clazz,
-		// PropertyType type, String... keys)
-		{
-			List<T> list = getChildValues(key);
-			return HelixProperty.convertListToMap(list);
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean createProperty(
-				PropertyKey key, T value) {
-			// TODO Auto-generated method stub
-			return false;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] createChildren(
-				List<PropertyKey> keys, List<T> children) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] setChildren(
-				List<PropertyKey> keys, List<T> children) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public Builder keyBuilder() {
-			return _propertyKeyBuilder;
-		}
-
-		@Override
-		public BaseDataAccessor getBaseDataAccessor() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public <T extends HelixProperty> boolean[] updateChildren(
-				List<String> paths, List<DataUpdater<ZNRecord>> updaters,
-				int options) {
-			// TODO Auto-generated method stub
-			return null;
-		}
-		
-	    @Override
-	    public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys)
-	    {
-	      List<T> list = new ArrayList<T>();
-	      for (PropertyKey key : keys)
-	      {
-	        @SuppressWarnings("unchecked")
-	        T t = (T)getProperty(key);
-	        list.add(t);
-	      }
-	      return list;
-	    }
-	}
-
-	public static class MockHealthReportProvider extends HealthReportProvider {
-
-		@Override
-		public Map<String, String> getRecentHealthReport() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public void resetStats() {
-			// TODO Auto-generated method stub
-
-		}
-
-	}
-
-	public static class MockClusterMessagingService implements
-			ClusterMessagingService {
-
-		@Override
-		public int send(Criteria recipientCriteria, Message message) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int send(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int sendAndWait(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public void registerMessageHandlerFactory(String type,
-				MessageHandlerFactory factory) {
-			// TODO Auto-generated method stub
-
-		}
-
-		@Override
-		public int send(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut, int retryCount) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public int sendAndWait(Criteria receipientCriteria, Message message,
-				AsyncCallback callbackOnReply, int timeOut, int retryCount) {
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-	}
-// >>>>>>> 5ef256eeced461eae733d568ad730aabeda3c0f2
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/ScriptTestHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/ScriptTestHelper.java b/helix-core/src/test/java/com/linkedin/helix/ScriptTestHelper.java
deleted file mode 100644
index 12ae227..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/ScriptTestHelper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.linkedin.helix;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.log4j.Logger;
-import org.testng.Assert;
-
-public class ScriptTestHelper
-{
-  private static final Logger LOG = Logger.getLogger(ScriptTestHelper.class);
-
-  public static final String INTEGRATION_SCRIPT_DIR = "src/main/scripts/integration-test/script";
-  public static final String INTEGRATION_TEST_DIR = "src/main/scripts/integration-test/testcases";
-  public static final long EXEC_TIMEOUT = 1200;
-  
-  public static String getPrefix()
-  {
-    StringBuilder prefixBuilder = new StringBuilder("");
-    String prefix = "";
-    String filepath = INTEGRATION_SCRIPT_DIR;
-    File integrationScriptDir = new File(filepath);
-
-    while (!integrationScriptDir.exists())
-    {
-      prefixBuilder.append("../");
-      prefix = prefixBuilder.toString();
-
-      integrationScriptDir = new File(prefix + filepath);
-
-      // Give up
-      if (prefix.length() > 30)
-      {
-        return "";
-      }
-    }
-    return new File(prefix).getAbsolutePath() + "/";
-  }
-  
-  public static ExternalCommand runCommandLineTest(String testName, String... arguments) throws IOException, InterruptedException,
-  TimeoutException
-  {
-    ExternalCommand cmd = ExternalCommand.executeWithTimeout(new File(getPrefix() + INTEGRATION_TEST_DIR),
-                                             testName, EXEC_TIMEOUT, arguments);
-    int exitValue = cmd.exitValue();
-    String output = cmd.getStringOutput("UTF8");
-
-    if (0 == exitValue)
-    {
-      LOG.info("Test " + testName + " has run. ExitCode=" + exitValue + ". Command output: " + output);
-    }
-    else
-    {
-      LOG.warn("Test " + testName + " is FAILING. ExitCode=" + exitValue + ". Command output: " + output);
-      Assert.fail(output);
-//      return cmd;
-    }
-    return cmd;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestClusterviewSerializer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestClusterviewSerializer.java b/helix-core/src/test/java/com/linkedin/helix/TestClusterviewSerializer.java
deleted file mode 100644
index 60ef816..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestClusterviewSerializer.java
+++ /dev/null
@@ -1,73 +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;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ClusterView;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.manager.file.StaticFileHelixManager;
-import com.linkedin.helix.tools.ClusterViewSerializer;
-
-public class TestClusterviewSerializer
-{
-  @Test ()
-  public void testClusterviewSerializer() throws Exception
-  {
-    List<StaticFileHelixManager.DBParam> dbParams = new ArrayList<StaticFileHelixManager.DBParam>();
-    // dbParams.add(new FileBasedClusterManager.DBParam("BizFollow", 1));
-    dbParams.add(new StaticFileHelixManager.DBParam("BizProfile", 1));
-    // dbParams.add(new FileBasedClusterManager.DBParam("EspressoDB", 10));
-    // dbParams.add(new FileBasedClusterManager.DBParam("MailboxDB", 128));
-    // dbParams.add(new FileBasedClusterManager.DBParam("MyDB", 8));
-    // dbParams.add(new FileBasedClusterManager.DBParam("schemata", 1));
-    // String[] nodesInfo = { "localhost:8900", "localhost:8901",
-    // "localhost:8902", "localhost:8903",
-    // "localhost:8904" };
-    String[] nodesInfo = { "localhost:12918" };
-    int replication = 0;
-
-    ClusterView view = StaticFileHelixManager.generateStaticConfigClusterView(nodesInfo, dbParams, replication);
-    view.setExternalView(new LinkedList<ZNRecord>());
-    String file = "/tmp/clusterView.json";
-    // ClusterViewSerializer serializer = new ClusterViewSerializer(file);
-
-    // byte[] bytes;
-    ClusterViewSerializer.serialize(view, new File(file));
-    // String str1 = new String(bytes);
-    ClusterView restoredView = ClusterViewSerializer.deserialize(new File(file));
-    // logger.info(restoredView);
-
-    // byte[] bytes2 = serializer.serialize(restoredView);
-
-    VerifyClusterViews(view, restoredView);
-  }
-
-  public void VerifyClusterViews(ClusterView view1, ClusterView view2)
-  {
-    AssertJUnit.assertEquals(view1.getPropertyLists().size(), view2.getPropertyLists().size());
-    AssertJUnit.assertEquals(view1.getExternalView().size(), view2.getExternalView().size());
-    AssertJUnit.assertEquals(view1.getMemberInstanceMap().size(), view2.getMemberInstanceMap().size());
-    AssertJUnit.assertEquals(view1.getInstances().size(), view2.getInstances().size());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestConfigAccessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestConfigAccessor.java b/helix-core/src/test/java/com/linkedin/helix/TestConfigAccessor.java
deleted file mode 100644
index d1e2cca..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestConfigAccessor.java
+++ /dev/null
@@ -1,147 +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;
-
-import java.util.List;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.ConfigScope.ConfigScopeProperty;
-
-public class TestConfigAccessor extends ZkUnitTestBase
-{
-  final String _className = getShortClassName();
-  final String _clusterName = "CLUSTER_" + _className;
-
-  @Test
-  public void testZkConfigAccessor() throws Exception
-  {
-    TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3,
-        "MasterSlave", true);
-
-    ConfigAccessor appConfig = new ConfigAccessor(_gZkClient);
-    ConfigScope clusterScope = new ConfigScopeBuilder().forCluster(_clusterName).build();
-
-    // cluster scope config
-    String clusterConfigValue = appConfig.get(clusterScope, "clusterConfigKey");
-    Assert.assertNull(clusterConfigValue);
-
-    appConfig.set(clusterScope, "clusterConfigKey", "clusterConfigValue");
-    clusterConfigValue = appConfig.get(clusterScope, "clusterConfigKey");
-    Assert.assertEquals(clusterConfigValue, "clusterConfigValue");
-
-    // resource scope config
-    ConfigScope resourceScope = new ConfigScopeBuilder().forCluster(_clusterName)
-        .forResource("testResource").build();
-    appConfig.set(resourceScope, "resourceConfigKey", "resourceConfigValue");
-    String resourceConfigValue = appConfig.get(resourceScope, "resourceConfigKey");
-    Assert.assertEquals(resourceConfigValue, "resourceConfigValue");
-
-    // partition scope config
-    ConfigScope partitionScope = new ConfigScopeBuilder().forCluster(_clusterName)
-        .forResource("testResource").forPartition("testPartition").build();
-    appConfig.set(partitionScope, "partitionConfigKey", "partitionConfigValue");
-    String partitionConfigValue = appConfig.get(partitionScope, "partitionConfigKey");
-    Assert.assertEquals(partitionConfigValue, "partitionConfigValue");
-
-    // participant scope config
-    ConfigScope participantScope = new ConfigScopeBuilder().forCluster(_clusterName)
-        .forParticipant("localhost_12918").build();
-    appConfig.set(participantScope, "participantConfigKey", "participantConfigValue");
-    String participantConfigValue = appConfig.get(participantScope, "participantConfigKey");
-    Assert.assertEquals(participantConfigValue, "participantConfigValue");
-
-    List<String> keys = appConfig.getKeys(ConfigScopeProperty.RESOURCE, _clusterName);
-    Assert.assertEquals(keys.size(), 1, "should be [testResource]");
-    Assert.assertEquals(keys.get(0), "testResource");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.CLUSTER, _clusterName);
-    Assert.assertEquals(keys.size(), 1, "should be [" + _clusterName + "]");
-    Assert.assertEquals(keys.get(0), _clusterName);
-
-    keys = appConfig.getKeys(ConfigScopeProperty.PARTICIPANT, _clusterName);
-    Assert.assertEquals(keys.size(), 5, "should be [localhost_12918~22] sorted");
-    Assert.assertEquals(keys.get(0), "localhost_12918");
-    Assert.assertEquals(keys.get(4), "localhost_12922");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.PARTITION, _clusterName, "testResource");
-    Assert.assertEquals(keys.size(), 1, "should be [testPartition]");
-    Assert.assertEquals(keys.get(0), "testPartition");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.RESOURCE, _clusterName, "testResource");
-    Assert.assertEquals(keys.size(), 1, "should be [resourceConfigKey]");
-    Assert.assertEquals(keys.get(0), "resourceConfigKey");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.CLUSTER, _clusterName, _clusterName);
-    Assert.assertEquals(keys.size(), 1, "should be [clusterConfigKey]");
-    Assert.assertEquals(keys.get(0), "clusterConfigKey");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.PARTICIPANT, _clusterName, "localhost_12918");
-    Assert.assertEquals(keys.size(), 4, "should be [HELIX_ENABLED, HELIX_HOST, HELIX_PORT, participantConfigKey]");
-    Assert.assertEquals(keys.get(3), "participantConfigKey");
-
-    keys = appConfig.getKeys(ConfigScopeProperty.PARTITION, _clusterName, "testResource", "testPartition");
-    Assert.assertEquals(keys.size(), 1, "should be [partitionConfigKey]");
-    Assert.assertEquals(keys.get(0), "partitionConfigKey");
-
-    // test configAccessor.remove()
-    appConfig.remove(clusterScope, "clusterConfigKey");
-    clusterConfigValue = appConfig.get(clusterScope, "clusterConfigKey");
-    Assert.assertNull(clusterConfigValue, "Should be null since it's removed");
-
-    appConfig.remove(resourceScope, "resourceConfigKey");
-    resourceConfigValue = appConfig.get(resourceScope, "resourceConfigKey");
-    Assert.assertNull(resourceConfigValue, "Should be null since it's removed");
-
-    appConfig.remove(partitionScope, "partitionConfigKey");
-    partitionConfigValue = appConfig.get(partitionScope, "partitionConfigKey");
-    Assert.assertNull(partitionConfigValue, "Should be null since it's removed");
-    
-    appConfig.remove(participantScope, "participantConfigKey");
-    participantConfigValue = appConfig.get(partitionScope, "participantConfigKey");
-    Assert.assertNull(participantConfigValue, "Should be null since it's removed");
-    
-    // negative tests
-    try
-    {
-      new ConfigScopeBuilder().forPartition("testPartition").build();
-      Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
-      // OK
-    }
-
-    try
-    {
-      new ConfigScopeBuilder().forCluster("testCluster").forPartition("testPartition").build();
-      Assert.fail("Should fail since resource name is not set");
-    } catch (Exception e)
-    {
-      // OK
-    }
-
-    try
-    {
-      new ConfigScopeBuilder().forParticipant("testParticipant").build();
-      Assert.fail("Should fail since cluster name is not set");
-    } catch (Exception e)
-    {
-      // OK
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestEspressoStorageClusterIdealState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestEspressoStorageClusterIdealState.java b/helix-core/src/test/java/com/linkedin/helix/TestEspressoStorageClusterIdealState.java
deleted file mode 100644
index 1dff848..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestEspressoStorageClusterIdealState.java
+++ /dev/null
@@ -1,319 +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;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.testng.Assert;
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.model.IdealState;
-import com.linkedin.helix.tools.ClusterSetup;
-import com.linkedin.helix.tools.IdealStateCalculatorForStorageNode;
-
-
-public class TestEspressoStorageClusterIdealState
-{
-  @Test ()
-  public void testEspressoStorageClusterIdealState() throws Exception
-  {
-    List<String> instanceNames = new ArrayList<String>();
-    for(int i = 0;i < 5; i++)
-    {
-      instanceNames.add("localhost:123" + i);
-    }
-    int partitions = 8, replicas = 0;
-    Map<String, Object> result0 = IdealStateCalculatorForStorageNode.calculateInitialIdealState(instanceNames, partitions, replicas);
-    Verify(result0, partitions,replicas);
-
-    partitions = 8192;
-    replicas = 3;
-
-    instanceNames.clear();
-    for(int i = 0;i < 20; i++)
-    {
-      instanceNames.add("localhost:123" + i);
-    }
-    Map<String, Object> resultOriginal = IdealStateCalculatorForStorageNode.calculateInitialIdealState(instanceNames, partitions, replicas);
-
-    Verify(resultOriginal, partitions,replicas);
-    printStat(resultOriginal);
-
-    Map<String, Object> result1 = IdealStateCalculatorForStorageNode.calculateInitialIdealState(instanceNames, partitions, replicas);
-
-    List<String> instanceNames2 = new ArrayList<String>();
-    for(int i = 30;i < 35; i++)
-    {
-      instanceNames2.add("localhost:123" + i);
-    }
-
-    IdealStateCalculatorForStorageNode.calculateNextIdealState(instanceNames2, result1);
-
-    List<String> instanceNames3 = new ArrayList<String>();
-    for(int i = 35;i < 40; i++)
-    {
-      instanceNames3.add("localhost:123" + i);
-    }
-
-    IdealStateCalculatorForStorageNode.calculateNextIdealState(instanceNames3, result1);
-    Double masterKeepRatio = 0.0, slaveKeepRatio = 0.0;
-    Verify(result1, partitions,replicas);
-    double[] result = compareResult(resultOriginal, result1);
-    masterKeepRatio = result[0];
-    slaveKeepRatio = result[1];
-    Assert.assertTrue(0.66 < masterKeepRatio && 0.67 > masterKeepRatio);
-    Assert.assertTrue(0.66 < slaveKeepRatio && 0.67 > slaveKeepRatio);
-
-  }
-  
-  @Test
-  public void testRebalance2()
-  {
-    int partitions = 1256, replicas = 3;
-    List<String> instanceNames = new ArrayList<String>();
-    
-    for(int i = 0;i < 10; i++)
-    {
-      instanceNames.add("localhost:123" + i);
-    }
-    
-    Map<String, Object> resultOriginal = IdealStateCalculatorForStorageNode.calculateInitialIdealState(instanceNames, partitions, replicas);
-    
-    ZNRecord idealState1 = IdealStateCalculatorForStorageNode.convertToZNRecord(resultOriginal, "TestDB", "MASTER", "SLAVE");
-    
-    Map<String, Object> result1 = ClusterSetup.buildInternalIdealState(new IdealState(idealState1));
-    
-    List<String> instanceNames2 = new ArrayList<String>();
-    for(int i = 30;i < 35; i++)
-    {
-      instanceNames2.add("localhost:123" + i);
-    }
-    
-    Map<String, Object> result2 = IdealStateCalculatorForStorageNode.calculateNextIdealState(instanceNames2, result1);
-    
-    Verify(resultOriginal, partitions,replicas);
-    Verify(result2, partitions,replicas);
-    Double masterKeepRatio = 0.0, slaveKeepRatio = 0.0;
-    double[] result = compareResult(resultOriginal, result2);
-    masterKeepRatio = result[0];
-    slaveKeepRatio = result[1];
-    Assert.assertTrue(0.66 < masterKeepRatio && 0.67 > masterKeepRatio);
-    Assert.assertTrue(0.66 < slaveKeepRatio && 0.67 > slaveKeepRatio);
-  }
-
-  public static void Verify(Map<String, Object> result, int partitions, int replicas)
-  {
-    Map<String, List<Integer>> masterAssignmentMap = (Map<String, List<Integer>>) (result.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap = (Map<String, Map<String, List<Integer>>>)(result.get("SlaveAssignmentMap"));
-
-    AssertJUnit.assertTrue( partitions == (Integer)(result.get("partitions")));
-
-    // Verify master partitions covers all master partitions on each node
-    Map<Integer, Integer> masterCounterMap = new TreeMap<Integer, Integer>();
-    for(int i = 0;i<partitions; i++)
-    {
-      masterCounterMap.put(i, 0);
-    }
-
-    int minMasters = Integer.MAX_VALUE, maxMasters = Integer.MIN_VALUE;
-    for(String instanceName : masterAssignmentMap.keySet())
-    {
-      List<Integer> masterList = masterAssignmentMap.get(instanceName);
-      // the assert needs to be changed when weighting is introduced
-      // AssertJUnit.assertTrue(masterList.size() == partitions /masterAssignmentMap.size() | masterList.size() == (partitions /masterAssignmentMap.size()+1) );
-
-      for(Integer x : masterList)
-      {
-        AssertJUnit.assertTrue(masterCounterMap.get(x) == 0);
-        masterCounterMap.put(x,1);
-      }
-      if(minMasters > masterList.size())
-      {
-        minMasters = masterList.size();
-      }
-      if(maxMasters < masterList.size())
-      {
-        maxMasters = masterList.size();
-      }
-    }
-    // Master partition should be evenly distributed most of the time
-    System.out.println("Masters: max: "+maxMasters+" Min:"+ minMasters);
-    // Each master partition should occur only once
-    for(int i = 0;i < partitions; i++)
-    {
-      AssertJUnit.assertTrue(masterCounterMap.get(i) == 1);
-    }
-    AssertJUnit.assertTrue(masterCounterMap.size() == partitions);
-
-    // for each node, verify the master partitions and the slave partition assignment map
-    if(replicas == 0)
-    {
-      AssertJUnit.assertTrue(nodeSlaveAssignmentMap.size() == 0);
-      return;
-    }
-
-    AssertJUnit.assertTrue(masterAssignmentMap.size() == nodeSlaveAssignmentMap.size());
-    for(String instanceName: masterAssignmentMap.keySet())
-    {
-      AssertJUnit.assertTrue(nodeSlaveAssignmentMap.containsKey(instanceName));
-
-      Map<String, List<Integer>> slaveAssignmentMap = nodeSlaveAssignmentMap.get(instanceName);
-      Map<Integer, Integer> slaveCountMap = new TreeMap<Integer, Integer>();
-      List<Integer> masterList = masterAssignmentMap.get(instanceName);
-
-      for(Integer masterPartitionId : masterList)
-      {
-        slaveCountMap.put(masterPartitionId, 0);
-      }
-      // Make sure that masterList are covered replica times by the slave assignment.
-      int minSlaves = Integer.MAX_VALUE, maxSlaves = Integer.MIN_VALUE;
-      for(String hostInstance : slaveAssignmentMap.keySet())
-      {
-        List<Integer> slaveAssignment = slaveAssignmentMap.get(hostInstance);
-        Set<Integer> occurenceSet = new HashSet<Integer>();
-
-        // Each slave should occur only once in the list, since the list is per-node slaves
-        for(Integer slavePartition : slaveAssignment)
-        {
-          AssertJUnit.assertTrue(!occurenceSet.contains(slavePartition));
-          occurenceSet.add(slavePartition);
-
-          slaveCountMap.put(slavePartition, slaveCountMap.get(slavePartition) + 1);
-        }
-        if(minSlaves > slaveAssignment.size())
-        {
-          minSlaves = slaveAssignment.size();
-        }
-        if(maxSlaves < slaveAssignment.size())
-        {
-          maxSlaves = slaveAssignment.size();
-        }
-      }
-      // check if slave distribution is even
-      AssertJUnit.assertTrue(maxSlaves - minSlaves <= 1);
-      // System.out.println("Slaves: max: "+maxSlaves+" Min:"+ minSlaves);
-
-      // for each node, the slave assignment map should cover the masters for exactly replica
-      // times
-      AssertJUnit.assertTrue(slaveCountMap.size() == masterList.size());
-      for(Integer masterPartitionId : masterList)
-      {
-        AssertJUnit.assertTrue(slaveCountMap.get(masterPartitionId) == replicas);
-      }
-    }
-
-  }
-
-  public void printStat(Map<String, Object> result)
-  {
-    // print out master distribution
-
-    // print out slave distribution
-
-  }
-
-  public static double [] compareResult(Map<String, Object> result1, Map<String, Object> result2)
-  {
-    double [] result = new double[2];
-    Map<String, List<Integer>> masterAssignmentMap1 = (Map<String, List<Integer>>) (result1.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap1 = (Map<String, Map<String, List<Integer>>>)(result1.get("SlaveAssignmentMap"));
-
-    Map<String, List<Integer>> masterAssignmentMap2 = (Map<String, List<Integer>>) (result2.get("MasterAssignmentMap"));
-    Map<String, Map<String, List<Integer>>> nodeSlaveAssignmentMap2 = (Map<String, Map<String, List<Integer>>>)(result2.get("SlaveAssignmentMap"));
-
-    int commonMasters = 0;
-    int commonSlaves = 0;
-    int partitions = (Integer)(result1.get("partitions"));
-    int replicas = (Integer)(result1.get("replicas"));
-
-    AssertJUnit.assertTrue((Integer)(result2.get("partitions")) == partitions);
-    AssertJUnit.assertTrue((Integer)(result2.get("replicas")) == replicas);
-
-    // masterMap1 maps from partition id to the holder instance name
-    Map<Integer, String> masterMap1 = new TreeMap<Integer, String>();
-    for(String instanceName : masterAssignmentMap1.keySet())
-    {
-      List<Integer> masterList1 = masterAssignmentMap1.get(instanceName);
-      for(Integer partition : masterList1)
-      {
-        AssertJUnit.assertTrue(!masterMap1.containsKey(partition));
-        masterMap1.put(partition, instanceName);
-      }
-    }
-    // go through masterAssignmentMap2 and find out the common number
-    for(String instanceName : masterAssignmentMap2.keySet())
-    {
-      List<Integer> masterList2 = masterAssignmentMap2.get(instanceName);
-      for(Integer partition : masterList2)
-      {
-        if(masterMap1.get(partition).equalsIgnoreCase(instanceName))
-        {
-          commonMasters ++;
-        }
-      }
-    }
-    
-    result[0] = 1.0*commonMasters/partitions;
-    System.out.println(commonMasters + " master partitions are kept, "+ (partitions - commonMasters) + " moved, keep ratio:" + 1.0*commonMasters/partitions);
-    
-    // maps from the partition id to the instance names that holds its slave partition
-    Map<Integer, Set<String>> slaveMap1 = new TreeMap<Integer, Set<String>>();
-    for(String instanceName : nodeSlaveAssignmentMap1.keySet())
-    {
-      Map<String, List<Integer>> slaveAssignment1 = nodeSlaveAssignmentMap1.get(instanceName);
-      for(String slaveHostName : slaveAssignment1.keySet())
-      {
-        List<Integer> slaveList = slaveAssignment1.get(slaveHostName);
-        for(Integer partition : slaveList)
-        {
-          if(!slaveMap1.containsKey(partition))
-          {
-            slaveMap1.put(partition, new TreeSet<String>());
-          }
-          AssertJUnit.assertTrue(!slaveMap1.get(partition).contains(slaveHostName));
-          slaveMap1.get(partition).add(slaveHostName);
-        }
-      }
-    }
-
-    for(String instanceName : nodeSlaveAssignmentMap2.keySet())
-    {
-      Map<String, List<Integer>> slaveAssignment2 = nodeSlaveAssignmentMap2.get(instanceName);
-      for(String slaveHostName : slaveAssignment2.keySet())
-      {
-        List<Integer> slaveList = slaveAssignment2.get(slaveHostName);
-        for(Integer partition : slaveList)
-        {
-          if(slaveMap1.get(partition).contains(slaveHostName))
-          {
-            commonSlaves++;
-          }
-        }
-      }
-    }
-    result[1] = 1.0*commonSlaves/partitions/replicas;
-    System.out.println(commonSlaves + " slave partitions are kept, " + (partitions * replicas - commonSlaves)+ " moved. keep ratio:"+1.0*commonSlaves/partitions/replicas);
-    return result;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestGetProperty.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestGetProperty.java b/helix-core/src/test/java/com/linkedin/helix/TestGetProperty.java
deleted file mode 100644
index 09799e0..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestGetProperty.java
+++ /dev/null
@@ -1,48 +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;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class TestGetProperty
-{
-  @Test
-  public void testGetProperty()
-  {
-    String version;
-    Properties props = new Properties();
-
-    try
-    {
-      InputStream stream = Thread.currentThread().getContextClassLoader()
-          .getResourceAsStream("cluster-manager-version.properties");
-      props.load(stream);
-      version = props.getProperty("clustermanager.version");
-      Assert.assertNotNull(version);
-      System.out.println("cluster-manager-version:" + version);
-    }
-    catch (IOException e)
-    {
-      // e.printStackTrace();
-      Assert.fail("could not open cluster-manager-version.properties. ", e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestGroupCommit.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestGroupCommit.java b/helix-core/src/test/java/com/linkedin/helix/TestGroupCommit.java
deleted file mode 100644
index 002a739..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestGroupCommit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.linkedin.helix;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class TestGroupCommit
-{
-  // @Test
-  public void testGroupCommit() throws InterruptedException
-  {
-    final BaseDataAccessor<ZNRecord> accessor = new Mocks.MockBaseDataAccessor();
-    final GroupCommit commit = new GroupCommit();
-    ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(400);
-    for (int i = 0; i < 2400; i++)
-    {
-      Runnable runnable = new MyClass(accessor, commit, i);
-      newFixedThreadPool.submit(runnable);
-    }
-    Thread.sleep(10000);
-    System.out.println(accessor.get("test", null, 0));
-    System.out.println(accessor.get("test", null, 0).getSimpleFields().size());
-  }
-
-}
-
-class MyClass implements Runnable
-{
-  private final BaseDataAccessor<ZNRecord> store;
-  private final GroupCommit                commit;
-  private final int                        i;
-
-  public MyClass(BaseDataAccessor<ZNRecord> store, GroupCommit commit, int i)
-  {
-    this.store = store;
-    this.commit = commit;
-    this.i = i;
-  }
-
-  @Override
-  public void run()
-  {
-    // System.out.println("START " + System.currentTimeMillis() + " --"
-    // + Thread.currentThread().getId());
-    ZNRecord znRecord = new ZNRecord("test");
-    znRecord.setSimpleField("test_id" + i, "" + i);
-    commit.commit(store, 0, "test", znRecord);
-    store.get("test", null, 0).getSimpleField("");
-    // System.out.println("END " + System.currentTimeMillis() + " --"
-    // + Thread.currentThread().getId());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskExecutor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskExecutor.java b/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskExecutor.java
deleted file mode 100644
index 91bc141..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskExecutor.java
+++ /dev/null
@@ -1,87 +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;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.Mocks.MockHelixTaskExecutor;
-import com.linkedin.helix.Mocks.MockManager;
-import com.linkedin.helix.Mocks.MockStateModel;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.messaging.handling.AsyncCallbackService;
-import com.linkedin.helix.messaging.handling.HelixStateTransitionHandler;
-import com.linkedin.helix.model.CurrentState;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.model.Message.MessageType;
-import com.linkedin.helix.model.StateModelDefinition;
-import com.linkedin.helix.tools.StateModelConfigGenerator;
-
-public class TestHelixTaskExecutor
-{
-
-  @Test()
-  public void testCMTaskExecutor() throws Exception
-  {
-    System.out.println("START TestCMTaskExecutor");
-    String msgId = "TestMessageId";
-    Message message = new Message(MessageType.TASK_REPLY, msgId);
-
-    message.setMsgId(msgId);
-    message.setSrcName("cm-instance-0");
-    message.setTgtName("cm-instance-1");
-    message.setTgtSessionId("1234");
-    message.setFromState("Offline");
-    message.setToState("Slave");
-    message.setPartitionName("TestDB_0");
-    message.setResourceName("TestDB");
-    message.setStateModelDef("MasterSlave");
-
-    MockManager manager = new MockManager("clusterName");
-    // DataAccessor accessor = manager.getDataAccessor();
-    HelixDataAccessor accessor = manager.getHelixDataAccessor();
-    StateModelConfigGenerator generator = new StateModelConfigGenerator();
-    StateModelDefinition stateModelDef =
-        new StateModelDefinition(generator.generateConfigForMasterSlave());
-    Builder keyBuilder = accessor.keyBuilder();
-    accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);
-
-    MockHelixTaskExecutor executor = new MockHelixTaskExecutor();
-    MockStateModel stateModel = new MockStateModel();
-    NotificationContext context;
-    executor.registerMessageHandlerFactory(MessageType.TASK_REPLY.toString(),
-                                           new AsyncCallbackService());
-    // String clusterName =" testcluster";
-    context = new NotificationContext(manager);
-    CurrentState currentStateDelta = new CurrentState("TestDB");
-    currentStateDelta.setState("TestDB_0", "OFFLINE");
-    HelixStateTransitionHandler handler =
-        new HelixStateTransitionHandler(stateModel,
-                                        message,
-                                        context,
-                                        currentStateDelta,
-                                        executor);
-
-    executor.scheduleTask(message, handler, context);
-    while (!executor.isDone(msgId + "/" + message.getPartitionName()))
-    {
-      Thread.sleep(500);
-    }
-    AssertJUnit.assertTrue(stateModel.stateModelInvoked);
-    System.out.println("END TestCMTaskExecutor");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskHandler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskHandler.java b/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskHandler.java
deleted file mode 100644
index a7d9c3b..0000000
--- a/helix-core/src/test/java/com/linkedin/helix/TestHelixTaskHandler.java
+++ /dev/null
@@ -1,127 +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;
-
-import java.util.Date;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import com.linkedin.helix.Mocks.MockManager;
-import com.linkedin.helix.Mocks.MockStateModel;
-import com.linkedin.helix.Mocks.MockStateModelAnnotated;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.messaging.handling.HelixStateTransitionHandler;
-import com.linkedin.helix.messaging.handling.HelixTask;
-import com.linkedin.helix.messaging.handling.HelixTaskExecutor;
-import com.linkedin.helix.model.CurrentState;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.model.Message.MessageType;
-import com.linkedin.helix.model.StateModelDefinition;
-import com.linkedin.helix.tools.StateModelConfigGenerator;
-
-public class TestHelixTaskHandler
-{
-  @Test()
-  public void testInvocation() throws Exception
-  {
-    HelixTaskExecutor executor = new HelixTaskExecutor();
-    System.out.println("START TestCMTaskHandler.testInvocation()");
-    Message message = new Message(MessageType.STATE_TRANSITION, "Some unique id");
-
-    message.setSrcName("cm-instance-0");
-    message.setTgtSessionId("1234");
-    message.setFromState("Offline");
-    message.setToState("Slave");
-    message.setPartitionName("TestDB_0");
-    message.setMsgId("Some unique message id");
-    message.setResourceName("TestDB");
-    message.setTgtName("localhost");
-    message.setStateModelDef("MasterSlave");
-    message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
-    MockStateModel stateModel = new MockStateModel();
-    NotificationContext context;
-    MockManager manager = new MockManager("clusterName");
-//    DataAccessor accessor = manager.getDataAccessor();
-    HelixDataAccessor accessor = manager.getHelixDataAccessor();
-    StateModelConfigGenerator generator = new StateModelConfigGenerator();
-    StateModelDefinition stateModelDef = new StateModelDefinition(
-        generator.generateConfigForMasterSlave());
-    Builder keyBuilder = accessor.keyBuilder();
-    accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);
-
-    context = new NotificationContext(manager);
-    CurrentState currentStateDelta = new CurrentState("TestDB");
-    currentStateDelta.setState("TestDB_0", "OFFLINE");
-
-    HelixStateTransitionHandler stHandler = new HelixStateTransitionHandler(stateModel, message,
-        context, currentStateDelta, executor);
-    HelixTask handler;
-    handler = new HelixTask(message, context, stHandler, executor);
-    handler.call();
-    AssertJUnit.assertTrue(stateModel.stateModelInvoked);
-    System.out.println("END TestCMTaskHandler.testInvocation() at "
-        + new Date(System.currentTimeMillis()));
-  }
-
-  @Test()
-  public void testInvocationAnnotated() throws Exception
-  {
-    System.out.println("START TestCMTaskHandler.testInvocationAnnotated() at "
-        + new Date(System.currentTimeMillis()));
-    HelixTaskExecutor executor = new HelixTaskExecutor();
-    Message message = new Message(MessageType.STATE_TRANSITION, "Some unique id");
-    message.setSrcName("cm-instance-0");
-    message.setTgtSessionId("1234");
-    message.setFromState("Offline");
-    message.setToState("Slave");
-    message.setPartitionName("TestDB_0");
-    message.setMsgId("Some unique message id");
-    message.setResourceName("TestDB");
-    message.setTgtName("localhost");
-    message.setStateModelDef("MasterSlave");
-    message.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
-    MockStateModelAnnotated stateModel = new MockStateModelAnnotated();
-    NotificationContext context;
-
-    MockManager manager = new MockManager("clusterName");
-//    DataAccessor accessor = manager.getDataAccessor();
-    HelixDataAccessor accessor = manager.getHelixDataAccessor();
-
-    StateModelConfigGenerator generator = new StateModelConfigGenerator();
-    StateModelDefinition stateModelDef = new StateModelDefinition(
-        generator.generateConfigForMasterSlave());
-//    accessor.setProperty(PropertyType.STATEMODELDEFS, stateModelDef, "MasterSlave");
-    Builder keyBuilder = accessor.keyBuilder();
-    accessor.setProperty(keyBuilder.stateModelDef("MasterSlave"), stateModelDef);
-
-
-    context = new NotificationContext(manager);
-    
-    CurrentState currentStateDelta = new CurrentState("TestDB");
-    currentStateDelta.setState("TestDB_0", "OFFLINE");
-
-    HelixStateTransitionHandler stHandler = new HelixStateTransitionHandler(stateModel, message,
-        context, currentStateDelta, executor);
-
-    HelixTask handler = new HelixTask(message, context, stHandler, executor);
-    handler.call();
-    AssertJUnit.assertTrue(stateModel.stateModelInvoked);
-    System.out.println("END TestCMTaskHandler.testInvocationAnnotated() at "
-        + new Date(System.currentTimeMillis()));
-  }
-
-}


Mime
View raw message