Change deprecated SchemaService by DOMSchemaService 97/57597/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 22 May 2017 09:09:06 +0000 (11:09 +0200)
committerDana Kutenicsova <dana.kutenics@gmail.com>
Thu, 1 Jun 2017 12:51:45 +0000 (12:51 +0000)
Change-Id: Iaa4adace5e15a1aeee2824cac81f8c72703a80fb
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImpl.java
bgp/rib-impl/src/main/resources/org/opendaylight/blueprint/bgp-rib.xml
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImplTest.java

index 64076a2cd8eca681f55f16ecb0aa3e30a96d87de..c341acebad0781b3946ec4f4fe05ed490cca3a1b 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListen
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
@@ -71,7 +71,7 @@ public final class RibImpl implements RIB, BGPRIBStateConsumer, AutoCloseable {
     private final BGPDispatcher dispatcher;
     private final BindingCodecTreeFactory codecTreeFactory;
     private final DOMDataBroker domBroker;
-    private final SchemaService schemaService;
+    private final DOMSchemaService domSchemaService;
     private RIBImpl ribImpl;
     private ServiceRegistration<?> serviceRegistration;
     private ListenerRegistration<SchemaContextListener> schemaContextRegistration;
@@ -84,20 +84,20 @@ public final class RibImpl implements RIB, BGPRIBStateConsumer, AutoCloseable {
 
     public RibImpl(final ClusterSingletonServiceProvider provider, final RIBExtensionConsumerContext contextProvider,
         final BGPDispatcher dispatcher, final BindingCodecTreeFactory codecTreeFactory, final DOMDataBroker domBroker,
-        final SchemaService schemaService) {
+        final DOMSchemaService domSchemaService) {
         this.provider = Preconditions.checkNotNull(provider);
         this.extensions = contextProvider;
         this.dispatcher = dispatcher;
         this.codecTreeFactory = codecTreeFactory;
         this.domBroker = domBroker;
-        this.schemaService = schemaService;
+        this.domSchemaService = domSchemaService;
     }
 
     void start(final Global global, final String instanceName, final BGPTableTypeRegistryConsumer tableTypeRegistry,
         final BgpDeployer.WriteConfiguration configurationWriter) {
         Preconditions.checkState(this.ribImpl == null, "Previous instance %s was not closed.", this);
         this.ribImpl = createRib(global, instanceName, tableTypeRegistry, configurationWriter);
-        this.schemaContextRegistration = this.schemaService.registerSchemaContextListener(this.ribImpl);
+        this.schemaContextRegistration = this.domSchemaService.registerSchemaContextListener(this.ribImpl);
     }
 
     Boolean isGlobalEqual(final Global global) {
index d3a78a34acb4eb781f5f883857cbbacdb3beb988..fc679007b5fa8106427a166a44e5883fd34fcc0d 100644 (file)
@@ -47,7 +47,7 @@
   <reference id="codecTreeFactory" interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory"/>
   <reference id="domDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker" odl:type="pingpong"/>
   <reference id="bgpTableTypeRegistry" interface="org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer"/>
-  <reference id="schemaService" interface="org.opendaylight.controller.sal.core.api.model.SchemaService"/>
+  <odl:static-reference id="domSchemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService"/>
   <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
 
   <bean id="bgpDeployer" class="org.opendaylight.protocol.bgp.rib.impl.config.BgpDeployerImpl"  destroy-method="close">
@@ -66,7 +66,7 @@
     <argument ref="BGPDispatcher"/>
     <argument ref="codecTreeFactory"/>
     <argument ref="domDataBroker"/>
-    <argument ref="schemaService"/>
+    <argument ref="domSchemaService"/>
   </bean>
 
   <bean id="bgpPeer" class="org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer" scope="prototype">
index e983dec39b5961d16f1a908fb7681e706eb49f3a..557f4b759399af3a362772cdea792490721872ea 100644 (file)
@@ -49,9 +49,9 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
 import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
@@ -185,7 +185,7 @@ public class BgpDeployerImplTest {
         Mockito.doReturn(serviceRegistration).when(singletonServiceProvider).registerClusterSingletonService(any());
         Mockito.doNothing().when(serviceRegistration).close();
 
-        final SchemaService schemaService = mock(SchemaService.class);
+        final DOMSchemaService schemaService = mock(DOMSchemaService.class);
         Mockito.doNothing().when(this.dataTreeRegistration).close();
 
         Mockito.doReturn(this.dataTreeRegistration).when(schemaService).registerSchemaContextListener(any());
index b78940127fca6238b918b530d24859cd4ab15a48..7d72fc93ae5835cd45b5ce3b56741abaafd1a1e9 100644 (file)
@@ -25,9 +25,9 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
 import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
@@ -73,7 +73,7 @@ public class RibImplTest extends AbstractConfig {
     @Mock
     private DOMDataBroker domDataBroker;
     @Mock
-    private SchemaService schemaService;
+    private DOMSchemaService domSchemaService;
     @Mock
     private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
     @Mock
@@ -105,7 +105,7 @@ public class RibImplTest extends AbstractConfig {
         final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
         Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
             .when(this.domDataBroker).getSupportedExtensions();
-        Mockito.doReturn(this.dataTreeRegistration).when(this.schemaService).registerSchemaContextListener(any());
+        Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
         Mockito.doNothing().when(this.dataTreeRegistration).close();
         Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService).registerDataTreeChangeListener(any(), any());
         Mockito.doNothing().when(this.serviceRegistration).unregister();
@@ -114,13 +114,13 @@ public class RibImplTest extends AbstractConfig {
     @Test
     public void testRibImpl() throws Exception {
         final RibImpl ribImpl = new RibImpl(this.clusterSingletonServiceProvider, this.extension, this.dispatcher,
-            this.bindingCodecTreeFactory, this.domDataBroker, this.schemaService);
+            this.bindingCodecTreeFactory, this.domDataBroker, this.domSchemaService);
         ribImpl.setServiceRegistration(this.serviceRegistration);
         ribImpl.start(createGlobal(), "rib-test", this.tableTypeRegistry, this.configurationWriter);
         verify(this.extension).getClassLoadingStrategy();
         verify(this.domDataBroker).getSupportedExtensions();
         verify(this.clusterSingletonServiceProvider).registerClusterSingletonService(any());
-        verify(this.schemaService).registerSchemaContextListener(any(RIBImpl.class));
+        verify(this.domSchemaService).registerSchemaContextListener(any(RIBImpl.class));
         this.singletonService.instantiateServiceInstance();
         Mockito.verify(this.configurationWriter).apply();
         assertEquals("RIBImpl{}", ribImpl.toString());