-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdDomain设置为csv-list将会导致返回值类型变为List<String>
- Loading branch information
1 parent
5ca6d8d
commit 8731718
Showing
6 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
1 change: 1 addition & 0 deletions
1
...ervice/cases/io/nop/auth/service/TestMetaGen/testCsvList/input/tables/nop_auth_op_log.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LOG_ID,USER_NAME,USER_ID,SESSION_ID,OPERATION,DESCRIPTION,ACTION_TIME,USED_TIME,RESULT_STATUS,ERROR_CODE,RET_MESSAGE,OP_REQUEST,OP_RESPONSE |
25 changes: 25 additions & 0 deletions
25
.../nop-auth-service/cases/io/nop/auth/service/TestMetaGen/testCsvList/output/response.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"id": "@var:NopAuthOpLog@logId", | ||
"logId": "@var:NopAuthOpLog@logId", | ||
"userName": "aaa", | ||
"userId": "a", | ||
"sessionId": "123", | ||
"operation": null, | ||
"description": null, | ||
"actionTime": "@var:NopAuthOpLog@actionTime", | ||
"usedTime": 0, | ||
"resultStatus": 1, | ||
"errorCode": null, | ||
"retMessage": null, | ||
"opRequest": null, | ||
"opResponse": [ | ||
"a", | ||
"b", | ||
"c" | ||
] | ||
} | ||
], | ||
"status": 0 | ||
} |
2 changes: 2 additions & 0 deletions
2
...rvice/cases/io/nop/auth/service/TestMetaGen/testCsvList/output/tables/nop_auth_op_log.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_chgType,LOG_ID,USER_NAME,USER_ID,SESSION_ID,OPERATION,DESCRIPTION,ACTION_TIME,USED_TIME,RESULT_STATUS,ERROR_CODE,RET_MESSAGE,OP_REQUEST,OP_RESPONSE | ||
A,@var:NopAuthOpLog@logId,aaa,a,123,,,@var:NopAuthOpLog@actionTime,@var:NopAuthOpLog@usedTime,1,,,,"a,b,c" |
48 changes: 48 additions & 0 deletions
48
nop-auth/nop-auth-service/src/test/java/io/nop/auth/service/TestMetaGen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.nop.auth.service; | ||
|
||
import io.nop.api.core.annotations.autotest.EnableSnapshot; | ||
import io.nop.api.core.annotations.autotest.NopTestConfig; | ||
import io.nop.api.core.beans.ApiRequest; | ||
import io.nop.api.core.beans.ApiResponse; | ||
import io.nop.api.core.time.CoreMetrics; | ||
import io.nop.auth.dao.entity.NopAuthOpLog; | ||
import io.nop.autotest.junit.JunitAutoTestCase; | ||
import io.nop.dao.api.IDaoProvider; | ||
import io.nop.dao.api.IEntityDao; | ||
import io.nop.graphql.core.IGraphQLExecutionContext; | ||
import io.nop.graphql.core.engine.IGraphQLEngine; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@NopTestConfig(localDb = true, initDatabaseSchema = true) | ||
public class TestMetaGen extends JunitAutoTestCase { | ||
|
||
@Inject | ||
IGraphQLEngine graphQLEngine; | ||
|
||
@Inject | ||
IDaoProvider daoProvider; | ||
|
||
@EnableSnapshot | ||
@Test | ||
public void testCsvList() { | ||
saveData(); | ||
ApiRequest<Void> request = new ApiRequest<>(); | ||
IGraphQLExecutionContext gqlCtx = graphQLEngine.newRpcContext(null, "NopAuthOpLog__findList", request); | ||
ApiResponse<?> response = graphQLEngine.executeRpc(gqlCtx); | ||
output("response.json5", response); | ||
} | ||
|
||
private void saveData() { | ||
IEntityDao<NopAuthOpLog> dao = daoProvider.daoFor(NopAuthOpLog.class); | ||
NopAuthOpLog log = new NopAuthOpLog(); | ||
log.setSessionId("123"); | ||
log.setActionTime(CoreMetrics.currentTimestamp()); | ||
log.setUserId("a"); | ||
log.setUsedTime(0L); | ||
log.setUserName("aaa"); | ||
log.setOpResponse("a,b,c"); | ||
log.setResultStatus(1); | ||
dao.saveEntity(log); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ice/src/test/resources/_vfs/_delta/default/nop/auth/model/NopAuthOpLog/NopAuthOpLog.xmeta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<meta x:extends="super" x:schema="/nop/schema/xmeta.xdef" | ||
xmlns:x="/nop/schema/xdsl.xdef" xmlns:graphql="graphql" xmlns:filter="filter"> | ||
|
||
<props> | ||
<prop name="opResponse"> | ||
<schema stdDomain="csv-list" /> | ||
</prop> | ||
</props> | ||
</meta> |