X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fcluster%2Fdatastore%2Fmodel%2FTestModel.java;h=836d7f9cfa9510139a88170688ebc93820387313;hb=refs%2Fchanges%2F75%2F64175%2F42;hp=cd8a75454c4298b83148eea0b226c3e9874dcd0d;hpb=c1336f9b497bc6867536a24f629c3f0b002ccb2f;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java index cd8a75454c..836d7f9cfa 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java @@ -7,11 +7,6 @@ */ package org.opendaylight.controller.md.cluster.datastore.model; -import com.google.common.io.Resources; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.List; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; @@ -23,10 +18,9 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; -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"); @@ -37,7 +31,6 @@ public class TestModel { public static final QName JUNK_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:junk", "2014-03-13", "junk"); - public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list"); public static final QName OUTER_CONTAINER_QNAME = QName.create(TEST_QNAME, "outer-container"); public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list"); @@ -59,21 +52,12 @@ public class TestModel { public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two"); public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three"); - public static SchemaContext createTestContext() { - final List sources; + private TestModel() { - try { - sources = Collections.singletonList( - Resources.asByteSource(TestModel.class.getResource(DATASTORE_TEST_YANG)).openStream()); - } catch (IOException e1) { - throw new ExceptionInInitializerError(e1); - } + } - try { - return YangParserTestUtils.parseYangStreams(sources); - } catch (ReactorException e) { - throw new RuntimeException("Unable to build schema context from " + sources, e); - } + public static SchemaContext createTestContext() { + return YangParserTestUtils.parseYangResource(DATASTORE_TEST_YANG); } public static DataContainerChild outerNode(final int... ids) {