Bug 8568: Remove deprecated HydrogenDataBrokerAdapter 25/58025/3
authorTom Pantelis <tompantelis@gmail.com>
Wed, 31 May 2017 00:55:24 +0000 (20:55 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 1 Jun 2017 13:05:03 +0000 (09:05 -0400)
Removed the deprecated DataProviderService implementation
class HydrogenDataBrokerAdapter and the corresponding
config yang and ForwardedCompatibleDataBrokerImplModule.

Change-Id: Ie18e6e1ae6a9e68b97e39b278618a4a0c1c9219d
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
features/mdsal/features-mdsal/src/main/features/features.xml
features/mdsal/odl-mdsal-broker-local/src/main/feature/feature.xml
opendaylight/md-sal/md-sal-config/src/main/resources/initial/01-md-sal.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenDataBrokerAdapter.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountInstanceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java [deleted file]
opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java [deleted file]
opendaylight/md-sal/sal-binding-config/src/main/yang/opendaylight-binding-broker-impl.yang
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java

index 0fcdb5e..00bb515 100644 (file)
@@ -56,7 +56,7 @@
         <bundle>mvn:org.opendaylight.controller/sal-inmemory-datastore/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.controller/sal-dom-broker-config/{{VERSION}}</bundle>
         <bundle start-level="40">mvn:org.opendaylight.controller/blueprint/{{VERSION}}</bundle>
-        <configfile finalname="${config.configfile.directory}/${config.mdsal.configfile}">mvn:org.opendaylight.controller/md-sal-config/{{VERSION}}/xml/config</configfile>
+        <configfile finalname="${config.configfile.directory}/${config.mdsal.configfile}" override="true">mvn:org.opendaylight.controller/md-sal-config/{{VERSION}}/xml/config</configfile>
     </feature>
     <feature name='odl-toaster' version='${project.version}' description="OpenDaylight :: Toaster">
         <feature version='${yangtools.version}'>odl-yangtools-common</feature>
index c808b48..654311a 100644 (file)
@@ -12,7 +12,7 @@
     <feature name="odl-mdsal-broker-local" version="${project.version}">
         <bundle start-level="70">mvn:org.opendaylight.controller/sal-schema-service/${project.version}</bundle>
         <bundle start-level="40">mvn:org.opendaylight.controller/blueprint/${blueprint.version}</bundle>
-        <configfile finalname="${config.configfile.directory}/${config.mdsal.configfile}">
+        <configfile finalname="${config.configfile.directory}/${config.mdsal.configfile}" override="true">
             mvn:org.opendaylight.controller/md-sal-config/${project.version}/xml/config
         </configfile>
     </feature>
index 947eee2..cde493f 100644 (file)
                             <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>
                             <name>binding-notification-broker</name>
                         </notification-service>
-                        <data-broker>
-                            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
-                            <name>binding-data-broker</name>
-                        </data-broker>
                         <root-data-broker>
                             <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
                             <name>binding-data-broker</name>
                         <name>inmemory-data-broker</name>
                     </async-data-broker>
                 </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-data-compatible-broker</type>
-                    <name>inmemory-binding-data-broker</name>
-                    <binding-data-compatible-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
-                        <data-broker>
-                            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
-                            <name>binding-data-broker</name>
-                        </data-broker>
-                    </binding-data-compatible-broker>
-                </module>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type>
                     <name>binding-async-data-broker</name>
                         </instance>
                     </service>
 
-                    <service>
-                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
-                        <instance>
-                            <name>binding-data-broker</name>
-                            <provider>/modules/module[type='binding-data-compatible-broker'][name='inmemory-binding-data-broker']</provider>
-                        </instance>
-                    </service>
-
                     <service>
                         <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
                         <instance>
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenDataBrokerAdapter.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenDataBrokerAdapter.java
deleted file mode 100644 (file)
index a4f260c..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.binding.compat;
-
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yangtools.concepts.Delegator;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Deprecated
-public class HydrogenDataBrokerAdapter implements DataProviderService, AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(HydrogenDataBrokerAdapter.class);
-
-    private final DataBroker delegate;
-
-    public HydrogenDataBrokerAdapter(final DataBroker dataBroker) {
-        delegate = dataBroker;
-        LOG.info("ForwardedBackwardsCompatibleBroker started.");
-    }
-
-    @Override
-    public DataModificationTransaction beginTransaction() {
-        return new ForwardedBackwardsCompatibleTransacion(delegate.newReadWriteTransaction());
-    }
-
-    @Override
-    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-        final DataModificationTransaction tx = beginTransaction();
-        return tx.readConfigurationData(path);
-    }
-
-    @Override
-    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-        final DataModificationTransaction tx = beginTransaction();
-        return tx.readOperationalData(path);
-    }
-
-    @Override
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(
-            final InstanceIdentifier<? extends DataObject> path, final DataChangeListener listener) {
-
-
-        final org.opendaylight.controller.md.sal.binding.api.DataChangeListener asyncOperListener = new BackwardsCompatibleOperationalDataChangeInvoker(listener);
-        final org.opendaylight.controller.md.sal.binding.api.DataChangeListener asyncCfgListener = new BackwardsCompatibleConfigurationDataChangeInvoker(listener);
-
-        final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> cfgReg = delegate.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, path, asyncCfgListener, DataChangeScope.SUBTREE);
-        final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> operReg = delegate.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, path, asyncOperListener, DataChangeScope.SUBTREE);
-
-        return new LegacyListenerRegistration(listener,cfgReg,operReg);
-    }
-
-    @Deprecated
-    private class ForwardedBackwardsCompatibleTransacion implements DataModificationTransaction {
-
-        private final ListenerRegistry<DataTransactionListener> listeners = ListenerRegistry.create();
-        private final Map<InstanceIdentifier<? extends DataObject>, DataObject> updated = new HashMap<>();
-        private final Map<InstanceIdentifier<? extends DataObject>, DataObject> created = new HashMap<>();
-        private final Set<InstanceIdentifier<? extends DataObject>> removed = new HashSet<>();
-        private final Map<InstanceIdentifier<? extends DataObject>, DataObject> original = new HashMap<>();
-        private TransactionStatus status = TransactionStatus.NEW;
-
-        private final Set<InstanceIdentifier<? extends DataObject>> posponedRemovedOperational = new HashSet<>();
-        private final Set<InstanceIdentifier<? extends DataObject>> posponedRemovedConfiguration = new HashSet<>();
-
-        private final ReadWriteTransaction delegate;
-
-
-        @Override
-        public final TransactionStatus getStatus() {
-            return status;
-        }
-
-        protected ForwardedBackwardsCompatibleTransacion(final ReadWriteTransaction delegate) {
-            this.delegate = delegate;
-            LOG.debug("Tx {} allocated.",getIdentifier());
-        }
-
-        @Override
-        public void putOperationalData(final InstanceIdentifier<? extends DataObject> path, final DataObject data) {
-            final boolean previouslyRemoved = posponedRemovedOperational.remove(path);
-
-            @SuppressWarnings({ "rawtypes", "unchecked" })
-            final InstanceIdentifier<DataObject> castedPath = (InstanceIdentifier) path;
-            if(previouslyRemoved) {
-                delegate.put(LogicalDatastoreType.OPERATIONAL, castedPath, data,true);
-            } else {
-                delegate.merge(LogicalDatastoreType.OPERATIONAL, castedPath, data,true);
-            }
-        }
-
-        @Override
-        public void putConfigurationData(final InstanceIdentifier<? extends DataObject> path, final DataObject data) {
-            final boolean previouslyRemoved = posponedRemovedConfiguration.remove(path);
-            final DataObject originalObj = readConfigurationData(path);
-            if (originalObj != null) {
-                original.put(path, originalObj);
-
-            } else {
-                created.put(path, data);
-            }
-            updated.put(path, data);
-            @SuppressWarnings({"rawtypes","unchecked"})
-            final InstanceIdentifier<DataObject> castedPath = (InstanceIdentifier) path;
-            if(previouslyRemoved) {
-                delegate.put(LogicalDatastoreType.CONFIGURATION, castedPath, data,true);
-            } else {
-                delegate.merge(LogicalDatastoreType.CONFIGURATION, castedPath, data,true);
-            }
-        }
-
-        @Override
-        public void removeOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-            posponedRemovedOperational.add(path);
-        }
-
-        @Override
-        public void removeConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-            posponedRemovedConfiguration.add(path);
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getCreatedOperationalData() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getCreatedConfigurationData() {
-            return created;
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getUpdatedOperationalData() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getUpdatedConfigurationData() {
-            return updated;
-        }
-
-        @Override
-        public Set<InstanceIdentifier<? extends DataObject>> getRemovedConfigurationData() {
-            return removed;
-        }
-
-        @Override
-        public Set<InstanceIdentifier<? extends DataObject>> getRemovedOperationalData() {
-            return Collections.emptySet();
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getOriginalConfigurationData() {
-            return original;
-        }
-
-        @Override
-        public Map<InstanceIdentifier<? extends DataObject>, DataObject> getOriginalOperationalData() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-            try {
-                return delegate.read(LogicalDatastoreType.OPERATIONAL, path).get().orNull();
-            } catch (InterruptedException | ExecutionException e) {
-                LOG.error("Read of {} failed.", path,e);
-                return null;
-            }
-        }
-
-        @Override
-        public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-            try {
-                return delegate.read(LogicalDatastoreType.CONFIGURATION, path).get().orNull();
-            } catch (InterruptedException | ExecutionException e) {
-                LOG.error("Read of {} failed.", path,e);
-                return null;
-            }
-        }
-
-        private void changeStatus(final TransactionStatus status) {
-            LOG.trace("Transaction {} changed status to {}", getIdentifier(), status);
-            this.status = status;
-
-            for(final ListenerRegistration<DataTransactionListener> listener : listeners) {
-                try {
-                    listener.getInstance().onStatusUpdated(this, status);
-                } catch (final Exception e) {
-                    LOG.error("Error during invoking transaction listener {}",listener.getInstance(),e);
-                }
-            }
-        }
-
-        @Override
-        public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-
-            for(final InstanceIdentifier<? extends DataObject> path : posponedRemovedConfiguration) {
-                delegate.delete(LogicalDatastoreType.CONFIGURATION, path);
-            }
-
-            for(final InstanceIdentifier<? extends DataObject> path : posponedRemovedOperational) {
-                delegate.delete(LogicalDatastoreType.OPERATIONAL, path);
-            }
-
-            changeStatus(TransactionStatus.SUBMITED);
-
-            final ListenableFuture<RpcResult<TransactionStatus>> f = delegate.commit();
-
-            Futures.addCallback(f, new FutureCallback<RpcResult<TransactionStatus>>() {
-                @Override
-                public void onSuccess(final RpcResult<TransactionStatus> result) {
-                    changeStatus(result.getResult());
-                }
-
-                @Override
-                public void onFailure(final Throwable t) {
-                    LOG.error("Transaction {} failed to complete", getIdentifier(), t);
-                    changeStatus(TransactionStatus.FAILED);
-                }
-            });
-
-            return f;
-        }
-
-        @Override
-        public ListenerRegistration<DataTransactionListener> registerListener(final DataTransactionListener listener) {
-            return listeners.register(listener);
-        }
-
-        @Override
-        public Object getIdentifier() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-    }
-
-    private static final class LegacyListenerRegistration implements ListenerRegistration<DataChangeListener> {
-
-        private final DataChangeListener instance;
-        private final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> cfgReg;
-        private final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> operReg;
-
-        public LegacyListenerRegistration(final DataChangeListener listener,
-                final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> cfgReg,
-                final ListenerRegistration<org.opendaylight.controller.md.sal.binding.api.DataChangeListener> operReg) {
-            this.instance = listener;
-            this.cfgReg = cfgReg;
-            this.operReg = operReg;
-        }
-
-        @Override
-        public DataChangeListener getInstance() {
-            return instance;
-        }
-
-        @Override
-        public void close() {
-            cfgReg.close();
-            operReg.close();
-        }
-
-    }
-
-    private static class BackwardsCompatibleOperationalDataChangeInvoker implements org.opendaylight.controller.md.sal.binding.api.DataChangeListener, Delegator<DataChangeListener> {
-
-        private final org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<?,?> delegate;
-
-
-        public BackwardsCompatibleOperationalDataChangeInvoker(final DataChangeListener listener) {
-            this.delegate = listener;
-        }
-
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        @Override
-        public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
-
-            final DataChangeEvent legacyChange = HydrogenDataChangeEvent.createOperational(change);
-            delegate.onDataChanged(legacyChange);
-
-        }
-
-        @Override
-        public DataChangeListener getDelegate() {
-            return (DataChangeListener) delegate;
-        }
-
-    }
-
-    private static class BackwardsCompatibleConfigurationDataChangeInvoker implements org.opendaylight.controller.md.sal.binding.api.DataChangeListener, Delegator<DataChangeListener> {
-        private final org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<?,?> delegate;
-
-        public BackwardsCompatibleConfigurationDataChangeInvoker(final DataChangeListener listener) {
-            this.delegate = listener;
-        }
-
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        @Override
-        public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
-
-            final DataChangeEvent legacyChange = HydrogenDataChangeEvent.createConfiguration(change);
-
-            delegate.onDataChanged(legacyChange);
-
-        }
-
-        @Override
-        public DataChangeListener getDelegate() {
-            return (DataChangeListener) delegate;
-        }
-
-    }
-
-    @Override
-    public void close() throws Exception {
-        // TODO Auto-generated method stub
-    }
-}
index 49340fa..35f7d87 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableClassToInstanceMap;
 import java.util.concurrent.ExecutorService;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPoint;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
@@ -45,10 +44,6 @@ public class HydrogenMountInstanceAdapter implements MountProviderInstance {
         this.identifier = key.getIdentifier();
         final ImmutableClassToInstanceMap.Builder<BindingAwareService> builder = ImmutableClassToInstanceMap.builder();
 
-        final Optional<DataBroker> dataBroker = key.getService(DataBroker.class);
-        if(dataBroker.isPresent()) {
-            builder.put(DataBrokerService.class, new HydrogenDataBrokerAdapter(dataBroker.get()));
-        }
         final Optional<org.opendaylight.controller.md.sal.binding.api.NotificationService> notificationService = key.getService(org.opendaylight.controller.md.sal.binding.api.NotificationService.class);
         if(notificationService.isPresent()) {
             builder.put(NotificationService.class, new HeliumNotificationServiceAdapter(notificationService.get()));
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java
deleted file mode 100644 (file)
index 3cdd9b5..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.md.sal.binding.impl.test;
-
-import static junit.framework.TestCase.assertNotNull;
-
-import com.google.common.collect.ImmutableSet;
-import java.util.concurrent.ExecutionException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.md.sal.binding.compat.HydrogenDataBrokerAdapter;
-import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
-import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestCustomizer;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
-
-@Deprecated
-public class ForwardedBackwardsCompatibleDataBrokerTest extends AbstractConcurrentDataBrokerTest {
-
-    private HydrogenDataBrokerAdapter dataBroker;
-    private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
-    private static final TopLevelListKey TOP_LIST_KEY = new TopLevelListKey("foo");
-    private static final InstanceIdentifier<TopLevelList> NODE_PATH = TOP_PATH.child(TopLevelList.class, TOP_LIST_KEY);
-    private static final TopLevelList NODE = new TopLevelListBuilder().setKey(TOP_LIST_KEY).build();
-
-    @Override
-    protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
-        return ImmutableSet.of(BindingReflections.getModuleInfo(TopLevelList.class));
-    }
-
-    @Override
-    protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
-        return new DataBrokerTestCustomizer();
-    }
-
-    @Before
-    public void setupWithDataBroker() {
-        this.dataBroker = new HydrogenDataBrokerAdapter(getDataBroker());
-    }
-
-    /**
-     * The purpose of this test is to exercise the backwards compatible broker
-     * <p>
-     * This test tries to execute the code which ensures that the parents
-     * for a given node get automatically created.
-     *
-     * @see org.opendaylight.controller.md.sal.binding.impl.AbstractReadWriteTransaction#ensureParentsByMerge(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.binding.InstanceIdentifier)
-     */
-    @Test
-    public void testEnsureParentsByMerge() throws InterruptedException, ExecutionException {
-        final DataModificationTransaction writeTx =
-            dataBroker.beginTransaction();
-
-        writeTx.putOperationalData(NODE_PATH, NODE);
-
-        writeTx.commit().get();
-
-        // TOP_PATH should exist as it is the parent of NODE_PATH
-        final DataObject object = dataBroker.readOperationalData(TOP_PATH);
-
-        assertNotNull(object);
-
-    }
-
-
-}
index 9da772a..87f7eaa 100644 (file)
@@ -45,7 +45,6 @@ import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointSer
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
 import org.opendaylight.controller.sal.core.api.BrokerService;
@@ -83,9 +82,6 @@ public class BindingTestContext implements AutoCloseable {
 
     private ImmutableMap<LogicalDatastoreType, DOMStore> newDatastores;
 
-    @Deprecated
-    private DataProviderService baData;
-
     private DOMDataBroker newDOMDataBroker;
 
     private final MockSchemaService mockSchemaService = new MockSchemaService();
@@ -262,6 +258,10 @@ public class BindingTestContext implements AutoCloseable {
         return this.baBrokerImpl.getLegacyMount();
     }
 
+    public MountPointService getBindingMountPointService() {
+        return this.baBrokerImpl.getMountService();
+    }
+
     public DOMMountPointService getDomMountProviderService() {
         return this.biMountImpl;
     }
diff --git a/opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java b/opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModule.java
deleted file mode 100644 (file)
index 6f03c15..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.md.sal.binding.impl;
-
-import org.opendaylight.controller.md.sal.binding.compat.HydrogenDataBrokerAdapter;
-
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Provider;
-
-/**
-*
-*/
-@Deprecated
-public final class ForwardedCompatibleDataBrokerImplModule extends
-        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModule
-        implements Provider {
-
-    public ForwardedCompatibleDataBrokerImplModule(
-            final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public ForwardedCompatibleDataBrokerImplModule(
-            final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final ForwardedCompatibleDataBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
-
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    protected void customValidation() {
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final HydrogenDataBrokerAdapter dataBroker = new HydrogenDataBrokerAdapter(getDataBrokerDependency());
-        return dataBroker;
-    }
-
-    @Override
-    public void onSessionInitiated(final ProviderSession session) {
-
-    }
-
-    @Override
-    public Collection<ProviderFunctionality> getProviderFunctionality() {
-        return Collections.emptySet();
-    }
-}
diff --git a/opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/ForwardedCompatibleDataBrokerImplModuleFactory.java
deleted file mode 100644 (file)
index 1dee6fd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.md.sal.binding.impl;
-
-@Deprecated
-public class ForwardedCompatibleDataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModuleFactory
-{
-
-}
index d1383c1..0316b11 100644 (file)
@@ -47,14 +47,6 @@ module opendaylight-sal-binding-broker-impl {
         config:java-name-prefix BindingBrokerImpl;
     }
 
-    identity binding-data-compatible-broker {
-        status deprecated;
-        base config:module-type;
-        config:provided-service sal:binding-data-broker;
-        config:provided-service sal:binding-data-consumer-broker;
-        config:java-name-prefix ForwardedCompatibleDataBrokerImpl;
-    }
-
     identity binding-forwarded-data-broker {
         status deprecated;
         base config:module-type;
@@ -131,7 +123,7 @@ module opendaylight-sal-binding-broker-impl {
             }*/
             container binding-broker-impl {
                 uses dom-forwarding-component;
-    
+
                 container data-broker {
                     status deprecated;
                     uses config:service-ref {
@@ -141,7 +133,7 @@ module opendaylight-sal-binding-broker-impl {
                         }
                     }
                 }
-    
+
                 container notification-service {
                     status deprecated;
                     uses config:service-ref {
@@ -151,7 +143,7 @@ module opendaylight-sal-binding-broker-impl {
                         }
                     }
                 }
-    
+
                 container root-data-broker {
                     status deprecated;
                     uses config:service-ref {
@@ -178,24 +170,6 @@ module opendaylight-sal-binding-broker-impl {
         }
     }
 
-    augment "/config:modules/config:module/config:configuration" {
-        case binding-data-compatible-broker {
-            when "/config:modules/config:module/config:type = 'binding-data-compatible-broker'";
-
-            container binding-data-compatible-broker {
-                container data-broker {
-                    status deprecated;
-                    uses config:service-ref {
-                        refine type {
-                            mandatory false;
-                            config:required-identity sal:binding-async-data-broker;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
     augment "/config:modules/config:module/config:configuration" {
         case binding-forwarded-data-broker {
             when "/config:modules/config:module/config:type = 'binding-forwarded-data-broker'";
index 6eeb6a6..d80e49c 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.binding.test.connect.dom;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -17,8 +18,13 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.MountPoint;
+import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -32,8 +38,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.List11SimpleAugment;
@@ -64,7 +68,7 @@ public class CrossBrokerMountPointTest {
 
     private static final TopLevelListKey TLL_KEY = new TopLevelListKey(TLL_NAME);
 
-    private static final Map<QName, Object> TLL_KEY_BI = Collections.<QName, Object> singletonMap(TLL_NAME_QNAME,
+    private static final Map<QName, Object> TLL_KEY_BI = Collections.<QName, Object>singletonMap(TLL_NAME_QNAME,
             TLL_NAME);
 
     private static final InstanceIdentifier<TopLevelList> TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) //
@@ -85,23 +89,23 @@ public class CrossBrokerMountPointTest {
             Cont.QNAME.getLocalName());
 
     private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier TLL_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
+        YangInstanceIdentifier.builder() //
             .node(Top.QNAME) //
             .node(TopLevelList.QNAME) //
             .nodeWithKey(TopLevelList.QNAME, TLL_KEY_BI) //
             .build();
 
-    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
-            //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier GROUP_STATISTICS_ID_BI =
+        YangInstanceIdentifier
             .builder(TLL_INSTANCE_ID_BI)
-            .nodeWithKey(QName.create(TllComplexAugment.QNAME, "list1"), QName.create(TllComplexAugment.QNAME, "attr-str"),
-                    LIST1_KEY.getAttrStr())
-            .nodeWithKey(QName.create(TllComplexAugment.QNAME, "list1-1"), QName.create(TllComplexAugment.QNAME, "attr-int"),
-                    LIST11_KEY.getAttrInt())
+            .nodeWithKey(QName.create(TllComplexAugment.QNAME, "list1"),
+                    QName.create(TllComplexAugment.QNAME, "attr-str"), LIST1_KEY.getAttrStr())
+            .nodeWithKey(QName.create(TllComplexAugment.QNAME, "list1-1"),
+                    QName.create(TllComplexAugment.QNAME, "attr-int"), LIST11_KEY.getAttrInt())
             .node(AUG_CONT).build();
 
     private BindingTestContext testContext;
-    private MountProviderService bindingMountPointService;
+    private MountPointService bindingMountPointService;
     private DOMMountPointService domMountPointService;
 
     @Before
@@ -112,7 +116,7 @@ public class CrossBrokerMountPointTest {
         testContext = testFactory.getTestContext();
 
         testContext.start();
-        bindingMountPointService = testContext.getBindingMountProviderService();
+        bindingMountPointService = testContext.getBindingMountPointService();
         domMountPointService = testContext.getDomMountProviderService();
 
         // biRpcInvoker = testContext.getDomRpcInvoker();
@@ -123,14 +127,15 @@ public class CrossBrokerMountPointTest {
     }
 
     @Test
-    public void testMountPoint() {
+    public void testMountPoint() throws ReadFailedException, TimeoutException {
         final Integer attrIntValue = 500;
         domMountPointService.createMountPoint(TLL_INSTANCE_ID_BI)
             .addService(DOMDataBroker.class, new DOMDataBroker() {
 
                 @Override
-                public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-                        final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+                public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(
+                        final LogicalDatastoreType store, final YangInstanceIdentifier path,
+                        final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
                     throw new UnsupportedOperationException();
                 }
 
@@ -146,16 +151,19 @@ public class CrossBrokerMountPointTest {
                         @Override
                         public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
                                 final LogicalDatastoreType store, final YangInstanceIdentifier path) {
-                            if(store == LogicalDatastoreType.OPERATIONAL && path.getLastPathArgument().equals(GROUP_STATISTICS_ID_BI.getLastPathArgument())) {
+                            if (store == LogicalDatastoreType.OPERATIONAL && path.getLastPathArgument()
+                                    .equals(GROUP_STATISTICS_ID_BI.getLastPathArgument())) {
 
                                 final ContainerNode data = Builders.containerBuilder()
                                         .withNodeIdentifier(new NodeIdentifier(AUG_CONT))
-                                        .withChild(ImmutableNodes.leafNode(QName.create(AUG_CONT, "attr-int"), attrIntValue))
+                                        .withChild(ImmutableNodes.leafNode(QName.create(AUG_CONT, "attr-int"),
+                                                attrIntValue))
                                         .build();
 
                                 return Futures.immediateCheckedFuture(Optional.<NormalizedNode<?,?>>of(data));
                             }
-                            return Futures.immediateFailedCheckedFuture(new ReadFailedException(TLL_NAME, new Exception()));
+                            return Futures.immediateFailedCheckedFuture(new ReadFailedException(TLL_NAME,
+                                    new Exception()));
                         }
 
                         @Override
@@ -220,13 +228,15 @@ public class CrossBrokerMountPointTest {
                 }
             }).register();
 
+        final Optional<MountPoint> bindingMountPoint = bindingMountPointService.getMountPoint(TLL_INSTANCE_ID_BA);
+        assertTrue(bindingMountPoint.isPresent());
 
+        final Optional<DataBroker> dataBroker = bindingMountPoint.get().getService(DataBroker.class);
+        assertTrue(dataBroker.isPresent());
 
-        final MountProviderInstance bindingMountPoint = bindingMountPointService.getMountPoint(TLL_INSTANCE_ID_BA);
-        assertNotNull(bindingMountPoint);
-
-        final Cont data = (Cont) bindingMountPoint.readOperationalData(AUG_CONT_ID_BA);
-        assertNotNull(data);
-        assertEquals(attrIntValue ,data.getAttrInt());
+        final Optional<Cont> data = dataBroker.get().newReadWriteTransaction().read(LogicalDatastoreType.OPERATIONAL,
+                AUG_CONT_ID_BA).checkedGet(5, TimeUnit.SECONDS);
+        assertTrue(data.isPresent());
+        assertEquals(attrIntValue ,data.get().getAttrInt());
     }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.