aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject [05/21] aurora git commit: Remove unused classes from commons fork.
Date Fri, 28 Aug 2015 18:33:23 GMT
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java b/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
index d43a6db..fdbef6f 100644
--- a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
+++ b/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
@@ -24,21 +24,18 @@ import com.google.inject.Injector;
 import com.google.inject.Module;
 
 import org.apache.aurora.common.application.ShutdownRegistry;
-import org.junit.Test;
-
 import org.apache.aurora.common.application.modules.LifecycleModule.LaunchException;
 import org.apache.aurora.common.application.modules.LifecycleModule.ServiceRunner;
 import org.apache.aurora.common.application.modules.LocalServiceRegistry.LocalService;
 import org.apache.aurora.common.base.Command;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
+import org.junit.Test;
 
+import static org.apache.aurora.common.net.InetSocketAddressHelper.getLocalAddress;
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import static org.apache.aurora.common.application.modules.LifecycleModule.bindLocalService;
-import static org.apache.aurora.common.net.InetSocketAddressHelper.getLocalAddress;
-
 /**
  * @author William Farner
  */
@@ -67,32 +64,6 @@ public class LifecycleModuleTest extends EasyMockTest {
   }
 
   @Test
-  public void testNoRunner() throws Exception {
-    final Command primaryShutdown = createMock(Command.class);
-    final Command auxShutdown = createMock(Command.class);
-
-    primaryShutdown.execute();
-    auxShutdown.execute();
-
-    Module testModule = new AbstractModule() {
-      @Override protected void configure() {
-        bindLocalService(binder(), LocalService.primaryService(99, primaryShutdown));
-        bindLocalService(binder(), LocalService.auxiliaryService("foo", 100, auxShutdown));
-      }
-    };
-
-    Injector injector = Guice.createInjector(new SystemModule(), testModule);
-    LocalServiceRegistry registry = injector.getInstance(LocalServiceRegistry.class);
-
-    control.replay();
-
-    assertEquals(Optional.of(getLocalAddress(99)), registry.getPrimarySocket());
-    assertEquals(ImmutableMap.of("foo", getLocalAddress(100)), registry.getAuxiliarySockets());
-
-    injector.getInstance(ShutdownRegistry.ShutdownRegistryImpl.class).execute();
-  }
-
-  @Test
   public void testOrdering() throws Exception {
     final ServiceRunner runner = createMock(ServiceRunner.class);
     Command shutdown = createMock(Command.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java b/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
deleted file mode 100644
index 26eb84d..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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 org.apache.aurora.common.base;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author William Farner
- */
-public class CachingSupplierTest extends EasyMockTest {
-
-  private static final Amount<Long, Time> ONE_SECOND = Amount.of(1L, Time.SECONDS);
-
-  private Supplier<String> supplier;
-  private FakeClock clock;
-  private Supplier<String> cache;
-
-  @Before
-  public void setUp() {
-    supplier = createMock(new Clazz<Supplier<String>>() { });
-    clock = new FakeClock();
-    cache = new CachingSupplier<String>(supplier, ONE_SECOND, clock);
-  }
-
-  @Test
-  public void testCaches() {
-    expect(supplier.get()).andReturn("foo");
-    expect(supplier.get()).andReturn("bar");
-
-    control.replay();
-
-    assertEquals("foo", cache.get());
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(999L, Time.MILLISECONDS));
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(1L, Time.MILLISECONDS));
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(1L, Time.MILLISECONDS));
-    assertEquals("bar", cache.get());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java b/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
deleted file mode 100644
index 39cb79e..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * 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 org.apache.aurora.common.base;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class EitherTest {
-
-  @Test
-  public void testLeft() {
-    Exception left = new Exception();
-    assertLeft(left, Either.<Exception, String>left(left));
-  }
-
-  @Test
-  public void testRight() {
-    assertRight("jake", Either.<Exception, String>right("jake"));
-  }
-
-  @Test
-  public void testSwap() {
-    assertLeft("jake", Either.right("jake").swap());
-    assertRight("jake", Either.left("jake").swap());
-
-    Either<String, Object> left = Either.left("jake");
-    assertEquals(left, left.swap().swap());
-
-    Either<Object, String> right = Either.right("jake");
-    assertEquals(right, right.swap().swap());
-  }
-
-  public static final Function<CharSequence, Integer> LENGTH =
-      new Function<CharSequence, Integer>() {
-        @Override public Integer apply(CharSequence item) {
-          return item.length();
-        }
-      };
-
-  public static final Function<Object, Integer> HASHCODE = new Function<Object, Integer>() {
-    @Override public Integer apply(Object item) {
-      return item.hashCode();
-    }
-  };
-
-  @Test
-  public void testMapLeft() {
-    RuntimeException left = new RuntimeException() {
-      @Override public int hashCode() {
-        return 42;
-      }
-    };
-    assertLeft(42, Either.left(left).mapLeft(HASHCODE));
-
-    assertRight("jake", Either.right("jake").mapLeft(HASHCODE));
-  }
-
-  @Test
-  public void testMapRight() {
-    assertRight(4, Either.right("jake").mapRight(LENGTH));
-
-    RuntimeException left = new RuntimeException();
-    assertLeft(left, Either.left(left).mapRight(HASHCODE));
-  }
-
-  @Test
-  public void testMap() {
-    Either.Transformer<Object, CharSequence, Integer> transformer = Either.transformer(HASHCODE, LENGTH);
-
-    Object left = new Object() {
-      @Override public int hashCode() {
-        return 1137;
-      }
-    };
-    Either<Object, CharSequence> either = Either.left(left);
-    assertEquals(1137, either.map(transformer).intValue());
-
-    assertEquals(19, Either.right("The Meaning of Life").map(transformer).intValue());
-  }
-
-  private static final ImmutableList<Either<String, String>> LEFT_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>left("jack"),
-          Either.<String, String>left("jill"));
-
-  private static final ImmutableList<Either<String, String>> RIGHT_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>right("jack"),
-          Either.<String, String>right("jill"));
-
-  private static final ImmutableList<Either<String, String>> MIXED_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>left("jack"),
-          Either.<String, String>right("jane"),
-          Either.<String, String>left("jill"));
-
-  @Test
-  public void testLefts() {
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.lefts(LEFT_RESULTS)));
-    assertEquals(ImmutableList.of(), ImmutableList.copyOf(Either.lefts(RIGHT_RESULTS)));
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.lefts(MIXED_RESULTS)));
-  }
-
-  @Test
-  public void testRights() {
-    assertEquals(ImmutableList.of(), ImmutableList.copyOf(Either.rights(LEFT_RESULTS)));
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.rights(RIGHT_RESULTS)));
-    assertEquals(ImmutableList.of("jane"), ImmutableList.copyOf(Either.rights(MIXED_RESULTS)));
-  }
-
-  @Test
-  public void testTransformer() {
-    assertEquals(ImmutableList.of("jackjack", "4", "jilljill"),
-        ImmutableList.copyOf(Iterables.transform(MIXED_RESULTS,
-            new Either.Transformer<String, String, String>() {
-              @Override public String mapLeft(String left) {
-                return left + left;
-              }
-              @Override public String mapRight(String right) {
-                return String.valueOf(right.length());
-              }
-            })));
-  }
-
-  static <T, X extends Exception> ExceptionalSupplier<T, X> constantSupplier(final T value) {
-    return new ExceptionalSupplier<T, X>() {
-      @Override public T get() {
-        return value;
-      }
-    };
-  }
-
-  static <T, X extends Exception> ExceptionalSupplier<T, X> failedSupplier(final X failure) {
-    return new ExceptionalSupplier<T, X>() {
-      @Override public T get() throws X {
-        throw failure;
-      }
-    };
-  }
-
-  @Test
-  public void testGuard() {
-    assertRight("jake",
-        Either.guard(IOException.class, EitherTest.<String, IOException>constantSupplier("jake")));
-
-    IOException left = new IOException();
-    assertLeft(left, Either.guard(IOException.class, failedSupplier(left)));
-
-    try {
-      Either.guard(IOException.class, new ExceptionalSupplier<Object, IOException>() {
-        @Override public String get() {
-          throw new ArithmeticException();
-        }
-      });
-      fail("Expected an unguarded exception type to fail fast.");
-    } catch (Either.UnguardedException e) {
-      assertTrue(e.getCause() instanceof ArithmeticException);
-    }
-
-    Either<Exception, String> result =
-        Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-            new SupplierE<String>() {
-              @Override public String get() throws InterruptedException {
-                throw new InterruptedException();
-              }
-            });
-    assertTrue(result.getLeft() instanceof InterruptedException);
-
-    result = Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-        new SupplierE<String>() {
-          @Override public String get() throws IOException {
-            throw new MalformedURLException();
-          }
-        });
-    assertTrue(result.getLeft() instanceof IOException);
-
-    class MyException extends Exception { }
-    try {
-      Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-          new SupplierE<String>() {
-            @Override public String get() throws Exception {
-              throw new MyException();
-            }
-          });
-      fail("Expected an unguarded exception type to fail fast.");
-    } catch (Either.UnguardedException e) {
-      assertTrue(e.getCause() instanceof MyException);
-    }
-  }
-
-  private static <L, R> void assertLeft(L left, Either<L, R> either) {
-    assertEquals(Either.left(left), either);
-
-    assertTrue(either.isLeft());
-    assertTrue(either.left().isPresent());
-    assertSame(left, either.getLeft());
-    assertSame(left, either.left().get());
-
-    assertFalse(either.isRight());
-    assertFalse(either.right().isPresent());
-    try {
-      either.getRight();
-      fail("Expected a a left to throw when accessing its right.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-    try {
-      either.right().get();
-      fail("Expected a a left to throw when accessing its right.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-  }
-
-  private static <L, R> void assertRight(R right, Either<L, R> either) {
-    assertEquals(Either.right(right), either);
-
-    assertTrue(either.isRight());
-    assertTrue(either.right().isPresent());
-    assertSame(right, either.getRight());
-    assertSame(right, either.right().get());
-
-    assertFalse(either.isLeft());
-    assertFalse(either.left().isPresent());
-    try {
-      either.getLeft();
-      fail("Expected a a right to throw when accessing its left.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-    try {
-      either.left().get();
-      fail("Expected a a right to throw when accessing its left.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java b/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
deleted file mode 100644
index b59f658..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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 org.apache.aurora.common.base;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.SocketException;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author John Sirois
- */
-public class ExceptionTransporterTest {
-
-  @Test(expected = FileNotFoundException.class)
-  public void testCheckedTransport() throws FileNotFoundException {
-    ExceptionTransporter.guard(new Function<ExceptionTransporter<FileNotFoundException>, File>() {
-      @Override public File apply(ExceptionTransporter<FileNotFoundException> transporter) {
-        throw transporter.transport(new FileNotFoundException());
-      }
-    });
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testUncheckedTransport() throws SocketException {
-    ExceptionTransporter.guard(new Function<ExceptionTransporter<SocketException>, File>() {
-      @Override public File apply(ExceptionTransporter<SocketException> transporter) {
-        throw new IllegalStateException();
-      }
-    });
-  }
-
-  @Test
-  public void testNoTransport() throws IOException {
-    assertEquals("jake", ExceptionTransporter.guard(
-        new Function<ExceptionTransporter<IOException>, String>() {
-          @Override public String apply(ExceptionTransporter<IOException> exceptionTransporter) {
-            return "jake";
-          }
-        }));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java b/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
deleted file mode 100644
index 34e0ca6..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * 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 org.apache.aurora.common.base;
-
-import java.io.IOException;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-/**
- * @author John Sirois
- */
-public class ExceptionalFunctionsTest {
-
-  private static final String STRING = "jake";
-  private ExceptionalFunction<String, Integer, NumberFormatException> stringToInt =
-      new ExceptionalFunction<String, Integer, NumberFormatException>() {
-        @Override
-        public Integer apply(String item) throws NumberFormatException {
-          return Integer.parseInt(item);
-        }
-      };
-  private ExceptionalFunction<Integer, Double, Exception> intToDouble =
-      new ExceptionalFunction<Integer, Double, Exception>() {
-        @Override
-        public Double apply(Integer item) throws NumberFormatException {
-          return item.doubleValue();
-        }
-      };
-  private IMocksControl control;
-  private ExceptionalFunction<String, Integer, IOException> function;
-
-  @Before
-  public void setUp() throws Exception {
-    control = EasyMock.createControl();
-
-    @SuppressWarnings("unchecked")
-    ExceptionalFunction<String, Integer, IOException> f =
-        control.createMock(ExceptionalFunction.class);
-    this.function = f;
-  }
-
-  @Test
-  public void testCurryLazy() throws IOException {
-    control.replay();
-
-    ExceptionalFunctions.curry(function, STRING);
-
-    control.verify();
-  }
-
-  @Test
-  public void testCurryExecution() throws IOException {
-    expect(function.apply(STRING)).andReturn(1);
-    expect(function.apply(STRING)).andReturn(2);
-
-    control.replay();
-
-    CallableExceptionalSupplier<Integer, IOException> supplier =
-        ExceptionalFunctions.curry(function, STRING);
-
-    assertEquals("curried function should be called", Integer.valueOf(1), supplier.get());
-    assertEquals("curried function should not be memoized", Integer.valueOf(2), supplier.get());
-
-    control.verify();
-  }
-
-  @Test
-  public void testCurryException() throws IOException {
-    IOException ioException = new IOException();
-    expect(function.apply(STRING)).andThrow(ioException);
-
-    RuntimeException runtimeException = new IllegalStateException();
-    expect(function.apply(STRING)).andThrow(runtimeException);
-
-    control.replay();
-
-    CallableExceptionalSupplier<Integer, IOException> supplier =
-        ExceptionalFunctions.curry(function, STRING);
-
-    try {
-      supplier.get();
-    } catch (IOException e) {
-      assertSame("Expected exception propagation to be transparent", ioException, e);
-    }
-
-    try {
-      supplier.get();
-    } catch (IllegalStateException e) {
-      assertSame("Expected exception propagation to be transparent", runtimeException, e);
-    }
-
-    control.verify();
-  }
-
-  @Test
-  public void testCompose() throws Exception {
-    ExceptionalFunction<String, Double, Exception> stringToDouble =
-        ExceptionalFunctions.compose(intToDouble, stringToInt);
-    assertEquals(new Double(2d), stringToDouble.apply("2"));
-    assertEquals(new Double(-1d), stringToDouble.apply("-1"));
-  }
-
-  @Test(expected = NumberFormatException.class)
-  public void testComposeWithException() throws Exception {
-    ExceptionalFunction<String, Double, Exception> stringToDouble =
-        ExceptionalFunctions.compose(intToDouble, stringToInt);
-    stringToDouble.apply("1.1");
-  }
-
-  @Test
-  public void testForFunction() {
-    com.google.common.base.Function<String, Integer> stringToIntegerGuavaFunction =
-        new com.google.common.base.Function<String, Integer>() {
-          @Override
-          public Integer apply(String item) {
-            return Integer.parseInt(item);
-          }
-        };
-    ExceptionalFunction<String, Integer, NumberFormatException> stringToIntegerExceptionalFunction =
-        ExceptionalFunctions.forFunction(stringToIntegerGuavaFunction);
-    assertEquals(
-        stringToIntegerGuavaFunction.apply("1234"),
-        stringToIntegerExceptionalFunction.apply("1234"));
-  }
-
-  @Test
-  public void testConstantReturn() {
-    final String value = "taxes?";
-    ExceptionalFunction<String, String, IllegalArgumentException> constant =
-        ExceptionalFunctions.constant(value);
-    assertEquals(value, constant.apply("yes"));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testConstantException() {
-    ExceptionalFunction<String, String, IllegalArgumentException> badness =
-        ExceptionalFunctions.forException(new IllegalArgumentException());
-    badness.apply("pleaseno");
-  }
-
-  @Test
-  public void testConstantExceptionReturn() {
-    final Exception value = new Exception("corner case?");
-    ExceptionalFunction<String, Exception, IllegalArgumentException> constant =
-        ExceptionalFunctions.constant(value);
-    assertEquals(value, constant.apply("yes"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java b/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
deleted file mode 100644
index b1c3758..0000000
--- a/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/**
- * 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 org.apache.aurora.common.collections;
-
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author William Farner
- */
-public class BitsTest {
-
-  private static final List<Long> BASIC_LONGS = Arrays.asList(
-      0x0000000000000000L,
-      0x00000000FFFFFFFFL,
-      0xFFFFFFFF00000000L,
-      0xFFFFFFFFFFFFFFFFL
-  );
-
-  private static final List<Long> SINGLE_BIT_LONGS = Arrays.asList(
-      0x0000000000000001L,
-      0x0000000000000002L,
-      0x0000000000000004L,
-      0x0000000000000008L,
-      0x0000000000000010L,
-      0x0000000000000020L,
-      0x0000000000000040L,
-      0x0000000000000080L,
-      0x0000000000000100L,
-      0x0000000000000200L,
-      0x0000000000000400L,
-      0x0000000000000800L,
-      0x0000000000001000L,
-      0x0000000000002000L,
-      0x0000000000004000L,
-      0x0000000000008000L,
-      0x0000000000010000L,
-      0x0000000000020000L,
-      0x0000000000040000L,
-      0x0000000000080000L,
-      0x0000000000100000L,
-      0x0000000000200000L,
-      0x0000000000400000L,
-      0x0000000000800000L,
-      0x0000000001000000L,
-      0x0000000002000000L,
-      0x0000000004000000L,
-      0x0000000008000000L,
-      0x0000000010000000L,
-      0x0000000020000000L,
-      0x0000000040000000L,
-      0x0000000080000000L,
-      0x0000000100000000L,
-      0x0000000200000000L,
-      0x0000000400000000L,
-      0x0000000800000000L,
-      0x0000001000000000L,
-      0x0000002000000000L,
-      0x0000004000000000L,
-      0x0000008000000000L,
-      0x0000010000000000L,
-      0x0000020000000000L,
-      0x0000040000000000L,
-      0x0000080000000000L,
-      0x0000100000000000L,
-      0x0000200000000000L,
-      0x0000400000000000L,
-      0x0000800000000000L,
-      0x0001000000000000L,
-      0x0002000000000000L,
-      0x0004000000000000L,
-      0x0008000000000000L,
-      0x0010000000000000L,
-      0x0020000000000000L,
-      0x0040000000000000L,
-      0x0080000000000000L,
-      0x0100000000000000L,
-      0x0200000000000000L,
-      0x0400000000000000L,
-      0x0800000000000000L,
-      0x1000000000000000L,
-      0x2000000000000000L,
-      0x4000000000000000L,
-      0x8000000000000000L
-  );
-
-  private static final List<Long> RANDOM_LONGS = Arrays.asList(
-      0x88BA910280684BFAL,
-      0xAD4376223ACCDA29L,
-      0xE5992FBC3D222B2BL,
-      0x93385280AC0EE09CL,
-      0x7BFCB384F2B88BD1L,
-      0xABD0E19C726DC54EL,
-      0xA0C0A9D1C38073E1L,
-      0x957A232B46A01071L,
-      0x04CCBDFE1F714EB4L,
-      0xACDC6DACDF25C070L,
-      0xCE9AC78F31BA17FAL,
-      0xEAE5F04361A46FFFL,
-      0x1B18F8BE5089C1EDL,
-      0xD8E0EED9F397496DL,
-      0xD6A1F134843B4AC9L,
-      0x186F1C907FBA5B3CL,
-      0x8A1CB91A7929357AL,
-      0xB6F5B84FFBFE21F3L,
-      0xD8F2E84C73735997L,
-      0xFE9C4FBDAB495B31L,
-      0x92AB7DEB113D3E8FL,
-      0x5CBA4C59FC1C7605L,
-      0xBADD2C1E2D9A7621L,
-      0x54ADAEDF528B347DL,
-      0x1C131C0F1FC1AA11L,
-      0x00D79CEBA636527CL,
-      0x7A6B6E39E6765118L,
-      0xF021A4E5DD3845D0L,
-      0x6966FAE6CA243F1BL,
-      0xF738DC1B00956B83L,
-      0x09D616F4502784A0L,
-      0xEFDA3B2B2EF13671L
-  );
-
-  private static final List<Integer> BASIC_INTS = Arrays.asList(
-      0x00000000,
-      0xFFFFFFFF
-  );
-
-  private static final List<Integer> SINGLE_BIT_INTS = Arrays.asList(
-      0x00000001,
-      0x00000002,
-      0x00000004,
-      0x00000008,
-      0x00000010,
-      0x00000020,
-      0x00000040,
-      0x00000080,
-      0x00000100,
-      0x00000200,
-      0x00000400,
-      0x00000800,
-      0x00001000,
-      0x00002000,
-      0x00004000,
-      0x00008000,
-      0x00010000,
-      0x00020000,
-      0x00040000,
-      0x00080000,
-      0x00100000,
-      0x00200000,
-      0x00400000,
-      0x00800000,
-      0x01000000,
-      0x02000000,
-      0x04000000,
-      0x08000000,
-      0x10000000,
-      0x20000000,
-      0x40000000,
-      0x80000000
-  );
-
-  private static final List<Integer> RANDOM_INTS = Arrays.asList(
-      0x124FE3D6,
-      0xA688379A,
-      0xB49EC20C,
-      0x0C2C8D99,
-      0x32D1E1BB,
-      0xCF7169FF,
-      0x94D7D596,
-      0xE3A962CD,
-      0xA47FA154,
-      0x20DB4BA5,
-      0x27FA77BC,
-      0x2DCEDF0D,
-      0xC05ACE5A,
-      0x4C871D86,
-      0x29B4D423,
-      0xFCB5EC65,
-      0x1CAD4057,
-      0x2EC8E1C8,
-      0x251D315A,
-      0x6D6C6021,
-      0x3F58FF67,
-      0xFB917B2E,
-      0x51338D3E,
-      0xE1D6695B,
-      0x149D5142,
-      0x51B6CFD1,
-      0xABB61BA0,
-      0x4E1FD4D4,
-      0x0AB11279,
-      0xEA8EE310,
-      0x9C6C8B24,
-      0x99DD3A07
-  );
-
-  @SuppressWarnings("unchecked") //Needed because type information lost in vargs.
-  private static final List<List<Long>> LONGS_TEST_LISTS = Arrays.asList(
-      BASIC_LONGS,
-      SINGLE_BIT_LONGS,
-      RANDOM_LONGS
-  );
-
-  @SuppressWarnings("unchecked") //Needed because type information lost in vargs.
-  private static final List<List<Integer>> INTS_TEST_LISTS = Arrays.asList(
-      BASIC_INTS,
-      SINGLE_BIT_INTS,
-      RANDOM_INTS
-  );
-
-  @Test
-  public void testSetAndGetSingleLongBits() {
-    for (List<Long> testList : LONGS_TEST_LISTS) {
-      for (long testValue : testList) {
-        for (int i = 0; i < 64; ++i) {
-          long setOneBit = Bits.setBit(testValue, i);
-          assertTrue(Bits.isBitSet(setOneBit, i));
-          assertEquals(Bits.clearBit(testValue, i), Bits.clearBit(setOneBit, i));
-          assertTrue(!Bits.isBitSet(Bits.clearBit(setOneBit, i), i));
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testAllLongBits() {
-    for (List<Long> testList : LONGS_TEST_LISTS) {
-      for (long testValue : testList) {
-        long inverseValue1 = 0;
-        long inverseValue2 = 0xFFFFFFFFFFFFFFFFL;
-        for (int i = 0; i < 64; ++i) {
-          if (!Bits.isBitSet(testValue, i)) {
-            inverseValue1 = Bits.setBit(inverseValue1, i);
-          } else {
-            inverseValue2 = Bits.clearBit(inverseValue2, i);
-          }
-        }
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue1 | testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue2 | testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue1 ^ testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue2 ^ testValue));
-      }
-    }
-  }
-
-  @Test
-  public void testSetAndGetSingleIntBits() {
-    for (List<Integer> testList : INTS_TEST_LISTS) {
-      for (int testValue : testList) {
-        for (int i = 0; i < 32; ++i) {
-          int setOneBit = Bits.setBit(testValue, i);
-          assertTrue(Bits.isBitSet(setOneBit, i));
-          assertEquals(Bits.clearBit(testValue, i), Bits.clearBit(setOneBit, i));
-          assertTrue(!Bits.isBitSet(Bits.clearBit(setOneBit, i), i));
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testAllIntBits() {
-    for (List<Integer> testList : INTS_TEST_LISTS) {
-      for (int testValue : testList) {
-        int inverseValue1 = 0;
-        int inverseValue2 = 0xFFFFFFFF;
-        for (int i = 0; i < 32; ++i) {
-          if (!Bits.isBitSet(testValue, i)) {
-            inverseValue1 = Bits.setBit(inverseValue1, i);
-          } else {
-            inverseValue2 = Bits.clearBit(inverseValue2, i);
-          }
-        }
-        assertThat(0xFFFFFFFF, is(inverseValue1 | testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue2 | testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue1 ^ testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue2 ^ testValue));
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java b/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
deleted file mode 100644
index 7fd74c9..0000000
--- a/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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 org.apache.aurora.common.inject;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Key;
-import com.google.inject.Provides;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author John Sirois
- */
-public class DefaultProviderTest {
-  public static final Key<String> CUSTOM_STRING = Key.get(String.class, Names.named("custom"));
-  public static final Key<String> DEFAULT_STRING = Key.get(String.class, Names.named("default"));
-  public static final Key<String> FINAL_STRING = Key.get(String.class, Names.named("final"));
-
-  @Test
-  public void testDefault() {
-    assertEquals("jack", Guice.createInjector(new AbstractModule() {
-      @Override protected void configure() {
-        DefaultProvider.bindOrElse(CUSTOM_STRING, DEFAULT_STRING, FINAL_STRING, binder());
-      }
-
-      @Provides @Named("default") String provideDefault() {
-        return "jack";
-      }
-    }).getInstance(FINAL_STRING));
-  }
-
-  @Test
-  public void testCustom() {
-    assertEquals("jill", Guice.createInjector(new AbstractModule() {
-      @Override protected void configure() {
-        DefaultProvider.bindOrElse(CUSTOM_STRING, DEFAULT_STRING, FINAL_STRING, binder());
-
-      }
-
-      @Provides @Named("default") String provideDefault() {
-        return "jack";
-      }
-
-      @Provides @Named("custom") String provideCustom() {
-        return "jill";
-      }
-    }).getInstance(FINAL_STRING));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java b/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
deleted file mode 100644
index 0530ca2..0000000
--- a/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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 org.apache.aurora.common.io;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Random;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.commons.codec.binary.Base64OutputStream;
-import org.junit.Assert;
-
-import junit.framework.TestCase;
-
-public class Base64ZlibCodecTest extends TestCase {
-
-  public void testEncodeDecode() throws Exception {
-    testEncodeDecode(0);
-    for (int i = 1; i < 10000; i *= 10) {
-      testEncodeDecode(i * 1024);
-    }
-  }
-
-  public void testDecodeGzip() throws Exception {
-    final byte[] input = createRandomBytes(10240);
-    ByteArrayOutputStream out = new ByteArrayOutputStream();
-    final OutputStream os = new GZIPOutputStream(new Base64OutputStream(out));
-    os.write(input);
-    os.close();
-    final String encoded = new String(out.toByteArray(), "8859_1");
-    assertTrue(encoded.startsWith("H4sIAAAAAAAAA"));
-    Assert.assertArrayEquals(input, Base64ZlibCodec.decode(encoded));
-  }
-
-  public void testInvalidData() throws Exception {
-    final String plain = createRandomText(10240);
-    try {
-      Base64ZlibCodec.decode("this is invalid");
-      fail();
-    } catch (Base64ZlibCodec.InvalidDataException e) {
-      // This is expected
-    }
-  }
-
-  public void testCorruptedData() throws Exception {
-    final char[] encoded = Base64ZlibCodec.encode(createRandomBytes(1024)).toCharArray();
-    for (int i = 100; i < encoded.length; ++i) {
-      if (encoded[i] != 'Z') {
-        ++encoded[i];
-        break;
-      }
-    }
-    try {
-      Base64ZlibCodec.decode(new String(encoded));
-      fail();
-    } catch (Base64ZlibCodec.InvalidDataException e) {
-      // This is expected
-    }
-  }
-
-  private static void testEncodeDecode(int len) throws Exception {
-    final byte[] input = createRandomBytes(len);
-    final String encoded = Base64ZlibCodec.encode(input);
-    assertTrue(encoded.startsWith("eJ"));
-    Assert.assertArrayEquals(input, Base64ZlibCodec.decode(encoded));
-  }
-
-  private static String createRandomText(int len) throws UnsupportedEncodingException {
-    final byte[] msg = new byte[len];
-    new Random().nextBytes(msg);
-    return new String(msg, "8859_1");
-  }
-
-  private static byte[] createRandomBytes(int len) throws UnsupportedEncodingException {
-    final byte[] msg = new byte[len];
-    new Random().nextBytes(msg);
-    return msg;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java b/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
deleted file mode 100644
index 949e78b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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 org.apache.aurora.common.io;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.BitSet;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class JsonCodecTest {
-  @Test
-  public void testRoundTrip() throws IOException {
-    TestClass testOut = createTestClassInstance();
-    Codec<TestClass> codec = JsonCodec.create(TestClass.class);
-    TestClass testIn = CodecTestUtilities.roundTrip(codec, testOut);
-    assertEquals(testOut.data1, testIn.data1);
-    assertEquals(testOut.data2, testIn.data2);
-    assertEquals(testOut.data3, testIn.data3);
-    assertTrue(Arrays.equals(testOut.data4, testIn.data4));
-  }
-
-  @Test
-  public void testExpectedFormat() throws IOException {
-    Codec<TestClass> codec = JsonCodec.create(TestClass.class);
-    TestClass item = createTestClassInstance();
-    JsonElement expectedElement = new JsonParser()
-        .parse("{\"data1\":\"foo\",\"data2\":\"bar\",\"data3\":42,\"data4\":[\"abc\",\"def\"]}");
-    JsonElement actualElement = new JsonParser().parse(new String(CodecTestUtilities.serialize(codec, item), "utf-8"));
-    assertEquals(expectedElement.toString(), actualElement.toString());
-  }
-
-  private TestClass createTestClassInstance() {
-    TestClass testOut = new TestClass();
-    testOut.data1 = "foo";
-    testOut.data2 = "bar";
-    testOut.data3 = 42;
-    testOut.data4 = new String[] { "abc", "def" };
-    return testOut;
-  }
-
-  @Test
-  public void testThriftExclusionWrongFieldClass() throws IOException {
-    ThriftTestClass1 test1 = new ThriftTestClass1();
-    test1.data1 = "foo";
-    test1.__isset_bit_vector = "bar";
-    assertEquals("foo", roundTrip(test1).data1);
-    assertEquals("bar", roundTrip(test1).__isset_bit_vector);
-  }
-
-  @Test
-  public void testThriftExclusionRightFieldClass() throws IOException {
-    ThriftTestClass2 test2 = new ThriftTestClass2();
-    test2.data1 = "foo";
-    test2.__isset_bit_vector = new BitSet(1);
-    assertEquals("foo", roundTrip(test2).data1);
-    assertNull(roundTrip(test2).__isset_bit_vector);
-  }
-
-  private static <T> T roundTrip(T item) throws IOException {
-    @SuppressWarnings("unchecked")
-    Class<T> itemType = (Class<T>) item.getClass();
-    return CodecTestUtilities.roundTrip(JsonCodec.create(itemType,
-        new GsonBuilder()
-            .setExclusionStrategies(JsonCodec.getThriftExclusionStrategy())
-            .create()), item);
-  }
-
-  public static class TestClass {
-    private String data1;
-    private String data2;
-    private int data3;
-    private String[] data4;
-  }
-
-  public static class ThriftTestClass1 {
-    private String data1;
-    private String __isset_bit_vector;
-  }
-
-  public static class ThriftTestClass2 {
-    private String data1;
-    private BitSet __isset_bit_vector;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java b/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
deleted file mode 100644
index b90fbd1..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * 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 org.apache.aurora.common.logging;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.MoreExecutors;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * Tests the BufferedLog.
- *
- * @author William Farner
- */
-public class BufferedLogTest {
-
-  private static final Predicate<Boolean> RETRY_FILTER = new Predicate<Boolean>() {
-    @Override public boolean apply(Boolean value) {
-      return !value;
-    }
-  };
-  private static final int BUFFER_SIZE = 5;
-  private static final int MAX_BUFFER_SIZE = 10;
-
-  private static final Boolean TRUE = Boolean.TRUE;
-  private static final Boolean FALSE = Boolean.FALSE;
-
-  private static final List<String> MESSAGES = Arrays.asList("1", "2", "3", "4", "5");
-
-  private BufferedLog<String, Boolean> bufferedLog;
-  private Log<String, Boolean> wrappedLog;
-
-  @Before
-  @SuppressWarnings("unchecked") // Due to createMock.
-  public void setUp() {
-    wrappedLog = createMock(Log.class);
-
-    bufferedLog = BufferedLog.<String, Boolean>builder()
-        .buffer(wrappedLog)
-        .withRetryFilter(RETRY_FILTER)
-        .withChunkLength(BUFFER_SIZE)
-        .withMaxBuffer(MAX_BUFFER_SIZE)
-        .withFlushInterval(Amount.of(10000, Time.SECONDS))
-        .withExecutorService(MoreExecutors.sameThreadExecutor())
-        .build();
-  }
-
-  @After
-  public void runTest() {
-    verify(wrappedLog);
-    assertThat(bufferedLog.getBacklog(), is(0));
-  }
-
-  @Test
-  public void testBuffers() {
-    expect(wrappedLog.log(MESSAGES)).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log(MESSAGES);
-  }
-
-  @Test
-  public void testFlush() {
-    expect(wrappedLog.log(Arrays.asList("a", "b", "c"))).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log("a");
-    bufferedLog.log("b");
-    bufferedLog.log("c");
-    bufferedLog.flush();
-  }
-
-  @Test
-  public void testBufferRetries() {
-    List<String> bufferAppended = ImmutableList.<String>builder().addAll(MESSAGES).add("6").build();
-
-    expect(wrappedLog.log(MESSAGES)).andReturn(FALSE);
-    expect(wrappedLog.log(bufferAppended)).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log(MESSAGES);
-    bufferedLog.log("6");
-  }
-
-  @Test
-  public void testTruncates() {
-    expect(wrappedLog.log(MESSAGES)).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d", "e")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d", "e", "f")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("2", "3", "4", "5", "a", "b", "c", "d", "e", "f", "g")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("3", "4", "5", "a", "b", "c", "d", "e", "f", "g", "h")))
-        .andReturn(TRUE);
-
-    replay(wrappedLog);
-
-    bufferedLog.log(MESSAGES);
-    bufferedLog.log("a");
-    bufferedLog.log("b");
-    bufferedLog.log("c");
-    bufferedLog.log("d");
-    bufferedLog.log("e");
-    bufferedLog.log("f");
-    bufferedLog.log("g");
-    bufferedLog.log("h");
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java b/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
deleted file mode 100644
index 6e6c3b1..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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 org.apache.aurora.common.logging;
-
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class LogUtilTest {
-
-  @Test
-  public void testEmptyPattern() {
-    test(null, LogUtil.DEFAULT_LOG_DIR);
-    test("", LogUtil.DEFAULT_LOG_DIR);
-  }
-
-  @Test
-  public void testLocalDir() {
-    test(".", ".");
-    test("./asdf.%g.log", ".");
-    test("asdf.%g.log", ".");
-  }
-
-  @Test
-  public void testRelativeDir() {
-    test("../asdf.%g.log", "..");
-    test("b/asdf.%g.log", "b");
-    test("b/c/d/asdf.%g.log", "b/c/d");
-  }
-
-  @Test
-  public void testAbsoluteDir() {
-    test("/a/b/c/d/logs.%g.%u.log", "/a/b/c/d");
-    test("/asdf.log", "/");
-  }
-
-  private void test(String pattern, String expected) {
-    assertThat(LogUtil.getLogManagerLogDir(pattern).getPath(), is(expected));
-  }
-
-  private void test(String pattern, File expected) {
-    test(pattern, expected.getPath());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
deleted file mode 100644
index aef4c80..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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 org.apache.aurora.common.logging.julbridge;
-
-import java.util.ListResourceBundle;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.apache.log4j.Category;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggingEvent;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeHandlerTest {
-
-  @Test
-  public void checkMessageWithParametersIsFormatted() {
-    LogRecord record = new LogRecord(Level.FINEST, "test is {0}");
-    record.setParameters(new Object[] {"successful"});
-
-    assertThat(JULBridgeHandler.formatMessage(record), is("test is successful"));
-  }
-
-  @Test
-  public void checkMessageWithResourceBundleIsFormatted() {
-    ResourceBundle bundle = new ListResourceBundle() {
-      @Override protected Object[][] getContents() {
-        return new Object[][] {
-            {"test is successful", "le test fonctionne"}
-        };
-      }
-    };
-
-    LogRecord record = new LogRecord(Level.FINEST, "test is successful");
-    record.setResourceBundle(bundle);
-
-    assertThat(JULBridgeHandler.formatMessage(record), is("le test fonctionne"));
-  }
-
-  @Test
-  public void checkGetLoggerReturnsLoggerWithSameName() {
-    LogRecord record = new LogRecord(Level.FINEST, "test message");
-    record.setLoggerName("test.checkGetLogger");
-
-    assertThat(new JULBridgeHandler().getLogger(record).getName(), is("test.checkGetLogger"));
-  }
-
-  @Test
-  public void checkToLoggingEvent() {
-    LogRecord record = new LogRecord(Level.FINEST, "test is {0}");
-    record.setParameters(new Object[] {"successful"});
-
-    record.setThreadID(42);
-    Throwable t = new Throwable();
-    record.setThrown(t);
-
-    // source class and method names are usually inferred, but because there's no JUL in the stack
-    // frame, it won't work as expected.
-    record.setSourceClassName(getClass().getName());
-    record.setSourceMethodName("checkToLoggingEvent");
-
-    Logger log4jLogger = new JULBridgeHandler().getLogger(record);
-    org.apache.log4j.Level log4jLevel = JULBridgeLevelConverter.toLog4jLevel(Level.FINEST);
-    LoggingEvent event = JULBridgeHandler.toLoggingEvent(record, log4jLogger, log4jLevel, false);
-
-    assertThat(event.getLogger(), is((Category) log4jLogger));
-    assertThat(event.getLevel(), is(log4jLevel));
-    assertThat(event.getMessage(), is((Object) "test is successful"));
-    assertThat(event.getThreadName(), is("42"));
-    assertThat(event.getTimeStamp(), is(record.getMillis()));
-    assertThat(event.getThrowableInformation().getThrowable(), is(sameInstance(t)));
-
-    LocationInfo info = event.getLocationInformation();
-    assertThat(info.getClassName(), is(getClass().getName()));
-    assertThat(info.getMethodName(), is("checkToLoggingEvent"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
deleted file mode 100644
index 79dfb26..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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 org.apache.aurora.common.logging.julbridge;
-
-import java.util.Arrays;
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeLevelConverterTest {
-
-  @RunWith(Parameterized.class)
-  public static class JULMappingToLog4JTest {
-    @SuppressWarnings("serial")
-    @Parameters
-    public static Iterable<Object[]> data() {
-      return Arrays.asList(new Object[][] {
-          { Level.FINEST,  org.apache.log4j.Level.TRACE },
-          { Level.FINER,   org.apache.log4j.Level.DEBUG },
-          { Level.FINE,    org.apache.log4j.Level.DEBUG },
-          { Level.INFO,    org.apache.log4j.Level.INFO },
-          { Level.WARNING, org.apache.log4j.Level.WARN },
-          { Level.SEVERE,  org.apache.log4j.Level.ERROR },
-          { Level.ALL,     org.apache.log4j.Level.ALL },
-          { Level.OFF,     org.apache.log4j.Level.OFF },
-          // Unknown level should map to DEBUG
-          { new Level("test", 42) {}, org.apache.log4j.Level.DEBUG }
-      });
-    }
-
-    private final Level level;
-    private final org.apache.log4j.Level expected;
-
-    public JULMappingToLog4JTest(Level level, org.apache.log4j.Level expected) {
-      this.level = level;
-      this.expected = expected;
-    }
-
-    @Test
-    public void checkJULMapsToLog4J() {
-      assertThat(JULBridgeLevelConverter.toLog4jLevel(level), is(expected));
-    }
-  }
-
-  @RunWith(Parameterized.class)
-  public static class Log4JMappingToJULTest {
-    @SuppressWarnings("serial")
-    @Parameters
-    public static Iterable<Object[]> data() {
-      return Arrays.asList(new Object[][] {
-          { org.apache.log4j.Level.TRACE, Level.FINEST },
-          { org.apache.log4j.Level.DEBUG, Level.FINE },
-          { org.apache.log4j.Level.INFO,  Level.INFO },
-          { org.apache.log4j.Level.WARN,  Level.WARNING },
-          { org.apache.log4j.Level.ERROR, Level.SEVERE },
-          { org.apache.log4j.Level.FATAL, Level.SEVERE },
-          { org.apache.log4j.Level.ALL,   Level.ALL },
-          { org.apache.log4j.Level.OFF,   Level.OFF },
-          // Unknown level should map to FINE
-          { new org.apache.log4j.Level(42, "test", 42) {}, Level.FINE }
-      });
-    }
-
-    private final org.apache.log4j.Level level;
-    private final Level expected;
-
-    public Log4JMappingToJULTest(org.apache.log4j.Level level, Level expected) {
-      this.level = level;
-      this.expected = expected;
-    }
-
-    @Test
-    public void checkJULMapsToLog4J() {
-      assertThat(JULBridgeLevelConverter.fromLog4jLevel(level), is(expected));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
deleted file mode 100644
index 40eac59..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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 org.apache.aurora.common.logging.julbridge;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.Hierarchy;
-import org.apache.log4j.spi.LoggerRepository;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.RootLogger;
-import org.junit.After;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeLogManagerTest {
-
-  @After
-  public void restoreLogConfiguration() throws SecurityException, IOException {
-    LogManager.getLogManager().readConfiguration();
-  }
-
-  @Test
-  public void checkAssimilateTakesOver() {
-    // Create a test log4j environment
-    final List<LoggingEvent> events = new LinkedList<LoggingEvent>();
-
-    org.apache.log4j.Logger log4jRoot = new RootLogger(org.apache.log4j.Level.ALL);
-    LoggerRepository loggerRepository = new Hierarchy(log4jRoot);
-    loggerRepository.setThreshold(org.apache.log4j.Level.INFO);
-
-    log4jRoot.addAppender(new AppenderSkeleton() {
-      @Override public boolean requiresLayout() {
-        return false;
-      }
-
-      @Override public void close() {}
-
-      @Override protected void append(LoggingEvent event) {
-        events.add(event);
-      }
-    });
-
-
-    JULBridgeLogManager.assimilate(loggerRepository);
-
-    Logger.getLogger("test.1").log(Level.INFO, "test message 1");
-    Logger.getLogger("test.2").log(Level.FINE, "test message 2");
-    Logger.getLogger("test.3").log(Level.WARNING, "test message 3");
-
-    assertThat(events.size(), is(2));
-    assertThat(events.get(0).getLoggerName(), is("test.1"));
-    assertThat(events.get(0).getMessage(), is((Object) "test message 1"));
-    assertThat(events.get(1).getLoggerName(), is("test.3"));
-    assertThat(events.get(1).getMessage(), is((Object) "test message 3"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
deleted file mode 100644
index c6e84bd..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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 org.apache.aurora.common.net;
-
-import com.google.common.collect.ImmutableList;
-import org.junit.Test;
-
-import java.net.URISyntaxException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * @author John Sirois
- */
-public class UrlHelperTest {
-  @Test
-  public void testGetDomain() {
-    assertEquals("www.twitter.com", UrlHelper.getDomain("www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.getDomain("www.twitter.com/a/b/c?foo=bar&bar=baz"));
-
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("www.thesun.co.uk",
-        UrlHelper.getDomain("www.thesun.co.uk/sol/homepa-http://dragtotop.com/thesun.co.uk"));
-    assertEquals("www.formspring.me",
-        UrlHelper.getDomain("www.formspring.me/chuuworangerrhttp://bit.ly/7pydt3"));
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("www.roundplace.com",
-        UrlHelper.getDomain("www.roundplace.com/en/watch/108/3/"
-                            + "baltimore-rave-http://dragtotop.com/patriots_vs_ravens"));
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals(null, UrlHelper.getDomain("http://?idonthaveadomain=true"));
-    assertEquals(null, UrlHelper.getDomain(":::<<<<<::IAMNOTAVALIDURIā€œ"));
-  }
-
-  @Test
-  public void testGetDomainChecked() throws Exception {
-    assertEquals("www.twitter.com", UrlHelper.getDomainChecked("http://www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.getDomainChecked("https://www.twitter.com/?a=b"));
-    assertEquals(null, UrlHelper.getDomainChecked("http://?idonthaveadomain=true"));
-    try {
-      UrlHelper.getDomainChecked(":::<<<<<::IAMNOTAVALIDURIā€œ");
-      fail();
-    } catch (URISyntaxException e) {
-      // Expected
-    }
-  }
-
-  @Test
-  public void testGetPath() {
-    assertEquals("", UrlHelper.getPath("www.twitter.com"));
-    assertEquals("/", UrlHelper.getPath("www.twitter.com/"));
-    assertEquals("/foo", UrlHelper.getPath("http://www.twitter.com/foo"));
-    assertEquals("/bar", UrlHelper.getPath("https://www.twitter.com/bar"));
-    assertEquals("/a/b/c", UrlHelper.getPath("www.twitter.com/a/b/c"));
-
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("/sol/homepa-http://dragtotop.com/thesun.co.uk",
-        UrlHelper.getPath("www.thesun.co.uk/sol/homepa-http://dragtotop.com/thesun.co.uk"));
-    assertEquals("/chuuworangerrhttp://bit.ly/7pydt3",
-        UrlHelper.getPath("www.formspring.me/chuuworangerrhttp://bit.ly/7pydt3"));
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("/en/watch/10855/3/baltimore-rave-http://dragtotop.com/patriots_vs_ravens",
-        UrlHelper.getPath("www.roundplace.com/en/watch/10855/3/"
-                            + "baltimore-rave-http://dragtotop.com/patriots_vs_ravens"));
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-  }
-
-  @Test
-  public void testAddProtocol() {
-    assertEquals("http://www.twitter.com", UrlHelper.addProtocol("www.twitter.com"));
-    assertEquals("http://www.twitter.com", UrlHelper.addProtocol("http://www.twitter.com"));
-    assertEquals("https://www.twitter.com", UrlHelper.addProtocol("https://www.twitter.com"));
-
-    assertEquals("http://www.twitter.com/this/is/a/http://stange/but/valid/path",
-        UrlHelper.addProtocol("http://www.twitter.com/this/is/a/http://stange/but/valid/path"));
-    assertEquals("http://www.twitter.com/this/is/a/http://stange/but/valid/path",
-        UrlHelper.addProtocol("www.twitter.com/this/is/a/http://stange/but/valid/path"));
-  }
-
-  @Test
-  public void testStripUrlParameters() {
-    assertEquals("www.twitter.com", UrlHelper.stripUrlParameters("www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.stripUrlParameters("www.twitter.com?foo-bar"));
-    assertEquals("www.twitter.com/a/b/",
-        UrlHelper.stripUrlParameters("www.twitter.com/a/b/?foo-bar"));
-
-    assertEquals("http://www.twitter.com", UrlHelper.stripUrlParameters("http://www.twitter.com"));
-    assertEquals("http://www.twitter.com",
-        UrlHelper.stripUrlParameters("http://www.twitter.com?foo=bar"));
-    assertEquals("http://www.twitter.com/a",
-        UrlHelper.stripUrlParameters("http://www.twitter.com/a?foo=bar"));
-  }
-
-  @Test
-  public void testGetDomainLevels() {
-    assertEquals(ImmutableList.of("www.fred", "fred"), UrlHelper.getDomainLevels("fred"));
-    assertEquals(ImmutableList.of("www.twitter.com", "twitter.com", "com"),
-        UrlHelper.getDomainLevels("www.twitter.com"));
-    assertEquals(ImmutableList.of("www.twitter.co.uk", "twitter.co.uk", "co.uk", "uk"),
-        UrlHelper.getDomainLevels("twitter.co.uk"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
deleted file mode 100644
index eb066fc..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * 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 org.apache.aurora.common.net;
-
-import org.apache.aurora.common.base.ExceptionalFunction;
-import org.apache.aurora.common.net.UrlResolver.ResolvedUrl;
-import org.apache.aurora.common.net.UrlResolver.ResolvedUrl.EndState;
-import org.apache.aurora.common.util.BackoffStrategy;
-import org.apache.aurora.common.util.Clock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static com.google.common.testing.junit4.JUnitAsserts.assertContentsInOrder;
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * @author John Sirois
- */
-public class UrlResolverTest {
-  private IMocksControl control;
-  private ExceptionalFunction<String, String, IOException> resolver;
-  private Clock clock;
-  private BackoffStrategy backoffStrategy;
-
-  @Before
-  public void setUp() throws Exception {
-    control = createControl();
-
-    @SuppressWarnings("unchecked")
-    ExceptionalFunction<String, String, IOException> resolver =
-        control.createMock(ExceptionalFunction.class);
-    this.resolver = resolver;
-    this.clock = control.createMock(Clock.class);
-    this.backoffStrategy = control.createMock(BackoffStrategy.class);
-  }
-
-  @Test
-  public void testResolveUrlResolved() throws Exception {
-    expect(resolver.apply("jake")).andReturn("jake");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlSingleRedirect() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("joe");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertEquals("joe", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlMultipleRedirects() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("bill");
-    expect(resolver.apply("bill")).andReturn("bob");
-    expect(resolver.apply("bob")).andReturn("fred");
-    expect(resolver.apply("fred")).andReturn("fred");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(5).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe", "bill", "bob");
-    assertEquals("fred", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlRedirectLimit() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("bill");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(2).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe");
-    assertEquals("bill", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REDIRECT_LIMIT, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlResolveError() throws Exception {
-    expect(resolver.apply("jake")).andThrow(new IOException());
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlResolveErrorCode() throws Exception {
-    expect(resolver.apply("jake")).andReturn(null);
-    expect(backoffStrategy.calculateBackoffMs(0L)).andReturn(1L);
-    clock.waitFor(1L);
-
-    expect(resolver.apply("jake")).andReturn(null);
-    expect(backoffStrategy.calculateBackoffMs(1L)).andReturn(2L);
-    clock.waitFor(2L);
-
-    expect(resolver.apply("jake")).andReturn(null);
-    // we shouldn't back off after the last attempt
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveStepsToPermanentError() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("fred");
-    expect(resolver.apply("fred")).andReturn(null);
-    // we shouldn't back off after the last attempt
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe");
-    assertEquals("fred", resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-  }
-
-  private UrlResolver createResolver(int maxRedirects) {
-    return new UrlResolver(clock, backoffStrategy, resolver, maxRedirects);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
deleted file mode 100644
index 3633da8..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * 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 org.apache.aurora.common.net;
-
-import com.google.common.base.Function;
-import com.google.common.testing.TearDown;
-import com.google.common.testing.junit4.TearDownTestCase;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.collections.Pair;
-import org.easymock.Capture;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URL;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * TODO(John Sirois): add test for error conditions
- *
- * @author John Sirois
- */
-public class UrlResolverUtilTest extends TearDownTestCase {
-  private static final String REDIRECT_LOCATION = "http://bar";
-
-  private IMocksControl control;
-  private Function<URL, String> urlToUA;
-  private Closure<Pair<HttpServletRequest, HttpServletResponse>> requestHandler;
-  private UrlResolverUtil urlResolverUtil;
-  private HttpServlet servlet;
-  private String url;
-
-  @Before
-  public void setUp() {
-    control = createControl();
-
-    @SuppressWarnings("unchecked")
-    Function<URL, String> urlToUA = control.createMock(Function.class);
-    this.urlToUA = urlToUA;
-
-    @SuppressWarnings("unchecked")
-    Closure<Pair<HttpServletRequest, HttpServletResponse>> handler =
-        control.createMock(Closure.class);
-    requestHandler = handler;
-
-    urlResolverUtil = new UrlResolverUtil(urlToUA);
-
-    servlet = new HttpServlet() {
-      @Override protected void service(HttpServletRequest req, HttpServletResponse resp)
-          throws ServletException, IOException {
-        requestHandler.execute(Pair.of(req, resp));
-      }
-    };
-  }
-
-  @Test
-  public void testUASelection() throws Exception {
-    url = startServer();
-    String redirectLocation = "http://bar.com";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(redirectLocation);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(redirectLocation, effectiveUrl);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRelativeRedirect() throws Exception {
-    url = startServer();
-    String relativeRedirect = "relatively/speaking";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(relativeRedirect);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(url + relativeRedirect, effectiveUrl);
-
-    control.verify();
-  }
-
-  @Test
-  public void testInvalidRedirect() throws Exception {
-    url = startServer();
-    String badRedirect = ":::<<<<<::IAMNOTAVALIDURI";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(badRedirect);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(badRedirect, effectiveUrl);
-
-    control.verify();
-  }
-
-  private void expectRequestAndRedirect(final String location) throws Exception {
-    final Capture<Pair<HttpServletRequest, HttpServletResponse>> requestCapture =
-        new Capture<Pair<HttpServletRequest, HttpServletResponse>>();
-    requestHandler.execute(capture(requestCapture));
-    expectLastCall().andAnswer(new IAnswer<Void>() {
-      @Override public Void answer() throws Throwable {
-        assertTrue(requestCapture.hasCaptured());
-        Pair<HttpServletRequest, HttpServletResponse> pair = requestCapture.getValue();
-
-        HttpServletRequest request = pair.getFirst();
-        assertEquals("HEAD", request.getMethod());
-        assertEquals("foo-agent", request.getHeader("User-Agent"));
-
-        pair.getSecond().sendRedirect(location);
-        return null;
-      }
-    });
-  }
-
-  private String startServer() throws Exception {
-    final Server server = new Server();
-    final SocketConnector connector = new SocketConnector();
-    connector.setHost("127.0.0.1");
-    connector.setPort(0);
-    server.addConnector(connector);
-
-    Context context = new Context(server, "/", Context.NO_SECURITY);
-    context.addServlet(new ServletHolder(servlet), "/*");
-    server.start();
-    addTearDown(new TearDown() {
-      @Override public void tearDown() throws Exception {
-        server.stop();
-      }
-    });
-
-    return "http://" + connector.getHost() + ":" + connector.getLocalPort() + "/";
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
deleted file mode 100644
index 6cc8abf..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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 org.apache.aurora.common.net;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Adam Samet
- */
-public class UrlTokenizerUtilTest {
-
-  @Test
-  public void testGetReversedDomainParts() {
-    List<String> list1 = Lists.newArrayList();
-    String url1 = "www.twitter.com";
-    list1.add("com");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 1));
-    list1.add("twitter");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 2));
-    list1.add("www");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 3));
-    list1.add("");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 4));
-    list1.add("");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 5));
-
-    List<String> list2 = Lists.newArrayList();
-    String url2 = "www.twitter.co.uk";
-    list2.add("co.uk");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 1));
-    list2.add("twitter");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 2));
-    list2.add("www");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 3));
-    list2.add("");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 4));
-    list2.add("");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 5));
-
-    List<String> list3 = Lists.newArrayList();
-    String url3= "www.twitter.co.ukNOT";
-    list3.add("ukNOT");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 1));
-    list3.add("co");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 2));
-    list3.add("twitter");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 3));
-    list3.add("www");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 4));
-    list3.add("");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 5));
-
-    assertEquals(Arrays.asList("co.jp", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.co.jp", 2));
-    assertEquals(Arrays.asList("co.jp", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.co.jp", 2));
-    assertEquals(Arrays.asList("com", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.com", 2));
-    assertEquals(Arrays.asList("com", "google", "news"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.com", 3));
-  }
-
-  @Test
-  public void testIsTLD() throws Exception {
-    assertTrue(UrlTokenizerUtil.isTLD("com.cn", false));
-    assertTrue(UrlTokenizerUtil.isTLD("com", false));
-    assertTrue(UrlTokenizerUtil.isTLD("co.jp", false));
-    assertTrue(UrlTokenizerUtil.isTLD("co.uk", false));
-    assertTrue(UrlTokenizerUtil.isTLD("uk.co", true));
-    assertTrue(UrlTokenizerUtil.isTLD("cn.com", true));
-    assertFalse(UrlTokenizerUtil.isTLD("google.co.uk", false));
-    assertFalse(UrlTokenizerUtil.isTLD("google.jp", false));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java b/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
deleted file mode 100644
index 3f2309b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * 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 org.apache.aurora.common.net.http;
-
-import java.util.logging.Level;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mortbay.jetty.HttpHeaders;
-import org.mortbay.jetty.HttpURI;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.RequestLog;
-import org.mortbay.jetty.Response;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.easymock.EasyMock.expect;
-
-public class RequestLoggerTest extends EasyMockTest {
-
-  private FakeClock clock;
-  private RequestLogger.LogSink sink;
-  private Request request;
-  private Response response;
-
-  private RequestLog log;
-
-  @Before
-  public void setUp() throws Exception {
-    clock = new FakeClock();
-    sink = createMock(RequestLogger.LogSink.class);
-    request = createMock(Request.class);
-    response = createMock(Response.class);
-    log = new RequestLogger(clock, sink);
-  }
-
-  @Test
-  public void testFormat200() throws Exception {
-    clock.advance(Amount.of(40L * 365, Time.DAYS));
-
-    expect(response.getStatus()).andReturn(200).atLeastOnce();
-    expect(request.getServerName()).andReturn("snoopy");
-    expect(request.getHeader(HttpHeaders.X_FORWARDED_FOR)).andReturn(null);
-    expect(request.getMethod()).andReturn("GET");
-    expect(request.getUri()).andReturn(new HttpURI("/"));
-    expect(request.getProtocol()).andReturn("http");
-    expect(response.getContentCount()).andReturn(256L);
-    expect(request.getRemoteAddr()).andReturn("easymock-test");
-    expect(request.getHeader(HttpHeaders.REFERER)).andReturn(null);
-    expect(request.getHeader(HttpHeaders.USER_AGENT)).andReturn("junit");
-    expect(request.getTimeStamp()).andReturn(clock.nowMillis()).atLeastOnce();
-
-    expect(sink.isLoggable(Level.FINE)).andReturn(true);
-    sink.log(Level.FINE, "snoopy easymock-test [22/Dec/2009:00:00:00 +0000]"
-        + " \"GET / http\" 200 256 \"-\" \"junit\" 110");
-
-    control.replay();
-
-    clock.advance(Amount.of(110L, Time.MILLISECONDS));
-    log.log(request, response);
-  }
-
-  @Test
-  public void testFormat500() throws Exception {
-    clock.advance(Amount.of(40L * 365, Time.DAYS));
-
-    expect(response.getStatus()).andReturn(500).atLeastOnce();
-    expect(request.getServerName()).andReturn("woodstock");
-    expect(request.getHeader(HttpHeaders.X_FORWARDED_FOR)).andReturn(null);
-    expect(request.getMethod()).andReturn("POST");
-    expect(request.getUri()).andReturn(new HttpURI("/data"));
-    expect(request.getProtocol()).andReturn("http");
-    expect(response.getContentCount()).andReturn(128L);
-    expect(request.getRemoteAddr()).andReturn("easymock-test");
-    expect(request.getHeader(HttpHeaders.REFERER)).andReturn(null);
-    expect(request.getHeader(HttpHeaders.USER_AGENT)).andReturn("junit");
-    expect(request.getTimeStamp()).andReturn(clock.nowMillis()).atLeastOnce();
-
-    expect(sink.isLoggable(Level.INFO)).andReturn(true);
-    sink.log(Level.INFO, "woodstock easymock-test [22/Dec/2009:00:00:00 +0000]"
-        + " \"POST /data http\" 500 128 \"-\" \"junit\" 500");
-
-    control.replay();
-
-    clock.advance(Amount.of(500L, Time.MILLISECONDS));
-    log.log(request, response);
-  }
-}


Mime
View raw message