You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/08/14 11:41:04 UTC

[servicecomb-pack] 08/21: SCB-1418 add test actorEventSink to KafkaChannelTest

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

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git

commit 0ef23fb5fd83eaf3b0218ae1607da6bf6bd093b0
Author: CMonkey <42...@gmail.com>
AuthorDate: Tue Aug 13 16:38:32 2019 +0800

    SCB-1418 add test actorEventSink to KafkaChannelTest
---
 .../pack/alpha/fsm/channel/kafka/test/KafkaChannelTest.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/alpha/alpha-fsm-channel-kafka/src/test/java/org/apache/servicecomb/pack/alpha/fsm/channel/kafka/test/KafkaChannelTest.java b/alpha/alpha-fsm-channel-kafka/src/test/java/org/apache/servicecomb/pack/alpha/fsm/channel/kafka/test/KafkaChannelTest.java
index 68d650a..942b16d 100644
--- a/alpha/alpha-fsm-channel-kafka/src/test/java/org/apache/servicecomb/pack/alpha/fsm/channel/kafka/test/KafkaChannelTest.java
+++ b/alpha/alpha-fsm-channel-kafka/src/test/java/org/apache/servicecomb/pack/alpha/fsm/channel/kafka/test/KafkaChannelTest.java
@@ -34,6 +34,8 @@ import org.springframework.test.context.junit4.SpringRunner;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
+import static org.junit.Assert.assertEquals;
+
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = KafkaApplication.class,
@@ -52,6 +54,9 @@ public class KafkaChannelTest {
     @Autowired
     private KafkaMessagePublisher kafkaMessagePublisher;
 
+    @Autowired
+    private KafkaActorEventSink actorEventSink;
+
     @Before
     public void setup(){
     }
@@ -66,11 +71,13 @@ public class KafkaChannelTest {
         buildData(globalTxId, localTxId_1, localTxId_2, localTxId_3).forEach(baseEvent -> kafkaMessagePublisher.publish(baseEvent));
 
         try {
-            TimeUnit.SECONDS.sleep(100);
+            // Waiting for sub
+            TimeUnit.SECONDS.sleep(5);
         } catch (InterruptedException e) {
-            e.printStackTrace();
         }
 
+        assertEquals(0, actorEventSink.countDownLatch.getCount());
+
     }
 
     private List<BaseEvent> buildData(String globalTxId, String localTxId_1, String localTxId_2, String localTxId_3){