Use ControllerContext non-statically
[netconf.git] / restconf / restconf-nb-bierman02 / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / Bug3595Test.java
index db96f0cb2b1fc4b612d2f082f652985f2d8fd6e0..96d7b5e3851488f79beedea5715295f863acbdcb 100644 (file)
@@ -14,6 +14,7 @@ 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;
@@ -27,19 +28,17 @@ 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 SchemaContext schemaContext;
 
-
-    private static ControllerContext controllerContext = ControllerContext.getInstance();
+    private final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext);
 
     @BeforeClass
     public static void initialize() throws FileNotFoundException {
-        final SchemaContext schemaContext = TestUtils.loadSchemaContext("/leafref/yang");
+        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