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