diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/disabled.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/disabled.txt new file mode 100644 index 00000000..0b9661d2 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/disabled.txt @@ -0,0 +1 @@ +See issue #121 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/expected.json new file mode 100644 index 00000000..78d32c1f --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/expected.json @@ -0,0 +1,11 @@ +{ + "adventureDuo": [ { + "name" : "Jake", + "animal" : "dog", + "tools" : [ "arms", "magic", "shapeShifting" ] + }, { + "name" : "Finn", + "animal" : "human", + "tools" : [ "anotherSword", "arm", "sword" ] + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/input.json new file mode 100644 index 00000000..9ae00b1c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/input.json @@ -0,0 +1,11 @@ +{ + "adventureDuo": [ { + "name" : "Jake", + "animal" : "dog", + "tools" : [ "magic", "arms", "shapeShifting" ] + }, { + "name" : "Finn", + "animal" : "human", + "tools" : [ "sword", "anotherSword", "arm" ] + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.fix new file mode 100644 index 00000000..a18704c6 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.fix @@ -0,0 +1,2 @@ +sort_field("adventureDuo[].*.tools[]") + diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldInArrayOfObjectsWithAsterisk/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/expected.json new file mode 100644 index 00000000..0b6279cc --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/expected.json @@ -0,0 +1,9 @@ +{ + "animals" : [ "cat", "cat", "dog", "zebra" ], + "animals_2" : [ "zebra", "dog", "cat", "cat" ], + "animals_3" : [ "cat", "dog", "zebra" ], + "numbers" : [ "1", "10", "2", "7", "7" ], + "numbers_2" : [ "1", "2", "7", "7", "10" ], + "numbers_3" : [ "10", "7", "7", "2", "1" ], + "numbers_4" : [ "1", "2", "7", "10" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/input.json new file mode 100644 index 00000000..4d31b867 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/input.json @@ -0,0 +1,9 @@ +{ + "animals" : [ "dog", "cat", "cat", "zebra" ], + "animals_2" : [ "dog", "cat", "cat", "zebra" ], + "animals_3" : [ "dog", "cat", "cat", "zebra" ], + "numbers" : [ "7", "2", "7", "1", "10" ], + "numbers_2" : [ "7", "2", "7", "1", "10" ], + "numbers_3" : [ "7", "2", "7", "1", "10" ], + "numbers_4" : [ "7", "2", "7", "1", "10" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.fix new file mode 100644 index 00000000..1ae49f39 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.fix @@ -0,0 +1,7 @@ +sort_field("animals[]") +sort_field("numbers[]") +sort_field("numbers_2[]",numeric:"true") +sort_field("animals_2[]",reverse:"true") +sort_field("numbers_3[]", numeric:"true",reverse:"true") +sort_field("animals_3[]", uniq:"true") +sort_field("numbers_4[]",numeric:"true", uniq:"true") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sort_fieldSimple/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/split_fieldSubfieldInArrayOfObjectsWithAsterisk/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/split_fieldSubfieldInArrayOfObjectsWithAsterisk/input.json index b29cc094..1e14a838 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/split_fieldSubfieldInArrayOfObjectsWithAsterisk/input.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/split_fieldSubfieldInArrayOfObjectsWithAsterisk/input.json @@ -1,11 +1,11 @@ { "adventureDuo": [ { - "name" : "Jake", - "animal" : "dog", - "tools" : "magic--arms--shapeShifting" - }, { - "name" : "Finn", - "animal" : "human", - "tools" : "sword--anotherSword--arm" - } ] + "name" : "Jake", + "animal" : "dog", + "tools" : "magic--arms--shapeShifting" + }, { + "name" : "Finn", + "animal" : "human", + "tools" : "sword--anotherSword--arm" + } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/expected.json new file mode 100644 index 00000000..ce6d5321 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/expected.json @@ -0,0 +1,4 @@ +{ + "numbers" : [ "27" ], + "numbers_2" : [ "10" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/input.json new file mode 100644 index 00000000..3abb6ce3 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/input.json @@ -0,0 +1,4 @@ +{ + "numbers" : [ "7", "2", "7", "1", "10" ], + "numbers_2" : [ "1", "2", "3", "4"] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.fix new file mode 100644 index 00000000..b3ff41e5 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.fix @@ -0,0 +1,3 @@ +sum("numbers[]") +sum("numbers_2[]") + diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSimple/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +; diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/disabled.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/disabled.txt new file mode 100644 index 00000000..0b9661d2 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/disabled.txt @@ -0,0 +1 @@ +See issue #121 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/expected.json new file mode 100644 index 00000000..c5284171 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/expected.json @@ -0,0 +1,7 @@ +{ + "objects" : [ { + "numbers" : [ "27" ] + }, { + "numbers" : [ "10"] + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/input.json new file mode 100644 index 00000000..63a3d84e --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/input.json @@ -0,0 +1,7 @@ +{ + "objects" : [ { + "numbers" : [ "7", "2", "7", "1", "10" ] + }, { + "numbers_2" : [ "1", "2", "3", "4"] + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.fix new file mode 100644 index 00000000..f134b293 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.fix @@ -0,0 +1,2 @@ +sum("objects[].*.numbers[]") + diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/sumSubfieldInArrayOfObjects/test.flux @@ -0,0 +1,8 @@ +FLUX_DIR + "input.json" +|open-file +|as-records +|decode-json +|fix(FLUX_DIR + "test.fix") +|encode-json(prettyPrinting="true") +|write(FLUX_DIR + "output-metafix.json") +;