Fix build failures after master merge
authorShanthoosh Venkataraman <svenkataraman@linkedin.com>
Wed, 26 Jul 2017 00:04:53 +0000 (17:04 -0700)
committernavina <navina@apache.org>
Wed, 26 Jul 2017 00:04:53 +0000 (17:04 -0700)
Changes
* Fix checkstyle errors from #243
* Fix failure after bad merge in #244

Author: Shanthoosh Venkataraman <svenkataraman@linkedin.com>

Reviewers: Navina Ramesh <navina@apache.org>

Closes #252 from shanthoosh/fix_NPE_after_master_merge

samza-core/src/test/java/org/apache/samza/clustermanager/MockContainerAllocator.java
samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerProcessManager.java
samza-core/src/test/java/org/apache/samza/zk/TestZkJobCoordinator.java

index 449b484..0c78b5e 100644 (file)
@@ -23,7 +23,6 @@ import org.apache.samza.config.Config;
 import java.lang.reflect.Field;
 
 import java.util.Map;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
index 6978341..4288aea 100644 (file)
@@ -255,7 +255,7 @@ public class TestContainerProcessManager {
 
     // Allow container to run and update state
 
-    if (!allocator.awaitContainersStart(1,2, TimeUnit.SECONDS)) {
+    if (!allocator.awaitContainersStart(1, 2, TimeUnit.SECONDS)) {
       fail("timed out waiting for the containers to start");
     }
     assertFalse(taskManager.shouldShutdown());
@@ -374,7 +374,7 @@ public class TestContainerProcessManager {
     taskManager.onResourceAllocated(container);
 
     // Allow container to run and update state
-    if (!allocator.awaitContainersStart(1,2, TimeUnit.SECONDS)) {
+    if (!allocator.awaitContainersStart(1, 2, TimeUnit.SECONDS)) {
       fail("timed out waiting for the containers to start");
     }
 
index 9b5210f..fd6065a 100644 (file)
@@ -19,6 +19,7 @@
 package org.apache.samza.zk;
 
 import java.util.HashMap;
+import org.I0Itec.zkclient.ZkClient;
 import org.apache.samza.config.MapConfig;
 import org.apache.samza.job.model.JobModel;
 import org.apache.samza.util.NoOpMetricsRegistry;
@@ -32,10 +33,12 @@ public class TestZkJobCoordinator {
   @Test
   public void testFollowerShouldStopWhenNotPartOfGeneratedJobModel() {
     ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class);
+    ZkClient mockZkClient = Mockito.mock(ZkClient.class);
     Mockito.when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT);
 
     ZkUtils zkUtils = Mockito.mock(ZkUtils.class);
     Mockito.when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder);
+    Mockito.when(zkUtils.getZkClient()).thenReturn(mockZkClient);
     Mockito.when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(new JobModel(new MapConfig(), new HashMap<>()));
 
     ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator(new MapConfig(), new NoOpMetricsRegistry(), zkUtils));