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/01/24 15:12:47 UTC

[incubator-servicecomb-saga] 01/07: SCB-237 skeleton for pack acceptance tests

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 7100b7942ea4336ac0994522d5a78a331dc594e5
Author: seanyinx <se...@huawei.com>
AuthorDate: Tue Jan 23 15:25:13 2018 +0800

    SCB-237 skeleton for pack acceptance tests
    
    Signed-off-by: seanyinx <se...@huawei.com>
---
 acceptance-tests/acceptance-pack/pom.xml           | 31 ++++++++++++
 .../org/apache/servicecomb/saga/PackStepdefs.java  | 45 +++++++++++++++++
 .../apache/servicecomb/saga/RunCucumberTest.java   | 29 +++++++++++
 .../test/resources/pack_success_scenario.feature   | 16 ++++++
 acceptance-tests/pom.xml                           | 58 ++++++++++++++++++++++
 pom.xml                                            |  1 +
 6 files changed, 180 insertions(+)

diff --git a/acceptance-tests/acceptance-pack/pom.xml b/acceptance-tests/acceptance-pack/pom.xml
new file mode 100644
index 0000000..5401ab5
--- /dev/null
+++ b/acceptance-tests/acceptance-pack/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>acceptance-tests</artifactId>
+    <groupId>org.apache.servicecomb.saga</groupId>
+    <version>0.0.3-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>acceptance-pack</artifactId>
+
+</project>
diff --git a/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
new file mode 100644
index 0000000..fd98536
--- /dev/null
+++ b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.saga;
+
+import cucumber.api.PendingException;
+import cucumber.api.java8.En;
+
+public class PackStepdefs implements En {
+  public PackStepdefs() {
+    Given("^Car Service is up and running$", () -> {
+      // Write code here that turns the phrase above into concrete actions
+      throw new PendingException();
+    });
+
+    And("^Hotel Service is up and running$", () -> {
+      // Write code here that turns the phrase above into concrete actions
+      throw new PendingException();
+    });
+
+    When("^A booking transaction is received$", () -> {
+      // Write code here that turns the phrase above into concrete actions
+      throw new PendingException();
+    });
+
+    Then("^Alpha records the following events$", () -> {
+      // Write code here that turns the phrase above into concrete actions
+      throw new PendingException();
+    });
+  }
+}
diff --git a/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/RunCucumberTest.java b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/RunCucumberTest.java
new file mode 100644
index 0000000..d4e2b43
--- /dev/null
+++ b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/RunCucumberTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.saga;
+
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(plugin = {"pretty", "html:target/cucumber"},
+    features = "src/test/resources")
+public class RunCucumberTest {
+}
diff --git a/acceptance-tests/acceptance-pack/src/test/resources/pack_success_scenario.feature b/acceptance-tests/acceptance-pack/src/test/resources/pack_success_scenario.feature
new file mode 100644
index 0000000..270e8ba
--- /dev/null
+++ b/acceptance-tests/acceptance-pack/src/test/resources/pack_success_scenario.feature
@@ -0,0 +1,16 @@
+Feature: Alpha records transaction events
+
+  Scenario: Everything is normal
+    Given Car Service is up and running
+    And Hotel Service is up and running
+
+    When A booking transaction is received
+
+    Then Alpha records the following events
+      | event type       |
+      | SagaStartedEvent |
+      | TxStartedEvent   |
+      | TxEndedEvent     |
+      | TxStartedEvent   |
+      | TxEndedEvent     |
+      | SagaEndedEvent   |
diff --git a/acceptance-tests/pom.xml b/acceptance-tests/pom.xml
new file mode 100644
index 0000000..0c41f81
--- /dev/null
+++ b/acceptance-tests/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>saga</artifactId>
+    <groupId>org.apache.servicecomb.saga</groupId>
+    <version>0.0.3-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>acceptance-tests</artifactId>
+  <packaging>pom</packaging>
+  <modules>
+    <module>acceptance-pack</module>
+  </modules>
+
+  <properties>
+    <cucumber.version>2.3.1</cucumber.version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>io.cucumber</groupId>
+      <artifactId>cucumber-java8</artifactId>
+      <version>${cucumber.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.cucumber</groupId>
+      <artifactId>cucumber-junit</artifactId>
+      <version>${cucumber.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/pom.xml b/pom.xml
index dbd748e..9939b7f 100755
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,7 @@
     <module>pack-common</module>
     <module>integration-tests</module>
     <module>saga-persistence</module>
+    <module>acceptance-tests</module>
   </modules>
 
   <properties>

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.