diff options
author | HuabingZhao <zhao.huabing@zte.com.cn> | 2017-07-25 15:18:33 +0800 |
---|---|---|
committer | HuabingZhao <zhao.huabing@zte.com.cn> | 2017-07-25 18:11:59 +0800 |
commit | 672f3d40be83d9e380fd7be4b674d5e8d5fa36de (patch) | |
tree | 43105e1d5e2ba8e8accea8648e57e1cf87db3f00 /apiroute/apiroute-service/src/test/resources | |
parent | 41d3db15a8e1a0496f9c2a5e15db2998a32bb9bf (diff) |
Divide the MSB source codes into two repos
Change-Id: Ie76d545b214a8ce5191f215350a623e1529983d9
Issue-id: MSB-5
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'apiroute/apiroute-service/src/test/resources')
13 files changed, 184 insertions, 0 deletions
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initApiGatewayConfig/initApiGatewayConfig.json b/apiroute/apiroute-service/src/test/resources/ext/initApiGatewayConfig/initApiGatewayConfig.json new file mode 100644 index 0000000..67580e1 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initApiGatewayConfig/initApiGatewayConfig.json @@ -0,0 +1,3 @@ +{
+ "port" : "80"
+}
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json new file mode 100644 index 0000000..80826f2 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json @@ -0,0 +1,12 @@ +{
+ "namespace":"all",
+ "predefineLabels":
+ {
+ "visualRange" : "0",
+ "network_plane_type":"net"
+ },
+ "customLabels":
+ {
+ "custom-key":"custom-value"
+ }
+}
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json.sample b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json.sample new file mode 100644 index 0000000..1ffdbc1 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/initRouteLabelsMatches.json.sample @@ -0,0 +1,12 @@ +{
+ "namespace":"all",
+ "predefineLabels":
+ {
+ "visualRange" : "0",
+ "network_plane_type":""
+ },
+ "customLabels":
+ {
+ "customLabel":""
+ }
+}
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/readme.txt b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/readme.txt new file mode 100644 index 0000000..3e95c5c --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initRouteLabels/readme.txt @@ -0,0 +1,17 @@ +Apigateway can synchronized service informations from the service discovery by configuring filter tag。
+Synchronization filter configuration file path:apiroute\ext\initRouteLabels\initVisualRangeMatches.json,
+{
+ "namespace":"",
+ "routeLabels":
+ {
+ "visualRange" : "0",
+ "network_plane_type":""
+ }
+}
+namespace为命令空间过滤条件,值为空则忽略此项过滤,否则只有服务namespace属性与条件一致的服务才进行下一步的自定义标签匹配。
+routeLabels为自定义标签,用户可自定义键值对匹配条件,支持多项值,以|分隔。任一个标签的值满足即同步
+当同步服务信息时使用visualRange这个标签筛选,取值范围 系统间:0(默认) 系统内:1,其中系统间将对服务路由访问做鉴权处理。
+
+如果是docker部署首选在apigateway所在容器配置env环境变量获取:
+变量名:NAMESPACE
+变量名:ROUTE_LABELS 变量值格式:visualRange:0; network_plane_type:xx|yy
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/initRouteWay.json b/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/initRouteWay.json new file mode 100644 index 0000000..b6ebf27 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/initRouteWay.json @@ -0,0 +1,3 @@ +{
+ "routeWay":"ip"
+}
\ No newline at end of file diff --git a/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/readme.txt b/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/readme.txt new file mode 100644 index 0000000..c219550 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initRouteWay/readme.txt @@ -0,0 +1,5 @@ +Apigateway 路由方式:ip/domain; 默认为ip
+
+如果是docker部署首选在apigateway所在容器配置env环境变量获取:
+变量名:ROUTE_WAY 变量可选值:ip/domain
+
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initServices/msb.json b/apiroute/apiroute-service/src/test/resources/ext/initServices/msb.json new file mode 100644 index 0000000..43b795d --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initServices/msb.json @@ -0,0 +1,44 @@ +[{
+ "serviceName" : "microservices",
+ "version" : "v1",
+ "url" : "/api/microservices/v1",
+ "apiJson" : "/api/microservices/v1/swagger.json",
+ "apiJsonType" : "1",
+ "metricsUrl" : "/admin/metrics",
+ "control" : "1",
+ "status" : "1",
+ "host":"msb",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8066",
+ "weight" : 0
+ }
+ ]
+ },
+{
+ "serviceName" : "microservices",
+ "url" : "/iui/microservices",
+ "control" : "1",
+ "status" : "1",
+ "host":"msb",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8066",
+ "weight" : 0
+ }
+ ]
+ },
+ {
+ "serviceName" : "/custom",
+ "url" : "/custom",
+ "control" : "1",
+ "status" : "1",
+ "host":"msb",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8066",
+ "weight" : 0
+ }
+ ]
+ }
+]
diff --git a/apiroute/apiroute-service/src/test/resources/ext/initServices/readme.txt b/apiroute/apiroute-service/src/test/resources/ext/initServices/readme.txt new file mode 100644 index 0000000..59ef5e4 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initServices/readme.txt @@ -0,0 +1,63 @@ +########################## initialize default routeInfo to redis ##########################
+
+#when msb is starting, it will automatically read all json files under this folder, and initializes to redis.
+#If the routeInfo is exist, it will be ignored, otherwise it will be saved.
+
+
+# JSON File content must be routeInfo format array like below examples:
+
+# optional:
+# apiJsonType: 1:user-defined json type 0:pre-defined json type
+# control: 0:default 1:readonly 2:hidden
+# status: 0:disabled 1:enabled
+# Tip:control、status、weight are non-mandatory
+
+[
+##########################apiRoute example##########################
+
+{
+ "serviceName" : "microservices",
+ "version" : "v1",
+ "url" : "/api/microservices/v1",
+ "apiJson" : "/api/microservices/v1/swagger.json",
+ "apiJsonType" : "1",
+ "metricsUrl" : "/admin/metrics",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ },
+
+##########################iuiRoute example##########################
+
+{
+ "serviceName" : "microservices",
+ "url" : "/iui/microservices",
+ "control" : "1",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "127.0.0.1",
+ "port" : "8086",
+ "weight" : 0
+ }
+ ]
+ },
+
+##########################customRoute example##########################
+ {
+ "serviceName" : "/test",
+ "url" : "/test",
+ "control" : "0",
+ "status" : "1",
+ "servers" : [{
+ "ip" : "10.74.56.36",
+ "port" : "8989",
+ "weight" : 0
+ }
+ ]
+ }
+]
\ No newline at end of file diff --git a/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc1.json b/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc1.json new file mode 100644 index 0000000..7c63d7e --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc1.json @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"version":"1.0.0","title":"Local API Test"},"basePath":"/service","tags":[{"name":"ApiRoute"}],"paths":{"/apiRoute":{"get":{"tags":["ApiRoute"],"summary":"get all ApiRoute ","description":"","operationId":"getApiRoutes","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/ApiRouteInfo"}}}}},"post":{"tags":["ApiRoute"],"summary":"add one ApiRoute ","description":"","operationId":"addApiRoute","produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"add ApiRoute error "}}}},"/apiRoute/type/{type}/{routeName}/version/{version}":{"get":{"tags":["ApiRoute"],"summary":"get one ApiRoute ","description":"","operationId":"getApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"get ApiRoute error "}}},"delete":{"tags":["ApiRoute"],"summary":"delete one ApiRoute by routeName and version","description":"","operationId":"deleteApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"delete ApiRoute error "}}}},"/apiRoute/{routeName}/version/{version}":{"put":{"tags":["ApiRoute"],"summary":"update one ApiRoute by routeName and version","description":"","operationId":"updateApiRoute","produces":["application/json"],"parameters":[{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"},{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"update ApiRoute error "}}}}},"definitions":{"ApiRouteLifeCycle":{"type":"object","properties":{"installPath":{"type":"string"},"startScript":{"type":"string"},"stopScript":{"type":"string"}}},"ApiRouteServer":{"type":"object","properties":{"ip":{"type":"string"},"weight":{"type":"integer","format":"int32"}}},"ApiRouteResult":{"type":"object","properties":{"result":{"type":"string"},"info":{"type":"string"}}},"ApiRouteInfo":{"type":"object","properties":{"routeName":{"type":"string"},"version":{"type":"string"},"url":{"type":"string"},"apiJson":{"type":"string"},"type":{"type":"string"},"servers":{"type":"array","items":{"$ref":"#/definitions/ApiRouteServer"}},"lifeCycle":{"$ref":"#/definitions/ApiRouteLifeCycle"}}}}}
\ No newline at end of file diff --git a/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc2.json b/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc2.json new file mode 100644 index 0000000..eb7c8cd --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initSwaggerJson/api-doc2.json @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"version":"1.0.0","title":"Local API Test2"},"basePath":"/service","tags":[{"name":"ApiRoute"}],"paths":{"/apiRoute":{"get":{"tags":["ApiRoute"],"summary":"get all ApiRoute ","description":"","operationId":"getApiRoutes","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/ApiRouteInfo"}}}}},"post":{"tags":["ApiRoute"],"summary":"add one ApiRoute ","description":"","operationId":"addApiRoute","produces":["application/json"],"parameters":[{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"add ApiRoute error "}}}},"/apiRoute/type/{type}/{routeName}/version/{version}":{"get":{"tags":["ApiRoute"],"summary":"get one ApiRoute ","description":"","operationId":"getApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteInfo"}},"500":{"description":"get ApiRoute error "}}},"delete":{"tags":["ApiRoute"],"summary":"delete one ApiRoute by routeName and version","description":"","operationId":"deleteApiRoute","produces":["application/json"],"parameters":[{"name":"type","in":"path","description":"Route type","required":true,"type":"string","enum":["iui","api"]},{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"delete ApiRoute error "}}}},"/apiRoute/{routeName}/version/{version}":{"put":{"tags":["ApiRoute"],"summary":"update one ApiRoute by routeName and version","description":"","operationId":"updateApiRoute","produces":["application/json"],"parameters":[{"name":"routeName","in":"path","description":"ApiRoute routeName","required":true,"type":"string"},{"name":"version","in":"path","description":"ApiRoute version","required":true,"type":"string"},{"in":"body","name":"body","description":"ApiRoute Instance Info","required":true,"schema":{"$ref":"#/definitions/ApiRouteInfo"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiRouteResult"}},"500":{"description":"update ApiRoute error "}}}}},"definitions":{"ApiRouteLifeCycle":{"type":"object","properties":{"installPath":{"type":"string"},"startScript":{"type":"string"},"stopScript":{"type":"string"}}},"ApiRouteServer":{"type":"object","properties":{"ip":{"type":"string"},"weight":{"type":"integer","format":"int32"}}},"ApiRouteResult":{"type":"object","properties":{"result":{"type":"string"},"info":{"type":"string"}}},"ApiRouteInfo":{"type":"object","properties":{"routeName":{"type":"string"},"version":{"type":"string"},"url":{"type":"string"},"apiJson":{"type":"string"},"type":{"type":"string"},"servers":{"type":"array","items":{"$ref":"#/definitions/ApiRouteServer"}},"lifeCycle":{"$ref":"#/definitions/ApiRouteLifeCycle"}}}}}
\ No newline at end of file diff --git a/apiroute/apiroute-service/src/test/resources/ext/initUrlRootPath/initUrlRootPath.json b/apiroute/apiroute-service/src/test/resources/ext/initUrlRootPath/initUrlRootPath.json new file mode 100644 index 0000000..9668592 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/initUrlRootPath/initUrlRootPath.json @@ -0,0 +1,4 @@ +{
+ "iuiRootPath" : "iui",
+ "apiRootPath" : "api"
+}
diff --git a/apiroute/apiroute-service/src/test/resources/ext/redisConf/redis.properties b/apiroute/apiroute-service/src/test/resources/ext/redisConf/redis.properties new file mode 100644 index 0000000..3703748 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/ext/redisConf/redis.properties @@ -0,0 +1,18 @@ +redis.host=127.0.0.1 +redis.port=6379 +#connectionTimeout +redis.connectionTimeout=2000 +#redis dbIndex锛宒efaule:0 +redis.db_index=0 + +#--------------redis pool config-------------- +#maxTotal +redis.pool.maxTotal=500 +#maxIdle +redis.pool.maxIdle=100 +#maxWaitMillis:ms +redis.pool.maxWaitMillis=15000 +#testOnBorrow +redis.pool.testOnBorrow=false +#testOnReturn +redis.pool.testOnReturn=true diff --git a/apiroute/apiroute-service/src/test/resources/org/onap/msb/apiroute/wrapper/consulextend/util/serviceslist.json b/apiroute/apiroute-service/src/test/resources/org/onap/msb/apiroute/wrapper/consulextend/util/serviceslist.json new file mode 100644 index 0000000..5139ca8 --- /dev/null +++ b/apiroute/apiroute-service/src/test/resources/org/onap/msb/apiroute/wrapper/consulextend/util/serviceslist.json @@ -0,0 +1 @@ +{"aaa-aaa":["\"ns\":{\"namespace\":\"aaa\"}","\"base\":{\"version\":\"v1\",\"protocol\":\"UI\",\"url\":\"/iui\",\"enable_ssl\":\"false\",\"is_manual\":\"true\",\"status\":\"1\"}","\"lb\":{\"lb_policy\":\"\"}","\"labels\":{\"visualRange\":\"1\"}"],"apigateway-default":["\"base\":{\"url\":\"/api/microservices/v1\",\"protocol\":\"REST\",\"version\":\"v1\"}","\"labels\":{\"visualRange\":\"1\"}","\"metadata\":{\"routeWay\":\"ip\"}","\"ns\":{\"namespace\":\"default\"}"],"authen":["\"lb\":{\"lb_policy\":\"\"}","\"labels\":{\"visualRange\":\"1\"}","\"base\":{\"version\":\"v1\",\"protocol\":\"HTTP\",\"url\":\"/authen/v1\",\"enable_ssl\":\"false\",\"is_manual\":\"false\",\"status\":\"1\",\"ha_role\":\"active\"}"],"author":["\"base\":{\"version\":\"v1\",\"protocol\":\"HTTP\",\"url\":\"/author/v1\",\"enable_ssl\":\"false\",\"is_manual\":\"false\",\"status\":\"1\",\"ha_role\":\"active\"}","\"lb\":{\"lb_policy\":\"\"}","\"labels\":{\"visualRange\":\"1\"}"],"bbb-bbb":["\"ns\":{\"namespace\":\"bbb\"}","\"base\":{\"version\":\"v1\",\"protocol\":\"HTTP\",\"url\":\"/iui/component\",\"enable_ssl\":\"false\",\"is_manual\":\"true\",\"status\":\"1\"}","\"lb\":{\"lb_policy\":\"\"}","\"labels\":{\"visualRange\":\"1\"}"],"br-engine":["\"base\":{\"version\":\"v1\",\"protocol\":\"HTTP\",\"url\":\"/br-engine/v1\",\"enable_ssl\":\"false\",\"is_manual\":\"false\",\"status\":\"1\",\"ha_role\":\"active\"}","\"lb\":{\"lb_policy\":\"\"}","\"labels\":{\"visualRange\":\"0|1\"}"]}
\ No newline at end of file |