mynameborat commented on code in PR #1652:
URL: https://github.com/apache/samza/pull/1652#discussion_r1092293902


##########
samza-log4j2/src/test/java/org/apache/samza/logging/log4j2/TestStreamAppender.java:
##########
@@ -444,6 +486,36 @@ private void logRecursivelyAndVerifyMessages(List<String> 
messages) throws Inter
     assertEquals(messages.size(), MockSystemProducer.messagesReceived.size());
   }
 
+  private void SetupSystemTimeoutAndVerifyMessages(long setUpSystemTime) 
throws InterruptedException {
+    MockSystemProducer.listeners.clear();
+    MockSystemAdmin.listeners.clear();
+    List<String> messages = Lists.newArrayList("testing1", "testing2");
+    // Set up latch
+    final CountDownLatch allMessagesSent = new CountDownLatch(messages.size());
+    MockSystemProducer.listeners.add((source, envelope) -> 
allMessagesSent.countDown());
+    MockSystemAdmin.listeners.add(streamSpec -> {
+      try {
+        // mock setUpSystem time during createStream() call
+        sleep(setUpSystemTime);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+    });
+    ExecutorService service0 = Executors.newFixedThreadPool(1);
+    ExecutorService service1 = Executors.newFixedThreadPool(1);
+    // Log the messages with two threads
+    service0.submit(()->LOG.info(messages.get(0)));
+    service1.submit(()->LOG.info(messages.get(1)));

Review Comment:
   precisely why I asked to add jitter to also cover the base that ordering 
doesn't matter as long as the messages emitted meets the criteria.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to