X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb-bierman02%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Frestconf%2Fimpl%2FInstanceIdentifierCodecImplTest.java;h=e0d48bb6daf733a2051d393750473ad2063ee558;hb=f402dcd49a468e018192c96151bef3a0cdf70d62;hp=0c7ab15b533e4e9d5a03b6a9da696ea331d0826b;hpb=824baf9fe14e31465c58f3842c4cb0aa88b34757;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/netconf/sal/restconf/impl/InstanceIdentifierCodecImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/netconf/sal/restconf/impl/InstanceIdentifierCodecImplTest.java index 0c7ab15b53..e0d48bb6da 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/netconf/sal/restconf/impl/InstanceIdentifierCodecImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/netconf/sal/restconf/impl/InstanceIdentifierCodecImplTest.java @@ -5,37 +5,43 @@ * 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.netconf.sal.restconf.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import java.io.FileNotFoundException; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; import org.opendaylight.netconf.sal.restconf.impl.RestCodec.InstanceIdentifierCodecImpl; import org.opendaylight.restconf.common.util.IdentityValuesDTO; -import org.opendaylight.yangtools.concepts.Codec; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; public class InstanceIdentifierCodecImplTest { + private static EffectiveModelContext schemaContext; - private Codec instanceIdentifierDTO; + private InstanceIdentifierCodecImpl instanceIdentifierDTO; private YangInstanceIdentifier instanceIdentifierBadNamespace; private YangInstanceIdentifier instanceIdentifierOKList; private YangInstanceIdentifier instanceIdentifierOKLeafList; - private SchemaContext schemaContext; + + @BeforeClass + public static void init() throws FileNotFoundException { + schemaContext = YangParserTestUtils.parseYangFiles( + TestRestconfUtils.loadFiles("/restconf/parser/deserializer")); + } @Before public void setUp() throws Exception { - this.schemaContext = - YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles("/restconf/parser/deserializer")); - this.instanceIdentifierDTO = new InstanceIdentifierCodecImpl(null); - ControllerContext.getInstance().setGlobalSchema(this.schemaContext); + ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext); + + this.instanceIdentifierDTO = new InstanceIdentifierCodecImpl(null, controllerContext); final QName baseQName = QName.create("deserializer:test", "2016-06-06", "deserializer-test"); final QName contA = QName.create(baseQName, "contA"); @@ -47,7 +53,7 @@ public class InstanceIdentifierCodecImplTest { .build(); this.instanceIdentifierOKList = YangInstanceIdentifier.builder() - .node(new YangInstanceIdentifier.NodeIdentifierWithPredicates( + .node(NodeIdentifierWithPredicates.of( QName.create(baseQName, "list-one-key"), QName.create(QName.create(baseQName, "list-one-key"), "name"), "value")) .build(); @@ -90,4 +96,4 @@ public class InstanceIdentifierCodecImplTest { this.instanceIdentifierDTO.deserialize(valuesDTO); assertNull(deserializedIdentifier); } -} \ No newline at end of file +}