diff --git a/pom.xml b/pom.xml index 9f89c20..e60075d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.6.RELEASE + 2.1.7.RELEASE @@ -22,7 +22,7 @@ UTF-8 UTF-8 Greenwich.SR2 - 2.7.2 + 2.7.3 @@ -47,19 +47,19 @@ org.apache.dubbo dubbo-spring-boot-starter - 2.7.1 + ${dubbo.version} org.apache.dubbo dubbo - 2.7.2 + ${dubbo.version} org.apache.dubbo dubbo-dependencies-zookeeper - 2.7.1 + ${dubbo.version} pom diff --git a/usergw-service/pom.xml b/usergw-service/pom.xml index 44ae320..9a657ba 100644 --- a/usergw-service/pom.xml +++ b/usergw-service/pom.xml @@ -17,9 +17,11 @@ 1.8 + false - + + cn.ecpark.service usergw-api @@ -56,7 +58,7 @@ org.yaml snakeyaml - 1.21 + 1.24 @@ -64,12 +66,6 @@ fastjson 1.2.58 - - - cn.ecpark.service - usergw-api - ${project.parent.version} - com.ctrip.framework.apollo @@ -91,17 +87,42 @@ org.springframework.boot spring-boot-maven-plugin + + cn.ecpark.service.usergw.App + - + + maven-compiler-plugin + maven-resources-plugin + maven-source-plugin + - maven-compiler-plugin - - - maven-resources-plugin - - - maven-source-plugin - + maven-assembly-plugin + 3.1.1 + + + make-assembly + package + + single + + + + + + + + true + + src/main/assembly/assembly.xml + + + + + + org.jacoco @@ -129,4 +150,4 @@ - \ No newline at end of file + diff --git a/usergw-service/src/main/assembly/assembly.xml b/usergw-service/src/main/assembly/assembly.xml new file mode 100644 index 0000000..c913986 --- /dev/null +++ b/usergw-service/src/main/assembly/assembly.xml @@ -0,0 +1,45 @@ + + assembly + + dir + zip + + false + + + src/main/assembly/scripts + bin + 0755 + true + + + + src/main/resources + config + + *.properties + gateway.yaml + + + + + ${project.build.directory} + / + + *.jar + + + + + + + + \ No newline at end of file diff --git a/usergw-service/src/main/assembly/scripts/run.bat b/usergw-service/src/main/assembly/scripts/run.bat new file mode 100644 index 0000000..9e69887 --- /dev/null +++ b/usergw-service/src/main/assembly/scripts/run.bat @@ -0,0 +1,10 @@ +@echo off & setlocal enabledelayedexpansion +set BIN_DIR=%~dp0 + +::run +cd %BIN_DIR%\.. + set APP_JAR="" + for %%f in (*-*-*.jar) do set APP_JAR=%%f + java -Dloader.path=config -Dfile.encoding=UTF-8 -Xms256m -Xmx512m -jar %APP_JAR% +cd %BIN_DIR% + diff --git a/usergw-service/src/main/assembly/scripts/run.sh b/usergw-service/src/main/assembly/scripts/run.sh new file mode 100644 index 0000000..caf978d --- /dev/null +++ b/usergw-service/src/main/assembly/scripts/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh +##cnf +APP_PMS="-Xms256m -Xmx512m" +APP_JAR=`echo *-*-*.jar` +##run +cur=$(dirname $(readlink -f "$0")) && cd $cur/.. + +exec java -Dloader.path=config -Dfile.encoding=UTF-8 ${APP_PMS} -jar ${APP_JAR} diff --git a/usergw-service/src/test/java/resources/test-gateway.yaml b/usergw-service/src/main/resources/test-gateway.yaml similarity index 100% rename from usergw-service/src/test/java/resources/test-gateway.yaml rename to usergw-service/src/main/resources/test-gateway.yaml diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig.java b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig.java index ba0b099..1877ac6 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig.java +++ b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig.java @@ -18,7 +18,7 @@ import reactor.netty.http.client.HttpClientResponse; @SpringBootTest(classes= App.class, webEnvironment = WebEnvironment.RANDOM_PORT) @RunWith(SpringRunner.class) -@TestPropertySource(locations = "classpath:/resources/test.properties", properties = {"apollo.meta=", "app.id="}) +@TestPropertySource(locations = "classpath:/resources/test1.properties", properties = {"apollo.meta=", "app.id="}) public class TestHttp2DubboConfig { @LocalServerPort diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig2.java b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig2.java index 5c3e37c..967eaa0 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig2.java +++ b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig2.java @@ -13,10 +13,10 @@ import reactor.netty.http.client.HttpClient; import reactor.netty.http.client.HttpClient.ResponseReceiver; import reactor.netty.http.client.HttpClientResponse; -// TODO: 添加附加Dubbo Service for Test启动进程 + @SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT) @RunWith(SpringRunner.class) -@TestPropertySource(locations = { "application2.properties" }) +@TestPropertySource(locations = "classpath:/resources/test2.properties", properties = {"apollo.meta=", "app.id="}) public class TestHttp2DubboConfig2 { @LocalServerPort diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig3.java b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig3.java index 9e9335d..787d1a1 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig3.java +++ b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig3.java @@ -17,10 +17,10 @@ import reactor.netty.http.client.HttpClient; import reactor.netty.http.client.HttpClient.ResponseReceiver; import reactor.netty.http.client.HttpClientResponse; -// TODO: 添加附加Dubbo Service for Test启动进程 + @SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.DEFINED_PORT) @RunWith(SpringRunner.class) -@TestPropertySource(locations = { "application3.properties" }) +@TestPropertySource(locations = "classpath:/resources/test3.properties", properties = {"apollo.meta=", "app.id="}) public class TestHttp2DubboConfig3 { @LocalServerPort diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig4.java b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig4.java index 37c79ac..9d2786e 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig4.java +++ b/usergw-service/src/test/java/cn/ecpark/service/usergw/TestHttp2DubboConfig4.java @@ -16,7 +16,7 @@ import reactor.netty.http.client.HttpClientResponse; // TODO: 添加附加Dubbo Service for Test启动进程 @SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT) @RunWith(SpringRunner.class) -@TestPropertySource(locations = { "application4.properties" }) +@TestPropertySource(locations = "classpath:/resources/test4.properties", properties = {"apollo.meta=", "app.id="}) public class TestHttp2DubboConfig4 { @LocalServerPort diff --git a/usergw-service/src/test/java/resources/test.properties b/usergw-service/src/test/java/resources/test1.properties similarity index 100% rename from usergw-service/src/test/java/resources/test.properties rename to usergw-service/src/test/java/resources/test1.properties diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/application2.properties b/usergw-service/src/test/java/resources/test2.properties similarity index 91% rename from usergw-service/src/test/java/cn/ecpark/service/usergw/application2.properties rename to usergw-service/src/test/java/resources/test2.properties index 592aa8c..7152322 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/application2.properties +++ b/usergw-service/src/test/java/resources/test2.properties @@ -11,5 +11,5 @@ server.port=8888 # logging.level.org.springframework.cloud.gateway=debug logging.file=logs/log -yame.config=test-gateway2.yaml +yame.gateway.config=test-gateway2.yaml diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/application3.properties b/usergw-service/src/test/java/resources/test3.properties similarity index 91% rename from usergw-service/src/test/java/cn/ecpark/service/usergw/application3.properties rename to usergw-service/src/test/java/resources/test3.properties index 1dcad2f..27ac3b7 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/application3.properties +++ b/usergw-service/src/test/java/resources/test3.properties @@ -11,5 +11,5 @@ server.port=8888 # logging.level.org.springframework.cloud.gateway=debug logging.file=logs/log -yame.config=test-gateway3.yaml +yame.gateway.config=test-gateway3.yaml diff --git a/usergw-service/src/test/java/cn/ecpark/service/usergw/application4.properties b/usergw-service/src/test/java/resources/test4.properties similarity index 92% rename from usergw-service/src/test/java/cn/ecpark/service/usergw/application4.properties rename to usergw-service/src/test/java/resources/test4.properties index fa63143..de36ee3 100644 --- a/usergw-service/src/test/java/cn/ecpark/service/usergw/application4.properties +++ b/usergw-service/src/test/java/resources/test4.properties @@ -17,5 +17,5 @@ server.port=8888 # logging.level.org.springframework.cloud.gateway=debug logging.file=logs/log -yame.config=test-gateway4.yaml +yame.gateway.config=test-gateway4.yaml