import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-public class TestModel {
+public final class TestModel {
public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
"test");
public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
+ private TestModel() {
+ throw new UnsupportedOperationException();
+ }
- public static final InputStream getDatastoreTestInputStream() {
+ public static InputStream getDatastoreTestInputStream() {
return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
}
public static SchemaContext createTestContext() {
+ return createTestContext(DATASTORE_TEST_YANG);
+ }
+
+ public static SchemaContext createTestContext(String resourcePath) {
YangParserImpl parser = new YangParserImpl();
try {
- return parser.parseSources(Collections.singleton(Resources.asByteSource(TestModel.class.getResource(DATASTORE_TEST_YANG))));
+ return parser.parseSources(Collections.singleton(Resources.asByteSource(TestModel.class
+ .getResource(resourcePath))));
} catch (IOException | YangSyntaxErrorException e) {
throw new IllegalStateException("Failed to create context", e);
}