2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.codec.impl;
10 import static org.junit.Assert.assertEquals;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.test.top.via.uses.rev151112.OpendaylightBindingTopLevelViaUsesData;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.test.top.via.uses.rev151112.container.top.ContainerTop;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
19 public class TopLevelContainerViaUsesTest extends AbstractBindingCodecTest {
20 private static final InstanceIdentifier<ContainerTop> TOP_LEVEL_CONTAINER_FROM_USES =
21 InstanceIdentifier.builderOfInherited(OpendaylightBindingTopLevelViaUsesData.class, ContainerTop.class).build();
24 public void testBindingToDomFirst() {
25 final YangInstanceIdentifier yangII = codecContext.toYangInstanceIdentifier(TOP_LEVEL_CONTAINER_FROM_USES);
26 final PathArgument lastArg = yangII.getLastPathArgument();
27 assertEquals(ContainerTop.QNAME, lastArg.getNodeType());
31 public void testDomToBindingFirst() {
32 final YangInstanceIdentifier yangII = YangInstanceIdentifier.of(ContainerTop.QNAME);
33 final InstanceIdentifier<?> bindingII = codecContext.fromYangInstanceIdentifier(yangII);
34 assertEquals(TOP_LEVEL_CONTAINER_FROM_USES, bindingII);