X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=restconf%2Frestconf-nb-bierman02%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestPutConfigTest.java;h=043f78b807ef931459cf82642c4a18db82d599e2;hb=cb1d2f74b370c16357af975a136e687fba3303e6;hp=958111767456a32290ee92d1a7b1f9217991d65e;hpb=72bcb09b111b10f7db3af61b9e4a628291eec209;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutConfigTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutConfigTest.java index 9581117674..043f78b807 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutConfigTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutConfigTest.java @@ -10,11 +10,13 @@ package org.opendaylight.controller.sal.restconf.impl.test; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; +import java.io.FileNotFoundException; import java.util.HashSet; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -39,19 +41,22 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; @RunWith(MockitoJUnitRunner.class) public class RestPutConfigTest { + private static SchemaContext schemaContext; private RestconfImpl restconfService; private ControllerContext controllerCx; - private SchemaContext schemaCx; @Mock private BrokerFacade brokerFacade; + @BeforeClass + public static void staticInit() throws FileNotFoundException { + schemaContext = TestRestconfUtils.loadSchemaContext("/test-config-data/yang1/", null); + } + @Before public void init() { this.restconfService = RestconfImpl.getInstance(); - this.controllerCx = ControllerContext.getInstance(); - this.schemaCx = TestRestconfUtils.loadSchemaContext("/test-config-data/yang1/", null); - this.controllerCx.setSchemas(this.schemaCx); + this.controllerCx = TestRestconfUtils.newControllerContext(schemaContext); this.restconfService.setControllerContext(this.controllerCx); } @@ -131,7 +136,7 @@ public class RestPutConfigTest { final PutResult result = Mockito.mock(PutResult.class); final CheckedFuture checkedFuture = Futures.immediateCheckedFuture(null); - Mockito.when(this.brokerFacade.commitConfigurationDataPut(this.schemaCx, yii, data, null, null)) + Mockito.when(this.brokerFacade.commitConfigurationDataPut(this.schemaContext, yii, data, null, null)) .thenReturn(result); Mockito.when(result.getFutureOfPutData()).thenReturn(checkedFuture); Mockito.when(result.getStatus()).thenReturn(Status.OK);