[ 
https://issues.apache.org/jira/browse/SCB-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309672#comment-16309672
 ] 

ASF GitHub Bot commented on SCB-138:
------------------------------------

WillemJiang commented on a change in pull request #98: SCB-138 use grpc 
bidirectional streaming to connect alpha and omega
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/98#discussion_r159429102
 
 

 ##########
 File path: 
alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
 ##########
 @@ -95,119 +103,86 @@ public void persistsEvent() throws Exception {
     assertThat(envelope.globalTxId(), is(globalTxId));
     assertThat(envelope.localTxId(), is(localTxId));
     assertThat(envelope.parentTxId(), is(parentTxId));
-    assertThat(envelope.type(), Is.is(EventType.TxStartedEvent.name()));
+    assertThat(envelope.type(), Is.is(TxStartedEvent.name()));
     assertThat(envelope.compensationMethod(), is(compensationMethod));
     assertThat(envelope.payloads(), is(payload.getBytes()));
   }
 
   @Test
-  public void doNotCompensateDuplicateTxOnFailure() throws Exception {
+  public void doNotCompensateDuplicateTxOnFailure() {
     // duplicate events with same content but different timestamp
-    eventRepo.save(eventEnvelopeOf(EventType.TxStartedEvent, localTxId, 
parentTxId, "service a".getBytes(), "method a"));
-    eventRepo.save(eventEnvelopeOf(EventType.TxStartedEvent, localTxId, 
parentTxId, "service a".getBytes(), "method a"));
-    eventRepo.save(eventEnvelopeOf(EventType.TxEndedEvent, new byte[0], 
"method a"));
+    StreamObserver<GrpcTxEvent> requestObserver = 
stub.callbackCommand(compensateResponseObserver);
+    requestObserver.onNext(eventOf(TxStartedEvent, localTxId, parentTxId, 
"service a".getBytes(), "method a"));
+    requestObserver.onNext(eventOf(TxStartedEvent, localTxId, parentTxId, 
"service a".getBytes(), "method a"));
+    requestObserver.onNext(eventOf(TxEndedEvent, new byte[0], "method a"));
 
     String localTxId1 = UUID.randomUUID().toString();
-    eventRepo.save(eventEnvelopeOf(EventType.TxStartedEvent, localTxId1, 
UUID.randomUUID().toString(), "service b".getBytes(), "method b"));
-    eventRepo.save(eventEnvelopeOf(EventType.TxEndedEvent, new byte[0], 
"method b"));
-
-    stub.reportEvent(someGrpcEvent(EventType.TxAbortedEvent));
-
-    await().atMost(1, SECONDS).until(() -> compensationContexts.size() > 1);
-    assertThat(compensationContexts, containsInAnyOrder(
-        new CompensationContext(globalTxId, this.localTxId, "method a", 
"service a".getBytes()),
-        new CompensationContext(globalTxId, localTxId1, "method b", "service 
b".getBytes())
+    String parentTxId1 = UUID.randomUUID().toString();
+    requestObserver.onNext(eventOf(TxStartedEvent, localTxId1, parentTxId1, 
"service b".getBytes(), "method b"));
+    requestObserver.onNext(eventOf(TxEndedEvent, new byte[0], "method b"));
+
+    requestObserver.onNext(someGrpcEvent(TxAbortedEvent));
+
+    await().atMost(1, SECONDS).until(() -> receivedCommands.size() > 1);
+    System.out.println(receivedCommands.size());
 
 Review comment:
   Please don't use the System.out here to verify the result.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [pack] omega's callback about transaction state
> -----------------------------------------------
>
>                 Key: SCB-138
>                 URL: https://issues.apache.org/jira/browse/SCB-138
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>          Components: Saga
>            Reporter: Eric Lee
>            Assignee: Eric Lee
>             Fix For: java-chassis-1.0.0-m1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> as a dev, i want to register callback function in the server side, so the 
> server can send messages back to the client directly instead of establishing 
> a new connection to the exact client with its corresponding uri.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to