diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/expected.json new file mode 100644 index 000000000..1dd0f7991 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/expected.json @@ -0,0 +1,16 @@ +{ + "GST" : [ { + "a" : "TestA1" + }, { + "a" : "TestB1", + "b" : "TestB2" + }, { + "a" : "TestC1", + "b" : "TestC2", + "c" : "TestC3" + } ], + "subject" : [ { + "name" : "Test", + "altLabel" : [ "TestA1", "TestB1 ( TestB2 )", "TestC1 ( TestC2 TestC3 )" ] + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/input.json new file mode 100644 index 000000000..37aa9694c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/input.json @@ -0,0 +1,14 @@ +{ + "GST" : [ + { + "a" : "TestA1" + }, { + "a" : "TestB1", + "b" : "TestB2" + }, { + "a" : "TestC1", + "b" : "TestC2", + "c" : "TestC3" + } + ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/test.fix new file mode 100644 index 000000000..c1f992c91 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/test.fix @@ -0,0 +1,9 @@ +set_array("subject[]") +add_field("subject[].$append.name","Test") +set_array("subject[].$last.altLabel[]") + +do list(path:"GST[]", "var": "$i") # Other altLabels have a "," character between $a and $b. + paste("subject[].$last.altLabel[].$append", "$i.a", "~(", "$i.b", "$i.c", "~)") +end + +replace_all("subject[].*.altLabel[].*"," | \\( \\)","") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/test.flux new file mode 100644 index 000000000..7c3575fac --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping/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/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/expected.json new file mode 100644 index 000000000..f5f9c4ca6 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/expected.json @@ -0,0 +1,18 @@ +{ + "GST" : [ { + "a" : "TestA1" + }, { + "a" : "TestB1", + "b" : "TestB2" + }, { + "a" : "TestC1", + "b" : "TestC2", + "c" : "TestC3" + } ], + "subject" : [ { + "name" : "Test", + "agent" : { + "altLabel" : [ "TestA1", "TestB1 ( TestB2 )", "TestC1 ( TestC2 TestC3 )" ] + } + } ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/input.json b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/input.json new file mode 100644 index 000000000..37aa9694c --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/input.json @@ -0,0 +1,14 @@ +{ + "GST" : [ + { + "a" : "TestA1" + }, { + "a" : "TestB1", + "b" : "TestB2" + }, { + "a" : "TestC1", + "b" : "TestC2", + "c" : "TestC3" + } + ] +} diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/test.fix new file mode 100644 index 000000000..776cc8656 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/test.fix @@ -0,0 +1,9 @@ +set_array("subject[]") +add_field("subject[].$append.name","Test") +set_array("subject[].$last.agent.altLabel[]") + +do list(path:"GST[]", "var": "$i") # Other altLabels have a "," character between $a and $b. + paste("subject[].$last.agent.altLabel[].$append", "$i.a", "~(", "$i.b", "$i.c", "~)") +end + +replace_all("subject[].*.agent.altLabel[].*"," | \\( \\)","") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/test.flux b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/test.flux new file mode 100644 index 000000000..7c3575fac --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/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/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/todo.txt new file mode 100644 index 000000000..cf98f2856 --- /dev/null +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/method/fromJson/toJson/replace_allInPastedSubfieldOfArrayOfObjectsWithAsteriskWithGrouping_2/todo.txt @@ -0,0 +1 @@ +See issue #278