Use moved BindingReflections
[neutron.git] / neutron-hostconfig / vpp / src / test / java / org / opendaylight / neutron / hostconfig / vpp / HostconfigsDataBrokerTest.java
1 /*
2  * Copyright (c) 2017 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.neutron.hostconfig.vpp;
10
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableList;
13 import com.google.common.collect.ImmutableSet;
14 import com.google.common.collect.ImmutableSet.Builder;
15
16 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
17 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
21 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
22
23 public class HostconfigsDataBrokerTest extends AbstractConcurrentDataBrokerTest {
24
25     @Override
26     protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
27         Builder<YangModuleInfo> moduleInfoSet = ImmutableSet.<YangModuleInfo>builder();
28         for (Class<?> moduleClass : ImmutableList.<Class<?>>of(
29             NetworkTopology.class, Neutron.class, NetconfNode.class)) {
30             YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(moduleClass);
31             Preconditions.checkNotNull(moduleInfo, "Module Info for %s is not available.", moduleClass);
32             collectYangModuleInfo(moduleInfo, moduleInfoSet);
33         }
34         return moduleInfoSet.build();
35     }
36
37     private static void collectYangModuleInfo(final YangModuleInfo moduleInfo,
38             final Builder<YangModuleInfo> moduleInfoSet) {
39         moduleInfoSet.add(moduleInfo);
40         for (YangModuleInfo dependency : moduleInfo.getImportedModules()) {
41             collectYangModuleInfo(dependency, moduleInfoSet);
42         }
43     }
44 }