From 130c716105017c7b20b4779973b915968b3dc322 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Wed, 16 Aug 2017 09:21:24 +0200 Subject: 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 --- .../translate/util/write/AbstractGenericWriterTest.java | 10 +++++----- .../translate/util/write/BindingBrokerWriterTest.java | 4 ++-- .../honeycomb/translate/util/write/NoopWriterRegistryTest.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'infra/translate-utils/src/test/java') diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/AbstractGenericWriterTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/AbstractGenericWriterTest.java index 14c9c6044..9b95f7662 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/AbstractGenericWriterTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/AbstractGenericWriterTest.java @@ -51,7 +51,7 @@ public class AbstractGenericWriterTest { @Test public void testDelete() throws Exception { before = mock(DataObject.class); - t.update(id, before, null, ctx); + t.processModification(id, before, null, ctx); verify(t).deleteCurrentAttributes(id, before, ctx); } @@ -59,7 +59,7 @@ public class AbstractGenericWriterTest { @Test public void testUpdate() throws Exception { before = mock(DataObject.class); - t.update(id, before, after, ctx); + t.processModification(id, before, after, ctx); verify(t).updateCurrentAttributes(id, before, after, ctx); } @@ -67,7 +67,7 @@ public class AbstractGenericWriterTest { @Test public void testNoUpdate() throws Exception { before = mock(DataObject.class); - t.update(id, before, before, ctx); + t.processModification(id, before, before, ctx); verify(t, times(0)).updateCurrentAttributes(id, before, after, ctx); } @@ -75,7 +75,7 @@ public class AbstractGenericWriterTest { @Test public void testCreate() throws Exception { before = mock(DataObject.class); - t.update(id, null, after, ctx); + t.processModification(id, null, after, ctx); verify(t).writeCurrentAttributes(id, after, ctx); } @@ -83,7 +83,7 @@ public class AbstractGenericWriterTest { private static class TestingWriter extends AbstractGenericWriter { TestingWriter() { - super(InstanceIdentifier.create(DataObject.class)); + super(InstanceIdentifier.create(DataObject.class), false); } @Override diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/BindingBrokerWriterTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/BindingBrokerWriterTest.java index 84dbb7b4e..9e09112c9 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/BindingBrokerWriterTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/BindingBrokerWriterTest.java @@ -58,7 +58,7 @@ public class BindingBrokerWriterTest { public void testWrite() throws Exception { assertEquals(id, bbWriter.getManagedDataObjectType()); - bbWriter.update(id, data, data, ctx); + bbWriter.processModification(id, data, data, ctx); verify(broker).newWriteOnlyTransaction(); verify(tx).put(LogicalDatastoreType.CONFIGURATION, id, data); verify(tx).submit(); @@ -67,6 +67,6 @@ public class BindingBrokerWriterTest { @Test(expected = io.fd.honeycomb.translate.write.WriteFailedException.class) public void testFailedWrite() throws Exception { when(tx.submit()).thenReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("failing"))); - bbWriter.update(id, data, data, ctx); + bbWriter.processModification(id, data, data, ctx); } } \ No newline at end of file diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/NoopWriterRegistryTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/NoopWriterRegistryTest.java index 411f24bc3..642e9f807 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/NoopWriterRegistryTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/NoopWriterRegistryTest.java @@ -23,7 +23,7 @@ public class NoopWriterRegistryTest { @Test public void testNoop() throws Exception { final NoopWriterRegistry noopWriterRegistry = new NoopWriterRegistry(); - noopWriterRegistry.update(null, null); + noopWriterRegistry.processModifications(null, null); noopWriterRegistry.close(); } } \ No newline at end of file -- cgit 1.2.3-korg