-
Notifications
You must be signed in to change notification settings - Fork 74
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
d38d1b7
commit b046d55
Showing
19 changed files
with
198 additions
and
95 deletions.
There are no files selected for viewing
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
45 changes: 45 additions & 0 deletions
45
nop-orm/src/test/java/io/nop/orm/component/TestXmlOrmComponent.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,45 @@ | ||
package io.nop.orm.component; | ||
|
||
import io.nop.core.initialize.CoreInitialization; | ||
import io.nop.core.lang.json.JsonTool; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class TestXmlOrmComponent { | ||
@BeforeAll | ||
public static void init() { | ||
CoreInitialization.initialize(); | ||
} | ||
|
||
@AfterAll | ||
public static void destroy() { | ||
CoreInitialization.destroy(); | ||
; | ||
} | ||
|
||
@Test | ||
public void testProp() { | ||
XmlOrmComponent comp = new XmlOrmComponent(); | ||
comp.setNormalizedXml("<rule><inputs><input name='a' mandatory='true' /></inputs></rule>"); | ||
|
||
List<Map<String, Object>> value = (List<Map<String, Object>>) comp.getChildValue("/nop/schema/rule.xdef", "inputs"); | ||
System.out.println(JsonTool.serialize(value, true)); | ||
|
||
value.get(0).put("name", "b"); | ||
value.get(0).put("displayName", "xx"); | ||
comp.setChildValue("/nop/schema/rule.xdef", "inputs", value); | ||
|
||
String xml = comp.getNormalizedXml(); | ||
assertEquals("<rule>\n" + | ||
" <inputs>\n" + | ||
" <input name=\"b\" mandatory=\"true\" displayName=\"xx\"/>\n" + | ||
" </inputs>\n" + | ||
"</rule>", xml); | ||
} | ||
} |
Binary file not shown.
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
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
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
11 changes: 8 additions & 3 deletions
11
...ule-meta/src/main/resources/_vfs/nop/rule/model/NopRuleDefinition/NopRuleDefinition.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
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
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
5 changes: 3 additions & 2 deletions
5
nop-rule/nop-rule-meta/src/main/resources/_vfs/nop/rule/model/NopRuleNode/NopRuleNode.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
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
Oops, something went wrong.