Fixup Augmentable and Identifiable methods changing
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / impl / test / Bug2562DeserializedUnkeyedListTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.md.sal.binding.impl.test;
10
11 import com.google.common.collect.ImmutableSet;
12 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.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.Root;
18 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.RootBuilder;
19 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.Fooroot;
20 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.FoorootBuilder;
21 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.Barroot;
22 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootBuilder;
23 import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootKey;
24 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
25 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
26 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
27
28 public class Bug2562DeserializedUnkeyedListTest extends AbstractDataTreeChangeListenerTest {
29     private static final InstanceIdentifier<Root> ROOT_PATH = InstanceIdentifier.create(Root.class);
30
31     @Override
32     protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
33         return ImmutableSet.of(BindingReflections.getModuleInfo(Root.class));
34     }
35
36     @Test
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();
41
42         final TestListener<Root> listenerRoot = createListener(LogicalDatastoreType.CONFIGURATION, ROOT_PATH,
43                 added(ROOT_PATH, root));
44
45         final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
46         readWriteTransaction.put(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, root);
47         assertCommit(readWriteTransaction.submit());
48
49         listenerRoot.verify();
50     }
51 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.