summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java')
-rw-r--r--src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java400
1 files changed, 199 insertions, 201 deletions
diff --git a/src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java b/src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java
index 36b11ed..198a0eb 100644
--- a/src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java
+++ b/src/test/java/org/onap/aai/sparky/util/TreeWalkerTest.java
@@ -57,8 +57,7 @@ public class TreeWalkerTest {
* @throws Exception the exception
*/
@Before
- public void init() throws Exception {
- }
+ public void init() throws Exception {}
/**
* Validate json node conversion null input.
@@ -184,8 +183,7 @@ public class TreeWalkerTest {
public void validateWalkTreeOneParentNodeWithObjectArray() {
try {
- String jsonStr =
- "{\"Employee\":[{\"id\":\"101\",\"name\":\"Pushkar\",\"salary\":\"5000\"},"
+ String jsonStr = "{\"Employee\":[{\"id\":\"101\",\"name\":\"Pushkar\",\"salary\":\"5000\"},"
+ "{\"id\":\"102\",\"name\":\"Rahul\",\"salary\":\"4000\"},"
+ "{\"id\":\"103\",\"name\":\"tanveer\",\"salary\":\"56678\"}]}";
TreeWalker walker = new TreeWalker();
@@ -230,68 +228,68 @@ public class TreeWalkerTest {
try {
String jsonStr =
"{ \"generalNodeClass\": { \"class\": \"aai-entity-node general-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\", "
- + " \"svgAttributes\": { \"r\": \"10\" "
- + "} }, { \"type\": \"text\", "
- + "\"class\": \"id-type-label\", \"displayKey\": \"itemType\", "
- + " \"shapeAttributes\": { \"offset\": { "
- + " \"x\": \"0\", \"y\": \"30\" } "
- + " } }, { \"type\": \"text\", "
- + " \"class\": \"id-value-label\", \"displayKey\":"
- + " \"itemNameValue\", \"shapeAttributes\": { "
- + " \"offset\": { \"x\": \"0\", "
- + " \"y\": \"40\" } } } ] "
- + " }, \"searchedNodeClass\": { \"class\": \"aai-entity-node search-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": { "
- + " \"r\": \"20\" } }, { "
- + " \"type\": \"circle\", \"class\": \"inner\", "
- + " \"svgAttributes\": { \"r\": \"10\" }"
- + " }, { \"type\": \"text\", "
- + "\"class\": \"id-type-label\", \"displayKey\": \"itemType\", "
- + " \"shapeAttributes\": { \"offset\": { "
- + " \"x\": \"0\", \"y\": \"30\" }"
- + " } }, { \"type\": \"text\", "
- + " \"class\": \"id-value-label\", "
- + "\"displayKey\": \"itemNameValue\", \"shapeAttributes\": {"
- + " \"offset\": { \"x\": \"0\","
- + " \"y\": \"40\" } }"
- + " } ] }, \"selectedSearchedNodeClass\": { "
- + "\"class\": \"aai-entity-node selected-search-node\", \"visualElements\": ["
- + " { \"type\": \"circle\", "
- + "\"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\" "
- + " } }, { \"type\": \"text\", "
- + " \"class\": \"id-type-label\", \"displayKey\": \"itemType\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"x\": \"0\", \"y\": \"30\""
- + " } } }, { "
- + " \"type\": \"text\", \"class\": \"id-value-label\", "
- + " \"displayKey\": \"itemNameValue\", \"shapeAttributes\": {"
- + " \"offset\": { \"x\": \"0\", "
- + " \"y\": \"40\" } } } ]"
- + " }, \"selectedNodeClass\": { \"class\":"
- + " \"aai-entity-node selected-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\" "
- + " } }, { \"type\": \"text\", "
- + " \"class\": \"id-type-label\", \"displayKey\": \"itemType\","
- + " \"shapeAttributes\": { \"offset\": "
- + "{ "
- + " \"x\": \"0\", \"y\": \"30\" } "
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\", \"displayKey\":"
- + " \"itemNameValue\", \"shapeAttributes\": { "
- + "\"offset\": { \"x\": \"0\", "
- + "\"y\": \"40\" } } } ] }}";
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\", "
+ + " \"svgAttributes\": { \"r\": \"10\" "
+ + "} }, { \"type\": \"text\", "
+ + "\"class\": \"id-type-label\", \"displayKey\": \"itemType\", "
+ + " \"shapeAttributes\": { \"offset\": { "
+ + " \"x\": \"0\", \"y\": \"30\" } "
+ + " } }, { \"type\": \"text\", "
+ + " \"class\": \"id-value-label\", \"displayKey\":"
+ + " \"itemNameValue\", \"shapeAttributes\": { "
+ + " \"offset\": { \"x\": \"0\", "
+ + " \"y\": \"40\" } } } ] "
+ + " }, \"searchedNodeClass\": { \"class\": \"aai-entity-node search-node\","
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": { "
+ + " \"r\": \"20\" } }, { "
+ + " \"type\": \"circle\", \"class\": \"inner\", "
+ + " \"svgAttributes\": { \"r\": \"10\" }"
+ + " }, { \"type\": \"text\", "
+ + "\"class\": \"id-type-label\", \"displayKey\": \"itemType\", "
+ + " \"shapeAttributes\": { \"offset\": { "
+ + " \"x\": \"0\", \"y\": \"30\" }"
+ + " } }, { \"type\": \"text\", "
+ + " \"class\": \"id-value-label\", "
+ + "\"displayKey\": \"itemNameValue\", \"shapeAttributes\": {"
+ + " \"offset\": { \"x\": \"0\","
+ + " \"y\": \"40\" } }"
+ + " } ] }, \"selectedSearchedNodeClass\": { "
+ + "\"class\": \"aai-entity-node selected-search-node\", \"visualElements\": ["
+ + " { \"type\": \"circle\", "
+ + "\"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\" "
+ + " } }, { \"type\": \"text\", "
+ + " \"class\": \"id-type-label\", \"displayKey\": \"itemType\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"x\": \"0\", \"y\": \"30\""
+ + " } } }, { "
+ + " \"type\": \"text\", \"class\": \"id-value-label\", "
+ + " \"displayKey\": \"itemNameValue\", \"shapeAttributes\": {"
+ + " \"offset\": { \"x\": \"0\", "
+ + " \"y\": \"40\" } } } ]"
+ + " }, \"selectedNodeClass\": { \"class\":"
+ + " \"aai-entity-node selected-node\","
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\" "
+ + " } }, { \"type\": \"text\", "
+ + " \"class\": \"id-type-label\", \"displayKey\": \"itemType\","
+ + " \"shapeAttributes\": { \"offset\": "
+ + "{ "
+ + " \"x\": \"0\", \"y\": \"30\" } "
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\", \"displayKey\":"
+ + " \"itemNameValue\", \"shapeAttributes\": { "
+ + "\"offset\": { \"x\": \"0\", "
+ + "\"y\": \"40\" } } } ] }}";
TreeWalker walker = new TreeWalker();
List<String> paths = new ArrayList<String>();
walker.walkTree(paths, walker.convertJsonToNode(jsonStr));
@@ -400,143 +398,143 @@ public class TreeWalkerTest {
try {
String n1Str =
"{ \"generalNodeClass\": { \"class\": \"aai-entity-node general-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\""
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-type-label\", \"displayKey\":"
- + " \"itemType\", \"shapeAttributes\": { \"offset\":"
- + " { \"x\": \"0\", \"y\": \"30\""
- + " } } }, {"
- + " \"type\": \"text\", \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\":"
- + " { \"x\": \"0\", \"y\": \"40\""
- + " } } } ] },"
- + " \"searchedNodeClass\": { \"class\": \"aai-entity-node search-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\""
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-type-label\", \"displayKey\":"
- + " \"itemType\", \"shapeAttributes\": { \"offset\": {"
- + " \"x\": \"0\", \"y\": \"30\""
- + " } } }, {"
- + " \"type\": \"text\", \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"x\": \"0\", \"y\": \"40\""
- + " } } } ] },"
- + " \"selectedSearchedNodeClass\": { \"class\":"
- + " \"aai-entity-node selected-search-node\", \"visualElements\": ["
- + " { \"type\": \"circle\", \"class\":"
- + " \"outer\", \"svgAttributes\": { \"r\": \"20\""
- + " } }, { \"type\": \"circle\","
- + " \"class\": \"inner\", \"svgAttributes\": {"
- + " \"r\": \"10\" } }, {"
- + " \"type\": \"text\", \"class\": \"id-type-label\","
- + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"x\": \"0\","
- + " \"y\": \"30\" } }"
- + " }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"x\": \"0\", \"y\": \"40\""
- + " } } } ] },"
- + " \"selectedNodeClass\": { \"class\": \"aai-entity-node selected-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\""
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-type-label\", \"displayKey\":"
- + " \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"x\": \"0\","
- + " \"y\": \"30\" }"
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\", \"displayKey\":"
- + " \"itemNameValue\", \"shapeAttributes\": {"
- + " \"offset\": { \"x\": \"0\","
- + " \"y\": \"40\" } }"
- + " } ] }}";
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\""
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-type-label\", \"displayKey\":"
+ + " \"itemType\", \"shapeAttributes\": { \"offset\":"
+ + " { \"x\": \"0\", \"y\": \"30\""
+ + " } } }, {"
+ + " \"type\": \"text\", \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\":"
+ + " { \"x\": \"0\", \"y\": \"40\""
+ + " } } } ] },"
+ + " \"searchedNodeClass\": { \"class\": \"aai-entity-node search-node\","
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\""
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-type-label\", \"displayKey\":"
+ + " \"itemType\", \"shapeAttributes\": { \"offset\": {"
+ + " \"x\": \"0\", \"y\": \"30\""
+ + " } } }, {"
+ + " \"type\": \"text\", \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"x\": \"0\", \"y\": \"40\""
+ + " } } } ] },"
+ + " \"selectedSearchedNodeClass\": { \"class\":"
+ + " \"aai-entity-node selected-search-node\", \"visualElements\": ["
+ + " { \"type\": \"circle\", \"class\":"
+ + " \"outer\", \"svgAttributes\": { \"r\": \"20\""
+ + " } }, { \"type\": \"circle\","
+ + " \"class\": \"inner\", \"svgAttributes\": {"
+ + " \"r\": \"10\" } }, {"
+ + " \"type\": \"text\", \"class\": \"id-type-label\","
+ + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"x\": \"0\","
+ + " \"y\": \"30\" } }"
+ + " }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"x\": \"0\", \"y\": \"40\""
+ + " } } } ] },"
+ + " \"selectedNodeClass\": { \"class\": \"aai-entity-node selected-node\","
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\""
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-type-label\", \"displayKey\":"
+ + " \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"x\": \"0\","
+ + " \"y\": \"30\" }"
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\", \"displayKey\":"
+ + " \"itemNameValue\", \"shapeAttributes\": {"
+ + " \"offset\": { \"x\": \"0\","
+ + " \"y\": \"40\" } }"
+ + " } ] }}";
String n2Str =
"{ \"searchedNodeClass\": { \"class\": \"aai-entity-node search-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } },"
- + " { \"type\": \"circle\","
- + " \"class\": \"inner\", \"svgAttributes\": {"
- + " \"r\": \"10\" } }, {"
- + " \"type\": \"text\", \"class\": \"id-type-label\","
- + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"y\": \"30\","
- + " \"x\": \"0\" } }"
- + " }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"y\": \"40\", \"x\": \"0\""
- + " } } } ] },"
- + " \"selectedSearchedNodeClass\": { \"class\":"
- + " \"aai-entity-node selected-search-node\", \"visualElements\": ["
- + " { \"type\": \"circle\", \"class\":"
- + " \"outer\", \"svgAttributes\": { \"r\": \"20\""
- + " } }, { \"type\": \"circle\","
- + " \"class\": \"inner\", \"svgAttributes\": {"
- + " \"r\": \"10\" } }, {"
- + " \"type\": \"text\", \"class\": \"id-type-label\","
- + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"y\": \"30\","
- + " \"x\": \"0\" } }"
- + " }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"y\": \"40\", \"x\": \"0\""
- + " } } } ] },"
- + " \"selectedNodeClass\": { \"class\": \"aai-entity-node selected-node\","
- + " \"visualElements\": [ { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } }, {"
- + " \"type\": \"circle\", \"class\": \"inner\","
- + " \"svgAttributes\": { \"r\": \"10\""
- + " } }, { \"type\": \"text\","
- + " \"class\": \"id-type-label\","
- + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"y\": \"30\","
- + " \"x\": \"0\" } }"
- + " }, { \"type\": \"text\","
- + " \"class\": \"id-value-label\","
- + " \"displayKey\": \"itemNameValue\","
- + " \"shapeAttributes\": { \"offset\": {"
- + " \"y\": \"40\", \"x\": \"0\""
- + " } } } ] },"
- + " \"generalNodeClass\": { \"class\":"
- + " \"aai-entity-node general-node\", \"visualElements\": ["
- + " { \"type\": \"circle\","
- + " \"class\": \"outer\", \"svgAttributes\": {"
- + " \"r\": \"20\" } },"
- + " { \"type\": \"circle\","
- + " \"class\": \"inner\", \"svgAttributes\": {"
- + " \"r\": \"10\" } },"
- + " { \"type\": \"text\","
- + " \"class\": \"id-type-label\", \"displayKey\":"
- + " \"itemType\", \"shapeAttributes\": {"
- + " \"offset\": { \"y\": \"30\","
- + " \"x\": \"0\" }"
- + " } }, {"
- + " \"type\": \"text\","
- + " \"class\": \"id-value-label\", \"displayKey\":"
- + " \"itemNameValue\", \"shapeAttributes\": {"
- + " \"offset\": { \"y\": \"40\","
- + " \"x\": \"0\" }"
- + " } } ] }}";
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } },"
+ + " { \"type\": \"circle\","
+ + " \"class\": \"inner\", \"svgAttributes\": {"
+ + " \"r\": \"10\" } }, {"
+ + " \"type\": \"text\", \"class\": \"id-type-label\","
+ + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"y\": \"30\","
+ + " \"x\": \"0\" } }"
+ + " }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"y\": \"40\", \"x\": \"0\""
+ + " } } } ] },"
+ + " \"selectedSearchedNodeClass\": { \"class\":"
+ + " \"aai-entity-node selected-search-node\", \"visualElements\": ["
+ + " { \"type\": \"circle\", \"class\":"
+ + " \"outer\", \"svgAttributes\": { \"r\": \"20\""
+ + " } }, { \"type\": \"circle\","
+ + " \"class\": \"inner\", \"svgAttributes\": {"
+ + " \"r\": \"10\" } }, {"
+ + " \"type\": \"text\", \"class\": \"id-type-label\","
+ + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"y\": \"30\","
+ + " \"x\": \"0\" } }"
+ + " }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"y\": \"40\", \"x\": \"0\""
+ + " } } } ] },"
+ + " \"selectedNodeClass\": { \"class\": \"aai-entity-node selected-node\","
+ + " \"visualElements\": [ { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } }, {"
+ + " \"type\": \"circle\", \"class\": \"inner\","
+ + " \"svgAttributes\": { \"r\": \"10\""
+ + " } }, { \"type\": \"text\","
+ + " \"class\": \"id-type-label\","
+ + " \"displayKey\": \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"y\": \"30\","
+ + " \"x\": \"0\" } }"
+ + " }, { \"type\": \"text\","
+ + " \"class\": \"id-value-label\","
+ + " \"displayKey\": \"itemNameValue\","
+ + " \"shapeAttributes\": { \"offset\": {"
+ + " \"y\": \"40\", \"x\": \"0\""
+ + " } } } ] },"
+ + " \"generalNodeClass\": { \"class\":"
+ + " \"aai-entity-node general-node\", \"visualElements\": ["
+ + " { \"type\": \"circle\","
+ + " \"class\": \"outer\", \"svgAttributes\": {"
+ + " \"r\": \"20\" } },"
+ + " { \"type\": \"circle\","
+ + " \"class\": \"inner\", \"svgAttributes\": {"
+ + " \"r\": \"10\" } },"
+ + " { \"type\": \"text\","
+ + " \"class\": \"id-type-label\", \"displayKey\":"
+ + " \"itemType\", \"shapeAttributes\": {"
+ + " \"offset\": { \"y\": \"30\","
+ + " \"x\": \"0\" }"
+ + " } }, {"
+ + " \"type\": \"text\","
+ + " \"class\": \"id-value-label\", \"displayKey\":"
+ + " \"itemNameValue\", \"shapeAttributes\": {"
+ + " \"offset\": { \"y\": \"40\","
+ + " \"x\": \"0\" }"
+ + " } } ] }}";
TreeWalker walker = new TreeWalker();
List<String> n1Paths = new ArrayList<String>();