X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=netconf%2Fnetconf-topology-singleton%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2Fsingleton%2Fimpl%2FNetconfTopologyManagerTest.java;h=f88314ec319d41d6292cc914d5eb5a716e384ecd;hb=1d91e1bbe29d0da6ea427a5d0837064c8a3d5134;hp=c61d1f8e93961c7511990a873079aa12028a1a8b;hpb=d80f25d21c6ede943a23d6f603466b2a36961de8;p=netconf.git diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java index c61d1f8e93..f88314ec31 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java @@ -20,23 +20,22 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.MockitoAnnotations.initMocks; -import static org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.DELETE; -import static org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.SUBTREE_MODIFIED; -import static org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.WRITE; +import static org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType.DELETE; +import static org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType.SUBTREE_MODIFIED; +import static org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType.WRITE; import akka.util.Timeout; -import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; import io.netty.util.concurrent.EventExecutor; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import javax.annotation.Nonnull; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -45,16 +44,16 @@ import org.opendaylight.aaa.encrypt.AAAEncryptionService; import org.opendaylight.controller.cluster.ActorSystemProvider; import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; import org.opendaylight.controller.config.threadpool.ThreadPool; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.test.ConstantSchemaAbstractDataBrokerTest; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataObjectModification; +import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; +import org.opendaylight.mdsal.binding.api.DataTreeModification; +import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTest; import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMMountPointService; +import org.opendaylight.mdsal.dom.api.DOMRpcProviderService; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; @@ -100,7 +99,7 @@ public class NetconfTopologyManagerTest { public void setUp() throws Exception { initMocks(this); - ConstantSchemaAbstractDataBrokerTest dataBrokerTest = new ConstantSchemaAbstractDataBrokerTest(false) { + AbstractDataBrokerTest dataBrokerTest = new AbstractDataBrokerTest() { @Override protected Set getModuleInfos() throws Exception { return ImmutableSet.of(BindingReflections.getModuleInfo(NetworkTopology.class), @@ -111,7 +110,7 @@ public class NetconfTopologyManagerTest { dataBrokerTest.setup(); dataBroker = spy(dataBrokerTest.getDataBroker()); - final RpcProviderRegistry rpcProviderRegistry = mock(RpcProviderRegistry.class); + final DOMRpcProviderService rpcProviderRegistry = mock(DOMRpcProviderService.class); final ScheduledThreadPool keepaliveExecutor = mock(ScheduledThreadPool.class); final ThreadPool processingThreadPool = mock(ThreadPool.class); final ExecutorService processingService = mock(ExecutorService.class); @@ -146,7 +145,7 @@ public class NetconfTopologyManagerTest { netconfTopologyManager.init(); await().atMost(5, TimeUnit.SECONDS).until(() -> { - ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); + ReadTransaction readTx = dataBroker.newReadOnlyTransaction(); Optional config = readTx.read(LogicalDatastoreType.CONFIGURATION, NetconfTopologyUtils.createTopologyListPath(TOPOLOGY_ID)).get(3, TimeUnit.SECONDS); Optional oper = readTx.read(LogicalDatastoreType.OPERATIONAL, @@ -157,7 +156,7 @@ public class NetconfTopologyManagerTest { // verify registration is called with right parameters verify(dataBroker).registerDataTreeChangeListener( - new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, NetconfTopologyUtils + DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, NetconfTopologyUtils .createTopologyListPath(TOPOLOGY_ID).child(Node.class)), netconfTopologyManager); netconfTopologyManager.close(); @@ -232,9 +231,9 @@ public class NetconfTopologyManagerTest { .registerClusterSingletonService(mockContext2); netconfTopologyManager.onDataTreeChanged(Arrays.asList( - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId1), dataObjectModification1), - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId2), dataObjectModification2))); verify(clusterSingletonServiceProvider).registerClusterSingletonService(mockContext1); @@ -261,9 +260,9 @@ public class NetconfTopologyManagerTest { doNothing().when(mockContext2).refresh(any()); netconfTopologyManager.onDataTreeChanged(Arrays.asList( - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId1), dataObjectModification1), - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId2), dataObjectModification2))); ArgumentCaptor mockContext1Setup = ArgumentCaptor.forClass(NetconfTopologySetup.class); @@ -281,7 +280,7 @@ public class NetconfTopologyManagerTest { doReturn(null).when(dataObjectModification1).getDataAfter(); netconfTopologyManager.onDataTreeChanged(Arrays.asList( - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId1), dataObjectModification1))); verify(mockClusterRegistration1).close(); @@ -310,7 +309,7 @@ public class NetconfTopologyManagerTest { }); netconfTopologyManager.onDataTreeChanged(Arrays.asList( - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId1), dataObjectModification1))); verify(clusterSingletonServiceProvider, times(2)).registerClusterSingletonService(newMockContext1); @@ -361,7 +360,7 @@ public class NetconfTopologyManagerTest { netconfTopologyManager.init(); netconfTopologyManager.onDataTreeChanged(Arrays.asList( - new CustomTreeModification(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + new CustomTreeModification(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeInstanceId), dataObjectModification))); verify(clusterSingletonServiceProvider, times(3)).registerClusterSingletonService(mockContext); @@ -382,13 +381,11 @@ public class NetconfTopologyManagerTest { this.rootNode = rootNode; } - @Nonnull @Override public DataTreeIdentifier getRootPath() { return rootPath; } - @Nonnull @Override public DataObjectModification getRootNode() { return rootNode;