package org.opendaylight.mdsal.binding.dom.adapter.test;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
Builders.orderedMapBuilder()
.withNodeIdentifier(new NodeIdentifier(Keyed.QNAME))
.addChild(Builders.mapEntryBuilder()
- .withNodeIdentifier(new NodeIdentifierWithPredicates(Keyed.QNAME, ImmutableMap.of(FOO_QNAME, "foo")))
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(Keyed.QNAME, FOO_QNAME, "foo"))
.addChild(ImmutableNodes.leafNode(FOO_QNAME, "foo"))
.build())
.addChild(Builders.mapEntryBuilder()
- .withNodeIdentifier(new NodeIdentifierWithPredicates(Keyed.QNAME, ImmutableMap.of(FOO_QNAME, "bar")))
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(Keyed.QNAME, FOO_QNAME, "bar"))
.addChild(ImmutableNodes.leafNode(FOO_QNAME, "bar"))
.build())
.build());
final DataTreeModification<Container> change = capture.iterator().next();
assertEquals(CONTAINER_TID, change.getRootPath());
final DataObjectModification<Container> changedContainer = change.getRootNode();
- assertEquals(new Item<>(Container.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(Container.class), changedContainer.getIdentifier());
assertEquals(ModificationType.SUBTREE_MODIFIED, changedContainer.getModificationType());
final Container containerAfter = changedContainer.getDataAfter();
assertEquals(new ContainerBuilder()
.setKeyed(ImmutableList.of(
- new KeyedBuilder().setFoo("foo").setKey(new KeyedKey("foo")).build(),
- new KeyedBuilder().setFoo("bar").setKey(new KeyedKey("bar")).build()))
+ new KeyedBuilder().setFoo("foo").withKey(new KeyedKey("foo")).build(),
+ new KeyedBuilder().setFoo("bar").withKey(new KeyedKey("bar")).build()))
.build(), containerAfter);
- final Collection<DataObjectModification<?>> changedChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> changedChildren = changedContainer.getModifiedChildren();
assertEquals(2, changedChildren.size());
- final Iterator<DataObjectModification<?>> it = changedChildren.iterator();
+ final Iterator<? extends DataObjectModification<?>> it = changedChildren.iterator();
final DataObjectModification<?> changedChild1 = it.next();
assertEquals(ModificationType.WRITE, changedChild1.getModificationType());
assertEquals(Collections.emptyList(), changedChild1.getModifiedChildren());
final DataTreeModification<Container> change = capture.iterator().next();
assertEquals(CONTAINER_TID, change.getRootPath());
final DataObjectModification<Container> changedContainer = change.getRootNode();
- assertEquals(new Item<>(Container.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(Container.class), changedContainer.getIdentifier());
assertEquals(ModificationType.WRITE, changedContainer.getModificationType());
final Container containerAfter = changedContainer.getDataAfter();
new UnkeyedBuilder().setFoo("bar").build()))
.build(), containerAfter);
- final Collection<DataObjectModification<?>> changedChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> changedChildren = changedContainer.getModifiedChildren();
assertEquals(0, changedChildren.size());
}
assertEquals(CHOICE_CONTAINER_TID, choiceChange.getRootPath());
final DataObjectModification<WithChoice> changedContainer = choiceChange.getRootNode();
assertEquals(ModificationType.SUBTREE_MODIFIED, changedContainer.getModificationType());
- assertEquals(new Item<>(WithChoice.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(WithChoice.class), changedContainer.getIdentifier());
- final Collection<DataObjectModification<?>> choiceChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> choiceChildren = changedContainer.getModifiedChildren();
assertEquals(1, choiceChildren.size());
final DataObjectModification<Addressable> changedCase = (DataObjectModification<Addressable>) choiceChildren
.iterator().next();
assertEquals(ModificationType.WRITE, changedCase.getModificationType());
- assertEquals(new Item<>(Addressable.class), changedCase.getIdentifier());
+ assertEquals(Item.of(Addressable.class), changedCase.getIdentifier());
assertEquals(new AddressableBuilder().build(), changedCase.getDataAfter());
}
assertEquals(ADDRESSABLE_CONTAINER_TID, contChange.getRootPath());
final DataObjectModification<AddressableCont> changedContainer = contChange.getRootNode();
assertEquals(ModificationType.SUBTREE_MODIFIED, changedContainer.getModificationType());
- assertEquals(new Item<>(AddressableCont.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(AddressableCont.class), changedContainer.getIdentifier());
- final Collection<DataObjectModification<?>> contChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> contChildren = changedContainer.getModifiedChildren();
assertEquals(1, contChildren.size());
final DataObjectModification<Addressable> changedChild = (DataObjectModification<Addressable>) contChildren
.iterator().next();
assertEquals(ModificationType.WRITE, changedChild.getModificationType());
- assertEquals(new Item<>(AddressableChild.class), changedChild.getIdentifier());
+ assertEquals(Item.of(AddressableChild.class), changedChild.getIdentifier());
assertEquals(new AddressableChildBuilder().build(), changedChild.getDataAfter());
}
assertEquals(UNADDRESSABLE_CONTAINER_TID, contChange.getRootPath());
final DataObjectModification<UnaddressableCont> changedContainer = contChange.getRootNode();
assertEquals(ModificationType.WRITE, changedContainer.getModificationType());
- assertEquals(new Item<>(UnaddressableCont.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(UnaddressableCont.class), changedContainer.getIdentifier());
- final Collection<DataObjectModification<?>> contChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> contChildren = changedContainer.getModifiedChildren();
assertEquals(0, contChildren.size());
}
// Should be write
assertEquals(ModificationType.WRITE, changedContainer.getModificationType());
- assertEquals(new Item<>(WithChoice.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(WithChoice.class), changedContainer.getIdentifier());
- final Collection<DataObjectModification<?>> choiceChildren = changedContainer.getModifiedChildren();
+ final Collection<? extends DataObjectModification<?>> choiceChildren = changedContainer.getModifiedChildren();
assertEquals(0, choiceChildren.size());
}
assertEquals(dti, change.getRootPath());
final DataObjectModification<T> changedContainer = change.getRootNode();
assertEquals(ModificationType.WRITE, changedContainer.getModificationType());
- assertEquals(new Item<>(bindingClass), changedContainer.getIdentifier());
+ assertEquals(Item.of(bindingClass), changedContainer.getIdentifier());
final T containerAfter = changedContainer.getDataAfter();
assertEquals(expected, containerAfter);
assertEquals(CHOICE_CONTAINER_TID, change.getRootPath());
final DataObjectModification<WithChoice> changedContainer = change.getRootNode();
assertEquals(ModificationType.WRITE, changedContainer.getModificationType());
- assertEquals(new Item<>(WithChoice.class), changedContainer.getIdentifier());
+ assertEquals(Item.of(WithChoice.class), changedContainer.getIdentifier());
final WithChoice containerAfter = changedContainer.getDataAfter();
assertEquals(new WithChoiceBuilder().build(), containerAfter);