* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.restconf.jersey.providers;
+package org.opendaylight.restconf.nb.rfc8040.jersey.providers.patch;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.sal.rest.impl.test.providers.TestJsonBodyReader;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.patch.PatchContext;
+import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.AbstractBodyReaderTest;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.JsonBodyReaderTest;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
when(MOUNT_POINT_SERVICE_HANDLER.get()).thenReturn(mountPointService);
when(mountPointService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(Optional.of(mountPoint));
when(mountPoint.getSchemaContext()).thenReturn(schemaContext);
-
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
+ SchemaContextHandler.setActualSchemaContext(schemaContext);
}
@Test
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHdata.json");
final PatchContext returnValue = jsonToPatchBodyReader
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHdataCreateAndDelete.json");
final PatchContext returnValue = jsonToPatchBodyReader
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHdataValueMissing.json");
try {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHdataValueNotSupported.json");
try {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHdataCompleteTargetInURI.json");
final PatchContext returnValue = jsonToPatchBodyReader
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHMergeOperationOnList.json");
final PatchContext returnValue = jsonToPatchBodyReader
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream = JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHMergeOperationOnContainer.json");
final PatchContext returnValue = jsonToPatchBodyReader
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, jsonToPatchBodyReader, false);
- final InputStream inputStream = TestJsonBodyReader.class
+ final InputStream inputStream =
+ JsonBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/jsonPATCHSimpleLeafValue.json");
final PatchContext returnValue = jsonToPatchBodyReader