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%2FCodecsExceptionsCatchingTest.java;h=a671a6c85a42481b3aab3af52d234a981244a9dc;hb=cb1d2f74b370c16357af975a136e687fba3303e6;hp=67f10412271292a3cc008c6a99494a29d53a3783;hpb=72bcb09b111b10f7db3af61b9e4a628291eec209;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CodecsExceptionsCatchingTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CodecsExceptionsCatchingTest.java index 67f1041227..a671a6c85a 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CodecsExceptionsCatchingTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CodecsExceptionsCatchingTest.java @@ -17,9 +17,10 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; -import org.junit.BeforeClass; +import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader; import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter; import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeXmlBodyWriter; @@ -32,15 +33,14 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; public class CodecsExceptionsCatchingTest extends JerseyTest { - private static RestconfImpl restConf; - private static ControllerContext controllerContext = ControllerContext.getInstance(); + private RestconfImpl restConf; + private ControllerContext controllerContext; - @BeforeClass - public static void init() throws FileNotFoundException, ReactorException { + @Before + public void init() throws FileNotFoundException, ReactorException { restConf = RestconfImpl.getInstance(); - controllerContext = ControllerContext.getInstance(); final SchemaContext schemaContext = TestUtils.loadSchemaContext("/decoding-exception/yang"); - controllerContext.setGlobalSchema(schemaContext); + controllerContext = TestRestconfUtils.newControllerContext(schemaContext); restConf.setControllerContext(controllerContext); } @@ -53,7 +53,8 @@ public class CodecsExceptionsCatchingTest extends JerseyTest { // set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue()); ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig = resourceConfig.registerInstances(restConf, new NormalizedNodeJsonBodyWriter(), - new NormalizedNodeXmlBodyWriter(), new XmlNormalizedNodeBodyReader(), new JsonNormalizedNodeBodyReader()); + new NormalizedNodeXmlBodyWriter(), new XmlNormalizedNodeBodyReader(controllerContext), + new JsonNormalizedNodeBodyReader(controllerContext)); resourceConfig.registerClasses(RestconfDocumentedExceptionMapper.class); return resourceConfig; } @@ -66,4 +67,4 @@ public class CodecsExceptionsCatchingTest extends JerseyTest { final String exceptionMessage = response.readEntity(String.class); assertTrue(exceptionMessage.contains("invalid-value")); } -} \ No newline at end of file +}