Bug 868: Removed use of CompositeNode Binding Codecs. 35/16835/2
authorTony Tkacik <ttkacik@cisco.com>
Thu, 19 Mar 2015 14:25:34 +0000 (15:25 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 19 Mar 2015 16:16:13 +0000 (16:16 +0000)
Change-Id: Iaaf22bd8bc788f26814e06873b483bf0424ceaf2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
16 files changed:
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BindingNormalizedCodecTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AbstractDataServiceTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/UnionSerializationTest.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-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ListProcessingAndOrderingTest.java [deleted file]
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java [deleted file]
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java [deleted file]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/binding/impl/DataBrokerServiceImpl.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/client/SalRemoteClientImpl.java
opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java [deleted file]
opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java [deleted file]

index 0ad0434..c228244 100644 (file)
@@ -9,21 +9,18 @@ package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import com.google.common.base.Preconditions;
 import java.util.Hashtable;
-import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
 /**
-*
-*/
+ *
+**/
 public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
 
     private BundleContext bundleContext;
@@ -54,40 +51,17 @@ public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
     @Override
     public java.lang.AutoCloseable createInstance() {
         final GeneratedClassLoadingStrategy classLoading = getGlobalClassLoadingStrategy();
-        final BindingIndependentMappingService legacyMapping = getGlobalLegacyMappingService(classLoading);
         BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
-        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, legacyMapping, codecRegistry);
+        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, codecRegistry);
         bundleContext.registerService(SchemaContextListener.class, instance, new Hashtable<String,String>());
         return instance;
     }
 
-    private BindingIndependentMappingService getGlobalLegacyMappingService(final GeneratedClassLoadingStrategy classLoading) {
-        BindingIndependentMappingService potential = tryToReuseGlobalMappingServiceInstance();
-        if(potential == null) {
-            potential =  new RuntimeGeneratedMappingServiceImpl(ClassPool.getDefault(),classLoading);
-            bundleContext.registerService(SchemaContextListener.class, (SchemaContextListener) potential, new Hashtable<String,String>());
-        }
-        return potential;
-    }
-
     private GeneratedClassLoadingStrategy getGlobalClassLoadingStrategy() {
         ServiceReference<GeneratedClassLoadingStrategy> ref = bundleContext.getServiceReference(GeneratedClassLoadingStrategy.class);
         return bundleContext.getService(ref);
     }
 
-    private BindingIndependentMappingService tryToReuseGlobalMappingServiceInstance() {
-        ServiceReference<BindingIndependentMappingService> serviceRef = getBundleContext().getServiceReference(BindingIndependentMappingService.class);
-        if(serviceRef == null) {
-            return null;
-        }
-        return bundleContext.getService(serviceRef);
-
-    }
-
-    private BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
     public void setBundleContext(final BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
index bf3ac3d..270ae50 100644 (file)
@@ -31,7 +31,6 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
@@ -41,16 +40,13 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public class BindingToNormalizedNodeCodec implements BindingCodecTreeFactory, SchemaContextListener, AutoCloseable {
 
-    private final BindingIndependentMappingService bindingToLegacy;
     private final BindingNormalizedNodeCodecRegistry codecRegistry;
     private DataNormalizer legacyToNormalized;
     private final GeneratedClassLoadingStrategy classLoadingStrategy;
     private BindingRuntimeContext runtimeContext;
 
     public BindingToNormalizedNodeCodec(final GeneratedClassLoadingStrategy classLoadingStrategy,
-            final BindingIndependentMappingService mappingService,
             final BindingNormalizedNodeCodecRegistry codecRegistry) {
-        this.bindingToLegacy = mappingService;
         this.classLoadingStrategy = classLoadingStrategy;
         this.codecRegistry = codecRegistry;
 
@@ -150,10 +146,6 @@ public class BindingToNormalizedNodeCodec implements BindingCodecTreeFactory, Sc
         return currentOp.createDefault(path.getLastPathArgument());
     }
 
-    public BindingIndependentMappingService getLegacy() {
-        return bindingToLegacy;
-    }
-
     public BindingNormalizedNodeCodecRegistry getCodecRegistry() {
         return codecRegistry;
     }
index 3e6c4c0..ad3d6c6 100644 (file)
@@ -1,8 +1,8 @@
 package org.opendaylight.controller.md.sal.binding.impl.test;
 
 import static org.junit.Assert.assertTrue;
-import javassist.ClassPool;
 
+import javassist.ClassPool;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.md.sal.binding.test.AbstractSchemaAwareTest;
@@ -15,7 +15,6 @@ import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializ
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -33,16 +32,13 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     private static final QName SIMPLE_VALUE_QNAME = QName.create(TreeComplexUsesAugment.QNAME, "simple-value");
 
 
-    private RuntimeGeneratedMappingServiceImpl mappingService;
-    private BindingToNormalizedNodeCodec codec;
+   private BindingToNormalizedNodeCodec codec;
 
     @Override
     protected void setupWithSchema(final SchemaContext context) {
-        mappingService = new RuntimeGeneratedMappingServiceImpl(ClassPool.getDefault());
         DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
         BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
-        codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), mappingService, registry);
-        mappingService.onGlobalContextUpdated(context);
+        codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry);
         codec.onGlobalContextUpdated(context);
     };
 
index 4535a7f..de5f3ca 100644 (file)
@@ -6,14 +6,13 @@ import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUti
 import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.TOP_FOO_KEY;
 import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.path;
 
-import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
-
 import com.google.common.base.Throwables;
 import java.util.Arrays;
 import javassist.ClassPool;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
+import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
@@ -66,7 +65,7 @@ public class RpcProviderRegistryTest  extends AbstractSchemaAwareTest {
         final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy classLoadingStrategy = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(classLoadingStrategy, null, codecRegistry);
+        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(classLoadingStrategy, codecRegistry);
         final DOMRpcRouter domRpcRegistry = new DOMRpcRouter();
         domRpcRegistry.onGlobalContextUpdated(context);
         codec.onGlobalContextUpdated(context);
index c513804..547d349 100644 (file)
@@ -14,10 +14,10 @@ import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter;
+import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
@@ -31,7 +31,6 @@ import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializ
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -39,7 +38,6 @@ public class DataBrokerTestCustomizer {
 
     private DOMDataBroker domDataBroker;
     private final DOMNotificationRouter domNotificationRouter;
-    private final RuntimeGeneratedMappingServiceImpl mappingService;
     private final MockSchemaService schemaService;
     private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
     private final BindingToNormalizedNodeCodec bindingToNormalized;
@@ -54,11 +52,10 @@ public class DataBrokerTestCustomizer {
     public DataBrokerTestCustomizer() {
         schemaService = new MockSchemaService();
         final ClassPool pool = ClassPool.getDefault();
-        mappingService = new RuntimeGeneratedMappingServiceImpl(pool);
         final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(pool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        bindingToNormalized = new BindingToNormalizedNodeCodec(loading, mappingService, codecRegistry);
+        bindingToNormalized = new BindingToNormalizedNodeCodec(loading, codecRegistry);
         schemaService.registerSchemaContextListener(bindingToNormalized);
         domNotificationRouter = DOMNotificationRouter.create(16);
     }
@@ -121,7 +118,6 @@ public class DataBrokerTestCustomizer {
 
     public void updateSchema(final SchemaContext ctx) {
         schemaService.changeSchema(ctx);
-        mappingService.onGlobalContextUpdated(ctx);
     }
 
     public DOMNotificationRouter getDomNotificationRouter() {
index 591e07d..059c644 100644 (file)
@@ -7,21 +7,19 @@
  */
 package org.opendaylight.controller.sal.binding.test;
 
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.Before;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
-
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 
 @SuppressWarnings("deprecation")
 public abstract class AbstractDataServiceTest {
 
     protected org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService;
     protected DataProviderService baDataService;
-    protected BindingIndependentMappingService mappingService;
+
     protected BindingTestContext testContext;
 
     @Before
@@ -35,7 +33,6 @@ public abstract class AbstractDataServiceTest {
 
         baDataService = testContext.getBindingDataBroker();
         biDataService = testContext.getDomDataBroker();
-        mappingService = testContext.getBindingToDomMappingService();
     }
 
     protected boolean getStartWithSchema() {
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/UnionSerializationTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/UnionSerializationTest.java
deleted file mode 100644 (file)
index 54c6cc2..0000000
+++ /dev/null
@@ -1,45 +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.sal.binding.test.compat;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.Prefix;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.PrefixBuilder;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-public class UnionSerializationTest extends AbstractDataServiceTest {
-
-    public static final String PREFIX_STRING = "192.168.0.1/32";
-
-
-    @Test
-    public void testPrefixSerialization() throws Exception {
-
-        Ipv4Prefix ipv4prefix = new Ipv4Prefix(PREFIX_STRING);
-        IpPrefix ipPrefix = new IpPrefix(ipv4prefix);
-        Prefix prefix = new PrefixBuilder().setPrefix(ipPrefix).build();
-
-        CompositeNode serialized = testContext.getBindingToDomMappingService().toDataDom(prefix);
-        assertNotNull(serialized);
-        assertNotNull(serialized.getFirstSimpleByName(Prefix.QNAME));
-        assertEquals(PREFIX_STRING, serialized.getFirstSimpleByName(Prefix.QNAME).getValue());
-
-        Prefix deserialized = (Prefix) testContext.getBindingToDomMappingService().dataObjectFromDataDom(Prefix.class, serialized);
-        assertNotNull(deserialized);
-        assertNotNull(deserialized.getPrefix());
-        assertNotNull(deserialized.getPrefix().getIpv4Prefix());
-        assertEquals(PREFIX_STRING, deserialized.getPrefix().getIpv4Prefix().getValue());
-    }
-
-}
index 262f5af..5de4313 100644 (file)
@@ -25,11 +25,11 @@ import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
 import org.opendaylight.controller.md.sal.binding.compat.HydrogenDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.compat.HydrogenMountProvisionServiceAdapter;
+import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMMountPointServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
@@ -62,21 +62,18 @@ import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeC
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
 
 
-    private RuntimeGeneratedMappingServiceImpl mappingServiceImpl;
     private BindingToNormalizedNodeCodec codec;
 
     private RootBindingAwareBroker baBrokerImpl;
@@ -247,13 +244,11 @@ public class BindingTestContext implements AutoCloseable {
 
     public void startBindingToDomMappingService() {
         checkState(classPool != null, "ClassPool needs to be present");
-        mappingServiceImpl = new RuntimeGeneratedMappingServiceImpl(classPool);
-        mockSchemaService.registerSchemaContextListener(mappingServiceImpl);
 
         final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(classPool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        codec = new BindingToNormalizedNodeCodec(loading, mappingServiceImpl, codecRegistry);
+        codec = new BindingToNormalizedNodeCodec(loading,  codecRegistry);
         mockSchemaService.registerSchemaContextListener(codec);
     }
 
@@ -329,10 +324,6 @@ public class BindingTestContext implements AutoCloseable {
         return biDataLegacyBroker;
     }
 
-    public BindingIndependentMappingService getBindingToDomMappingService() {
-        return mappingServiceImpl;
-    }
-
     public RpcProviderRegistry getBindingRpcRegistry() {
         return baBrokerImpl.getRoot();
     }
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ListProcessingAndOrderingTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ListProcessingAndOrderingTest.java
deleted file mode 100644 (file)
index 7274300..0000000
+++ /dev/null
@@ -1,193 +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.data;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Test;
-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.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.Lists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.OrderedContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.UnkeyedContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.UnkeyedContainerBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.UnorderedContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.ordered.container.OrderedList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.ordered.container.OrderedListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.ordered.container.OrderedListKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unkeyed.container.UnkeyedList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unkeyed.container.UnkeyedListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedListKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/*
- * FIXME: THis test should be moved to sal-binding-broker and rewriten
- * to use new DataBroker API
- */
-@SuppressWarnings("deprecation")
-public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
-
-    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
-            .builder().node(Lists.QNAME).node(UnorderedContainer.QNAME).node(UnorderedList.QNAME).build();
-
-    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_ORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
-            .builder().node(Lists.QNAME).node(OrderedContainer.QNAME).node(OrderedList.QNAME).build();
-
-
-    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNKEYED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
-            .builder().node(Lists.QNAME).node(UnkeyedContainer.QNAME).node(UnkeyedList.QNAME).build();
-
-    private static final InstanceIdentifier<UnorderedContainer> UNORDERED_CONTAINER_PATH = InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).build();
-    private static final InstanceIdentifier<OrderedContainer> ORDERED_CONTAINER_PATH = InstanceIdentifier.builder(Lists.class).child(OrderedContainer.class).build();
-    private static final InstanceIdentifier<UnkeyedContainer> UNKEYED_CONTAINER_PATH = InstanceIdentifier.builder(Lists.class).child(UnkeyedContainer.class).build();
-
-    private static final UnorderedListKey UNORDERED_FOO_KEY = new UnorderedListKey("foo");
-    private static final UnorderedListKey UNORDERED_BAR_KEY = new UnorderedListKey("bar");
-
-    private static final InstanceIdentifier<UnorderedList> UNORDERED_FOO_PATH = UNORDERED_CONTAINER_PATH.child(UnorderedList.class,UNORDERED_FOO_KEY);
-    private static final InstanceIdentifier<UnorderedList> UNORDERED_BAR_PATH = UNORDERED_CONTAINER_PATH.child(UnorderedList.class,UNORDERED_BAR_KEY);
-
-    private static final OrderedListKey ORDERED_FOO_KEY = new OrderedListKey("foo");
-    private static final OrderedListKey ORDERED_BAR_KEY = new OrderedListKey("bar");
-    private static final InstanceIdentifier<OrderedList> ORDERED_FOO_PATH = ORDERED_CONTAINER_PATH.child(OrderedList.class,ORDERED_FOO_KEY);
-    private static final InstanceIdentifier<OrderedList> ORDERED_BAR_PATH = ORDERED_CONTAINER_PATH.child(OrderedList.class,ORDERED_BAR_KEY);
-
-
-    @Test
-    public void unorderedListReadWriteTest() throws InterruptedException, ExecutionException {
-        DataModificationTransaction tx = baDataService.beginTransaction();
-
-        tx.putOperationalData(UNORDERED_FOO_PATH, createUnordered("foo"));
-        tx.putOperationalData(UNORDERED_BAR_PATH, createUnordered("bar"));
-        assertedCommit(tx);
-
-        NormalizedNode<?, ?> data = resolveDataAsserted(DOM_UNORDERED_LIST_PATH);
-        assertTrue(data instanceof MapNode);
-        assertFalse(data instanceof OrderedMapNode);
-
-        assertXmlRepresentation(UNORDERED_CONTAINER_PATH, "foo","bar");
-    }
-
-
-
-    @Test
-    public void orderedListReadWriteTest() throws InterruptedException, ExecutionException {
-        DataModificationTransaction tx = baDataService.beginTransaction();
-
-        tx.putOperationalData(ORDERED_FOO_PATH, createOrdered("foo"));
-        tx.putOperationalData(ORDERED_BAR_PATH, createOrdered("bar"));
-        assertedCommit(tx);
-        NormalizedNode<?, ?> data = resolveDataAsserted(DOM_ORDERED_LIST_PATH);
-        assertTrue(data instanceof MapNode);
-        assertTrue(data instanceof OrderedMapNode);
-
-        assertXmlRepresentation(ORDERED_CONTAINER_PATH, "foo","bar");
-
-    }
-
-
-
-    @Test
-    public void unkeyedListReadWriteTest() throws InterruptedException, ExecutionException {
-        DataModificationTransaction tx = baDataService.beginTransaction();
-
-        ImmutableList<UnkeyedList> unkeyedItems= ImmutableList.<UnkeyedList>builder()
-                .add(createUnkeyed("foo"))
-                .add(createUnkeyed("bar"))
-                .build();
-
-        tx.putOperationalData(UNKEYED_CONTAINER_PATH, new UnkeyedContainerBuilder().setUnkeyedList(unkeyedItems).build());
-        assertedCommit(tx);
-        NormalizedNode<?, ?> data = resolveDataAsserted(DOM_UNKEYED_LIST_PATH);
-        assertFalse(data instanceof MapNode);
-        assertTrue(data instanceof UnkeyedListNode);
-
-        assertXmlRepresentation(UNKEYED_CONTAINER_PATH, "foo","bar");
-    }
-
-    private NormalizedNode<?, ?> resolveDataAsserted(
-            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath) {
-
-        try (DOMDataReadOnlyTransaction readTx = testContext.getDomAsyncDataBroker().newReadOnlyTransaction()){
-            ListenableFuture<Optional<NormalizedNode<?, ?>>> data = readTx.read(LogicalDatastoreType.OPERATIONAL, domPath);
-            Optional<NormalizedNode<?, ?>> potential = data.get();
-            assertTrue(potential.isPresent());
-            return potential.get();
-        } catch (InterruptedException | ExecutionException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private static UnorderedList createUnordered(final String name) {
-        return new UnorderedListBuilder().setName(name).setValue(createValue(name)).build();
-    }
-
-    private static OrderedList createOrdered(final String name) {
-        return new OrderedListBuilder().setName(name).setValue(createValue(name)).build();
-    }
-
-    private static UnkeyedList createUnkeyed(final String name) {
-        return new UnkeyedListBuilder().setName(name).setValue(createValue(name)).build();
-    }
-
-    private static String createValue(final String name) {
-        return name + "-" + name.hashCode();
-    }
-
-    private static void assertedCommit(final DataModificationTransaction tx) throws InterruptedException, ExecutionException {
-        RpcResult<TransactionStatus> result = tx.commit().get();
-        assertTrue(result.isSuccessful());
-        assertEquals(TransactionStatus.COMMITED,result.getResult());
-    }
-
-    private void assertXmlRepresentation(final InstanceIdentifier<?> containerPath, final String... childNameValues) {
-
-        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
-        CompositeNode compositeNode = testContext.getDomDataBroker().readOperationalData(domPath);
-        assertNotNull(compositeNode);
-
-        Set<String> childValues = new HashSet<>();
-        Collections.addAll(childValues, childNameValues);
-
-        for(Node<?> child : compositeNode.getChildren()) {
-            assertTrue(child instanceof CompositeNode);
-            CompositeNode compChild = (CompositeNode) child;
-            String nameLeafValue = (String) compChild.getSimpleNodesByName("name").get(0).getValue();
-            String valueLeafValue = (String) compChild.getSimpleNodesByName("value").get(0).getValue();
-
-            assertEquals(createValue(nameLeafValue), valueLeafValue);
-            childValues.remove(nameLeafValue);
-        }
-        assertTrue(childValues.isEmpty());
-    }
-
-}
index d85cb7a..d5ddc9f 100644 (file)
@@ -10,12 +10,13 @@ package org.opendaylight.controller.sal.binding.test.bugfix;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
@@ -27,9 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-
 @SuppressWarnings("deprecation")
 public class DOMCodecBug02Test extends AbstractDataServiceTest {
 
@@ -54,7 +52,6 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest {
 
         baDataService = testContext.getBindingDataBroker();
         biDataService = testContext.getDomDataBroker();
-        mappingService = testContext.getBindingToDomMappingService();
     };
 
     @Test
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/FlagsSerializationTest.java
deleted file mode 100644 (file)
index 9ad46bb..0000000
+++ /dev/null
@@ -1,117 +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.sal.binding.test.bugfix;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.BitFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.TllComplexAugment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1Key;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Key;
-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.TopLevelListKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-import com.google.common.collect.ImmutableSet;
-
-@SuppressWarnings("deprecation")
-public class FlagsSerializationTest extends AbstractDataServiceTest {
-    private static final TopLevelListKey TLL_KEY = new TopLevelListKey("foo");
-    private static final List11Key LIST11_KEY = new List11Key(1234);
-    private static final List1Key LIST1_KEY = new List1Key("1");
-
-    private static final InstanceIdentifier<TopLevelList> TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) //
-            .child(TopLevelList.class, TLL_KEY).toInstance();
-
-    private static final InstanceIdentifier<? extends DataObject> LIST11_INSTANCE_ID_BA = //
-            TLL_INSTANCE_ID_BA.builder() //
-            .augmentation(TllComplexAugment.class)
-            .child(List1.class,LIST1_KEY)
-            .child(List11.class, LIST11_KEY) //
-            .toInstance();
-    private static final QName LIST11_FLAGS_QNAME = QName.create(List11.QNAME, "flags");
-
-    @Test
-    public void testIndirectGeneration() throws Exception {
-
-        BitFlags checkOverlapFlags = new BitFlags(true,false,false,false,false);
-        ImmutableSet<String> domCheckOverlapFlags = ImmutableSet.<String>of("FLAG_FIVE");
-        testFlags(checkOverlapFlags,domCheckOverlapFlags);
-
-
-
-        BitFlags allFalseFlags = new BitFlags(false,false,false,false,false);
-        ImmutableSet<String> domAllFalseFlags = ImmutableSet.<String>of();
-        testFlags(allFalseFlags,domAllFalseFlags);
-
-        BitFlags allTrueFlags = new BitFlags(true,true,true,true,true);
-        ImmutableSet<String> domAllTrueFlags = ImmutableSet.<String>of("FLAG_ONE","FLAG_TWO","FLAG_THREE","FLAG_FOUR","FLAG_FIVE");
-        testFlags(allTrueFlags,domAllTrueFlags);
-
-        testFlags(null,null);
-
-
-
-    }
-
-    private void testFlags(final BitFlags flagsToTest, final ImmutableSet<String> domFlags) throws Exception {
-        List11 list11 = createList11(flagsToTest);
-        assertNotNull(list11);
-
-        CompositeNode domList11 = biDataService.readConfigurationData(mappingService.toDataDom(LIST11_INSTANCE_ID_BA));
-
-        assertNotNull(domList11);
-        org.opendaylight.yangtools.yang.data.api.Node<?> readedFlags = domList11.getFirstSimpleByName(LIST11_FLAGS_QNAME);
-
-        if(domFlags != null) {
-            assertNotNull(readedFlags);
-            assertEquals(domFlags,readedFlags.getValue());
-        } else {
-            assertNull(readedFlags);
-        }
-        assertEquals(flagsToTest, list11.getFlags());
-
-        DataModificationTransaction transaction = baDataService.beginTransaction();
-        transaction.removeConfigurationData(LIST11_INSTANCE_ID_BA);
-        RpcResult<TransactionStatus> result = transaction.commit().get();
-        assertEquals(TransactionStatus.COMMITED, result.getResult());
-
-    }
-
-    private List11 createList11(final BitFlags flagsToTest) throws Exception {
-
-        DataModificationTransaction modification = baDataService.beginTransaction();
-
-        List11Builder list11b = new List11Builder();
-
-        list11b.setKey(LIST11_KEY);
-        list11b.setAttrStr("list:1:1");
-
-        list11b.setFlags(flagsToTest);
-
-        modification.putConfigurationData(LIST11_INSTANCE_ID_BA, list11b.build());
-        RpcResult<TransactionStatus> ret = modification.commit().get();
-        assertNotNull(ret);
-        assertEquals(TransactionStatus.COMMITED, ret.getResult());
-        return (List11) baDataService.readConfigurationData(LIST11_INSTANCE_ID_BA);
-    }
-}
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java
deleted file mode 100644 (file)
index 25b159b..0000000
+++ /dev/null
@@ -1,139 +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.sal.binding.test.connect.dom;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.TllComplexAugment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1Key;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List11Key;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List12Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.list1.List12Key;
-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.TopLevelListKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.SettableFuture;
-
-/**
- * FIXME: Migrate to use new Data Broker APIs
- */
-@SuppressWarnings("deprecation")
-public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
-
-    protected static final Logger LOG = LoggerFactory.getLogger(ChangeOriginatedInDomBrokerTest.class);
-
-    private static final QName TLL_NAME_QNAME = QName.create(TopLevelList.QNAME, "name");
-    private static final QName LIST1_ATTR_STR_QNAME = QName.create(List1.QNAME, "attr-str");
-
-    private static final String TLL_NAME = "1";
-    private static final int LIST11_ATTR_INT = 1234;
-    private static final String LIST1_ATTR_STR = "foo:foo";
-
-    private static final TopLevelListKey TLL_KEY = new TopLevelListKey(TLL_NAME);
-    private static final List1Key LIST1_KEY = new List1Key(LIST1_ATTR_STR);
-    private static final List11Key LIST11_KEY = new List11Key(LIST11_ATTR_INT);
-
-    protected final SettableFuture<DataChangeEvent<InstanceIdentifier<?>, DataObject>> modificationCapture = SettableFuture.create();
-
-    private static final Map<QName, Object> TLL_KEY_BI = Collections.<QName, Object> singletonMap(TLL_NAME_QNAME,
-            TLL_NAME);
-
-    private static final InstanceIdentifier<TopLevelList> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) //
-            .child(TopLevelList.class, TLL_KEY).toInstance();
-
-    private static final Map<QName, Object> LIST1_KEY_BI = //
-    ImmutableMap.<QName, Object> of(LIST1_ATTR_STR_QNAME, LIST1_ATTR_STR);;
-
-    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier LIST1_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
-            .node(Top.QNAME) //
-            .nodeWithKey(TopLevelList.QNAME, TLL_KEY_BI) //
-            .nodeWithKey(List1.QNAME, LIST1_KEY_BI) //
-            .toInstance();
-
-    private static final InstanceIdentifier<List1> LIST1_PATH_BA = //
-            NODE_INSTANCE_ID_BA.builder() //
-            .augmentation(TllComplexAugment.class) //
-            .child(List1.class, LIST1_KEY) //
-            .toInstance();
-
-    @Test
-    public void simpleModifyOperation() throws Exception {
-
-        assertNull(biDataService.readConfigurationData(LIST1_INSTANCE_ID_BI));
-
-        registerChangeListener();
-
-        CompositeNode domflow = createTestList1();
-        DataModificationTransaction biTransaction = biDataService.beginTransaction();
-        biTransaction.putConfigurationData(LIST1_INSTANCE_ID_BI, domflow);
-        RpcResult<TransactionStatus> biResult = biTransaction.commit().get();
-        assertEquals(TransactionStatus.COMMITED, biResult.getResult());
-        DataChangeEvent<InstanceIdentifier<?>, DataObject> event = modificationCapture.get(1000,TimeUnit.MILLISECONDS);
-        assertNotNull(event);
-        LOG.info("Created Configuration :{}",event.getCreatedConfigurationData());
-        List1 list1 = (List1) event.getCreatedConfigurationData().get(LIST1_PATH_BA);
-        assertNotNull(list1);
-        assertNotNull(list1.getAttrStr());
-        assertNotNull(list1.getList11());
-        assertNotNull(list1.getList12());
-        assertEquals(TransactionStatus.COMMITED, biResult.getResult());
-
-    }
-
-    private void registerChangeListener() {
-        baDataService.registerDataChangeListener(LIST1_PATH_BA, new DataChangeListener() {
-
-            @Override
-            public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
-                LOG.info("Data Change listener invoked.");
-                modificationCapture.set(change);
-            }
-        });
-    }
-
-    private CompositeNode createTestList1() {
-        List1Builder l1b = new List1Builder();
-        List11Builder l11b = new List11Builder();
-        List12Builder l12b = new List12Builder();
-        l11b.setKey(LIST11_KEY);
-        l11b.setAttrStr("foo:foo:foo");
-        l12b.setKey(new List12Key(321));
-        l12b.setAttrStr("foo:foo:bar");
-        l1b.setKey(LIST1_KEY);
-        l1b.setList11(ImmutableList.of(l11b.build()));
-        l1b.setList12(ImmutableList.of(l12b.build()));
-        CompositeNode domList1 = mappingService.toDataDom(l1b.build());
-        return domList1;
-    }
-}
index 416f194..d87e499 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.sal.restconf.binding.impl;
 
 import java.net.URL;
-
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
@@ -18,7 +17,6 @@ import org.opendaylight.yangtools.restconf.client.api.RestconfClientContextFacto
 import org.opendaylight.yangtools.restconf.client.api.UnsupportedProtocolException;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,8 +27,8 @@ public class DataBrokerServiceImpl implements DataBrokerService {
     private final RestconfClientContext restconfClientContext;
     private final RestconfClientContextFactory restconfClientContextFactory = null;
 
-    public DataBrokerServiceImpl(URL baseUrl, BindingIndependentMappingService mappingService, SchemaContextHolder schemaContextHolder) throws UnsupportedProtocolException {
-        this.restconfClientContext = restconfClientContextFactory.getRestconfClientContext(baseUrl, mappingService, schemaContextHolder);
+    public DataBrokerServiceImpl(URL baseUrl, SchemaContextHolder schemaContextHolder) throws UnsupportedProtocolException {
+        this.restconfClientContext = restconfClientContextFactory.getRestconfClientContext(baseUrl, schemaContextHolder);
     }
 
     @Override
index a6ab915..7428b90 100644 (file)
@@ -7,10 +7,8 @@
  */
 package org.opendaylight.controller.sal.restconf.broker.client;
 
+import com.google.common.base.Preconditions;
 import java.net.URL;
-
-import javassist.ClassPool;
-
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.restconf.broker.SalRemoteServiceBroker;
@@ -18,33 +16,30 @@ import org.opendaylight.yangtools.restconf.client.RestconfClientFactory;
 import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
 import org.opendaylight.yangtools.restconf.client.api.UnsupportedProtocolException;
 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
-class SalRemoteClientImpl implements SalRemoteClient {
+class SalRemoteClientImpl implements SalRemoteClient, SchemaContextHolder {
 
     private static final Logger logger = LoggerFactory.getLogger(SalRemoteClientImpl.class);
 
     private final RestconfClientContext restconfClientContext;
     private final SalRemoteServiceBroker salRemoteBroker;
-    private final RuntimeGeneratedMappingServiceImpl mappingService;
+
+    private SchemaContext schemaContext;
 
     public SalRemoteClientImpl(final URL url) {
         Preconditions.checkNotNull(url);
 
-        this.mappingService = new RuntimeGeneratedMappingServiceImpl(ClassPool.getDefault());
 
         final ModuleInfoBackedContext moduleInfo = ModuleInfoBackedContext.create();
         moduleInfo.addModuleInfos(BindingReflections.loadModuleInfos());
-        this.mappingService.onGlobalContextUpdated(moduleInfo.tryToCreateSchemaContext().get());
-
+        schemaContext = moduleInfo.tryToCreateSchemaContext().get();
         try {
-            this.restconfClientContext = new RestconfClientFactory().getRestconfClientContext(url, this.mappingService,
-                    this.mappingService);
+            this.restconfClientContext = new RestconfClientFactory().getRestconfClientContext(url,this);
 
             this.salRemoteBroker = new SalRemoteServiceBroker("remote-broker", restconfClientContext);
             this.salRemoteBroker.start();
@@ -64,6 +59,11 @@ class SalRemoteClientImpl implements SalRemoteClient {
         }, null);
     }
 
+    @Override
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
     @Override
     public void close() throws Exception {
         this.restconfClientContext.close();
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java
deleted file mode 100644 (file)
index eafc47d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2013 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.sal.binding.impl.test;
-
-public class DataBrokerImplTest {
-
-    public static void main(String[] args){
-
-    }
-}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java
deleted file mode 100644 (file)
index a91b06e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2013 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.sal.binding.impl.test;
-
-public class NotificationServiceImplTest {
-
-    public static void main(String[] args){
-
-    }
-}

©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.