-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3f9232
commit fbdf2cd
Showing
3 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
nop-auth/nop-auth-service/src/test/java/io/nop/auth/service/TestTransformIn.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,39 @@ | ||
package io.nop.auth.service; | ||
|
||
import io.nop.api.core.annotations.autotest.NopTestConfig; | ||
import io.nop.api.core.beans.ApiRequest; | ||
import io.nop.autotest.junit.JunitBaseTestCase; | ||
import io.nop.graphql.core.IGraphQLExecutionContext; | ||
import io.nop.graphql.core.engine.IGraphQLEngine; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@NopTestConfig(localDb = true, initDatabaseSchema = true) | ||
public class TestTransformIn extends JunitBaseTestCase { | ||
|
||
@Inject | ||
IGraphQLEngine graphQLEngine; | ||
|
||
@Test | ||
public void testTransformIn() { | ||
ApiRequest<Map<String, Object>> req = new ApiRequest<>(); | ||
Map<String, Object> data = new HashMap<>(); | ||
data.put("name", "a"); | ||
data.put("remark", "B"); | ||
|
||
Map<String, Object> m = new HashMap<>(); | ||
m.put("data", data); | ||
req.setData(m); | ||
|
||
IGraphQLExecutionContext gqlCtx = graphQLEngine.newRpcContext(null, | ||
"NopAuthPosition__save", req); | ||
|
||
Map<String, Object> map = (Map<String, Object>) graphQLEngine.executeRpc(gqlCtx).get(); | ||
assertEquals("BEXT", map.get("remark")); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...c/test/resources/_vfs/_delta/default/nop/auth/model/NopAuthPosition/NopAuthPosition.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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<meta x:schema="/nop/schema/xmeta.xdef" xmlns:x="/nop/schema/xdsl.xdef" x:extends="super"> | ||
<props> | ||
<prop name="remark"> | ||
<transformIn> | ||
return value + 'EXT' | ||
</transformIn> | ||
</prop> | ||
</props> | ||
</meta> |
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