* 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.mdsal.binding.dom.adapter.test;
+package org.opendaylight.mdsal.binding.dom.codec.test;
import static org.junit.Assert.assertNotNull;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode;
-import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.bug._5524.module1.rev160101.grouping.module1.ListModule11Builder;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.bug._5524.module1.rev160101.grouping.module1.list.module1._1.ListModule12Builder;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.bug._5524.module1.rev160101.grouping.module1.list.module1._1.list.module1._2.ContainerModule1Builder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public class Bug5524augmentUses extends AbstractDataBrokerTest {
-
+public class Bug5524augmentUses extends AbstractBindingCodecTest {
@Test
public void testBug5224() throws Exception {
- final BindingToNormalizedNodeCodec mappingService = new BindingToNormalizedNodeCodec(
- GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry());
- final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
- moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Module4Main.class));
- mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
-
final Module4Main module4Main = new Module4MainBuilder().setContainerModule4(
new ContainerModule4Builder().setListModule11(Collections.singletonList(
new ListModule11Builder().setListModule12(Collections.singletonList(
new ContainerManualContainerModule2Builder().build()).build())
.build())).build())).build()).build();
- final BindingCodecTree codecContext = mappingService.getCodecFactory().getCodecContext();
+ final BindingCodecTree codecContext = registry.getCodecContext();
final BindingDataObjectCodecTreeNode<Module4Main> subtreeCodec = codecContext.getSubtreeCodec(
InstanceIdentifier.create(Module4Main.class));
final NormalizedNode<?, ?> serialized = subtreeCodec.serialize(module4Main);
* 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.mdsal.binding.dom.adapter.test;
+package org.opendaylight.mdsal.binding.dom.codec.test;
import static org.junit.Assert.assertNotNull;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode;
-import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainer;
import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101._boolean.container.BooleanListBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public class Bug5845booleanKeyTest extends AbstractDataBrokerTest {
-
+public class Bug5845booleanKeyTest extends AbstractBindingCodecTest {
@Test
public void testBug5845() throws Exception {
- final BindingToNormalizedNodeCodec mappingService = new BindingToNormalizedNodeCodec(
- GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry());
- final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
- moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BooleanContainer.class));
- mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
-
final BooleanContainer booleanContainer = new BooleanContainerBuilder().setBooleanList(Collections
.singletonList(new BooleanListBuilder()
.withKey(new BooleanListKey(true, true))
.build()))
.build();
- final BindingCodecTree codecContext = mappingService.getCodecFactory().getCodecContext();
+ final BindingCodecTree codecContext = registry.getCodecContext();
final BindingDataObjectCodecTreeNode<BooleanContainer> subtreeCodec = codecContext.getSubtreeCodec(
InstanceIdentifier.create(BooleanContainer.class));
final NormalizedNode<?, ?> serializedInt = subtreeCodec.serialize(booleanContainerInt);