Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
auto-test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xie.qin
auto-test
Commits
9f99ae70
Commit
9f99ae70
authored
Sep 23, 2021
by
xie.qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
to support openapi-service and block-service.
parent
0e9c1e6e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
1 deletion
+124
-1
apiTest.feature
api/resources/features/sanitytest/apiTest.feature
+15
-0
OpenApiParser.java
...main/java/com/fuzamei/autotest/openapi/OpenApiParser.java
+47
-1
BlockServiceProperties.java
.../autotest/properties/services/BlockServiceProperties.java
+24
-0
OpenapiServiceProperties.java
...utotest/properties/services/OpenapiServiceProperties.java
+24
-0
application.yml
api/src/main/resources/application.yml
+14
-0
No files found.
api/resources/features/sanitytest/apiTest.feature
View file @
9f99ae70
...
...
@@ -71,3 +71,18 @@ Feature: API tests for ALL Services
Given
Found OpenAPI definition for website service
Then
Analyze OpenAPI file of website service and generate REST-ful requests automatically
@openapi-service
Scenario
:
OPENAPI-Service APIs smoke test
Given
Found OpenAPI definition for openapi service
Then
Analyze OpenAPI file of openapi service and generate REST-ful requests automatically
@block-service
Scenario
:
BLOCK-Service APIs smoke test
Given
Found OpenAPI definition for block service
Then
Analyze OpenAPI file of block service and generate REST-ful requests automatically
@others
Scenario
:
Other services APIs smoke test
Given
Found OpenAPI definition for other service
Then
Analyze OpenAPI file of other service and generate REST-ful requests automatically
api/src/main/java/com/fuzamei/autotest/openapi/OpenApiParser.java
View file @
9f99ae70
...
...
@@ -73,6 +73,12 @@ public class OpenApiParser {
WebsiteServiceProperties
websiteServiceProperties
;
@Autowired
OpenapiServiceProperties
openapiServiceProperties
;
@Autowired
BlockServiceProperties
blockServiceProperties
;
@Autowired
GlobalProperties
globalProperties
;
@Resource
...
...
@@ -1103,8 +1109,48 @@ public class OpenApiParser {
path
=
"http://"
+
path
;
}
break
;
default
:
case
"openapi"
:
if
(!
URL
.
toLowerCase
().
contains
(
"openapi-service"
)){
return
null
;
}
path
=
openapiServiceProperties
.
getHost
()
+
":"
+
openapiServiceProperties
.
getPort
()
+
URL
;
if
(
openapiServiceProperties
.
getHttps
())
{
path
=
"https://"
+
path
;
}
else
{
path
=
"http://"
+
path
;
}
break
;
case
"block"
:
if
(!
URL
.
toLowerCase
().
contains
(
"block-service"
)){
return
null
;
}
path
=
blockServiceProperties
.
getHost
()
+
":"
+
blockServiceProperties
.
getPort
()
+
URL
;
if
(
blockServiceProperties
.
getHttps
())
{
path
=
"https://"
+
path
;
}
else
{
path
=
"http://"
+
path
;
}
break
;
default
:
// other services
if
(
URL
.
toLowerCase
().
contains
(
"website-service"
)
||
URL
.
toLowerCase
().
contains
(
"user-service"
)
||
URL
.
toLowerCase
().
contains
(
"pay-service"
)
||
URL
.
toLowerCase
().
contains
(
"order-service"
)
||
URL
.
toLowerCase
().
contains
(
"monitor-service"
)
||
URL
.
toLowerCase
().
contains
(
"logger-service"
)
||
URL
.
toLowerCase
().
contains
(
"license-service"
)
||
URL
.
toLowerCase
().
contains
(
"common-service"
)
||
URL
.
toLowerCase
().
contains
(
"commodity-service"
)
||
URL
.
toLowerCase
().
contains
(
"cloud-service"
)
||
URL
.
toLowerCase
().
contains
(
"chain-service"
)
||
URL
.
toLowerCase
().
contains
(
"auth-service"
)
||
URL
.
toLowerCase
().
contains
(
"app-service"
)
||
URL
.
toLowerCase
().
contains
(
"openapi-service"
)
||
URL
.
toLowerCase
().
contains
(
"block-service"
))
{
return
null
;
}
path
=
backendServiceProperties
.
getHost
()
+
":"
+
backendServiceProperties
.
getPort
()
+
URL
;
if
(
backendServiceProperties
.
getHttps
()){
path
=
"https://"
+
path
;
}
else
{
path
=
"http://"
+
path
;
}
}
return
path
;
...
...
api/src/main/java/com/fuzamei/autotest/properties/services/BlockServiceProperties.java
0 → 100644
View file @
9f99ae70
package
com
.
fuzamei
.
autotest
.
properties
.
services
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"service.app"
)
@PropertySource
(
value
=
"classpath:application.yml"
,
encoding
=
"UTF-8"
)
@Setter
@Getter
public
class
BlockServiceProperties
{
private
String
host
;
private
String
port
;
private
String
openapifilepath
;
//private String httpschema;
private
Boolean
https
;
@Value
(
"${service.block.http2.enabled}"
)
private
Boolean
http2
;
}
api/src/main/java/com/fuzamei/autotest/properties/services/OpenapiServiceProperties.java
0 → 100644
View file @
9f99ae70
package
com
.
fuzamei
.
autotest
.
properties
.
services
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"service.app"
)
@PropertySource
(
value
=
"classpath:application.yml"
,
encoding
=
"UTF-8"
)
@Setter
@Getter
public
class
OpenapiServiceProperties
{
private
String
host
;
private
String
port
;
private
String
openapifilepath
;
//private String httpschema;
private
Boolean
https
;
@Value
(
"${service.openapi.http2.enabled}"
)
private
Boolean
http2
;
}
api/src/main/resources/application.yml
View file @
9f99ae70
...
...
@@ -107,6 +107,20 @@ service:
https
:
${service.backend.https}
http2
:
enabled
:
${service.backend.http2.enabled}
openapi
:
host
:
${service.backend.host}
port
:
${service.backend.port}
openapidefinitionpath
:
/
https
:
${service.backend.https}
http2
:
enabled
:
${service.backend.http2.enabled}
block
:
host
:
${service.backend.host}
port
:
${service.backend.port}
openapidefinitionpath
:
/
https
:
${service.backend.https}
http2
:
enabled
:
${service.backend.http2.enabled}
mysql
:
host
:
${service.backend.host}
database
:
baas
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment