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 2018/09/21 06:09:35 UTC

[incubator-servicecomb-saga] 04/06: SCB-923 Using the tcc/events services in tcc accept test

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/incubator-servicecomb-saga.git

commit 94e19b59dba215109c0b20391487c281369e890f
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Fri Sep 21 10:02:53 2018 +0800

    SCB-923 Using the tcc/events services in tcc accept test
---
 .../java/org/apache/servicecomb/saga/PackStepdefs.java    | 15 +++++++--------
 .../src/test/resources/pack_tcc_cancel_scenario.feature   |  8 ++++++++
 .../src/test/resources/pack_tcc_confirm_scenario.feature  |  8 ++++++++
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
index 2a70d9b..7c56eab 100644
--- a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
+++ b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
@@ -91,16 +91,15 @@ public class PackStepdefs implements En {
       // Need to wait for a while to let the confirm or cannel command finished.
       Thread.sleep(2000);
     });
-
-    //TODO need to check the events from the alpha
-    /*Then("^Alpha records the following events$", (DataTable dataTable) -> {
+    
+    Then("^Alpha records the following events$", (DataTable dataTable) -> {
       Consumer<Map<String, String>[]> columnStrippingConsumer = dataMap -> {
         for (Map<String, String> map : dataMap)
           map.keySet().retainAll(dataTable.topCells());
       };
 
-      dataMatches(System.getProperty(ALPHA_REST_ADDRESS) + "/events", dataTable, columnStrippingConsumer);
-    });*/
+      dataMatches(System.getProperty(ALPHA_REST_ADDRESS) + "/tcc/events", dataTable, columnStrippingConsumer);
+    });
 
     Then("^Inventory Service contains the following booking orders$", (DataTable dataTable) -> {
       dataMatches(System.getProperty(INVENTORY_SERVICE_ADDRESS) + INVENTORY_ORDERS_URI, dataTable, NO_OP_CONSUMER);
@@ -122,11 +121,11 @@ public class PackStepdefs implements En {
           .statusCode(is(200));
     }
 
-    /*given()
+    given()
         .when()
-        .delete(System.getProperty(ALPHA_REST_ADDRESS) + "/events")
+        .delete(System.getProperty(ALPHA_REST_ADDRESS) + "/tcc/events")
         .then()
-        .statusCode(is(200));*/
+        .statusCode(is(200));
 
   }
 
diff --git a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_cancel_scenario.feature b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_cancel_scenario.feature
index 38fb9dd..ce50cb3 100644
--- a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_cancel_scenario.feature
+++ b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_cancel_scenario.feature
@@ -23,6 +23,14 @@ Feature: Alpha records transaction events
 
     When User UserC requests to order 2 units of ProductA with unit price 2 fail
 
+    Then Alpha records the following events
+      | serviceName  | txType             |
+      | ordering     | STARTED            |
+      | inventory    | PARTICIPATED       |
+      | payment      | PARTICIPATED       |
+      | ordering     | ENDED              |
+      | inventory    | COORDINATED        |
+
     Then Inventory Service contains the following booking orders
       | userName | productName | units | confirmed | cancelled |
       | UserC    | ProductA    |  2    | false     |  true     |
diff --git a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_confirm_scenario.feature b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_confirm_scenario.feature
index 87ba508..40886c2 100644
--- a/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_confirm_scenario.feature
+++ b/acceptance-tests/acceptance-pack-tcc-spring-demo/src/test/resources/pack_tcc_confirm_scenario.feature
@@ -23,6 +23,14 @@ Feature: Alpha records transaction events
 
     When User UserA requests to order 2 units of ProductA with unit price 2 success
 
+    Then Alpha records the following events
+      | serviceName  | txType             |
+      | ordering     | STARTED            |
+      | inventory    | PARTICIPATED       |
+      | payment      | PARTICIPATED       |
+      | ordering     | ENDED              |
+      | inventory    | COORDINATED        |
+      | payment      | COORDINATED        |
 
     And Inventory Service contains the following booking orders
       | userName | productName | units | confirmed | cancelled |