summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl/src/test
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-08-16 09:21:24 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-08-16 07:56:39 +0000
commit130c716105017c7b20b4779973b915968b3dc322 (patch)
tree50b28ac5691928dcff03fcf8cb57bec651a270c1 /infra/translate-impl/src/test
parentc643983450d5fd56db40ad2718877ec2289e6e6f (diff)
HONEYCOMB-386 - Make update optional
If customizer does not support update directly, updates for its handled nodes are broken up to delete + create pairs. Change-Id: I2929109e8c9a1db0bef108367cf7d839135ce173 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/translate-impl/src/test')
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java6
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericWriterTest.java15
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/NoopWriters.java63
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java6
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java60
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java31
6 files changed, 140 insertions, 41 deletions
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
index 2f50ece79..91785b25e 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
@@ -71,13 +71,13 @@ public class GenericListWriterTest {
(InstanceIdentifier<IdentifiableDataObject>) InstanceIdentifier.create(Collections
.singleton(new InstanceIdentifier.IdentifiableItem<>(IdentifiableDataObject.class, keyAfter)));
- writer.update(DATA_OBJECT_ID, before, after, ctx);
+ writer.processModification(DATA_OBJECT_ID, before, after, ctx);
verify(customizer).updateCurrentAttributes(keyedIdBefore, before, after, ctx);
- writer.update(DATA_OBJECT_ID, before, null, ctx);
+ writer.processModification(DATA_OBJECT_ID, before, null, ctx);
verify(customizer).deleteCurrentAttributes(keyedIdBefore, before, ctx);
- writer.update(DATA_OBJECT_ID, null, after, ctx);
+ writer.processModification(DATA_OBJECT_ID, null, after, ctx);
verify(customizer).writeCurrentAttributes(keyedIdAfter, after, ctx);
}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericWriterTest.java
index 3caea571e..c9d381ad4 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericWriterTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericWriterTest.java
@@ -17,6 +17,8 @@
package io.fd.honeycomb.translate.impl.write;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
@@ -53,13 +55,13 @@ public class GenericWriterTest {
@Test
public void testUpdate() throws Exception {
assertEquals(DATA_OBJECT_ID, writer.getManagedDataObjectType());
- writer.update(DATA_OBJECT_ID, before, after, ctx);
+ writer.processModification(DATA_OBJECT_ID, before, after, ctx);
verify(customizer).updateCurrentAttributes(DATA_OBJECT_ID, before, after, ctx);
- writer.update(DATA_OBJECT_ID, before, null, ctx);
+ writer.processModification(DATA_OBJECT_ID, before, null, ctx);
verify(customizer).deleteCurrentAttributes(DATA_OBJECT_ID, before, ctx);
- writer.update(DATA_OBJECT_ID, null, after, ctx);
+ writer.processModification(DATA_OBJECT_ID, null, after, ctx);
verify(customizer).writeCurrentAttributes(DATA_OBJECT_ID, after, ctx);
}
@@ -85,4 +87,11 @@ public class GenericWriterTest {
writer = new GenericWriter<>(DATA_OBJECT_ID, customizer);
writer.deleteCurrentAttributes(DATA_OBJECT_ID, before, ctx);
}
+
+ @Test
+ public void testUpdateSupported() {
+ assertFalse(GenericWriter.isUpdateSupported(new NoopWriters.NonDirectUpdateWriterCustomizer()));
+ assertTrue(GenericWriter.isUpdateSupported(new NoopWriters.DirectUpdateWriterCustomizer()));
+ assertTrue(GenericWriter.isUpdateSupported(new NoopWriters.ParentImplDirectUpdateWriterCustomizer()));
+ }
} \ No newline at end of file
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/NoopWriters.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/NoopWriters.java
new file mode 100644
index 000000000..8ea91d282
--- /dev/null
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/NoopWriters.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.translate.impl.write;
+
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public final class NoopWriters {
+
+ private NoopWriters() {
+ }
+
+ public static class NonDirectUpdateWriterCustomizer implements WriterCustomizer<DataObject> {
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<DataObject> id,
+ @Nonnull final DataObject dataAfter,
+ @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+ // NOOP
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<DataObject> id,
+ @Nonnull final DataObject dataBefore,
+ @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+ // NOOP
+ }
+ }
+
+ public static class DirectUpdateWriterCustomizer extends NonDirectUpdateWriterCustomizer {
+
+ @Override
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<DataObject> id,
+ @Nonnull final DataObject dataBefore, @Nonnull final DataObject dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ // is direct support
+ }
+ }
+
+ public static class ParentImplDirectUpdateWriterCustomizer extends DirectUpdateWriterCustomizer {
+ // parent impls directly
+ }
+}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java
index feaba726c..dd1adb368 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java
@@ -87,9 +87,9 @@ public class FlatWriterRegistryBuilderTest {
Multimaps.forMap(Collections.singletonMap(id, update)),
Multimaps.forMap(Collections.emptyMap()));
final WriteContext ctx = mock(WriteContext.class);
- build.update(updates, ctx);
+ build.processModifications(updates, ctx);
- verify(writer).update(id, before, after, ctx);
+ verify(writer).processModification(id, before, after, ctx);
}
@Test(expected = IllegalArgumentException.class)
@@ -104,7 +104,7 @@ public class FlatWriterRegistryBuilderTest {
final WriterRegistry.DataObjectUpdates updates = new WriterRegistry.DataObjectUpdates(
Multimaps.forMap(Collections.singletonMap(id2, update2)),
Multimaps.forMap(Collections.emptyMap()));
- build.update(updates, mock(WriteContext.class));
+ build.processModifications(updates, mock(WriteContext.class));
}
@Test
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
index f66ab8f90..72a91cb00 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
@@ -84,10 +84,10 @@ public class FlatWriterRegistryTest {
final DataObject1 dataObject = mock(DataObject1.class);
updates.put(DataObject1.IID, DataObjectUpdate.create(iid, dataObject, dataObject));
updates.put(DataObject1.IID, DataObjectUpdate.create(iid2, dataObject, dataObject));
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
- verify(writer1).update(iid, dataObject, dataObject, ctx);
- verify(writer1).update(iid2, dataObject, dataObject, ctx);
+ verify(writer1).processModification(iid, dataObject, dataObject, ctx);
+ verify(writer1).processModification(iid2, dataObject, dataObject, ctx);
// Invoked when registry is being created
verifyNoMoreInteractions(writer1);
verifyZeroInteractions(writer2);
@@ -105,11 +105,11 @@ public class FlatWriterRegistryTest {
final InstanceIdentifier<DataObject2> iid2 = InstanceIdentifier.create(DataObject2.class);
final DataObject2 dataObject2 = mock(DataObject2.class);
updates.put(DataObject2.IID, DataObjectUpdate.create(iid2, dataObject2, dataObject2));
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
final InOrder inOrder = inOrder(writer1, writer2);
- inOrder.verify(writer1).update(iid, dataObject, dataObject, ctx);
- inOrder.verify(writer2).update(iid2, dataObject2, dataObject2, ctx);
+ inOrder.verify(writer1).processModification(iid, dataObject, dataObject, ctx);
+ inOrder.verify(writer2).processModification(iid2, dataObject2, dataObject2, ctx);
verifyNoMoreInteractions(writer1);
verifyNoMoreInteractions(writer2);
@@ -128,12 +128,12 @@ public class FlatWriterRegistryTest {
final DataObject2 dataObject2 = mock(DataObject2.class);
deletes.put(
DataObject2.IID, ((DataObjectUpdate.DataObjectDelete) DataObjectUpdate.create(iid2, dataObject2, null)));
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(ImmutableMultimap.of(), deletes), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(ImmutableMultimap.of(), deletes), ctx);
final InOrder inOrder = inOrder(writer1, writer2);
// Reversed order of invocation, first writer2 and then writer1
- inOrder.verify(writer2).update(iid2, dataObject2, null, ctx);
- inOrder.verify(writer1).update(iid, dataObject, null, ctx);
+ inOrder.verify(writer2).processModification(iid2, dataObject2, null, ctx);
+ inOrder.verify(writer1).processModification(iid, dataObject, null, ctx);
verifyNoMoreInteractions(writer1);
verifyNoMoreInteractions(writer2);
@@ -159,15 +159,15 @@ public class FlatWriterRegistryTest {
DataObject2.IID, ((DataObjectUpdate.DataObjectDelete) DataObjectUpdate.create(iid2, dataObject2, null)));
// Writer 2 update
updates.put(DataObject2.IID, DataObjectUpdate.create(iid2, dataObject2, dataObject2));
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, deletes), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, deletes), ctx);
final InOrder inOrder = inOrder(writer1, writer2);
// Reversed order of invocation, first writer2 and then writer1 for deletes
- inOrder.verify(writer2).update(iid2, dataObject2, null, ctx);
- inOrder.verify(writer1).update(iid, dataObject, null, ctx);
+ inOrder.verify(writer2).processModification(iid2, dataObject2, null, ctx);
+ inOrder.verify(writer1).processModification(iid, dataObject, null, ctx);
// Then also updates are processed
- inOrder.verify(writer1).update(iid, dataObject, dataObject, ctx);
- inOrder.verify(writer2).update(iid2, dataObject2, dataObject2, ctx);
+ inOrder.verify(writer1).processModification(iid, dataObject, dataObject, ctx);
+ inOrder.verify(writer2).processModification(iid2, dataObject2, dataObject2, ctx);
verifyNoMoreInteractions(writer1);
verifyNoMoreInteractions(writer2);
@@ -181,7 +181,7 @@ public class FlatWriterRegistryTest {
final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create();
addUpdate(updates, DataObject1.class);
addUpdate(updates, DataObject2.class);
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
}
@Test
@@ -191,14 +191,14 @@ public class FlatWriterRegistryTest {
// Writer1 always fails
doThrow(new RuntimeException()).when(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create();
addUpdate(updates, DataObject1.class);
addUpdate(updates, DataObject2.class);
try {
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
fail("Bulk update should have failed on writer1");
} catch (WriterRegistry.BulkUpdateException e) {
assertThat(e.getUnrevertedSubtrees(), hasSize(2));
@@ -215,7 +215,7 @@ public class FlatWriterRegistryTest {
// Writer1 always fails
doThrow(new RuntimeException()).when(writer3)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create();
addUpdate(updates, DataObject1.class);
@@ -226,26 +226,26 @@ public class FlatWriterRegistryTest {
updates.put(DataObject2.IID, DataObjectUpdate.create(iid2, before2, after2));
try {
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
fail("Bulk update should have failed on writer1");
} catch (WriterRegistry.BulkUpdateException e) {
assertThat(e.getUnrevertedSubtrees().size(), is(1));
final InOrder inOrder = inOrder(writer1, writer2, writer3);
inOrder.verify(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
inOrder.verify(writer2)
- .update(iid2, before2, after2, ctx);
+ .processModification(iid2, before2, after2, ctx);
inOrder.verify(writer3)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
e.revertChanges(revertWriteContext);
// Revert changes. Successful updates are iterated in reverse
// also binding other write context,to verify if update context is not reused
inOrder.verify(writer2)
- .update(iid2, after2, before2, revertWriteContext);
+ .processModification(iid2, after2, before2, revertWriteContext);
inOrder.verify(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), eq(revertWriteContext));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), eq(revertWriteContext));
verifyNoMoreInteractions(writer3);
}
}
@@ -258,7 +258,7 @@ public class FlatWriterRegistryTest {
// Writer1 always fails
doThrow(new RuntimeException()).when(writer3)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create();
addUpdate(updates, DataObject1.class);
@@ -266,12 +266,12 @@ public class FlatWriterRegistryTest {
addUpdate(updates, DataObjects.DataObject3.class);
try {
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
fail("Bulk update should have failed on writer1");
} catch (WriterRegistry.BulkUpdateException e) {
// Writer1 always fails from now
doThrow(new RuntimeException()).when(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class), any(WriteContext.class));
try {
e.revertChanges(revertWriteContext);
} catch (WriterRegistry.Reverter.RevertFailedException e1) {
@@ -293,19 +293,19 @@ public class FlatWriterRegistryTest {
// Writer1 always fails
doThrow(new RuntimeException()).when(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class),
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class),
any(WriteContext.class));
final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create();
addKeyedUpdate(updates,DataObjects.DataObject1ChildK.class);
addUpdate(updates, DataObject1.class);
try {
- flatWriterRegistry.update(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
+ flatWriterRegistry.processModifications(new WriterRegistry.DataObjectUpdates(updates, ImmutableMultimap.of()), ctx);
fail("Bulk update should have failed on writer1");
} catch (WriterRegistry.BulkUpdateException e) {
// Writer1 always fails from now
doThrow(new RuntimeException()).when(writer1)
- .update(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class),
+ .processModification(any(InstanceIdentifier.class), any(DataObject.class), any(DataObject.class),
any(WriteContext.class));
try {
e.revertChanges(revertWriteContext);
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java
index ff2f83158..65b2f375b 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java
@@ -16,15 +16,21 @@
package io.fd.honeycomb.translate.impl.write.registry;
-import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import com.google.common.collect.Sets;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.impl.write.NoopWriters.DirectUpdateWriterCustomizer;
+import io.fd.honeycomb.translate.impl.write.NoopWriters.NonDirectUpdateWriterCustomizer;
+import io.fd.honeycomb.translate.impl.write.NoopWriters.ParentImplDirectUpdateWriterCustomizer;
import io.fd.honeycomb.translate.util.DataObjects;
import io.fd.honeycomb.translate.write.Writer;
import java.util.Collections;
+import java.util.Set;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
@@ -79,7 +85,28 @@ public class SubtreeWriterTest {
assertEquals(writer.getManagedDataObjectType(), forWriter.getManagedDataObjectType());
assertEquals(1, forWriter.getHandledChildTypes().size());
- assertThat(forWriter.getHandledChildTypes(), CoreMatchers.hasItem(DataObjects.DataObject4.DataObject41.DataObject411.IID));
+ assertThat(forWriter.getHandledChildTypes(),
+ CoreMatchers.hasItem(DataObjects.DataObject4.DataObject41.DataObject411.IID));
+ }
+
+ @Test
+ public void testUpdateSupported() {
+ // test supportsDirectUpdate(), because subtree writer overrides this method and delegate call on delegate writer
+ final InstanceIdentifier<DataObject> fakeIID = InstanceIdentifier.create(DataObject.class);
+ final Set<InstanceIdentifier<?>> handledChildren = Collections.emptySet();
+
+ final NonDirectUpdateWriterCustomizer nonDirectCustomizer = new NonDirectUpdateWriterCustomizer();
+ final DirectUpdateWriterCustomizer directCustomizer = new DirectUpdateWriterCustomizer();
+ final ParentImplDirectUpdateWriterCustomizer parentImplCustomizer =
+ new ParentImplDirectUpdateWriterCustomizer();
+
+ final GenericWriter<DataObject> nonDirectWriter = new GenericWriter<>(fakeIID, nonDirectCustomizer);
+ final GenericWriter<DataObject> directWriter = new GenericWriter<>(fakeIID, directCustomizer);
+ final GenericWriter<DataObject> parentImplWriter = new GenericWriter<>(fakeIID, parentImplCustomizer);
+
+ assertFalse(SubtreeWriter.createForWriter(handledChildren, nonDirectWriter).supportsDirectUpdate());
+ assertTrue(SubtreeWriter.createForWriter(handledChildren, directWriter).supportsDirectUpdate());
+ assertTrue(SubtreeWriter.createForWriter(handledChildren, parentImplWriter).supportsDirectUpdate());
}
} \ No newline at end of file