|
|
|
@ -85,7 +85,7 @@ public class TbJsonPathNodeTest { |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void givenPrimitiveMsg_whenOnMsg_thenVerifyOutput() throws Exception { |
|
|
|
void givenJsonMsg_whenOnMsg_thenVerifyOutputJsonPrimitiveNode() throws Exception { |
|
|
|
String data = "{\"Attribute_1\":22.5,\"Attribute_2\":100}"; |
|
|
|
VerifyOutputMsg(data, 1, 100); |
|
|
|
|
|
|
|
@ -93,6 +93,17 @@ public class TbJsonPathNodeTest { |
|
|
|
VerifyOutputMsg(data, 2, "StringValue"); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void givenJsonMsg_whenOnMsg_thenVerifyJavaPrimitiveOutput() throws Exception { |
|
|
|
config.setJsonPath("$.attributes.length()"); |
|
|
|
nodeConfiguration = new TbNodeConfiguration(mapper.valueToTree(config)); |
|
|
|
node.init(ctx, nodeConfiguration); |
|
|
|
|
|
|
|
String data = "{\"attributes\":[{\"attribute_1\":10},{\"attribute_2\":20},{\"attribute_3\":30},{\"attribute_4\":40}]}"; |
|
|
|
VerifyOutputMsg(data, 1, 4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void givenJsonArray_whenOnMsg_thenVerifyOutput() throws Exception { |
|
|
|
String data = "{\"Attribute_1\":22.5,\"Attribute_2\":[{\"Attribute_3\":22.5,\"Attribute_4\":10.3}, {\"Attribute_5\":22.5,\"Attribute_6\":10.3}]}"; |
|
|
|
|