This is an automated email from the ASF dual-hosted git repository.

thw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apex-malhar.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ef615b  
APEXMALHAR-2546.Mocking-dependencies-should-be-part-of-parent-pom
2ef615b is described below

commit 2ef615b86be6d426252bd2e1ae6996bdba475239
Author: Ananth <ananthg.a...@gmail.com>
AuthorDate: Fri Oct 6 05:34:43 2017 +1100

    APEXMALHAR-2546.Mocking-dependencies-should-be-part-of-parent-pom
---
 .../apache/apex/malhar/flume/sink/FlumeSinkTest.java   | 18 ++++++++++++++----
 kudu/pom.xml                                           | 12 ------------
 pom.xml                                                | 12 ++++++++++--
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git 
a/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java 
b/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
index e1bc7b8..e7007cb 100644
--- a/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
+++ b/flume/src/test/java/org/apache/apex/malhar/flume/sink/FlumeSinkTest.java
@@ -54,12 +54,20 @@ public class FlumeSinkTest
       @Override
       public synchronized void unadvertise(Service<byte[]> service)
       {
+        logger.info("Unadvertise invoked");
         notify();
       }
 
       @Override
       public synchronized void advertise(Service<byte[]> service)
       {
+        logger.info("Advertise invoked");
+        // There is a race condition that is breaking the test (Advertise 
invoked before discover started, hence sleep
+        try {
+          Thread.sleep(1000);
+        } catch (InterruptedException e) {
+          logger.warn("Not able to sleep because of interruption " + 
e.getMessage(),e);
+        }
         port = service.getPort();
         logger.debug("listening at {}", service);
         notify();
@@ -69,8 +77,10 @@ public class FlumeSinkTest
       @SuppressWarnings("unchecked")
       public synchronized Collection<Service<byte[]>> discover()
       {
+        logger.info("Discover invoked");
         try {
           wait();
+          logger.info("Discover wait completed");
         } catch (InterruptedException ie) {
           throw new RuntimeException(ie);
         }
@@ -78,6 +88,8 @@ public class FlumeSinkTest
       }
 
     };
+    DefaultEventLoop eventloop = new DefaultEventLoop("Eventloop-TestClient");
+    eventloop.start();
     FlumeSink sink = new FlumeSink();
     sink.setName("TeskSink");
     sink.setHostname(hostname);
@@ -86,6 +98,7 @@ public class FlumeSinkTest
     sink.setChannel(new MemoryChannel());
     sink.setDiscovery(discovery);
     sink.start();
+    logger.info("Sink started");
     AbstractLengthPrependerClient client = new AbstractLengthPrependerClient()
     {
       private byte[] array;
@@ -119,12 +132,10 @@ public class FlumeSinkTest
         array[offset + 8] = 8;
         Server.writeLong(array, offset + Server.Request.TIME_OFFSET, 
System.currentTimeMillis());
         write(array, offset, Server.Request.FIXED_SIZE);
+        logger.info("Connect complete");
       }
 
     };
-
-    DefaultEventLoop eventloop = new DefaultEventLoop("Eventloop-TestClient");
-    eventloop.start();
     discovery.discover();
     try {
       eventloop.connect(new InetSocketAddress(hostname, port), client);
@@ -138,7 +149,6 @@ public class FlumeSinkTest
     } finally {
       eventloop.stop();
     }
-
     sink.stop();
   }
 
diff --git a/kudu/pom.xml b/kudu/pom.xml
index 2b518ae..cef5909 100755
--- a/kudu/pom.xml
+++ b/kudu/pom.xml
@@ -140,18 +140,6 @@
       <classifier>jdk7</classifier><!-- Set classifier to jdk8 when malhar 
switches to JDK 8 -->
     </dependency>
     <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <version>2.8.47</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
-      <version>1.7.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.powermock</groupId>
       <artifactId>powermock-api-mockito2</artifactId>
       <version>1.7.1</version>
diff --git a/pom.xml b/pom.xml
index d824587..34d800f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,8 @@
     <apex.core.version>3.6.0</apex.core.version>
     <semver.plugin.skip>false</semver.plugin.skip>
     <surefire.args>-Xmx2048m</surefire.args>
+    <mockito-version>2.8.47</mockito-version>
+    <power-mock-version>1.7.1</power-mock-version>
   </properties>
 
   <build>
@@ -227,8 +229,8 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <version>1.8.5</version>
+      <artifactId>mockito-core</artifactId>
+      <version>${mockito-version}</version>
       <scope>test</scope>
       <exclusions>
         <exclusion>
@@ -237,6 +239,12 @@
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>org.powermock</groupId>
+      <artifactId>powermock-module-junit4</artifactId>
+      <version>${power-mock-version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

-- 
To stop receiving notification emails like this one, please contact
['"commits@apex.apache.org" <commits@apex.apache.org>'].

Reply via email to