summaryrefslogtreecommitdiffstats
path: root/infra/it
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/it
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/it')
-rw-r--r--infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java52
-rw-r--r--infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java28
2 files changed, 40 insertions, 40 deletions
diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
index cd1816ff8..a740e0121 100644
--- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
+++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
@@ -176,22 +176,22 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest {
// verify(complexAugmentWriter).update(eq(COMPLEX_AUGMENT_ID), eq(null), eq(getComplexAugment()), any(WriteContext.class));
// 1
inOrder.verify(complexAugmentContainerWriter)
- .update(eq(Ids.COMPLEX_AUGMENT_CONTAINER_ID), eq(null), eq(getComplexAugmentContainer()), any(WriteContext.class));
+ .processModification(eq(Ids.COMPLEX_AUGMENT_CONTAINER_ID), eq(null), eq(getComplexAugmentContainer()), any(WriteContext.class));
// 2
inOrder.verify(c3Writer)
- .update(eq(Ids.C3_ID), eq(null), eq(getC3()), any(WriteContext.class));
+ .processModification(eq(Ids.C3_ID), eq(null), eq(getC3()), any(WriteContext.class));
// 2
verify(simpleAugmentWriter)
- .update(eq(Ids.SIMPLE_AUGMENT_ID), eq(null), eq(getSimpleAugment()), any(WriteContext.class));
+ .processModification(eq(Ids.SIMPLE_AUGMENT_ID), eq(null), eq(getSimpleAugment()), any(WriteContext.class));
// 3
inOrder.verify(simpleContainerWriter)
- .update(eq(Ids.SIMPLE_CONTAINER_ID), eq(null), eq(getSimpleContainer()), any(WriteContext.class));
+ .processModification(eq(Ids.SIMPLE_CONTAINER_ID), eq(null), eq(getSimpleContainer()), any(WriteContext.class));
// 4
inOrder.verify(containerWithChoiceWriter)
- .update(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(null), eq(getContainerWithChoiceWithComplexCase()), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(null), eq(getContainerWithChoiceWithComplexCase()), any(WriteContext.class));
// 5
inOrder.verify(containerFromGroupingWriter)
- .update(eq(Ids.CONTAINER_FROM_GROUPING_ID), eq(null), eq(getContainerFromGrouping()), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_FROM_GROUPING_ID), eq(null), eq(getContainerFromGrouping()), any(WriteContext.class));
final KeyedInstanceIdentifier<ListInContainer, ListInContainerKey> keyedListInContainer1 =
Ids.CONTAINER_WITH_LIST_ID.child(ListInContainer.class, new ListInContainerKey((long) 1));
@@ -204,21 +204,21 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest {
// 6 - two items
inOrder.verify(nestedListWriter)
- .update(eq(keyedNestedList1), eq(null), eq(getSingleNestedList("1")), any(WriteContext.class));
+ .processModification(eq(keyedNestedList1), eq(null), eq(getSingleNestedList("1")), any(WriteContext.class));
verify(nestedListWriter)
- .update(eq(keyedNestedList2), eq(null), eq(getSingleNestedList("2")), any(WriteContext.class));
+ .processModification(eq(keyedNestedList2), eq(null), eq(getSingleNestedList("2")), any(WriteContext.class));
// 7 - two items
inOrder.verify(listInContainerWriter)
- .update(eq(keyedListInContainer1), eq(null), eq(getSingleListInContainer((long)1)), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer1), eq(null), eq(getSingleListInContainer((long)1)), any(WriteContext.class));
verify(listInContainerWriter)
- .update(eq(keyedListInContainer2), eq(null), eq(getSingleListInContainer((long)2)), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer2), eq(null), eq(getSingleListInContainer((long)2)), any(WriteContext.class));
// 8
inOrder.verify(containerInListWriter)
- .update(eq(keyedListInContainer1.child(ContainerInList.class)), eq(null), eq(getContainerInList("1")), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer1.child(ContainerInList.class)), eq(null), eq(getContainerInList("1")), any(WriteContext.class));
verify(containerInListWriter)
- .update(eq(keyedListInContainer2.child(ContainerInList.class)), eq(null), eq(getContainerInList("2")), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer2.child(ContainerInList.class)), eq(null), eq(getContainerInList("2")), any(WriteContext.class));
// 9 - Ignored because the container has no leaves, only complex child nodes
// inOrder.verify(containerWithListWriter)
@@ -280,39 +280,39 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest {
// Deletes are handled in reverse order
// 1
inOrder.verify(containerInListWriter)
- .update(eq(keyedListInContainer1.child(ContainerInList.class)), eq(getContainerInList("1")), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer1.child(ContainerInList.class)), eq(getContainerInList("1")), eq(null), any(WriteContext.class));
verify(containerInListWriter)
- .update(eq(keyedListInContainer2.child(ContainerInList.class)), eq(getContainerInList("2")), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer2.child(ContainerInList.class)), eq(getContainerInList("2")), eq(null), any(WriteContext.class));
// 2
inOrder.verify(listInContainerWriter)
- .update(eq(keyedListInContainer1), eq(getSingleListInContainer((long)1)), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer1), eq(getSingleListInContainer((long)1)), eq(null), any(WriteContext.class));
verify(listInContainerWriter)
- .update(eq(keyedListInContainer2), eq(getSingleListInContainer((long)2)), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedListInContainer2), eq(getSingleListInContainer((long)2)), eq(null), any(WriteContext.class));
// 3
inOrder.verify(nestedListWriter)
- .update(eq(keyedNestedList1), eq(getSingleNestedList("1")), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedNestedList1), eq(getSingleNestedList("1")), eq(null), any(WriteContext.class));
verify(nestedListWriter)
- .update(eq(keyedNestedList2), eq(getSingleNestedList("2")), eq(null), any(WriteContext.class));
+ .processModification(eq(keyedNestedList2), eq(getSingleNestedList("2")), eq(null), any(WriteContext.class));
// 4
inOrder.verify(containerFromGroupingWriter)
- .update(eq(Ids.CONTAINER_FROM_GROUPING_ID), eq(getContainerFromGrouping()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_FROM_GROUPING_ID), eq(getContainerFromGrouping()), eq(null), any(WriteContext.class));
// 5
inOrder.verify(containerWithChoiceWriter)
- .update(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(getContainerWithChoiceWithComplexCase()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(getContainerWithChoiceWithComplexCase()), eq(null), any(WriteContext.class));
// 6
inOrder.verify(simpleContainerWriter)
- .update(eq(Ids.SIMPLE_CONTAINER_ID), eq(getSimpleContainer()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.SIMPLE_CONTAINER_ID), eq(getSimpleContainer()), eq(null), any(WriteContext.class));
// 7
verify(simpleAugmentWriter)
- .update(eq(Ids.SIMPLE_AUGMENT_ID), eq(getSimpleAugment()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.SIMPLE_AUGMENT_ID), eq(getSimpleAugment()), eq(null), any(WriteContext.class));
// 8
inOrder.verify(c3Writer)
- .update(eq(Ids.C3_ID), eq(getC3()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.C3_ID), eq(getC3()), eq(null), any(WriteContext.class));
// 9
inOrder.verify(complexAugmentContainerWriter)
- .update(eq(Ids.COMPLEX_AUGMENT_CONTAINER_ID), eq(getComplexAugmentContainer()), eq(null), any(WriteContext.class));
+ .processModification(eq(Ids.COMPLEX_AUGMENT_CONTAINER_ID), eq(getComplexAugmentContainer()), eq(null), any(WriteContext.class));
for (Writer<?> orderedWriter : orderedWriters) {
verify(orderedWriter).getManagedDataObjectType();
@@ -493,7 +493,7 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest {
verify(containerWithChoiceWriter, atLeastOnce()).getManagedDataObjectType();
verify(containerWithChoiceWriter)
- .update(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(null), eq(containerWithChoice), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(null), eq(containerWithChoice), any(WriteContext.class));
verifyNoMoreInteractions(containerWithChoiceWriter);
// Test delete sub-node
@@ -504,7 +504,7 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest {
verify(containerWithChoiceWriter, atLeastOnce()).getManagedDataObjectType();
verify(containerWithChoiceWriter)
- .update(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(containerWithChoice), eq(containerWithChoiceEmpty), any(WriteContext.class));
+ .processModification(eq(Ids.CONTAINER_WITH_CHOICE_ID), eq(containerWithChoice), eq(containerWithChoiceEmpty), any(WriteContext.class));
verifyNoMoreInteractions(containerWithChoiceWriter);
// Test write with subtree node that's not handled by subtree writer
diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java
index 3b7d4a1cb..37dac0f4c 100644
--- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java
+++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java
@@ -162,7 +162,7 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
dataModification.commit();
- verify(simpleAugmentWriter).update(eq(SIMPLE_AUGMENT_ID), eq(null), eq(simpleAugment()), any(WriteContext.class));
+ verify(simpleAugmentWriter).processModification(eq(SIMPLE_AUGMENT_ID), eq(null), eq(simpleAugment()), any(WriteContext.class));
}
@Test
@@ -181,9 +181,9 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
dataModification.commit();
- verify(augTargetWriter).update(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
- verify(fromAugmentWriter).update(eq(FROM_AUGMENT_ID), eq(null), eq(fromAugmentSimple(augData)), any(WriteContext.class));
- verify(simpleNestedAugmentWriter).update(eq(SIMPLE_NESTED_AUGMENT_ID), eq(null), eq(augData), any(WriteContext.class));
+ verify(augTargetWriter).processModification(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
+ verify(fromAugmentWriter).processModification(eq(FROM_AUGMENT_ID), eq(null), eq(fromAugmentSimple(augData)), any(WriteContext.class));
+ verify(simpleNestedAugmentWriter).processModification(eq(SIMPLE_NESTED_AUGMENT_ID), eq(null), eq(augData), any(WriteContext.class));
}
private SimpleAugment simpleAugment() {
@@ -204,9 +204,9 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
dataModification.commit();
- verify(augTargetWriter).update(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
- verify(fromAugmentWriter).update(eq(FROM_AUGMENT_ID), eq(null), eq(fromAugment()), any(WriteContext.class));
- verify(fromAugment2Writer).update(eq(FROM_AUGMENT2_ID), eq(null), eq(fromAugment2()), any(WriteContext.class));
+ verify(augTargetWriter).processModification(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
+ verify(fromAugmentWriter).processModification(eq(FROM_AUGMENT_ID), eq(null), eq(fromAugment()), any(WriteContext.class));
+ verify(fromAugment2Writer).processModification(eq(FROM_AUGMENT2_ID), eq(null), eq(fromAugment2()), any(WriteContext.class));
}
@Test
@@ -228,10 +228,10 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
dataModification.commit();
final ArgumentCaptor<DataObject> doCaptor = ArgumentCaptor.forClass(DataObject.class);
- verify(augTargetWriter).update(eq(AUG_TARGET_ID), eq(null), doCaptor.capture(), any(WriteContext.class));
+ verify(augTargetWriter).processModification(eq(AUG_TARGET_ID), eq(null), doCaptor.capture(), any(WriteContext.class));
assertEquals(data.getSomeLeaf(), ((AugTarget)doCaptor.getValue()).getSomeLeaf());
- verify(fromAugmentWriter).update(eq(FROM_AUGMENT_ID), eq(null), doCaptor.capture(), any(WriteContext.class));
+ verify(fromAugmentWriter).processModification(eq(FROM_AUGMENT_ID), eq(null), doCaptor.capture(), any(WriteContext.class));
assertEquals(fromAugment.getSomeLeaf(), ((FromAugment)doCaptor.getValue()).getSomeLeaf());
@@ -241,9 +241,9 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
FROM_AUGMENT_LIST_AUGMENT_ID.child(FromAugmentEntry.class, new FromAugmentEntryKey("2"));
verify(fromAugmentListWriter)
- .update(eq(keyedNestedList1), eq(null), eq(entries.get(0)), any(WriteContext.class));
+ .processModification(eq(keyedNestedList1), eq(null), eq(entries.get(0)), any(WriteContext.class));
verify(fromAugmentListWriter)
- .update(eq(keyedNestedList2), eq(null), eq(entries.get(1)), any(WriteContext.class));
+ .processModification(eq(keyedNestedList2), eq(null), eq(entries.get(1)), any(WriteContext.class));
}
@Test
@@ -270,19 +270,19 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest {
dataModification.commit();
// verify aug target update:
- verify(augTargetWriter).update(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
+ verify(augTargetWriter).processModification(eq(AUG_TARGET_ID), eq(null), eq(data), any(WriteContext.class));
// verify list customizer update:
final KeyedInstanceIdentifier<ListFromAugment, ListFromAugmentKey> keyedNestedList =
LIST_AUGMENT_ID.child(ListFromAugment.class, new ListFromAugmentKey("some-leaf-val"));
final ArgumentCaptor<DataObject> doCaptor = ArgumentCaptor.forClass(DataObject.class);
verify(listFromAugmentWriter)
- .update(eq(keyedNestedList), eq(null), doCaptor.capture(), any(WriteContext.class));
+ .processModification(eq(keyedNestedList), eq(null), doCaptor.capture(), any(WriteContext.class));
assertEquals(list.get(0).getSomeLeaf(), ((ListFromAugment) doCaptor.getValue()).getSomeLeaf());
// verify list augmentation customizer update:
verify(listFromAugmentAugmentWriter)
- .update(eq(keyedNestedList.augmentation(ListFromAugmentAugment.class)), eq(null), doCaptor.capture(),
+ .processModification(eq(keyedNestedList.augmentation(ListFromAugmentAugment.class)), eq(null), doCaptor.capture(),
any(WriteContext.class));
assertEquals(listAugmentation.getNewLeaf(), ((ListFromAugmentAugment) doCaptor.getValue()).getNewLeaf());
}