This is an automated email from the ASF dual-hosted git repository. ningjiang pushed a commit to branch SCB-555 in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit 8c56cf0c079c33f925d8635479e5686fc4cd3101 Author: wuzunqian <wuzunq...@msn.com> AuthorDate: Tue May 15 00:58:21 2018 +0800 docker plugin for mvn test --- acceptance-tests/acceptance-dubbo-demo/pom.xml | 279 +++++++++++++++++++++ .../acceptance/dubbodemo/DubboDemoStepdefs.java | 1 - .../src/main/resources/schema-mysql.sql | 6 +- saga-demo/pom.xml | 5 + .../saga-dubbo-demo/docker-compose.mysql.yaml | 106 +++++++- saga-demo/saga-dubbo-demo/docker-compose.yaml | 73 ++++++ saga-demo/saga-dubbo-demo/pom.xml | 13 +- saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh | 2 +- saga-demo/saga-dubbo-demo/service-api/pom.xml | 5 - saga-demo/saga-dubbo-demo/servicea/pom.xml | 44 ++++ .../servicea/src/main/resources/application.yaml | 31 ++- .../servicea/src/main/resources/jdbc.xml | 44 +--- .../servicea/src/main/resources/schema-mysql.sql | 24 ++ .../src/main/resources/schema-postgresql.sql | 26 ++ saga-demo/saga-dubbo-demo/serviceb/pom.xml | 44 ++++ .../serviceb/src/main/resources/application.yaml | 25 +- .../serviceb/src/main/resources/jdbc.xml | 43 +--- .../serviceb/src/main/resources/schema-mysql.sql | 24 ++ .../src/main/resources/schema-postgresql.sql | 26 ++ saga-demo/saga-dubbo-demo/servicec/pom.xml | 44 ++++ .../servicec/src/main/resources/application.yaml | 25 +- .../servicec/src/main/resources/jdbc.xml | 43 +--- .../servicec/src/main/resources/schema-mysql.sql | 24 ++ .../src/main/resources/schema-postgresql.sql | 26 ++ 24 files changed, 849 insertions(+), 134 deletions(-) diff --git a/acceptance-tests/acceptance-dubbo-demo/pom.xml b/acceptance-tests/acceptance-dubbo-demo/pom.xml index 023a2d8..8dc7265 100644 --- a/acceptance-tests/acceptance-dubbo-demo/pom.xml +++ b/acceptance-tests/acceptance-dubbo-demo/pom.xml @@ -41,5 +41,284 @@ </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> + </profiles> + </project> \ No newline at end of file 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 80e503e..9b07486 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 @@ -80,7 +80,6 @@ public class DubboDemoStepdefs implements En { Consumer<Map<String, Object>[]> sortAndColumnStrippingConsumer = dataMaps -> { //blur match: service for sagaEndedEvent may be unable to que for(Map<String, Object> dataMap : dataMaps){ - LOG.info(dataMap.toString()); if(dataMap.values().contains("SagaEndedEvent")){ for(String key : dataMap.keySet()){ if("SagaEndedEvent".equals(dataMap.get(key))){ diff --git a/alpha/alpha-server/src/main/resources/schema-mysql.sql b/alpha/alpha-server/src/main/resources/schema-mysql.sql index e2e5d81..ecb934e 100644 --- a/alpha/alpha-server/src/main/resources/schema-mysql.sql +++ b/alpha/alpha-server/src/main/resources/schema-mysql.sql @@ -27,11 +27,12 @@ CREATE TABLE IF NOT EXISTS TxEvent ( compensationMethod varchar(256) NOT NULL, expiryTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, payloads varbinary(10240), + retries int(11) NOT NULL DEFAULT '0', + retryMethod varchar(256) DEFAULT NULL, PRIMARY KEY (surrogateId), INDEX saga_events_index (surrogateId, globalTxId, localTxId, type, expiryTime) ) DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS Command ( surrogateId bigint NOT NULL AUTO_INCREMENT, eventId bigint NOT NULL UNIQUE, @@ -41,8 +42,6 @@ CREATE TABLE IF NOT EXISTS Command ( localTxId varchar(36) NOT NULL, parentTxId varchar(36) DEFAULT NULL, compensationMethod varchar(256) NOT NULL, - retryMethod varchar(256) NOT NULL, - retries int NOT NULL DEFAULT 0, payloads varbinary(10240), status varchar(12), lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -51,7 +50,6 @@ CREATE TABLE IF NOT EXISTS Command ( INDEX saga_commands_index (surrogateId, eventId, globalTxId, localTxId, status) ) DEFAULT CHARSET=utf8; - CREATE TABLE IF NOT EXISTS TxTimeout ( surrogateId bigint NOT NULL AUTO_INCREMENT, eventId bigint NOT NULL UNIQUE, diff --git a/saga-demo/pom.xml b/saga-demo/pom.xml index 9ee16f0..0c77b00 100644 --- a/saga-demo/pom.xml +++ b/saga-demo/pom.xml @@ -69,6 +69,11 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> </dependencies> <build> diff --git a/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml b/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml index 43f3b5e..6e0fcb7 100644 --- a/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml +++ b/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml @@ -15,25 +15,113 @@ ## limitations under the License. ## --------------------------------------------------------------------------- +## +#you need to add mysql drive to alpha pom.xml and saga-dubbo-demo pom.xml first +## version: '2.1' services: + + zookeeper: + image: "docker.io/zookeeper" + hostname: zookeeper + database: - image: "mysql/mysql-server:5.7" - hostname: mysql + image: "mysql/mysql-server:5.7" + hostname: mysql + environment: + - MYSQL_ROOT_PASSWORD=password + - MYSQL_DATABASE=saga + - MYSQL_USER=saga + - MYSQL_PASSWORD=password + healthcheck: + test: ["CMD-SHELL", "nc -z localhost 3306 &> /dev/null; echo $$?"] + interval: 30s + timeout: 10s + retries: 5 + + alpha: + image: "alpha-server:${TAG}" + hostname: alpha-server + ports: + - "8081:8080" + - "8091:8090" + links: + - "database:mysql.servicecomb.io" environment: - - MYSQL_ROOT_PASSWORD=password - - MYSQL_DATABASE=saga - - MYSQL_USER=saga - - MYSQL_PASSWORD=password + - JAVA_OPTS=-Dspring.profiles.active=mysql healthcheck: - test: ["CMD-SHELL", "nc -z localhost 3306 &> /dev/null; echo $$?"] + test: ["CMD-SHELL", "nc -z localhost 8080 &> /dev/null; echo $$?"] interval: 30s timeout: 10s retries: 5 + depends_on: + database: + condition: service_healthy - alpha: + servicea: + image: "servicea:${TAG}" + hostname: servicea links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" - "database:mysql.servicecomb.io" environment: - - JAVA_OPTS=-Dspring.profiles.active=mysql + - JAVA_OPTS= -Dspring.profiles.active=mysql + -Dspring.datasource.url=jdbc:mysql://mysql.servicecomb.io:3306/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 + ports: + - "8071:8071" + depends_on: + alpha: + condition: service_healthy + + serviceb: + image: "serviceb:${TAG}" + hostname: serviceb + links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" + - "database:mysql.servicecomb.io" + environment: + - JAVA_OPTS= -Dspring.profiles.active=mysql + -Dspring.datasource.url=jdbc:mysql://mysql.servicecomb.io:3306/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 + ports: + - "8072:8072" + depends_on: + alpha: + condition: service_healthy + + servicec: + image: "servicec:${TAG}" + hostname: servicec + links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" + - "database:mysql.servicecomb.io" + environment: + - JAVA_OPTS= -Dspring.profiles.active=mysql + -Dspring.datasource.url=jdbc:mysql://mysql.servicecomb.io:3306/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 + ports: + - "8073:8073" + depends_on: + alpha: + condition: service_healthy + diff --git a/saga-demo/saga-dubbo-demo/docker-compose.yaml b/saga-demo/saga-dubbo-demo/docker-compose.yaml index 7c3b8dd..b1e295c 100644 --- a/saga-demo/saga-dubbo-demo/docker-compose.yaml +++ b/saga-demo/saga-dubbo-demo/docker-compose.yaml @@ -18,6 +18,11 @@ version: '2.1' services: + + zookeeper: + image: "docker.io/zookeeper" + hostname: zookeeper + database: image: "postgres" hostname: postgres @@ -25,6 +30,8 @@ services: - POSTGRES_DB=saga - POSTGRES_USER=saga - POSTGRES_PASSWORD=password + ports: + - "5432:5432" healthcheck: test: ["CMD-SHELL", "nc -z localhost 5432 &> /dev/null; echo $$?"] interval: 30s @@ -49,3 +56,69 @@ services: depends_on: database: condition: service_healthy + + servicea: + image: "servicea:${TAG}" + hostname: servicea + links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" + - "database:postgresql.servicecomb.io" + environment: + - 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 + ports: + - "8071:8071" + depends_on: + alpha: + condition: service_healthy + + serviceb: + image: "serviceb:${TAG}" + hostname: serviceb + links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" + - "database:postgresql.servicecomb.io" + environment: + - 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 + ports: + - "8072:8072" + depends_on: + alpha: + condition: service_healthy + + servicec: + image: "servicec:${TAG}" + hostname: servicec + links: + - "zookeeper:zookeeper.servicecomb.io" + - "alpha:alpha-server.servicecomb.io" + - "database:postgresql.servicecomb.io" + environment: + - 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 + ports: + - "8073:8073" + depends_on: + alpha: + condition: service_healthy \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/pom.xml b/saga-demo/saga-dubbo-demo/pom.xml index 634cd69..a7d568b 100644 --- a/saga-demo/saga-dubbo-demo/pom.xml +++ b/saga-demo/saga-dubbo-demo/pom.xml @@ -81,17 +81,9 @@ </dependency> <dependency> <groupId>org.apache.servicecomb.saga</groupId> - <artifactId>omega-spring-starter</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb.saga</groupId> <artifactId>omega-transport-resttemplate</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter</artifactId> - </dependency> - <dependency> <groupId>com.github.sgroschupf</groupId> <artifactId>zkclient</artifactId> <version>0.1</version> @@ -107,10 +99,9 @@ <artifactId>commons-dbcp2</artifactId> <version>2.1.1</version> </dependency> - <dependency> + <!--<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> - <version>5.1.37</version> - </dependency> + </dependency>--> </dependencies> </project> diff --git a/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh b/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh index 48df117..6a9a926 100755 --- a/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh +++ b/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh @@ -26,7 +26,7 @@ case $1 in up-mysql) fetch_version echo "Starting ${service}:${version}" - TAG=$version docker-compose -f docker-compose.yaml -f docker-compose.mysql.yaml up + TAG=$version docker-compose -f docker-compose.mysql.yaml up exit $? ;; diff --git a/saga-demo/saga-dubbo-demo/service-api/pom.xml b/saga-demo/saga-dubbo-demo/service-api/pom.xml index 1347a47..36b0c58 100644 --- a/saga-demo/saga-dubbo-demo/service-api/pom.xml +++ b/saga-demo/saga-dubbo-demo/service-api/pom.xml @@ -24,12 +24,7 @@ <dependency> <groupId>org.apache.servicecomb.saga.demo</groupId> <artifactId>service-pub</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb.saga.demo</groupId> - <artifactId>service-pub</artifactId> <version>0.2.0-SNAPSHOT</version> - <scope>compile</scope> </dependency> </dependencies> diff --git a/saga-demo/saga-dubbo-demo/servicea/pom.xml b/saga-demo/saga-dubbo-demo/servicea/pom.xml index 1360034..33102df 100644 --- a/saga-demo/saga-dubbo-demo/servicea/pom.xml +++ b/saga-demo/saga-dubbo-demo/servicea/pom.xml @@ -41,4 +41,48 @@ <artifactId>servicea</artifactId> + <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> + <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> + </project> \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/application.yaml b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/application.yaml index 3880847..98d0b78 100644 --- a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/application.yaml +++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/application.yaml @@ -17,7 +17,36 @@ spring: application: name: servicea + profiles: + active: prd + alpha: cluster: - address: localhost:8080 + address: alpha-server.servicecomb.io:8080 + +--- +spring: + profiles: prd + datasource: + username: saga + password: password + url: jdbc:postgresql://postgresql.servicecomb.io:5432/saga?useSSL=false + platform: postgresql + +--- +spring: + profiles: mysql + datasource: + username: saga + password: password + url: jdbc:mysql://mysql.servicecomb.io:3306/saga?useSSL=false + platform: mysql + continue-on-error: true + jpa: + properties: + eclipselink: + ddl-generation: none + + + 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 001ee81..219e96a 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,40 +16,16 @@ ~ 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 - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd - http://www.springframework.org/schema/aop - http://www.springframework.org/schema/aop/spring-aop-3.0.xsd - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> - - <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.jdbc.Driver" /> - <!--jdbc:mysql://127.0.0.1:3306/saga_dubbo--> - <property name="url" value="${database.url}" /> - <property name="username" value="${database.username}" /> - <property name="password" value="${database.password}" /> - <property name="maxTotal" value="50" /> - <property name="initialSize" value="20" /> - <property name="maxWaitMillis" value="60000" /> - <property name="minIdle" value="6" /> - <property name="logAbandoned" value="true" /> - <property name="removeAbandonedOnMaintenance" value="true" /> - <property name="removeAbandonedOnBorrow" value="true" /> - <property name="removeAbandonedTimeout" value="1800" /> - - <property name="testWhileIdle" value="true" /> - <property name="testOnBorrow" value="false" /> - <property name="testOnReturn" value="false" /> - <property name="validationQuery" value="select 'x' " /> - <property name="validationQueryTimeout" value="1" /> - <property name="timeBetweenEvictionRunsMillis" value="30000" /> - <property name="numTestsPerEvictionRun" value="20" /> - </bean> + 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 + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd + 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" /> diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-mysql.sql b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-mysql.sql new file mode 100644 index 0000000..91fc88a --- /dev/null +++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-mysql.sql @@ -0,0 +1,24 @@ +/* + * 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. + */ + +CREATE TABLE `testa` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `service` varchar(128) DEFAULT NULL, + `vstatus` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +INSERT INTO `testa` (`id`, `service`, `vstatus`) VALUES ('1','servicea','init'); \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-postgresql.sql b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-postgresql.sql new file mode 100644 index 0000000..21c05cd --- /dev/null +++ b/saga-demo/saga-dubbo-demo/servicea/src/main/resources/schema-postgresql.sql @@ -0,0 +1,26 @@ +/* + * 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. + */ + +CREATE TABLE IF NOT EXISTS testa ( + id BIGSERIAL PRIMARY KEY, + service varchar(128) NOT NULL, + vstatus varchar(36) NOT NULL +); + +CREATE INDEX IF NOT EXISTS testa_index ON testa (id, service); + +INSERT INTO testa (id, service, vstatus) VALUES ('1','servicea','init'); \ 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 bbfceb6..2471269 100644 --- a/saga-demo/saga-dubbo-demo/serviceb/pom.xml +++ b/saga-demo/saga-dubbo-demo/serviceb/pom.xml @@ -37,4 +37,48 @@ <artifactId>serviceb</artifactId> + <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> + <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> + </project> \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/application.yaml b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/application.yaml index f78027a..be1536a 100644 --- a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/application.yaml +++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/application.yaml @@ -19,4 +19,27 @@ spring: name: serviceb alpha: cluster: - address: localhost:8080 + address: alpha-server.servicecomb.io:8080 + +--- +spring: + profiles: prd + datasource: + username: saga + password: password + url: jdbc:postgresql://postgresql.servicecomb.io:5432/saga?useSSL=false + platform: postgresql + +--- +spring: + profiles: mysql + datasource: + username: saga + password: password + url: jdbc:mysql://mysql.servicecomb.io:3306/saga?useSSL=false + platform: mysql + continue-on-error: true + jpa: + properties: + eclipselink: + ddl-generation: none 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 3bdafa1..219e96a 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,39 +16,16 @@ ~ 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 - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd - http://www.springframework.org/schema/aop - http://www.springframework.org/schema/aop/spring-aop-3.0.xsd - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> - - <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.jdbc.Driver" /> - <property name="url" value="${database.url}" /> - <property name="username" value="${database.username}" /> - <property name="password" value="${database.password}" /> - <property name="maxTotal" value="50" /> - <property name="initialSize" value="20" /> - <property name="maxWaitMillis" value="60000" /> - <property name="minIdle" value="6" /> - <property name="logAbandoned" value="true" /> - <property name="removeAbandonedOnMaintenance" value="true" /> - <property name="removeAbandonedOnBorrow" value="true" /> - <property name="removeAbandonedTimeout" value="1800" /> - - <property name="testWhileIdle" value="true" /> - <property name="testOnBorrow" value="false" /> - <property name="testOnReturn" value="false" /> - <property name="validationQuery" value="select 'x' " /> - <property name="validationQueryTimeout" value="1" /> - <property name="timeBetweenEvictionRunsMillis" value="30000" /> - <property name="numTestsPerEvictionRun" value="20" /> - </bean> + 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 + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd + 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" /> diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-mysql.sql b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-mysql.sql new file mode 100644 index 0000000..2bc2a0c --- /dev/null +++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-mysql.sql @@ -0,0 +1,24 @@ +/* + * 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. + */ + +CREATE TABLE `testb` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `service` varchar(128) DEFAULT NULL, + `vstatus` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +INSERT INTO `testb` (`id`, `service`, `vstatus`) VALUES ('2','serviceb','init'); \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-postgresql.sql b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-postgresql.sql new file mode 100644 index 0000000..a50781b --- /dev/null +++ b/saga-demo/saga-dubbo-demo/serviceb/src/main/resources/schema-postgresql.sql @@ -0,0 +1,26 @@ +/* + * 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. + */ + +CREATE TABLE IF NOT EXISTS testb ( + id BIGSERIAL PRIMARY KEY, + service varchar(128) NOT NULL, + vstatus varchar(36) NOT NULL +); + +CREATE INDEX IF NOT EXISTS testb_index ON testb (id, service); + +INSERT INTO testb (id, service, vstatus) VALUES ('1','serviceb','init'); \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/servicec/pom.xml b/saga-demo/saga-dubbo-demo/servicec/pom.xml index 79cdd4d..f15fe2a 100644 --- a/saga-demo/saga-dubbo-demo/servicec/pom.xml +++ b/saga-demo/saga-dubbo-demo/servicec/pom.xml @@ -37,4 +37,48 @@ <artifactId>servicec</artifactId> + <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> + <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> + </project> \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/application.yaml b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/application.yaml index 0535557..7b282f5 100644 --- a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/application.yaml +++ b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/application.yaml @@ -19,4 +19,27 @@ spring: name: servicec alpha: cluster: - address: localhost:8080 + address: alpha-server.servicecomb.io:8080 + +--- +spring: + profiles: prd + datasource: + username: saga + password: password + url: jdbc:postgresql://postgresql.servicecomb.io:5432/saga?useSSL=false + platform: postgresql + +--- +spring: + profiles: mysql + datasource: + username: saga + password: password + url: jdbc:mysql://mysql.servicecomb.io:3306/saga?useSSL=false + platform: mysql + continue-on-error: true + jpa: + properties: + eclipselink: + ddl-generation: none 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 3bdafa1..219e96a 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,39 +16,16 @@ ~ 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 - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd - http://www.springframework.org/schema/aop - http://www.springframework.org/schema/aop/spring-aop-3.0.xsd - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> - - <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.jdbc.Driver" /> - <property name="url" value="${database.url}" /> - <property name="username" value="${database.username}" /> - <property name="password" value="${database.password}" /> - <property name="maxTotal" value="50" /> - <property name="initialSize" value="20" /> - <property name="maxWaitMillis" value="60000" /> - <property name="minIdle" value="6" /> - <property name="logAbandoned" value="true" /> - <property name="removeAbandonedOnMaintenance" value="true" /> - <property name="removeAbandonedOnBorrow" value="true" /> - <property name="removeAbandonedTimeout" value="1800" /> - - <property name="testWhileIdle" value="true" /> - <property name="testOnBorrow" value="false" /> - <property name="testOnReturn" value="false" /> - <property name="validationQuery" value="select 'x' " /> - <property name="validationQueryTimeout" value="1" /> - <property name="timeBetweenEvictionRunsMillis" value="30000" /> - <property name="numTestsPerEvictionRun" value="20" /> - </bean> + 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 + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd + 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" /> diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-mysql.sql b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-mysql.sql new file mode 100644 index 0000000..8a32eae --- /dev/null +++ b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-mysql.sql @@ -0,0 +1,24 @@ +/* + * 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. + */ + +CREATE TABLE `testc` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `service` varchar(128) DEFAULT NULL, + `vstatus` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +INSERT INTO `testc` (`id`, `service`, `vstatus`) VALUES ('3','servicec','init'); \ No newline at end of file diff --git a/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-postgresql.sql b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-postgresql.sql new file mode 100644 index 0000000..58f27dc --- /dev/null +++ b/saga-demo/saga-dubbo-demo/servicec/src/main/resources/schema-postgresql.sql @@ -0,0 +1,26 @@ +/* + * 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. + */ + +CREATE TABLE IF NOT EXISTS testc ( + id BIGSERIAL PRIMARY KEY, + service varchar(128) NOT NULL, + vstatus varchar(36) NOT NULL +); + +CREATE INDEX IF NOT EXISTS testc_index ON testc (id, service); + +INSERT INTO testc (id, service, vstatus) VALUES ('1','servicec','init'); \ No newline at end of file -- To stop receiving notification emails like this one, please contact ningji...@apache.org.