X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb-bierman02%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FBug3595Test.java;h=0d7241df843ed80aa97d31aea1eefb7685b503b0;hb=09c1d18add7cfc310f3d190a1a02a523159162ce;hp=deb443ad0c719830df4ac68750bf6a4a93b11c23;hpb=1bcaf624205de83ea78a131e960103f2b785468c;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/Bug3595Test.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/Bug3595Test.java index deb443ad0c..0d7241df84 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/Bug3595Test.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/Bug3595Test.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; @@ -14,40 +13,39 @@ import static org.junit.Assert.assertNotNull; import java.io.FileNotFoundException; import org.junit.BeforeClass; import org.junit.Test; +import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; import org.opendaylight.netconf.sal.restconf.impl.ControllerContext; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.Module; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; public class Bug3595Test { private static final QName CONT_QNAME = QName.create("leafref:module", "2014-04-17", "cont"); private static final QName LST_WITH_LFREF_KEY_QNAME = QName.create(CONT_QNAME, "lst-with-lfref-key"); private static final QName LFREF_KEY_QNAME = QName.create(CONT_QNAME, "lfref-key"); + private static EffectiveModelContext schemaContext; - - private static ControllerContext controllerContext = ControllerContext.getInstance(); + private final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext); @BeforeClass - public static void initialize() throws FileNotFoundException, ReactorException { - final SchemaContext schemaContext = TestUtils.loadSchemaContext("/leafref/yang"); + public static void initialize() throws FileNotFoundException { + schemaContext = TestUtils.loadSchemaContext("/leafref/yang"); Module module = TestUtils.findModule(schemaContext.getModules(), "leafref-module"); assertNotNull(module); module = TestUtils.findModule(schemaContext.getModules(), "referenced-module"); assertNotNull(module); - - controllerContext.setGlobalSchema(schemaContext); } @Test public void testLeafrefListKeyDeserializtion() { final YangInstanceIdentifier node1IIexpected = YangInstanceIdentifier.of(CONT_QNAME) - .node(LST_WITH_LFREF_KEY_QNAME).node(new YangInstanceIdentifier.NodeIdentifierWithPredicates( + .node(LST_WITH_LFREF_KEY_QNAME).node(NodeIdentifierWithPredicates.of( LST_WITH_LFREF_KEY_QNAME, LFREF_KEY_QNAME, "node1")); - final InstanceIdentifierContext iiContext = + final InstanceIdentifierContext iiContext = controllerContext.toInstanceIdentifier("leafref-module:cont/lst-with-lfref-key/node1"); iiContext.getInstanceIdentifier(); assertEquals(node1IIexpected, iiContext.getInstanceIdentifier());