* 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.codec.impl;
import static org.junit.Assert.assertEquals;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
public class UnionTypeTest extends AbstractBindingCodecTest {
-
private static final String TEST_STRING = "testtesttest";
-
- public static final QName WRAPPER_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:yangtools:test:union",
+ private static final QName WRAPPER_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:yangtools:test:union",
"2015-01-21", "wrapper");
- public static final QName WRAP_LEAF_QNAME = QName.create(WRAPPER_QNAME, "wrap");
+ private static final QName WRAP_LEAF_QNAME = QName.create(WRAPPER_QNAME, "wrap");
@Test
public void unionTest() {
TopLevel topLevel = TopLevelBuilder.getDefaultInstance(TEST_STRING);
Wrapper wrapper = new WrapperBuilder().setWrap(topLevel).build();
- NormalizedNode<?, ?> topLevelEntry = registry.toNormalizedNode(InstanceIdentifier.create(Wrapper.class),
+ NormalizedNode<?, ?> topLevelEntry = codecContext.toNormalizedNode(InstanceIdentifier.create(Wrapper.class),
wrapper).getValue();
ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(WRAPPER_QNAME))
+ .withNodeIdentifier(new NodeIdentifier(WRAPPER_QNAME))
.withChild(ImmutableNodes.leafNode(WRAP_LEAF_QNAME, TEST_STRING))
.build();
Assert.assertEquals(topLevelEntry, containerNode);
public void bug5446Test() {
IpAddressBinary ipAddress = IpAddressBinaryBuilder.getDefaultInstance("fwAAAQ==");
Root root = new RootBuilder().setIpAddress(ipAddress).build();
- NormalizedNode<?, ?> rootNode = registry.toNormalizedNode(InstanceIdentifier.builder(Root.class).build(), root)
+ NormalizedNode<?, ?> rootNode = codecContext.toNormalizedNode(InstanceIdentifier.create(Root.class), root)
.getValue();
- Entry<InstanceIdentifier<?>, DataObject> rootEntry = registry.fromNormalizedNode(
+ Entry<InstanceIdentifier<?>, DataObject> rootEntry = codecContext.fromNormalizedNode(
YangInstanceIdentifier.of(rootNode.getNodeType()), rootNode);
DataObject rootObj = rootEntry.getValue();