X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fcluster%2Fdatastore%2Fmodel%2FTestModel.java;h=cfbaee6f61b834db8042eb11fcc374094191c008;hp=c75bd04bf46a4d09b9e1942c7db1a102deffef5f;hb=c8121ea6b5bf54c43777afe6a747be40637e1f42;hpb=2d60632f7cf63712e8357a3cf3fc40d83366e5e6 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 c75bd04bf4..cfbaee6f61 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,7 +18,6 @@ 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 final class TestModel { @@ -63,20 +57,11 @@ public final class TestModel { } public static SchemaContext createTestContext() { - final List sources; - - try { - sources = Collections.singletonList( - Resources.asByteSource(TestModel.class.getResource(DATASTORE_TEST_YANG)).openStream()); - } catch (IOException e1) { - throw new ExceptionInInitializerError(e1); - } + return YangParserTestUtils.parseYangResource(DATASTORE_TEST_YANG); + } - try { - return YangParserTestUtils.parseYangStreams(sources); - } catch (ReactorException e) { - throw new RuntimeException("Unable to build schema context from " + sources, e); - } + public static DataContainerChild outerMapNode() { + return ImmutableNodes.mapNodeBuilder(OUTER_LIST_QNAME).build(); } public static DataContainerChild outerNode(final int... ids) { @@ -120,7 +105,7 @@ public final class TestModel { } public static NodeIdentifierWithPredicates outerEntryKey(final int id) { - return new NodeIdentifierWithPredicates(OUTER_LIST_QNAME, ID_QNAME, id); + return NodeIdentifierWithPredicates.of(OUTER_LIST_QNAME, ID_QNAME, id); } public static YangInstanceIdentifier outerEntryPath(final int id) { @@ -128,10 +113,14 @@ public final class TestModel { } public static NodeIdentifierWithPredicates innerEntryKey(final String name) { - return new NodeIdentifierWithPredicates(INNER_LIST_QNAME, NAME_QNAME, name); + return NodeIdentifierWithPredicates.of(INNER_LIST_QNAME, NAME_QNAME, name); } public static YangInstanceIdentifier innerEntryPath(final int id, final String name) { return OUTER_LIST_PATH.node(outerEntryKey(id)).node(INNER_LIST_QNAME).node(innerEntryKey(name)); } + + public static YangInstanceIdentifier innerMapPath(final int id) { + return OUTER_LIST_PATH.node(outerEntryKey(id)).node(INNER_LIST_QNAME); + } }