From 92954a0cf27787a4f1c6ec4ad805f53e20c587bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=BClte?= Date: Tue, 1 Mar 2022 17:41:10 +0100 Subject: [PATCH] Add integration test for #121 --- .../expected.json | 4 ++++ .../move_fieldFromArrayOfStringsWithAsterisk/input.json | 4 ++++ .../move_fieldFromArrayOfStringsWithAsterisk/test.fix | 1 + .../move_fieldFromArrayOfStringsWithAsterisk/test.flux | 8 ++++++++ .../expected.json | 3 +++ .../replace_AllFromArrayOfStringsWithAsterisk/input.json | 3 +++ .../replace_AllFromArrayOfStringsWithAsterisk/test.fix | 1 + .../replace_AllFromArrayOfStringsWithAsterisk/test.flux | 8 ++++++++ 8 files changed, 32 insertions(+) create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/expected.json create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/input.json create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.fix create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.flux create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/expected.json create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/input.json create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.fix create mode 100644 metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.flux diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/expected.json new file mode 100644 index 00000000..3791064c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/expected.json @@ -0,0 +1,4 @@ +{ + "key" : [ ], + "words" : [ "value", "more_value", "even_more_value" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/input.json new file mode 100644 index 00000000..5cf962f7 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/input.json @@ -0,0 +1,4 @@ +{ + "key" : [ "value", "more_value", "even_more_value" ], + "words" : [ ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.fix new file mode 100644 index 00000000..b0b9e3c7 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.fix @@ -0,0 +1 @@ +move_field("key[].*", "words[].$append") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldFromArrayOfStringsWithAsterisk/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/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/expected.json new file mode 100644 index 00000000..3784e98d --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/expected.json @@ -0,0 +1,3 @@ +{ + "key" : [ "value", "m__re_value", "even_m__re_value" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/input.json new file mode 100644 index 00000000..160261df --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/input.json @@ -0,0 +1,3 @@ +{ + "key" : [ "value", "more_value", "even_more_value" ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.fix new file mode 100644 index 00000000..0f50b7d8 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.fix @@ -0,0 +1 @@ +replace_all("test[].*", "o", "__") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/test.flux new file mode 100644 index 00000000..7c3575fa --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/replace_AllFromArrayOfStringsWithAsterisk/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") +;