diff --git a/metafix/src/main/java/org/metafacture/metafix/FixPath.java b/metafix/src/main/java/org/metafacture/metafix/FixPath.java index ec35670c..7b5846ee 100644 --- a/metafix/src/main/java/org/metafacture/metafix/FixPath.java +++ b/metafix/src/main/java/org/metafacture/metafix/FixPath.java @@ -170,6 +170,9 @@ void apply(final Array array, final String field, final Value value) { final ReservedField reservedField = ReservedField.fromString(field); if (reservedField != null) { switch (reservedField) { + case $prepend: + array.add(0, value); + break; case $append: array.add(value); break; @@ -275,10 +278,8 @@ else if (isReference(field)) { mode.apply(hash, field, newValue); } else { - if (!hash.containsField(field)) { - hash.put(field, Value.newHash().withPathSet(newValue.getPath())); - } - insertInto(hash.get(field), mode, newValue, field, tail(path)); + final String[] tail = tail(path); + insertInto(getContainerValue(hash, field, newValue.getPath(), tail[0]), mode, newValue, field, tail); } return new Value(hash); @@ -298,12 +299,29 @@ private Value insertInto(final Value value, final InsertMode mode, final Value n } } + private Value getContainerValue(final Hash hash, final String field, final String newPath, final String nextField) { + Value result = hash.get(field); + final boolean isAddingToArray = nextField.equals(ReservedField.$prepend.name()) || nextField.equals(ReservedField.$append.name()); + if (result == null) { + result = (isAddingToArray ? Value.newArray() : Value.newHash()).withPathSet(newPath); + hash.put(field, result); + } + else { + if (isAddingToArray && result.isString()) { + final Value value = result; + result = Value.newArray(a -> a.add(value)); + hash.put(field, result); + } + } + return result; + } + private String[] tail(final String[] fields) { return Arrays.copyOfRange(fields, 1, fields.length); } private enum ReservedField { - $append, $first, $last; + $prepend, $append, $first, $last; private static final Map STRING_TO_ENUM = new HashMap<>(); static { @@ -343,6 +361,10 @@ private Value getReferencedValue(final Array array, final String field, final St referencedValue = Value.newHash().withPathSet(p); // TODO: append non-hash? array.add(referencedValue); break; + case $prepend: + referencedValue = Value.newHash().withPathSet(p); + array.add(0, referencedValue); + break; default: break; } diff --git a/metafix/src/main/java/org/metafacture/metafix/Value.java b/metafix/src/main/java/org/metafacture/metafix/Value.java index 8aeae637..25d54496 100644 --- a/metafix/src/main/java/org/metafacture/metafix/Value.java +++ b/metafix/src/main/java/org/metafacture/metafix/Value.java @@ -433,8 +433,24 @@ public void add(final Value value) { } /* package-private */ void add(final Value value, final boolean appendToPath) { + add(list.size(), value, appendToPath); + } + + /* package-private */ void add(final int index, final Value value) { + add(index, value, true); + } + + /* package-private */ void add(final int index, final Value value, final boolean appendToPath) { if (!isNull(value)) { - list.add(appendToPath ? value.withPathAppend(list.size() + 1) : value); + list.add(index, appendToPath ? value.withPathAppend(index + 1) : value); + updateIndexesInPathsAfter(index); + } + } + + private void updateIndexesInPathsAfter(final int start) { + for (int index = start + 1; index < list.size(); index = index + 1) { + final Value value = list.get(index); + value.withPathSet(value.getPath().replaceAll("\\d+$", String.valueOf(index + 1))); } } diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java index f67a1b22..e2de4a02 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java @@ -928,14 +928,23 @@ public void shouldLookupInNestedArrays() { } @Test - public void shouldLookupInCopiedNestedArrays() { + public void shouldLookupInCopiedNestedArraysCreatedWithAppend() { + shouldLookupInCopiedNestedArraysCreatedWith("$append"); + } + + @Test + public void shouldLookupInCopiedNestedArraysCreatedWithPrepend() { + shouldLookupInCopiedNestedArraysCreatedWith("$prepend"); + } + + private void shouldLookupInCopiedNestedArraysCreatedWith(final String reservedField) { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( "put_map('rswk-indicator', s: 'SubjectHeading')", "set_array('subject[]')", - "set_array('subject[].$append.componentList[]')", - "set_array('subject[].$last.componentList[].$append.type[]')", + "set_array('subject[]." + reservedField + ".componentList[]')", + "set_array('subject[].$last.componentList[]." + reservedField + ".type[]')", "do list(path: 'D', 'var': '$i')", - " copy_field('$i', 'subject[].$last.componentList[].$last.type[].$append')", + " copy_field('$i', 'subject[].$last.componentList[].$last.type[]." + reservedField + "')", "end", "lookup('subject[].*.componentList[].*.type[].*', 'rswk-indicator')", "retain('subject[]')" diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java index 67e6ea77..b8c13b87 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixRecordTest.java @@ -303,6 +303,115 @@ public void addWithAppendInNewArray() { ); } + @Test + public void addWithAppendInImplicitArray() { + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "add_field('my.name.$append','patrick')", + "add_field('my.name.$append','nicolas')" + ), + i -> { + i.startRecord("1"); + i.endRecord(); + + i.startRecord("2"); + i.startEntity("my"); + i.literal("name", "max"); + i.endEntity(); + i.endRecord(); + + i.startRecord("3"); + i.endRecord(); + }, + o -> { + o.get().startRecord("1"); + o.get().startEntity("my"); + o.get().literal("name", "patrick"); + o.get().literal("name", "nicolas"); + o.get().endEntity(); + o.get().endRecord(); + + o.get().startRecord("2"); + o.get().startEntity("my"); + o.get().literal("name", "max"); + o.get().literal("name", "patrick"); + o.get().literal("name", "nicolas"); + o.get().endEntity(); + o.get().endRecord(); + + o.get().startRecord("3"); + o.get().startEntity("my"); + o.get().literal("name", "patrick"); + o.get().literal("name", "nicolas"); + o.get().endEntity(); + o.get().endRecord(); + } + ); + } + + @Test + public void addWithPrependInImplicitArray() { + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "add_field('my.name.$prepend','patrick')", + "add_field('my.name.$prepend','nicolas')" + ), + i -> { + i.startRecord("1"); + i.endRecord(); + + i.startRecord("2"); + i.startEntity("my"); + i.literal("name", "max"); + i.endEntity(); + i.endRecord(); + + i.startRecord("3"); + i.endRecord(); + }, + o -> { + o.get().startRecord("1"); + o.get().startEntity("my"); + o.get().literal("name", "nicolas"); + o.get().literal("name", "patrick"); + o.get().endEntity(); + o.get().endRecord(); + + o.get().startRecord("2"); + o.get().startEntity("my"); + o.get().literal("name", "nicolas"); + o.get().literal("name", "patrick"); + o.get().literal("name", "max"); + o.get().endEntity(); + o.get().endRecord(); + + o.get().startRecord("3"); + o.get().startEntity("my"); + o.get().literal("name", "nicolas"); + o.get().literal("name", "patrick"); + o.get().endEntity(); + o.get().endRecord(); + } + ); + } + + @Test + public void addWithLastInNonArray() { + MetafixTestHelpers.assertExecutionException(IllegalStateException.class, "Expected Array or Hash, got String", () -> + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "add_field('my.name.$last','patrick')" + ), + i -> { + i.startRecord("1"); + i.startEntity("my"); + i.literal("name", "max"); + i.endEntity(); + i.endRecord(); + }, + o -> { + } + ) + ); + } + @Test public void addWithAppendInArray() { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( @@ -1417,11 +1526,9 @@ public void renameArrayOfHashes() { } @Test - @MetafixToDo("Do we actually need/want implicit $append? WDCD?") - public void copyIntoArrayOfHashesImplicitAppend() { + public void copyIntoImplicitArrayAppend() { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( - "set_array('author[]')", - "copy_field('your.name','author[].name')", + "copy_field('your.name','author[].$append.name')", "remove_field('your')"), i -> { i.startRecord("1"); @@ -1446,7 +1553,34 @@ public void copyIntoArrayOfHashesImplicitAppend() { } @Test - public void copyIntoArrayOfHashesExplicitAppend() { + public void copyIntoImplicitArrayPrepend() { + MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( + "copy_field('your.name','author[].$prepend.name')", + "remove_field('your')"), + i -> { + i.startRecord("1"); + i.startEntity("your"); + i.literal("name", "max"); + i.endEntity(); + i.startEntity("your"); + i.literal("name", "mo"); + i.endEntity(); + i.endRecord(); + }, (o, f) -> { + o.get().startRecord("1"); + o.get().startEntity("author[]"); + o.get().startEntity("1"); + o.get().literal("name", "mo"); + o.get().endEntity(); + o.get().startEntity("2"); + o.get().literal("name", "max"); + f.apply(2).endEntity(); + o.get().endRecord(); + }); + } + + @Test + public void copyIntoExplicitArrayAppend() { MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList( "set_array('author[]')", "copy_field('your.name','author[].$append.name')", diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/expected.json index 8e7ba3f2..42599003 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/expected.json @@ -1,7 +1,7 @@ { "test" : "test", "object" : { - "arrayOfObjects" : [ { + "arrayOfObject" : [ { "key" : "value" }, { "key" : "more_value" diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldAppendAndCreateNestedArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldPrependAndCreateArray/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldPrependAndCreateArray/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/add_fieldPrependAndCreateArray/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/expected.json index d8894a0c..370535e9 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/expected.json @@ -1,9 +1,9 @@ { - "arrayOfObjects" : [ { + "key" : "value", + "key_2" : "more_value", + "arrayOfObject" : [ { "key" : "value" }, { "key" : "more_value" - } ], - "key" : "value", - "key_2" : "more_value" + } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json index 632a2674..6bc5863e 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json @@ -1,19 +1,19 @@ { - "arrayOfObjects_1" : [ { - "arrayOfObjects_2" : [ { + "key" : "value", + "key_2" : "more_value", + "key_3" : "even_more_value", + "key_4" : "so_much_value", + "arrayOfObject_1" : [ { + "arrayOfObject_2" : [ { "key" : "value" }, { "key" : "more_value" } ] }, { - "arrayOfObjects_3" : [ { + "arrayOfObject_3" : [ { "key" : "even_more_value" }, { "key" : "so_much_value" } ] - } ], - "key" : "value", - "key_2" : "more_value", - "key_3" : "even_more_value", - "key_4" : "so_much_value" + } ] } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/expected.json index d8894a0c..b8423f75 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/expected.json @@ -1,9 +1,11 @@ { - "arrayOfObjects" : [ { - "key" : "value" - }, { - "key" : "more_value" - } ], "key" : "value", - "key_2" : "more_value" + "key_2" : "more_value", + "object" : { + "arrayOfObject" : [ { + "key" : "value" + }, { + "key" : "more_value" + } ] + } } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/expected.json index 34d83a66..00d40868 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/expected.json @@ -1,7 +1,7 @@ { + "key" : "value", + "key_2" : "more_value", "object" : { "test" : [ "value", "more_value" ] - }, - "key" : "value", - "key_2" : "more_value" + } } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldAppendAndCreateNestedArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependAndCreateArray/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependAndCreateArray/todo.txt deleted file mode 100644 index 7c5b8c32..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependAndCreateArray/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 and #93 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependObjectToArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependObjectToArrayOfObjects/todo.txt deleted file mode 100644 index 2f4b8670..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/copy_fieldPrependObjectToArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #92 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/expected.json index 50fe5a3a..8e77e7a0 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/expected.json @@ -1,5 +1,5 @@ { - "arrayOfObjects" : [ { + "arrayOfObject" : [ { "key" : "value" }, { "key" : "more_value" diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json index c13b46bb..b01b2ae3 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/expected.json @@ -1,12 +1,12 @@ { - "arrayOfObjects_1" : [ { - "arrayOfObjects_2" : [ { + "arrayOfObject_1" : [ { + "arrayOfObject_2" : [ { "key" : "value" }, { "key" : "more_value" } ] }, { - "arrayOfObjects_3" : [ { + "arrayOfObject_3" : [ { "key" : "even_more_value" }, { "key" : "so_much_value" diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfObjectsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateArrayOfStringsInArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/expected.json b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/expected.json index 50fe5a3a..cf44f006 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/expected.json +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/expected.json @@ -1,7 +1,9 @@ { - "arrayOfObjects" : [ { - "key" : "value" - }, { - "key" : "more_value" - } ] + "object" : { + "arrayOfObject" : [ { + "key" : "value" + }, { + "key" : "more_value" + } ] + } } diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfStrings/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfStrings/todo.txt deleted file mode 100644 index 636eae9f..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldAppendAndCreateNestedArrayOfStrings/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependAndCreateArray/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependAndCreateArray/todo.txt deleted file mode 100644 index 7c5b8c32..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependAndCreateArray/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #127 and #93 diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/test.fix b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/test.fix index cf2c5df0..241bfc75 100644 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/test.fix +++ b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/test.fix @@ -1 +1 @@ -copy_field("test_2", "test[].$prepend") +move_field("test_2", "test[].$prepend") diff --git a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/todo.txt b/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/todo.txt deleted file mode 100644 index 2f4b8670..00000000 --- a/metafix/src/test/resources/org/metafacture/metafix/integration/record/fromJson/toJson/move_fieldPrependObjectToArrayOfObjects/todo.txt +++ /dev/null @@ -1 +0,0 @@ -See issue #92