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/06/01 05:53:34 UTC
[incubator-servicecomb-saga] branch master updated: SCB-632
reformat code according to google style
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
The following commit(s) were added to refs/heads/master by this push:
new e9c53ba SCB-632 reformat code according to google style
e9c53ba is described below
commit e9c53bafa44280e29e3141ed1e138387f48ee581
Author: Eric Lee <er...@gmail.com>
AuthorDate: Fri Jun 1 12:13:34 2018 +0800
SCB-632 reformat code according to google style
---
acceptance-tests/acceptance-dubbo-demo/pom.xml | 612 ++++++++++-----------
.../acceptance/dubbodemo/DubboDemoStepdefs.java | 75 +--
.../saga/acceptance/dubbodemo/RunCucumberIT.java | 4 +-
saga-demo/saga-dubbo-demo/pom.xml | 195 +++----
saga-demo/saga-dubbo-demo/service-api/pom.xml | 32 +-
.../servicecomb/saga/demo/dubbo/api/IService.java | 1 +
saga-demo/saga-dubbo-demo/service-pub/pom.xml | 18 +-
.../saga/demo/dubbo/pub/AbsService.java | 24 +-
.../saga/demo/dubbo/pub/IInvokeCode.java | 32 +-
.../saga/demo/dubbo/pub/InvokeContext.java | 73 ++-
.../servicecomb/saga/demo/dubbo/pub/ServiceVO.java | 44 +-
saga-demo/saga-dubbo-demo/servicea/pom.xml | 124 ++---
.../saga/demo/dubbo/servicea/ApplicationA.java | 2 +-
.../saga/demo/dubbo/servicea/ServiceA.java | 73 ++-
.../servicea/src/main/resources/dubbo-context.xml | 24 +-
.../servicea/src/main/resources/jdbc.xml | 12 +-
.../servicea/src/main/resources/static/index.html | 39 +-
saga-demo/saga-dubbo-demo/serviceb/pom.xml | 116 ++--
.../saga/demo/dubbo/serviceb/ServiceB.java | 61 +-
.../serviceb/src/main/resources/dubbo-context.xml | 22 +-
.../serviceb/src/main/resources/jdbc.xml | 12 +-
saga-demo/saga-dubbo-demo/servicec/pom.xml | 116 ++--
.../saga/demo/dubbo/servicec/ApplicationC.java | 2 +-
.../saga/demo/dubbo/servicec/ServiceC.java | 59 +-
.../servicec/src/main/resources/dubbo-context.xml | 18 +-
.../servicec/src/main/resources/jdbc.xml | 12 +-
saga-demo/saga-spring-cloud-demo/pom.xml | 2 +-
27 files changed, 905 insertions(+), 899 deletions(-)
diff --git a/acceptance-tests/acceptance-dubbo-demo/pom.xml b/acceptance-tests/acceptance-dubbo-demo/pom.xml
index 85500d4..47f61d1 100644
--- a/acceptance-tests/acceptance-dubbo-demo/pom.xml
+++ b/acceptance-tests/acceptance-dubbo-demo/pom.xml
@@ -17,314 +17,314 @@
-->
<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.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <name>Saga:Acceptance Tests::DubboDemo</name>
- <artifactId>acceptance-dubbo-demo</artifactId>
+ 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.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <name>Saga:Acceptance Tests::DubboDemo</name>
+ <artifactId>acceptance-dubbo-demo</artifactId>
- <dependencies>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ </dependencies>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <images>
- <image>
- <name>docker.io/zookeeper</name>
- <alias>zookeeper</alias>
- <run>
- <ports>
- <port>zk.port:2181</port>
- </ports>
- </run>
- </image>
- <image>
- <name>postgres</name>
- <alias>postgres</alias>
- <run>
- <env>
- <POSTGRES_DB>saga</POSTGRES_DB>
- <POSTGRES_USER>saga</POSTGRES_USER>
- <POSTGRES_PASSWORD>password</POSTGRES_PASSWORD>
- </env>
- <wait>
- <log>database system is ready to accept connections</log>
- <tcp>
- <ports>
- <port>5432</port>
- </ports>
- </tcp>
- <time>60000</time>
- </wait>
- <ports>
- <port>postgres.port:5432</port>
- </ports>
- </run>
- </image>
- <image>
- <name>alpha-server:${project.version}</name>
- <alias>alpha</alias>
- <run>
- <env>
- <JAVA_OPTS>
- -Dspring.profiles.active=prd -Dspring.datasource.initialization-mode=always
- </JAVA_OPTS>
- </env>
- <links>
- <link>postgres:postgresql.servicecomb.io</link>
- </links>
- <wait>
- <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
- <tcp>
- <ports>
- <port>8080</port>
- <port>8090</port>
- </ports>
- </tcp>
- <time>120000</time>
- </wait>
- <ports>
- <port>alpha.port:8080</port>
- <port>alpha.rest.port:8090</port>
- </ports>
- <dependsOn>
- <container>postgres</container>
- </dependsOn>
- </run>
- </image>
- <image>
- <name>servicea:${project.version}</name>
- <alias>servicea</alias>
- <run>
- <env>
- <JAVA_OPTS>
- -Dspring.profiles.active=prd
- -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
- -Dspring.datasource.username=saga
- -Dspring.datasource.password=password
- -Dzookeeper.url=zookeeper.servicecomb.io:2181
- -Dserver.port=8071
- -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
- -Dspring.datasource.initialization-mode=always
- </JAVA_OPTS>
- </env>
- <wait>
- <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
- <tcp>
- <ports>
- <port>8071</port>
- </ports>
- </tcp>
- <time>120000</time>
- </wait>
- <links>
- <link>postgres:postgresql.servicecomb.io</link>
- <link>alpha:alpha-server.servicecomb.io</link>
- <link>zookeeper:zookeeper.servicecomb.io</link>
- </links>
- <ports>
- <port>servicea.port:8071</port>
- </ports>
- <dependsOn>
- <container>postgres</container>
- <container>alpha</container>
- <container>zookeeper</container>
- </dependsOn>
- </run>
- </image>
- <image>
- <name>serviceb:${project.version}</name>
- <alias>serviceb</alias>
- <run>
- <env>
- <JAVA_OPTS>
- -Dspring.profiles.active=prd
- -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
- -Dspring.datasource.username=saga
- -Dspring.datasource.password=password
- -Dzookeeper.url=zookeeper.servicecomb.io:2181
- -Dserver.port=8072
- -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
- -Dspring.datasource.initialization-mode=always
- </JAVA_OPTS>
- </env>
- <wait>
- <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
- <tcp>
- <ports>
- <port>8072</port>
- </ports>
- </tcp>
- <time>120000</time>
- </wait>
- <links>
- <link>postgres:postgresql.servicecomb.io</link>
- <link>alpha:alpha-server.servicecomb.io</link>
- <link>zookeeper:zookeeper.servicecomb.io</link>
- </links>
- <ports>
- <port>serviceb.port:8072</port>
- </ports>
- <dependsOn>
- <container>postgres</container>
- <container>alpha</container>
- <container>zookeeper</container>
- </dependsOn>
- </run>
- </image>
- <image>
- <name>servicec:${project.version}</name>
- <alias>servicec</alias>
- <run>
- <env>
- <JAVA_OPTS>
- -Dspring.profiles.active=prd
- -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
- -Dspring.datasource.username=saga
- -Dspring.datasource.password=password
- -Dzookeeper.url=zookeeper.servicecomb.io:2181
- -Dserver.port=8073
- -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
- -Dspring.datasource.initialization-mode=always
- </JAVA_OPTS>
- </env>
- <wait>
- <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
- <tcp>
- <ports>
- <port>8073</port>
- </ports>
- </tcp>
- <time>120000</time>
- </wait>
- <links>
- <link>postgres:postgresql.servicecomb.io</link>
- <link>alpha:alpha-server.servicecomb.io</link>
- <link>zookeeper:zookeeper.servicecomb.io</link>
- </links>
- <ports>
- <port>servicec.port:8073</port>
- </ports>
- <dependsOn>
- <container>postgres</container>
- <container>alpha</container>
- <container>zookeeper</container>
- </dependsOn>
- </run>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>start</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-default-properties</id>
- <phase>initialize</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
- project.properties.setProperty('docker.hostname', 'localhost')
- log.info("Docker hostname is " + project.properties['docker.hostname'])
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${maven.failsafe.version}</version>
- <configuration>
- <systemPropertyVariables>
- <alpha.cluster.address>
- http://${docker.hostname}:${alpha.port}
- </alpha.cluster.address>
- <alpha.rest.address>
- http://${docker.hostname}:${alpha.rest.port}
- </alpha.rest.address>
- <servicea.address>
- http://${docker.hostname}:${servicea.port}
- </servicea.address>
- <serviceb.address>
- http://${docker.hostname}:${serviceb.port}
- </serviceb.address>
- <servicec.address>
- http://${docker.hostname}:${servicec.port}
- </servicec.address>
- <spring.datasource.url>
- jdbc:postgresql://${docker.hostname}:${postgres.port}/saga?useSSL=false
- </spring.datasource.url>
- <info.service.uri>
- ${info.service.uri}
- </info.service.uri>
- </systemPropertyVariables>
- <argLine>${jacoco.failsafe.argLine}</argLine>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.ethlo.persistence.tools</groupId>
- <artifactId>eclipselink-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>spring-boot-2</id>
- <properties>
- <info.service.uri>/actuator/info</info.service.uri>
- </properties>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <images>
+ <image>
+ <name>docker.io/zookeeper</name>
+ <alias>zookeeper</alias>
+ <run>
+ <ports>
+ <port>zk.port:2181</port>
+ </ports>
+ </run>
+ </image>
+ <image>
+ <name>postgres</name>
+ <alias>postgres</alias>
+ <run>
+ <env>
+ <POSTGRES_DB>saga</POSTGRES_DB>
+ <POSTGRES_USER>saga</POSTGRES_USER>
+ <POSTGRES_PASSWORD>password</POSTGRES_PASSWORD>
+ </env>
+ <wait>
+ <log>database system is ready to accept connections</log>
+ <tcp>
+ <ports>
+ <port>5432</port>
+ </ports>
+ </tcp>
+ <time>60000</time>
+ </wait>
+ <ports>
+ <port>postgres.port:5432</port>
+ </ports>
+ </run>
+ </image>
+ <image>
+ <name>alpha-server:${project.version}</name>
+ <alias>alpha</alias>
+ <run>
+ <env>
+ <JAVA_OPTS>
+ -Dspring.profiles.active=prd -Dspring.datasource.initialization-mode=always
+ </JAVA_OPTS>
+ </env>
+ <links>
+ <link>postgres:postgresql.servicecomb.io</link>
+ </links>
+ <wait>
+ <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
+ <tcp>
+ <ports>
+ <port>8080</port>
+ <port>8090</port>
+ </ports>
+ </tcp>
+ <time>120000</time>
+ </wait>
+ <ports>
+ <port>alpha.port:8080</port>
+ <port>alpha.rest.port:8090</port>
+ </ports>
+ <dependsOn>
+ <container>postgres</container>
+ </dependsOn>
+ </run>
+ </image>
+ <image>
+ <name>servicea:${project.version}</name>
+ <alias>servicea</alias>
+ <run>
+ <env>
+ <JAVA_OPTS>
+ -Dspring.profiles.active=prd
+ -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
+ -Dspring.datasource.username=saga
+ -Dspring.datasource.password=password
+ -Dzookeeper.url=zookeeper.servicecomb.io:2181
+ -Dserver.port=8071
+ -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
+ -Dspring.datasource.initialization-mode=always
+ </JAVA_OPTS>
+ </env>
+ <wait>
+ <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
+ <tcp>
+ <ports>
+ <port>8071</port>
+ </ports>
+ </tcp>
+ <time>120000</time>
+ </wait>
+ <links>
+ <link>postgres:postgresql.servicecomb.io</link>
+ <link>alpha:alpha-server.servicecomb.io</link>
+ <link>zookeeper:zookeeper.servicecomb.io</link>
+ </links>
+ <ports>
+ <port>servicea.port:8071</port>
+ </ports>
+ <dependsOn>
+ <container>postgres</container>
+ <container>alpha</container>
+ <container>zookeeper</container>
+ </dependsOn>
+ </run>
+ </image>
+ <image>
+ <name>serviceb:${project.version}</name>
+ <alias>serviceb</alias>
+ <run>
+ <env>
+ <JAVA_OPTS>
+ -Dspring.profiles.active=prd
+ -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
+ -Dspring.datasource.username=saga
+ -Dspring.datasource.password=password
+ -Dzookeeper.url=zookeeper.servicecomb.io:2181
+ -Dserver.port=8072
+ -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
+ -Dspring.datasource.initialization-mode=always
+ </JAVA_OPTS>
+ </env>
+ <wait>
+ <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
+ <tcp>
+ <ports>
+ <port>8072</port>
+ </ports>
+ </tcp>
+ <time>120000</time>
+ </wait>
+ <links>
+ <link>postgres:postgresql.servicecomb.io</link>
+ <link>alpha:alpha-server.servicecomb.io</link>
+ <link>zookeeper:zookeeper.servicecomb.io</link>
+ </links>
+ <ports>
+ <port>serviceb.port:8072</port>
+ </ports>
+ <dependsOn>
+ <container>postgres</container>
+ <container>alpha</container>
+ <container>zookeeper</container>
+ </dependsOn>
+ </run>
+ </image>
+ <image>
+ <name>servicec:${project.version}</name>
+ <alias>servicec</alias>
+ <run>
+ <env>
+ <JAVA_OPTS>
+ -Dspring.profiles.active=prd
+ -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb.io:5432/saga
+ -Dspring.datasource.username=saga
+ -Dspring.datasource.password=password
+ -Dzookeeper.url=zookeeper.servicecomb.io:2181
+ -Dserver.port=8073
+ -Dalpha.cluster.address=alpha-server.servicecomb.io:8080
+ -Dspring.datasource.initialization-mode=always
+ </JAVA_OPTS>
+ </env>
+ <wait>
+ <log>Started [a-zA-Z]+ in [0-9.]+ seconds</log>
+ <tcp>
+ <ports>
+ <port>8073</port>
+ </ports>
+ </tcp>
+ <time>120000</time>
+ </wait>
+ <links>
+ <link>postgres:postgresql.servicecomb.io</link>
+ <link>alpha:alpha-server.servicecomb.io</link>
+ <link>zookeeper:zookeeper.servicecomb.io</link>
+ </links>
+ <ports>
+ <port>servicec.port:8073</port>
+ </ports>
+ <dependsOn>
+ <container>postgres</container>
+ <container>alpha</container>
+ <container>zookeeper</container>
+ </dependsOn>
+ </run>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-default-properties</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ project.properties.setProperty('docker.hostname', 'localhost')
+ log.info("Docker hostname is " + project.properties['docker.hostname'])
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven.failsafe.version}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <alpha.cluster.address>
+ http://${docker.hostname}:${alpha.port}
+ </alpha.cluster.address>
+ <alpha.rest.address>
+ http://${docker.hostname}:${alpha.rest.port}
+ </alpha.rest.address>
+ <servicea.address>
+ http://${docker.hostname}:${servicea.port}
+ </servicea.address>
+ <serviceb.address>
+ http://${docker.hostname}:${serviceb.port}
+ </serviceb.address>
+ <servicec.address>
+ http://${docker.hostname}:${servicec.port}
+ </servicec.address>
+ <spring.datasource.url>
+ jdbc:postgresql://${docker.hostname}:${postgres.port}/saga?useSSL=false
+ </spring.datasource.url>
+ <info.service.uri>
+ ${info.service.uri}
+ </info.service.uri>
+ </systemPropertyVariables>
+ <argLine>${jacoco.failsafe.argLine}</argLine>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.ethlo.persistence.tools</groupId>
+ <artifactId>eclipselink-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>spring-boot-2</id>
+ <properties>
+ <info.service.uri>/actuator/info</info.service.uri>
+ </properties>
+ </profile>
+ </profiles>
</project>
diff --git a/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/DubboDemoStepdefs.java b/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/DubboDemoStepdefs.java
index 9b07486..bf2990a 100644
--- a/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/DubboDemoStepdefs.java
+++ b/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/DubboDemoStepdefs.java
@@ -17,53 +17,52 @@
package org.apache.servicecomb.saga.acceptance.dubbodemo;
-import cucumber.api.DataTable;
-import cucumber.api.java.After;
-import cucumber.api.java.Before;
-import cucumber.api.java8.En;
-import io.restassured.response.Response;
-import org.hamcrest.core.StringContains;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.invoke.MethodHandles;
-import java.util.*;
-import java.util.function.Consumer;
-
import static io.restassured.RestAssured.given;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.core.Is.is;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.hamcrest.core.StringContains;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.restassured.response.Response;
+import cucumber.api.DataTable;
+import cucumber.api.java.Before;
+import cucumber.api.java8.En;
+
public class DubboDemoStepdefs implements En {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String ALPHA_REST_ADDRESS = "alpha.rest.address";
+
private static final String SERVICEA_ADDRESS = "servicea.address";
+
private static final String SERVICEB_ADDRESS = "serviceb.address";
+
private static final String SERVICEC_ADDRESS = "servicec.address";
+
private static final String INFO_SERVICE_URI = "info.service.uri";
private static final Consumer<Map<String, String>[]> NO_OP_CONSUMER = (dataMap) -> {
};
public DubboDemoStepdefs() {
- Given("^ServiceA is up and running$", () -> {
- probe(System.getProperty(SERVICEA_ADDRESS));
- });
+ Given("^ServiceA is up and running$", () -> probe(System.getProperty(SERVICEA_ADDRESS)));
- And("^ServiceB is up and running$", () -> {
- probe(System.getProperty(SERVICEB_ADDRESS));
- });
+ And("^ServiceB is up and running$", () -> probe(System.getProperty(SERVICEB_ADDRESS)));
- And("^ServiceC is up and running$", () -> {
- probe(System.getProperty(SERVICEC_ADDRESS));
- });
+ And("^ServiceC is up and running$", () -> probe(System.getProperty(SERVICEC_ADDRESS)));
- And("^Alpha is up and running$", () -> {
- probe(System.getProperty(ALPHA_REST_ADDRESS));
- });
+ And("^Alpha is up and running$", () -> probe(System.getProperty(ALPHA_REST_ADDRESS)));
When("^([A-Za-z]+) :: .*$", (invokeCode) -> {
LOG.info("invokeCode: " + invokeCode);
@@ -79,10 +78,10 @@ public class DubboDemoStepdefs implements En {
Then("^Alpha records the following events$", (DataTable dataTable) -> {
Consumer<Map<String, Object>[]> sortAndColumnStrippingConsumer = dataMaps -> {
//blur match: service for sagaEndedEvent may be unable to que
- for(Map<String, Object> dataMap : dataMaps){
- if(dataMap.values().contains("SagaEndedEvent")){
- for(String key : dataMap.keySet()){
- if("SagaEndedEvent".equals(dataMap.get(key))){
+ for (Map<String, Object> dataMap : dataMaps) {
+ if (dataMap.values().contains("SagaEndedEvent")) {
+ for (String key : dataMap.keySet()) {
+ if ("SagaEndedEvent".equals(dataMap.get(key))) {
dataMap.put("serviceName", "*");
break;
}
@@ -90,8 +89,9 @@ public class DubboDemoStepdefs implements En {
}
}
//strip columns
- for (Map<String, Object> map : dataMaps)
+ for (Map<String, Object> map : dataMaps) {
map.keySet().retainAll(dataTable.topCells());
+ }
};
dataMatches(System.getProperty(ALPHA_REST_ADDRESS) + "/events", dataTable, sortAndColumnStrippingConsumer);
@@ -99,11 +99,13 @@ public class DubboDemoStepdefs implements En {
And("^(service[a-c]+) success update status$", (String serviceName, DataTable dataTable) -> {
Consumer<Map<String, Object>[]> columnStrippingConsumer = dataMap -> {
- for (Map<String, Object> map : dataMap)
+ for (Map<String, Object> map : dataMap) {
map.keySet().retainAll(dataTable.topCells());
+ }
};
- dataMatches(System.getProperty(SERVICEA_ADDRESS) + "/serviceInfo/"+serviceName, dataTable, columnStrippingConsumer);
+ dataMatches(System.getProperty(SERVICEA_ADDRESS) + "/serviceInfo/" + serviceName, dataTable,
+ columnStrippingConsumer);
});
}
@@ -112,10 +114,10 @@ public class DubboDemoStepdefs implements En {
LOG.info("Cleaning up services");
given()
- .when()
- .delete(System.getProperty(ALPHA_REST_ADDRESS) + "/events")
- .then()
- .statusCode(is(200));
+ .when()
+ .delete(System.getProperty(ALPHA_REST_ADDRESS) + "/events")
+ .then()
+ .statusCode(is(200));
}
@SuppressWarnings("unchecked")
@@ -170,5 +172,4 @@ public class DubboDemoStepdefs implements En {
.then()
.statusCode(is(200));
}
-
}
diff --git a/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/RunCucumberIT.java b/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/RunCucumberIT.java
index caf974c..cab33be 100644
--- a/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/RunCucumberIT.java
+++ b/acceptance-tests/acceptance-dubbo-demo/src/test/java/org/apache/servicecomb/saga/acceptance/dubbodemo/RunCucumberIT.java
@@ -16,9 +16,11 @@
*/
package org.apache.servicecomb.saga.acceptance.dubbodemo;
+
+import org.junit.runner.RunWith;
+
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
-import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "html:target/cucumber"},
diff --git a/saga-demo/saga-dubbo-demo/pom.xml b/saga-demo/saga-dubbo-demo/pom.xml
index af8cc4c..34c22dc 100644
--- a/saga-demo/saga-dubbo-demo/pom.xml
+++ b/saga-demo/saga-dubbo-demo/pom.xml
@@ -16,108 +16,109 @@
~ 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-demo</artifactId>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+<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-demo</artifactId>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>saga-dubbo-demo</artifactId>
- <name>Saga::Demo::Saga-dubbo-demo</name>
- <packaging>pom</packaging>
+ <artifactId>saga-dubbo-demo</artifactId>
+ <name>Saga::Demo::Dubbo-Demo</name>
+ <packaging>pom</packaging>
- <properties>
- <saga.version>0.2.0-SNAPSHOT</saga.version>
- </properties>
+ <properties>
+ <saga.version>0.2.0-SNAPSHOT</saga.version>
+ </properties>
- <modules>
- <module>service-api</module>
- <module>servicea</module>
- <module>serviceb</module>
- <module>servicec</module>
- <module>service-pub</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring.boot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>${maven-dependency-plugin.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <modules>
+ <module>service-api</module>
+ <module>servicea</module>
+ <module>serviceb</module>
+ <module>servicec</module>
+ <module>service-pub</module>
+ </modules>
+ <dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${maven-dependency-plugin.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>omega-transport-dubbo</artifactId>
+ <version>${saga.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>omega-spring-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga</groupId>
+ <artifactId>omega-transport-resttemplate</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.github.sgroschupf</groupId>
+ <artifactId>zkclient</artifactId>
+ <version>0.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+ <!--<dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </dependency>-->
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>spring-boot-2</id>
+ <properties>
+ <spring.boot.version>${spring.boot2.version}</spring.boot.version>
+ </properties>
+ <!-- Need to add the dependency of log4j jar to avoid no class found error -->
+ <dependencies>
<dependency>
- <groupId>org.apache.servicecomb.saga</groupId>
- <artifactId>omega-transport-dubbo</artifactId>
- <version>${saga.version} </version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.saga</groupId>
- <artifactId>omega-spring-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.saga</groupId>
- <artifactId>omega-transport-resttemplate</artifactId>
- </dependency>
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- <version>2.1.1</version>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ <version>1.2.17</version>
</dependency>
- <!--<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>-->
- </dependencies>
- <profiles>
- <profile>
- <id>spring-boot-2</id>
- <properties>
- <spring.boot.version>${spring.boot2.version}</spring.boot.version>
- </properties>
- <!-- Need to add the dependency of log4j jar to avoid no class found error -->
- <dependencies>
- <dependency>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- <version>1.2.17</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
diff --git a/saga-demo/saga-dubbo-demo/service-api/pom.xml b/saga-demo/saga-dubbo-demo/service-api/pom.xml
index 36b0c58..a74c31b 100644
--- a/saga-demo/saga-dubbo-demo/service-api/pom.xml
+++ b/saga-demo/saga-dubbo-demo/service-api/pom.xml
@@ -17,23 +17,23 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>service-pub</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
+ 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">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>service-pub</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
- <parent>
- <artifactId>saga-dubbo-demo</artifactId>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <artifactId>saga-dubbo-demo</artifactId>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>service-api</artifactId>
+ <artifactId>service-api</artifactId>
</project>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/service-api/src/main/java/org/apache/servicecomb/saga/demo/dubbo/api/IService.java b/saga-demo/saga-dubbo-demo/service-api/src/main/java/org/apache/servicecomb/saga/demo/dubbo/api/IService.java
index f02ee8d..523d4ab 100644
--- a/saga-demo/saga-dubbo-demo/service-api/src/main/java/org/apache/servicecomb/saga/demo/dubbo/api/IService.java
+++ b/saga-demo/saga-dubbo-demo/service-api/src/main/java/org/apache/servicecomb/saga/demo/dubbo/api/IService.java
@@ -20,5 +20,6 @@ import org.apache.servicecomb.saga.demo.dubbo.pub.InvokeContext;
public interface IService {
Object run(InvokeContext invokeContext) throws Exception;
+
void cancelRun(InvokeContext invokeContext);
}
diff --git a/saga-demo/saga-dubbo-demo/service-pub/pom.xml b/saga-demo/saga-dubbo-demo/service-pub/pom.xml
index 1ca1310..1dff58e 100644
--- a/saga-demo/saga-dubbo-demo/service-pub/pom.xml
+++ b/saga-demo/saga-dubbo-demo/service-pub/pom.xml
@@ -16,16 +16,16 @@
~ 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-dubbo-demo</artifactId>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+ 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-dubbo-demo</artifactId>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>service-pub</artifactId>
+ <artifactId>service-pub</artifactId>
</project>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/AbsService.java b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/AbsService.java
index 16f5608..c2082de 100644
--- a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/AbsService.java
+++ b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/AbsService.java
@@ -18,22 +18,22 @@ package org.apache.servicecomb.saga.demo.dubbo.pub;
import org.springframework.jdbc.core.JdbcTemplate;
-import java.util.Map;
-
public abstract class AbsService {
- @javax.annotation.Resource(name = "jdbcTemplate")
- protected JdbcTemplate jdbcTemplate;
+ @javax.annotation.Resource(name = "jdbcTemplate")
+ protected JdbcTemplate jdbcTemplate;
- public abstract String getServiceName();
- public abstract String getTableName();
+ public abstract String getServiceName();
- protected void doRunBusi() {
- this.jdbcTemplate.update(String.format("update %s set vstatus=? where service = ?", getTableName()), "run", getServiceName());
- }
+ public abstract String getTableName();
- protected void doCancelBusi() {
- this.jdbcTemplate.update(String.format("update %s set vstatus=? where service = ?", getTableName()), "cancel", getServiceName());
- }
+ protected void doRunBusi() {
+ this.jdbcTemplate
+ .update(String.format("update %s set vstatus=? where service = ?", getTableName()), "run", getServiceName());
+ }
+ protected void doCancelBusi() {
+ this.jdbcTemplate
+ .update(String.format("update %s set vstatus=? where service = ?", getTableName()), "cancel", getServiceName());
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/IInvokeCode.java b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/IInvokeCode.java
index b0f6036..96ab819 100644
--- a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/IInvokeCode.java
+++ b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/IInvokeCode.java
@@ -18,21 +18,21 @@ package org.apache.servicecomb.saga.demo.dubbo.pub;
/**
* a invoke code describe a test scenario
-* @date 05/05/2018 3:27 PM
-*/
+ * @date 05/05/2018 3:27 PM
+ */
public interface IInvokeCode {
- String Ab_description="A->B, success";
- String Ab = "Ab";
- String AExceptionWhenAb_description="A->B, A.run exception after A call B.run";
- String AExceptionWhenAb="AExceptionWhenAb";
- String BExceptionWhenAb_description="A->B, B.run exception";
- String BExceptionWhenAb="BExceptionWhenAb";
- String AbAc_description="A->B, A->C success";
- String AbAc="AbAc";
- String CExceptionWhenAbAc_description="A->B,A->C, C.run exception";
- String CExceptionWhenAbAc="CExceptionWhenAbAc";
- String AbBc_description="A->B, B->C, success";
- String AbBc="AbBc";
- String CExceptionWhenAbBc_description="A->B, B->C, C.run exception";
- String CExceptionWhenAbBc="CExceptionWhenAbBc";
+ String Ab_description = "A->B, success";
+ String Ab = "Ab";
+ String AExceptionWhenAb_description = "A->B, A.run exception after A call B.run";
+ String AExceptionWhenAb = "AExceptionWhenAb";
+ String BExceptionWhenAb_description = "A->B, B.run exception";
+ String BExceptionWhenAb = "BExceptionWhenAb";
+ String AbAc_description = "A->B, A->C success";
+ String AbAc = "AbAc";
+ String CExceptionWhenAbAc_description = "A->B,A->C, C.run exception";
+ String CExceptionWhenAbAc = "CExceptionWhenAbAc";
+ String AbBc_description = "A->B, B->C, success";
+ String AbBc = "AbBc";
+ String CExceptionWhenAbBc_description = "A->B, B->C, C.run exception";
+ String CExceptionWhenAbBc = "CExceptionWhenAbBc";
}
diff --git a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/InvokeContext.java b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/InvokeContext.java
index 8225447..513aca3 100644
--- a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/InvokeContext.java
+++ b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/InvokeContext.java
@@ -16,41 +16,40 @@
*/
package org.apache.servicecomb.saga.demo.dubbo.pub;
-public class InvokeContext implements java.io.Serializable{
-
- private String invokeCode;
-
- public String getInvokeCode() {
- return invokeCode;
- }
-
- public InvokeContext setInvokeCode(String invokeCode) {
- this.invokeCode = invokeCode;
- return this;
- }
-
- public boolean isInvokeB(String serviceName) {
- return "servicea".equals(serviceName) && (IInvokeCode.AExceptionWhenAb.equals(invokeCode)
- || IInvokeCode.Ab.equals(invokeCode)
- || IInvokeCode.BExceptionWhenAb.equals(invokeCode)
- || IInvokeCode.AbAc.equals(invokeCode)
- || IInvokeCode.CExceptionWhenAbAc.equals(invokeCode)
- || IInvokeCode.AbBc.equals(invokeCode)
- || IInvokeCode.CExceptionWhenAbBc.equals(invokeCode));
- }
-
- public boolean isInvokeC(String serviceName) {
- return ("serviceb".equals(serviceName) && IInvokeCode.AbBc.equals(invokeCode))
- || ("serviceb".equals(serviceName) && IInvokeCode.CExceptionWhenAbBc.equals(invokeCode))
- || ("servicea".equals(serviceName) && IInvokeCode.AbAc.equals(invokeCode))
- || ("servicea".equals(serviceName) && IInvokeCode.CExceptionWhenAbAc.equals(invokeCode));
- }
-
- public boolean isException(String serviceName) {
- return ("servicea".equals(serviceName) && IInvokeCode.AExceptionWhenAb.equals(invokeCode))
- || ("serviceb".equals(serviceName) && IInvokeCode.BExceptionWhenAb.equals(invokeCode))
- || ("servicec".equals(serviceName) && (IInvokeCode.CExceptionWhenAbAc.equals(invokeCode)
- || IInvokeCode.CExceptionWhenAbBc.equals(invokeCode)));
- }
-
+public class InvokeContext implements java.io.Serializable {
+
+ private String invokeCode;
+
+ public String getInvokeCode() {
+ return invokeCode;
+ }
+
+ public InvokeContext setInvokeCode(String invokeCode) {
+ this.invokeCode = invokeCode;
+ return this;
+ }
+
+ public boolean isInvokeB(String serviceName) {
+ return "servicea".equals(serviceName) && (IInvokeCode.AExceptionWhenAb.equals(invokeCode)
+ || IInvokeCode.Ab.equals(invokeCode)
+ || IInvokeCode.BExceptionWhenAb.equals(invokeCode)
+ || IInvokeCode.AbAc.equals(invokeCode)
+ || IInvokeCode.CExceptionWhenAbAc.equals(invokeCode)
+ || IInvokeCode.AbBc.equals(invokeCode)
+ || IInvokeCode.CExceptionWhenAbBc.equals(invokeCode));
+ }
+
+ public boolean isInvokeC(String serviceName) {
+ return ("serviceb".equals(serviceName) && IInvokeCode.AbBc.equals(invokeCode))
+ || ("serviceb".equals(serviceName) && IInvokeCode.CExceptionWhenAbBc.equals(invokeCode))
+ || ("servicea".equals(serviceName) && IInvokeCode.AbAc.equals(invokeCode))
+ || ("servicea".equals(serviceName) && IInvokeCode.CExceptionWhenAbAc.equals(invokeCode));
+ }
+
+ public boolean isException(String serviceName) {
+ return ("servicea".equals(serviceName) && IInvokeCode.AExceptionWhenAb.equals(invokeCode))
+ || ("serviceb".equals(serviceName) && IInvokeCode.BExceptionWhenAb.equals(invokeCode))
+ || ("servicec".equals(serviceName) && (IInvokeCode.CExceptionWhenAbAc.equals(invokeCode)
+ || IInvokeCode.CExceptionWhenAbBc.equals(invokeCode)));
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/ServiceVO.java b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/ServiceVO.java
index ff53b78..bae3371 100644
--- a/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/ServiceVO.java
+++ b/saga-demo/saga-dubbo-demo/service-pub/src/main/java/org/apache/servicecomb/saga/demo/dubbo/pub/ServiceVO.java
@@ -18,31 +18,33 @@ package org.apache.servicecomb.saga.demo.dubbo.pub;
public class ServiceVO {
- private String id;
- private String service;
- private String vstatus;
+ private String id;
- public String getId() {
- return id;
- }
+ private String service;
- public void setId(String id) {
- this.id = id;
- }
+ private String vstatus;
- public String getService() {
- return service;
- }
+ public String getId() {
+ return id;
+ }
- public void setService(String service) {
- this.service = service;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public String getVstatus() {
- return vstatus;
- }
+ public String getService() {
+ return service;
+ }
- public void setVstatus(String vstatus) {
- this.vstatus = vstatus;
- }
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public String getVstatus() {
+ return vstatus;
+ }
+
+ public void setVstatus(String vstatus) {
+ this.vstatus = vstatus;
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/servicea/pom.xml b/saga-demo/saga-dubbo-demo/servicea/pom.xml
index 33102df..025bdbd 100644
--- a/saga-demo/saga-dubbo-demo/servicea/pom.xml
+++ b/saga-demo/saga-dubbo-demo/servicea/pom.xml
@@ -17,72 +17,72 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>service-api</artifactId>
- <version>${saga.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>service-pub</artifactId>
- <version>${saga.version}</version>
- </dependency>
- </dependencies>
+ 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">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>service-api</artifactId>
+ <version>${saga.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>service-pub</artifactId>
+ <version>${saga.version}</version>
+ </dependency>
+ </dependencies>
- <parent>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>saga-dubbo-demo</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>saga-dubbo-demo</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>servicea</artifactId>
+ <artifactId>servicea</artifactId>
- <build>
+ <build>
+ <plugins>
+ <!-- mixin plugin configurations declared in another pom,
+ just like importing dependencies managed in another pom -->
+ <plugin>
+ <groupId>com.github.odavid.maven.plugins</groupId>
+ <artifactId>mixin-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
<plugins>
- <!-- mixin plugin configurations declared in another pom,
- just like importing dependencies managed in another pom -->
- <plugin>
- <groupId>com.github.odavid.maven.plugins</groupId>
- <artifactId>mixin-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.commonjava.maven.plugins</groupId>
+ <artifactId>directory-maven-plugin</artifactId>
+ </plugin>
</plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.commonjava.maven.plugins</groupId>
- <artifactId>directory-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>demo</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </build>
+ </profile>
+ <profile>
+ <id>demo</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ApplicationA.java b/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ApplicationA.java
index ace9358..ae715a6 100644
--- a/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ApplicationA.java
+++ b/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ApplicationA.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
package org.apache.servicecomb.saga.demo.dubbo.servicea;
+
import org.apache.servicecomb.saga.omega.spring.EnableOmega;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ServiceA.java b/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ServiceA.java
index dad5259..0bd5f7b 100644
--- a/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ServiceA.java
+++ b/saga-demo/saga-dubbo-demo/servicea/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicea/ServiceA.java
@@ -16,6 +16,8 @@
*/
package org.apache.servicecomb.saga.demo.dubbo.servicea;
+import java.lang.invoke.MethodHandles;
+
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceA;
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceB;
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceC;
@@ -28,51 +30,48 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.invoke.MethodHandles;
-
public class ServiceA extends AbsService implements IServiceA {
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- @Autowired
- private IServiceB serviceB;
+ @Autowired
+ private IServiceB serviceB;
- @Autowired
- private IServiceC serviceC;
+ @Autowired
+ private IServiceC serviceC;
- @Override
- public String getServiceName() {
- return "servicea";
- }
+ @Override
+ public String getServiceName() {
+ return "servicea";
+ }
- @Override
- public String getTableName() {
- return "testa";
- }
+ @Override
+ public String getTableName() {
+ return "testa";
+ }
- @Override
- @SagaStart
- @Compensable( compensationMethod="cancelRun")
- @Transactional(rollbackFor = Exception.class)
- public Object run(InvokeContext invokeContext) throws Exception {
- LOG.info("A.run called");
- doRunBusi();
- if(invokeContext.isInvokeB(getServiceName())){
- serviceB.run(invokeContext);
- }
- if(invokeContext.isInvokeC(getServiceName())){
- serviceC.run(invokeContext);
- }
- if(invokeContext.isException(getServiceName()) ){
- LOG.info("A.run exception");
- throw new Exception("A.run exception");
- }
- return null;
+ @Override
+ @SagaStart
+ @Compensable(compensationMethod = "cancelRun")
+ @Transactional(rollbackFor = Exception.class)
+ public Object run(InvokeContext invokeContext) throws Exception {
+ LOG.info("A.run called");
+ doRunBusi();
+ if (invokeContext.isInvokeB(getServiceName())) {
+ serviceB.run(invokeContext);
}
-
- public void cancelRun(InvokeContext invokeContext){
- LOG.info("A.cancel called");
- doCancelBusi();
+ if (invokeContext.isInvokeC(getServiceName())) {
+ serviceC.run(invokeContext);
+ }
+ if (invokeContext.isException(getServiceName())) {
+ LOG.info("A.run exception");
+ throw new Exception("A.run exception");
}
+ return null;
+ }
+ public void cancelRun(InvokeContext invokeContext) {
+ LOG.info("A.cancel called");
+ doCancelBusi();
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/dubbo-context.xml b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/dubbo-context.xml
index 1c73e90..16a5b63 100644
--- a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/dubbo-context.xml
+++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/dubbo-context.xml
@@ -16,16 +16,16 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <dubbo:application name="dubbo-servicea"/>
- <dubbo:consumer check="false" timeout="10000" />
- <!--localhost:2181-->
- <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
- <dubbo:protocol name="dubbo" port="20881"/>
- <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceA" ref="servicea"/>
- <bean id="servicea" class="org.apache.servicecomb.saga.demo.dubbo.servicea.ServiceA"/>
- <dubbo:reference id="serviceb" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceB"/>
- <dubbo:reference id="servicec" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC"/>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+ <dubbo:application name="dubbo-servicea"/>
+ <dubbo:consumer check="false" timeout="10000"/>
+ <!--localhost:2181-->
+ <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
+ <dubbo:protocol name="dubbo" port="20881"/>
+ <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceA" ref="servicea"/>
+ <bean id="servicea" class="org.apache.servicecomb.saga.demo.dubbo.servicea.ServiceA"/>
+ <dubbo:reference id="serviceb" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceB"/>
+ <dubbo:reference id="servicec" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC"/>
</beans>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/jdbc.xml b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/jdbc.xml
index 219e96a..a8d9247 100644
--- a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/jdbc.xml
+++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/jdbc.xml
@@ -16,9 +16,9 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
@@ -27,8 +27,8 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource" />
- </bean>
+ <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
</beans>
diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/static/index.html b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/static/index.html
index f366003..695193f 100644
--- a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/static/index.html
+++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/static/index.html
@@ -17,26 +17,29 @@
<!DOCTYPE html>
<html>
<head>
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta charset="utf-8">
- <title>saga-dubbo-demo</title>
- <meta name="description" content="">
- <meta name="author" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="">
- <!--[if lt IE 9]>
- <script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- <link rel="shortcut icon" href="">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta charset="utf-8">
+ <title>saga-dubbo-demo</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="">
+ <!--[if lt IE 9]>
+ <script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
+ <![endif]-->
+ <link rel="shortcut icon" href="">
</head>
<body>
-<p>1.<a href="/serviceInvoke/Ab" target="_blank">[A.run->B.run, success]</a> </p>
-<p>2.<a href="/serviceInvoke/AExceptionWhenAb" target="_blank">[A.run(x)->B.run, A.run exception after call B.run]</a> </p>
-<p>3.<a href="/serviceInvoke/BExceptionWhenAb" target="_blank">[A.run->B.run(x), B.run exception]</a> </p>
-<p>4.<a href="/serviceInvoke/AbAc" target="_blank">[A.run->B.run, A.run->C.run, success]</a> </p>
-<p>5.<a href="/serviceInvoke/CExceptionWhenAbAc" target="_blank">[A.run->B.run, A.run->C.run(x), C.run exception]</a> </p>
+<p>1.<a href="/serviceInvoke/Ab" target="_blank">[A.run->B.run, success]</a></p>
+<p>2.<a href="/serviceInvoke/AExceptionWhenAb" target="_blank">[A.run(x)->B.run, A.run exception after call B.run]</a>
+</p>
+<p>3.<a href="/serviceInvoke/BExceptionWhenAb" target="_blank">[A.run->B.run(x), B.run exception]</a></p>
+<p>4.<a href="/serviceInvoke/AbAc" target="_blank">[A.run->B.run, A.run->C.run, success]</a></p>
+<p>5.<a href="/serviceInvoke/CExceptionWhenAbAc" target="_blank">[A.run->B.run, A.run->C.run(x), C.run exception]</a>
+</p>
<p>6.<a href="/serviceInvoke/AbBc" target="_blank">[A.run->B.run, B.run->C.run, success]</a></p>
-<p>7.<a href="/serviceInvoke/CExceptionWhenAbBc" target="_blank">[A.run->B.run, B.run->C.run(x), C.run exception]</a> </p>
+<p>7.<a href="/serviceInvoke/CExceptionWhenAbBc" target="_blank">[A.run->B.run, B.run->C.run(x), C.run exception]</a>
+</p>
</body>
</html>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/serviceb/pom.xml b/saga-demo/saga-dubbo-demo/serviceb/pom.xml
index 2471269..c5d736b 100644
--- a/saga-demo/saga-dubbo-demo/serviceb/pom.xml
+++ b/saga-demo/saga-dubbo-demo/serviceb/pom.xml
@@ -17,68 +17,68 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>service-api</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
+ 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">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>service-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
- <parent>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>saga-dubbo-demo</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>saga-dubbo-demo</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>serviceb</artifactId>
+ <artifactId>serviceb</artifactId>
- <build>
+ <build>
+ <plugins>
+ <!-- mixin plugin configurations declared in another pom,
+ just like importing dependencies managed in another pom -->
+ <plugin>
+ <groupId>com.github.odavid.maven.plugins</groupId>
+ <artifactId>mixin-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
<plugins>
- <!-- mixin plugin configurations declared in another pom,
- just like importing dependencies managed in another pom -->
- <plugin>
- <groupId>com.github.odavid.maven.plugins</groupId>
- <artifactId>mixin-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.commonjava.maven.plugins</groupId>
+ <artifactId>directory-maven-plugin</artifactId>
+ </plugin>
</plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.commonjava.maven.plugins</groupId>
- <artifactId>directory-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>demo</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </build>
+ </profile>
+ <profile>
+ <id>demo</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/java/org/apache/servicecomb/saga/demo/dubbo/serviceb/ServiceB.java b/saga-demo/saga-dubbo-demo/serviceb/src/main/java/org/apache/servicecomb/saga/demo/dubbo/serviceb/ServiceB.java
index 0c7890f..01cfb89 100644
--- a/saga-demo/saga-dubbo-demo/serviceb/src/main/java/org/apache/servicecomb/saga/demo/dubbo/serviceb/ServiceB.java
+++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/java/org/apache/servicecomb/saga/demo/dubbo/serviceb/ServiceB.java
@@ -16,6 +16,8 @@
*/
package org.apache.servicecomb.saga.demo.dubbo.serviceb;
+import java.lang.invoke.MethodHandles;
+
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceB;
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceC;
import org.apache.servicecomb.saga.demo.dubbo.pub.AbsService;
@@ -26,44 +28,41 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.invoke.MethodHandles;
-
public class ServiceB extends AbsService implements IServiceB {
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- @Autowired
- private IServiceC serviceC;
+ @Autowired
+ private IServiceC serviceC;
- @Override
- public String getServiceName() {
- return "serviceb";
- }
+ @Override
+ public String getServiceName() {
+ return "serviceb";
+ }
- @Override
- public String getTableName() {
- return "testb";
- }
-
- @Override
- @Compensable( compensationMethod="cancelRun")
- @Transactional(rollbackFor = Exception.class)
- public Object run(InvokeContext invokeContext) throws Exception {
- LOG.info("B.run called");
- doRunBusi();
- if(invokeContext.isInvokeC(getServiceName())){
- serviceC.run(invokeContext);
- }
- if(invokeContext.isException(getServiceName())){
- throw new Exception("B.run exception");
- }
+ @Override
+ public String getTableName() {
+ return "testb";
+ }
- return null;
+ @Override
+ @Compensable(compensationMethod = "cancelRun")
+ @Transactional(rollbackFor = Exception.class)
+ public Object run(InvokeContext invokeContext) throws Exception {
+ LOG.info("B.run called");
+ doRunBusi();
+ if (invokeContext.isInvokeC(getServiceName())) {
+ serviceC.run(invokeContext);
}
-
- public void cancelRun(InvokeContext invokeContext){
- LOG.info("B.cancel called");
- doCancelBusi();
+ if (invokeContext.isException(getServiceName())) {
+ throw new Exception("B.run exception");
}
+ return null;
+ }
+
+ public void cancelRun(InvokeContext invokeContext) {
+ LOG.info("B.cancel called");
+ doCancelBusi();
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/dubbo-context.xml b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/dubbo-context.xml
index 519900e..43a629c 100644
--- a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/dubbo-context.xml
+++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/dubbo-context.xml
@@ -16,15 +16,15 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <dubbo:application name="dubbo-serviceb"/>
- <dubbo:consumer check="false" timeout="10000" />
- <!--localhost:2181-->
- <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
- <dubbo:protocol name="dubbo" port="20882"/>
- <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceB" ref="serviceb"/>
- <bean id="serviceb" class="org.apache.servicecomb.saga.demo.dubbo.serviceb.ServiceB"/>
- <dubbo:reference id="servicec" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC"/>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+ <dubbo:application name="dubbo-serviceb"/>
+ <dubbo:consumer check="false" timeout="10000"/>
+ <!--localhost:2181-->
+ <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
+ <dubbo:protocol name="dubbo" port="20882"/>
+ <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceB" ref="serviceb"/>
+ <bean id="serviceb" class="org.apache.servicecomb.saga.demo.dubbo.serviceb.ServiceB"/>
+ <dubbo:reference id="servicec" interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC"/>
</beans>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/jdbc.xml b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/jdbc.xml
index 219e96a..a8d9247 100644
--- a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/jdbc.xml
+++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/jdbc.xml
@@ -16,9 +16,9 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
@@ -27,8 +27,8 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource" />
- </bean>
+ <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
</beans>
diff --git a/saga-demo/saga-dubbo-demo/servicec/pom.xml b/saga-demo/saga-dubbo-demo/servicec/pom.xml
index f15fe2a..d1eb1d4 100644
--- a/saga-demo/saga-dubbo-demo/servicec/pom.xml
+++ b/saga-demo/saga-dubbo-demo/servicec/pom.xml
@@ -17,68 +17,68 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>service-api</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
+ 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">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>service-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
- <parent>
- <groupId>org.apache.servicecomb.saga.demo</groupId>
- <artifactId>saga-dubbo-demo</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.apache.servicecomb.saga.demo</groupId>
+ <artifactId>saga-dubbo-demo</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>servicec</artifactId>
+ <artifactId>servicec</artifactId>
- <build>
+ <build>
+ <plugins>
+ <!-- mixin plugin configurations declared in another pom,
+ just like importing dependencies managed in another pom -->
+ <plugin>
+ <groupId>com.github.odavid.maven.plugins</groupId>
+ <artifactId>mixin-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
<plugins>
- <!-- mixin plugin configurations declared in another pom,
- just like importing dependencies managed in another pom -->
- <plugin>
- <groupId>com.github.odavid.maven.plugins</groupId>
- <artifactId>mixin-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.commonjava.maven.plugins</groupId>
+ <artifactId>directory-maven-plugin</artifactId>
+ </plugin>
</plugins>
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.commonjava.maven.plugins</groupId>
- <artifactId>directory-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>demo</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </build>
+ </profile>
+ <profile>
+ <id>demo</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ApplicationC.java b/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ApplicationC.java
index 4fdfe25..5b3d7c7 100644
--- a/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ApplicationC.java
+++ b/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ApplicationC.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
package org.apache.servicecomb.saga.demo.dubbo.servicec;
+
import org.apache.servicecomb.saga.omega.spring.EnableOmega;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ServiceC.java b/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ServiceC.java
index 1f8d63e..a2abd2e 100644
--- a/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ServiceC.java
+++ b/saga-demo/saga-dubbo-demo/servicec/src/main/java/org/apache/servicecomb/saga/demo/dubbo/servicec/ServiceC.java
@@ -16,6 +16,8 @@
*/
package org.apache.servicecomb.saga.demo.dubbo.servicec;
+import java.lang.invoke.MethodHandles;
+
import org.apache.servicecomb.saga.demo.dubbo.api.IServiceC;
import org.apache.servicecomb.saga.demo.dubbo.pub.AbsService;
import org.apache.servicecomb.saga.demo.dubbo.pub.InvokeContext;
@@ -24,38 +26,35 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.invoke.MethodHandles;
-
public class ServiceC extends AbsService implements IServiceC {
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @Override
- public String getServiceName() {
- return "servicec";
- }
-
- @Override
- public String getTableName() {
- return "testc";
- }
-
- @Override
- @Compensable(compensationMethod="cancelRun")
- @Transactional(rollbackFor = Exception.class)
- public Object run(InvokeContext invokeContext) throws Exception {
- LOG.info("C.run called");
- doRunBusi();
- if(invokeContext.isException(getServiceName()) ){
- LOG.info("C.run exception");
- throw new Exception("C.run exception");
- }
- return null;
- }
-
- public void cancelRun(InvokeContext invokeContext){
- LOG.info("C.cancel called");
- doCancelBusi();
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ @Override
+ public String getServiceName() {
+ return "servicec";
+ }
+
+ @Override
+ public String getTableName() {
+ return "testc";
+ }
+
+ @Override
+ @Compensable(compensationMethod = "cancelRun")
+ @Transactional(rollbackFor = Exception.class)
+ public Object run(InvokeContext invokeContext) throws Exception {
+ LOG.info("C.run called");
+ doRunBusi();
+ if (invokeContext.isException(getServiceName())) {
+ LOG.info("C.run exception");
+ throw new Exception("C.run exception");
}
+ return null;
+ }
+ public void cancelRun(InvokeContext invokeContext) {
+ LOG.info("C.cancel called");
+ doCancelBusi();
+ }
}
diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/dubbo-context.xml b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/dubbo-context.xml
index b37d8a4..1eb1ffc 100644
--- a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/dubbo-context.xml
+++ b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/dubbo-context.xml
@@ -16,13 +16,13 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <dubbo:application name="dubbo-servicec"/>
- <!--localhost:2181-->
- <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
- <dubbo:protocol name="dubbo" port="20883"/>
- <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC" ref="servicec"/>
- <bean id="servicec" class="org.apache.servicecomb.saga.demo.dubbo.servicec.ServiceC"/>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+ <dubbo:application name="dubbo-servicec"/>
+ <!--localhost:2181-->
+ <dubbo:registry address="zookeeper://${zookeeper.url}?client=zkclient"/>
+ <dubbo:protocol name="dubbo" port="20883"/>
+ <dubbo:service interface="org.apache.servicecomb.saga.demo.dubbo.api.IServiceC" ref="servicec"/>
+ <bean id="servicec" class="org.apache.servicecomb.saga.demo.dubbo.servicec.ServiceC"/>
</beans>
\ No newline at end of file
diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/jdbc.xml b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/jdbc.xml
index 219e96a..a8d9247 100644
--- a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/jdbc.xml
+++ b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/jdbc.xml
@@ -16,9 +16,9 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
@@ -27,8 +27,8 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource" />
- </bean>
+ <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
</beans>
diff --git a/saga-demo/saga-spring-cloud-demo/pom.xml b/saga-demo/saga-spring-cloud-demo/pom.xml
index b507618..03b2f11 100644
--- a/saga-demo/saga-spring-cloud-demo/pom.xml
+++ b/saga-demo/saga-spring-cloud-demo/pom.xml
@@ -25,7 +25,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>booking</artifactId>
- <name>Saga::Demo::Booking</name>
+ <name>Saga::Demo::Spring-Cloud-Demo</name>
<packaging>pom</packaging>
<modules>
--
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.