2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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;
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.mdsal668.norev.Foo;
15 import org.opendaylight.yang.gen.v1.mdsal668.norev.FooBuilder;
16 import org.opendaylight.yang.gen.v1.mdsal668.norev.bar.Bar;
17 import org.opendaylight.yang.gen.v1.mdsal668.norev.bar.BarBuilder;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
20 import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
22 public class Mdsal668Test extends AbstractBindingCodecTest {
23 private static final NodeIdentifier FOO = new NodeIdentifier(Foo.QNAME);
24 private static final InstanceIdentifier<Foo> FOO_IID = InstanceIdentifier.create(Foo.class);
27 public void testLeaflistLeafref() {
28 assertEquals(ImmutableNodes.newContainerBuilder()
29 .withNodeIdentifier(FOO)
30 .withChild(ImmutableNodes.newContainerBuilder()
31 .withNodeIdentifier(new NodeIdentifier(Bar.QNAME))
32 .withChild(ImmutableNodes.newSystemLeafSetBuilder()
33 .withNodeIdentifier(new NodeIdentifier(Bar.QNAME))
34 // FIXME: MDSAL-670: these should get translated to YangInstanceIdentifier.of(FOO)
35 .withChild(ImmutableNodes.leafSetEntry(Bar.QNAME, FOO_IID))
39 codecContext.toNormalizedDataObject(FOO_IID,
40 new FooBuilder().setBar(new BarBuilder().setBar(Set.of(FOO_IID)).build()).build()).node());