Skip to content

Commit

Permalink
8th test of Jolt is passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmondal committed Dec 12, 2022
1 parent b14894f commit 2b613ad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/samples/mappers/j8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"data": {
"clientId": "1234",
"clientName": "Acme"
}
}
7 changes: 7 additions & 0 deletions app/samples/mappers/jolt_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ jolt_7x:
xpath($,'../hidden') ? 'disabled' : 'enabled'
jolt_8z:
bookMap :
_each: "[ $.data ]"
_key : "$.clientId"
_value: "$.clientName"


jolt_9x:
clientIds :
_each: "#//clientId"
Expand Down
14 changes: 14 additions & 0 deletions app/src/test/java/flower/TransformTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ public void jolt_7x(){

}

@Test
public void jolt_8z(){
Object o = load( "samples/mappers/j8.json");
Transformation<?> tr = transformation( "samples/mappers/jolt_all.yaml", "jolt_8z");
Object r = tr.apply(o);
Assert.assertNotNull(r);
String js = toFormattedJson(r);
System.out.println(js);
Object actual = ZMethodInterceptor.Default.jxPath(r, "//bookMap", false);
Assert.assertTrue(actual instanceof Map);
Assert.assertEquals(1, ((Map<?,?>) actual).size());

}

@Test
public void jolt_9x(){
Object o = load( "samples/mappers/j9.json");
Expand Down

0 comments on commit 2b613ad

Please sign in to comment.