Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
e9f21513
提交
e9f21513
authored
1月 24, 2022
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(base): 新增了TestController 的 测试接口
上级
c0afee43
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
96 行增加
和
8 行删除
+96
-8
pom.xml
kt-base/pom.xml
+26
-0
Hello.java
...e/src/main/java/org/matrix/database/controller/Hello.java
+9
-0
TestController.java
...n/java/org/matrix/database/controller/TestController.java
+50
-4
CaseActuatorTest.java
.../test/java/org/matrix/actuators/sql/CaseActuatorTest.java
+10
-4
HttpClientActuatorTest.java
...java/org/matrix/actuators/sql/HttpClientActuatorTest.java
+1
-0
没有找到文件。
kt-base/pom.xml
浏览文件 @
e9f21513
...
...
@@ -7,10 +7,13 @@
<groupId>
org.matrix
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<name>
keystone-base
</name>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
kt-base
</artifactId>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.matrix
</groupId>
...
...
@@ -166,4 +169,26 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<skipTests>
true
</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.8
</source>
<!--指明源码用的Jdk版本-->
<target>
1.8
</target>
<!--指明打包后的Jdk版本-->
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
kt-base/src/main/java/org/matrix/database/controller/Hello.java
0 → 100644
浏览文件 @
e9f21513
package
org
.
matrix
.
database
.
controller
;
import
lombok.Data
;
@Data
public
class
Hello
{
private
String
name
;
}
kt-base/src/main/java/org/matrix/database/controller/TestController.java
浏览文件 @
e9f21513
package
org
.
matrix
.
database
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
/**
* TestController. 用于测试的控制器
...
...
@@ -25,4 +23,52 @@ public class TestController {
public
ResponseEntity
<
String
>
getTableName
(
@RequestParam
String
tableName
)
{
return
ResponseEntity
.
ok
(
tableName
);
}
@PostMapping
(
"/sayHelloJson"
)
public
String
sendMessage
(
@RequestBody
Hello
hello
)
{
return
String
.
format
(
"{\n"
+
" \"store\": {\n"
+
" \"book\": [\n"
+
" {\n"
+
" \"category\": \"%s\",\n"
+
" \"author\": \"Nigel Rees\",\n"
+
" \"title\": \"Sayings of the Century\",\n"
+
" \"price\": 8.95\n"
+
" },\n"
+
" {\n"
+
" \"category\": \"fiction\",\n"
+
" \"author\": \"Evelyn Waugh\",\n"
+
" \"title\": \"Sword of Honour\",\n"
+
" \"price\": 12.99\n"
+
" },\n"
+
" {\n"
+
" \"category\": \"fiction\",\n"
+
" \"author\": \"Herman Melville\",\n"
+
" \"title\": \"Moby Dick\",\n"
+
" \"isbn\": \"0-553-21311-3\",\n"
+
" \"price\": 8.99\n"
+
" },\n"
+
" {\n"
+
" \"category\": \"fiction\",\n"
+
" \"author\": \"J. R. R. Tolkien\",\n"
+
" \"title\": \"The Lord of the Rings\",\n"
+
" \"isbn\": \"0-395-19395-8\",\n"
+
" \"price\": 22.99\n"
+
" }\n"
+
" ],\n"
+
" \"bicycle\": {\n"
+
" \"color\": \"red\",\n"
+
" \"price\": 19.95\n"
+
" }\n"
+
" },\n"
+
" \"expensive\": 10\n"
+
"}"
,
hello
.
getName
());
}
@GetMapping
(
"/sendMessage"
)
public
ResponseEntity
sendMessage
(
String
tableName
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"message"
,
String
.
format
(
"你好: %s"
,
tableName
));
return
ResponseEntity
.
ok
(
jsonObject
);
}
}
kt-base/src/test/java/org/matrix/actuators/sql/CaseActuatorTest.java
浏览文件 @
e9f21513
...
...
@@ -21,15 +21,21 @@ class CaseActuatorTest {
1
l
);
String
json
=
"{\n"
+
" \"url\":\"http://192.168.102.223:13245/test/sayHelloJson\",\n"
+
" \"method\":\"POST\",\n"
+
" \"requestType\":\"JSON\",\n"
+
" \"stringValue\":\"{\\\"name\\\":\\\"${componentName}[0]\\\"}\",\n"
+
" \"url\":\"http://127.0.0.1:8080/test/sendMessage\",\n"
+
" \"method\":\"GET\",\n"
+
" \"requestType\":\"QUERY\",\n"
+
" \"headers\":[\n"
+
" {\n"
+
" \"name\":\"cookie\",\n"
+
" \"value\":\"123456\"\n"
+
" }\n"
+
" ],\n"
+
" \"requestBodies\":[\n"
+
" {\n"
+
" \"key\":\"tableName\",\n"
+
" \"type\":\"TEXT\",\n"
+
" \"value\":\"张三\"\n"
+
" }\n"
+
" ]\n"
+
"}"
;
System
.
out
.
println
(
json
);
...
...
kt-base/src/test/java/org/matrix/actuators/sql/HttpClientActuatorTest.java
浏览文件 @
e9f21513
...
...
@@ -33,6 +33,7 @@ class HttpClientActuatorTest {
" }\n"
+
" ]\n"
+
"}"
;
HttpRequestDetail
httpRequestDetail1
=
JSON
.
parseObject
(
json
,
HttpRequestDetail
.
class
);
HttpRequestDetail
httpRequestDetail
=
JSON
.
parseObject
(
json
,
HttpRequestDetail
.
class
);
HttpResponseDetail
httpResponseDetail
=
httpClientActuator
.
sendHttpRequest
(
httpRequestDetail
);
System
.
out
.
println
(
httpResponseDetail
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论