1 package org.opendaylight.controller.sal.restconf.impl.test;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
8 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
9 import org.opendaylight.yangtools.yang.model.api.Module;
11 public abstract class YangAndXmlAndDataSchemaLoader {
13 protected static Set<Module> modules;
14 protected static DataSchemaNode dataSchemaNode;
15 protected static String searchedModuleName;
16 protected static String searchedDataSchemaName;
17 protected static String schemaNodePath;
19 protected static void dataLoad(String yangPath) {
20 dataLoad(yangPath, 1, null, null);
23 protected static void dataLoad(String yangPath, int modulesNumber, String moduleName, String dataSchemaName) {
24 modules = TestUtils.loadModulesFrom(yangPath);
25 assertEquals(modulesNumber, modules.size());
26 Module module = TestUtils.resolveModule(moduleName, modules);
27 searchedModuleName = module == null ? "" : module.getName();
28 assertNotNull(module);
29 dataSchemaNode = TestUtils.resolveDataSchemaNode(dataSchemaName, module);
30 searchedDataSchemaName = dataSchemaNode == null ? "" : dataSchemaNode.getQName().getLocalName();
31 assertNotNull(dataSchemaNode);
32 schemaNodePath = searchedModuleName + ":" + searchedDataSchemaName;