// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/test/TestCondition.java
// public interface TestCondition {
// 	/**
// 	 * @return True when the condition is fulfilled, false otherwise
// 	 */
// 	boolean evaluate();
// }
// 
// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/test/TestUtils.java
// public class TestUtils {
//   private static final int DEFAULT_RETRY_TIMEOUT = 100;
//   private static Random random = new Random();
// 
//   /**
//    * @return An ephemeral port available for test usage
//    */
//   public static int getAvailablePort() {
//     try (ServerSocket s = new ServerSocket(0)) {
//       return s.getLocalPort();
//     } catch (Exception e) {
//       throw new AssertionError("Failed to find available port", e);
//     }
//   }
// 
//   /**
//    * @param n
//    *          Max int allowed
//    * @return A random number between 1 and n
//    */
//   public static final int getRandomPositiveInt(int n) {
//     Preconditions.checkArgument(n > 1, "Cannot generate this kind of number!");
//     return random.nextInt(n - 1) + 1;
//   }
// 
//   /**
//    * Waits that the condition is fulfilled - careful, this may never return!
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static void waitFor(final TestCondition condition) throws InterruptedException {
//     waitFor(condition, Integer.MAX_VALUE);
//   }
// 
//   /**
//    * Waits that the condition is fulfilled, for up to a specified amount of time
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @param maxWaitInMs
//    *          The maximum number of milliseconds to wait
//    * @return True if the condition is fulfilled in time, false otherwise
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static boolean waitFor(final TestCondition condition, final int maxWaitInMs) throws InterruptedException {
//     return waitFor(condition, maxWaitInMs, DEFAULT_RETRY_TIMEOUT);
//   }
// 
//   /**
//    * Waits that the condition is fulfilled, for up to a specified amount of time
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @param maxWaitInMs
//    *          The maximum number of milliseconds to wait
//    * @param retryTimeout
//    *          The number of milliseconds to wait before retry the test
//    * @return True if the condition is fulfilled in time, false otherwise
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static boolean waitFor(final TestCondition condition, final int maxWaitInMs, final int retryTimeout)
//       throws InterruptedException {
//     final long t0 = System.currentTimeMillis();
//     while (!condition.evaluate() && (System.currentTimeMillis() - t0) < maxWaitInMs) {
//       Thread.sleep(retryTimeout);
//     }
//     if (condition.evaluate()) {
//       return true;
//     }
//     throw new AssertionError("TestCondition did not validate in time");
//   }
// }


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import org.apache.commons.lang.StringUtils;
import com.comcast.viper.flume2storm.utility.test.TestCondition;
import com.comcast.viper.flume2storm.utility.test.TestUtils;
import com.google.common.base.Preconditions;
/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * 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.comcast.viper.flume2storm.zookeeper;




/**
 * 
 */
public class ZkTestUtils {
  public static final int TEST_TIMEOUT = 10000;
  public static final int ZK_OP_TIMEOUT = 3000;
  public static final int A_LITTLE = 1500;

  public static final String HOST = "127.0.0.1";
// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/test/TestCondition.java
// public interface TestCondition {
// 	/**
// 	 * @return True when the condition is fulfilled, false otherwise
// 	 */
// 	boolean evaluate();
// }
// 
// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/test/TestUtils.java
// public class TestUtils {
//   private static final int DEFAULT_RETRY_TIMEOUT = 100;
//   private static Random random = new Random();
// 
//   /**
//    * @return An ephemeral port available for test usage
//    */
//   public static int getAvailablePort() {
//     try (ServerSocket s = new ServerSocket(0)) {
//       return s.getLocalPort();
//     } catch (Exception e) {
//       throw new AssertionError("Failed to find available port", e);
//     }
//   }
// 
//   /**
//    * @param n
//    *          Max int allowed
//    * @return A random number between 1 and n
//    */
//   public static final int getRandomPositiveInt(int n) {
//     Preconditions.checkArgument(n > 1, "Cannot generate this kind of number!");
//     return random.nextInt(n - 1) + 1;
//   }
// 
//   /**
//    * Waits that the condition is fulfilled - careful, this may never return!
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static void waitFor(final TestCondition condition) throws InterruptedException {
//     waitFor(condition, Integer.MAX_VALUE);
//   }
// 
//   /**
//    * Waits that the condition is fulfilled, for up to a specified amount of time
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @param maxWaitInMs
//    *          The maximum number of milliseconds to wait
//    * @return True if the condition is fulfilled in time, false otherwise
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static boolean waitFor(final TestCondition condition, final int maxWaitInMs) throws InterruptedException {
//     return waitFor(condition, maxWaitInMs, DEFAULT_RETRY_TIMEOUT);
//   }
// 
//   /**
//    * Waits that the condition is fulfilled, for up to a specified amount of time
//    * 
//    * @param condition
//    *          The condition to evaluate. It should be fast to evaluate
//    * @param maxWaitInMs
//    *          The maximum number of milliseconds to wait
//    * @param retryTimeout
//    *          The number of milliseconds to wait before retry the test
//    * @return True if the condition is fulfilled in time, false otherwise
//    * @throws InterruptedException
//    *           If wait is interrupted
//    */
//   public static boolean waitFor(final TestCondition condition, final int maxWaitInMs, final int retryTimeout)
//       throws InterruptedException {
//     final long t0 = System.currentTimeMillis();
//     while (!condition.evaluate() && (System.currentTimeMillis() - t0) < maxWaitInMs) {
//       Thread.sleep(retryTimeout);
//     }
//     if (condition.evaluate()) {
//       return true;
//     }
//     throw new AssertionError("TestCondition did not validate in time");
//   }
// }


// Path: dynamic-location-service/src/test/java/com/comcast/viper/flume2storm/zookeeper/ZkTestUtils.java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import org.apache.commons.lang.StringUtils;
import com.comcast.viper.flume2storm.utility.test.TestCondition;
import com.comcast.viper.flume2storm.utility.test.TestUtils;
import com.google.common.base.Preconditions;

/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * 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.comcast.viper.flume2storm.zookeeper;




/**
 * 
 */
public class ZkTestUtils {
  public static final int TEST_TIMEOUT = 10000;
  public static final int ZK_OP_TIMEOUT = 3000;
  public static final int A_LITTLE = 1500;

  public static final String HOST = "127.0.0.1";
  public static final int PORT = TestUtils.getAvailablePort();