Bulk-add copyright headers to java files
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / YangAndXmlAndDataSchemaLoader.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.sal.restconf.impl.test;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12
13 import java.util.Set;
14
15 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.Module;
17
18 public abstract class YangAndXmlAndDataSchemaLoader {
19
20     protected static Set<Module> modules;
21     protected static DataSchemaNode dataSchemaNode;
22     protected static String searchedModuleName;
23     protected static String searchedDataSchemaName;
24     protected static String schemaNodePath;
25
26     protected static void dataLoad(String yangPath) {
27         dataLoad(yangPath, 1, null, null);
28     }
29
30     protected static void dataLoad(String yangPath, int modulesNumber, String moduleName, String dataSchemaName) {
31         modules = TestUtils.loadModulesFrom(yangPath);
32         assertEquals(modulesNumber, modules.size());
33         Module module = TestUtils.resolveModule(moduleName, modules);
34         searchedModuleName = module == null ? "" : module.getName();
35         assertNotNull(module);
36         dataSchemaNode = TestUtils.resolveDataSchemaNode(dataSchemaName, module);
37         searchedDataSchemaName = dataSchemaNode == null ? "" : dataSchemaNode.getQName().getLocalName();
38         assertNotNull(dataSchemaNode);
39         schemaNodePath = searchedModuleName + ":" + searchedDataSchemaName;
40     }
41
42 }