jia-gao commented on code in PR #1652:
URL: https://github.com/apache/samza/pull/1652#discussion_r1092296612
##########
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:
oh ok, thanks for clarifying. will add it
--
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]