import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.DATA_TREE;
import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.resetMocks;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Map;
-import javax.annotation.Nonnull;
+import java.util.Optional;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
+import org.opendaylight.mdsal.dom.spi.shard.ChildShardContext;
+import org.opendaylight.mdsal.dom.spi.shard.ReadableWriteableDOMDataTreeShard;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
public class AbstractDOMShardTreeChangePublisherTest extends AbstractDOMShardTreeChangePublisher {
private static final YangInstanceIdentifier YANG_INSTANCE_IDENTIFIER =
- YangInstanceIdentifier.of(QName.create("test"));
+ YangInstanceIdentifier.of(QName.create("", "test"));
private static final DOMDataTreeIdentifier DOM_DATA_TREE_IDENTIFIER =
new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, YANG_INSTANCE_IDENTIFIER);
@Test
public void registerTreeChangeListenerTest() throws Exception {
final DOMDataTreeChangeListener domDataTreeChangeListener = mock(DOMDataTreeChangeListener.class);
- final ListenerRegistration listenerRegistration = mock(ListenerRegistration.class);
+ final ListenerRegistration<?> listenerRegistration = mock(ListenerRegistration.class);
final DataTreeSnapshot initialSnapshot = mock(DataTreeSnapshot.class);
- final DataContainerNode initialData =
+ final DataContainerNode<?> initialData =
ImmutableContainerNodeBuilder.create()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("test")))
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("", "test")))
.build();
doReturn(initialSnapshot).when(DATA_TREE).takeSnapshot();
doReturn(Optional.of(initialData)).when(initialSnapshot).readNode(any());
@Test(expected = UnsupportedOperationException.class)
public void registerTreeChangeListenerTestWithException() throws Exception {
final DOMDataTreeChangeListener domDataTreeChangeListener = mock(DOMDataTreeChangeListener.class);
- final ListenerRegistration listenerRegistration = mock(ListenerRegistration.class);
+ final ListenerRegistration<?> listenerRegistration = mock(ListenerRegistration.class);
doReturn(listenerRegistration)
.when(READABLE_WRITEABLE_DOM_DATA_TREE_SHARD).registerTreeChangeListener(any(), any());
final DOMDataTreeIdentifier domDataTreeIdentifier =
- new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
+ new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty());
final ChildShardContext childShardContext =
new ChildShardContext(domDataTreeIdentifier, READABLE_WRITEABLE_DOM_DATA_TREE_SHARD);
final Map<DOMDataTreeIdentifier, ChildShardContext> childShardContextMap =
super(DATA_TREE, YANG_INSTANCE_IDENTIFIER, CHILD_SHARDS);
}
- private AbstractDOMShardTreeChangePublisherTest(final Map<DOMDataTreeIdentifier, ChildShardContext> childShardContextMap) {
+ private AbstractDOMShardTreeChangePublisherTest(
+ final Map<DOMDataTreeIdentifier, ChildShardContext> childShardContextMap) {
super(DATA_TREE, YANG_INSTANCE_IDENTIFIER, childShardContextMap);
}
@Override
- protected void notifyListeners(@Nonnull final Collection<AbstractDOMDataTreeChangeListenerRegistration<?>> registrations,
- @Nonnull final YangInstanceIdentifier path, @Nonnull final DataTreeCandidateNode node) {
+ protected void notifyListener(final AbstractDOMDataTreeChangeListenerRegistration<?> registration,
+ final Collection<DataTreeCandidate> changes) {
// NOOP
}
@Override
- protected void registrationRemoved(@Nonnull final AbstractDOMDataTreeChangeListenerRegistration<?> registration) {
+ protected void registrationRemoved(final AbstractDOMDataTreeChangeListenerRegistration<?> registration) {
// NOOP
}
public void reset() {
resetMocks();
}
-}
\ No newline at end of file
+}