2 * Copyright (c) 2016 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.adapter;
10 import com.google.common.collect.ImmutableSet;
11 import java.util.Arrays;
14 import org.junit.Test;
15 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
16 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest;
17 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
18 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
19 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.Root;
20 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.RootBuilder;
21 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.Fooroot;
22 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.FoorootBuilder;
23 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.Barroot;
24 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootBuilder;
25 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootKey;
26 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
27 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
29 public class Bug2562DeserializedUnkeyedListTest extends AbstractDataTreeChangeListenerTest {
30 private static final InstanceIdentifier<Root> ROOT_PATH = InstanceIdentifier.create(Root.class);
33 protected Set<YangModuleInfo> getModuleInfos() throws Exception {
34 return ImmutableSet.of(BindingReflections.getModuleInfo(Root.class));
38 public void writeListToList2562Root() {
39 final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).withKey(new BarrootKey(2)).build();
40 final Fooroot fooRoot = new FoorootBuilder().setBarroot(Map.of(barRoot.key(), barRoot)).build();
41 final Root root = new RootBuilder().setFooroot(Arrays.asList(fooRoot)).build();
43 final TestListener<Root> listenerRoot = createListener(LogicalDatastoreType.CONFIGURATION, ROOT_PATH,
44 added(ROOT_PATH, root));
46 final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
47 readWriteTransaction.put(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, root);
48 assertCommit(readWriteTransaction.commit());
50 listenerRoot.verify();