add: 修改Pom Assembly设置, 完美打包scripts.

fix: test的设置,  使unittest可以根据不同配置变量启动测试
This commit is contained in:
huangsimin
2019-08-15 17:42:04 +08:00
parent e7dacaa09b
commit b5a19c78cf
14 changed files with 116 additions and 32 deletions

View File

@@ -0,0 +1,45 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>assembly</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>src/main/assembly/scripts</directory>
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>config</outputDirectory>
<includes>
<include>*.properties</include>
<include>gateway.yaml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
<!-- <dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>compile</scope>
</dependencySet>
</dependencySets> -->
</assembly>

View File

@@ -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%

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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