return actualSchemaContext;
}
+ public static void setActualSchemaContext(final SchemaContext schemaContext) {
+ actualSchemaContext = schemaContext;
+ }
+
private void putData(
final NormalizedNode<NodeIdentifier, Collection<DataContainerChild<? extends PathArgument, ?>>> normNode) {
final DOMDataWriteTransaction wTx = this.transactionChainHandler.get().newWriteOnlyTransaction();
return HttpMethod.POST.equals(this.request.getMethod());
}
- void setUriInfo(final UriInfo uriInfo) {
+ public void setUriInfo(final UriInfo uriInfo) {
this.uriInfo = uriInfo;
}
- void setRequest(final Request request) {
+ public void setRequest(final Request request) {
this.request = request;
}
}
* 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;
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
* 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;
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
* 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;
import com.google.common.collect.Sets;
import java.util.ArrayList;
* 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;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
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.md.sal.rest.common.TestRestconfUtils;
-import org.opendaylight.controller.sal.rest.impl.test.providers.TestXmlBodyReader;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+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.XmlBodyReaderTest;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
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
@Test
public void findFooContainerUsingNamespaceTest() throws Exception {
mockBodyReader("instance-identifier-module:cont/yang-ext:mount", this.xmlBodyReader, true);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlDataFindFooContainer.xml");
final NormalizedNodeContext returnValue = this.xmlBodyReader
.readFrom(null, null, null, this.mediaType, null, inputStream);
@Test
public void findBarContainerUsingNamespaceTest() throws Exception {
mockBodyReader("instance-identifier-module:cont/yang-ext:mount", this.xmlBodyReader, true);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlDataFindBarContainer.xml");
final NormalizedNodeContext returnValue = this.xmlBodyReader
.readFrom(null, null, null, this.mediaType, null, inputStream);
@Test
public void wrongRootElementTest() throws Exception {
mockBodyReader("instance-identifier-module:cont/yang-ext:mount", this.xmlBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class.getResourceAsStream(
+ final InputStream inputStream =
+ XmlBodyReaderTest.class.getResourceAsStream(
"/instanceidentifier/xml/bug7933.xml");
try {
this.xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
* 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
* 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.BeforeClass;
import org.junit.Test;
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.model.api.SchemaContext;
public class JsonPatchBodyReaderTest extends AbstractBodyReaderTest {
public static void initialization() {
schemaContext = schemaContextLoader("/instanceidentifier/yang", schemaContext);
when(MOUNT_POINT_SERVICE_HANDLER.get()).thenReturn(mock(DOMMountPointService.class));
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
+ SchemaContextHandler.setActualSchemaContext(schemaContext);
}
@Test
final String uri = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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
* 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 org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
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.TestXmlBodyReader;
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.XmlBodyReaderTest;
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
public void moduleDataTest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdata.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataValueMissingNegativeTest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataValueMissing.xml");
try {
xmlToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataNotValueNotSupportedNegativeTest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataValueNotSupported.xml");
try {
xmlToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataAbsoluteTargetPathTest() throws Exception {
final String uri = MOUNT_POINT;
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataAbsoluteTargetPath.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void modulePatchCompleteTargetInURITest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataCompleteTargetInURI.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataMergeOperationOnListTest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataMergeOperationOnList.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataMergeOperationOnContainerTest() throws Exception {
final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataMergeOperationOnContainer.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
* 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 org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.sal.rest.impl.test.providers.TestXmlBodyReader;
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.XmlBodyReaderTest;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class XmlPatchBodyReaderTest extends AbstractBodyReaderTest {
public static void initialization() {
schemaContext = schemaContextLoader("/instanceidentifier/yang", schemaContext);
when(MOUNT_POINT_SERVICE_HANDLER.get()).thenReturn(mock(DOMMountPointService.class));
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
+ SchemaContextHandler.setActualSchemaContext(schemaContext);
}
@Test
public void moduleDataTest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdata.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataValueMissingNegativeTest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataValueMissing.xml");
try {
xmlToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataNotValueNotSupportedNegativeTest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataValueNotSupported.xml");
try {
xmlToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataAbsoluteTargetPathTest() throws Exception {
final String uri = "";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataAbsoluteTargetPath.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void modulePatchCompleteTargetInURITest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataCompleteTargetInURI.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataMergeOperationOnListTest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataMergeOperationOnList.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
public void moduleDataMergeOperationOnContainerTest() throws Exception {
final String uri = "instance-identifier-patch-module:patch-cont";
mockBodyReader(uri, xmlToPatchBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/xml/xmlPATCHdataMergeOperationOnContainer.xml");
final PatchContext returnValue = xmlToPatchBodyReader
.readFrom(null, null, null, mediaType, null, inputStream);
* 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.test;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
-import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
-import org.opendaylight.netconf.sal.rest.api.RestconfConstants;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.restconf.RestConnectorProvider;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.patch.PatchContext;
-import org.opendaylight.restconf.handlers.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.nb.rfc8040.RestConnectorProvider;
+import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.spi.AbstractIdentifierAwareJaxRsProvider;
+import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-abstract class AbstractBodyReaderTest {
+public abstract class AbstractBodyReaderTest {
- protected static final ControllerContext CONTROLLER_CONTEXT = ControllerContext.getInstance();
protected static final DOMMountPointServiceHandler MOUNT_POINT_SERVICE_HANDLER =
mock(DOMMountPointServiceHandler.class);
protected final MediaType mediaType;
- AbstractBodyReaderTest() throws NoSuchFieldException, IllegalAccessException {
+ protected AbstractBodyReaderTest() throws NoSuchFieldException, IllegalAccessException {
mediaType = getMediaType();
final Field mountPointServiceHandlerField =
* 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.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
-import org.opendaylight.controller.sal.rest.impl.test.providers.TestXmlBodyReader;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
+import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.JsonNormalizedNodeBodyReader;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
final Collection<File> testFiles = TestRestconfUtils.loadFiles("/instanceidentifier/yang");
testFiles.addAll(TestRestconfUtils.loadFiles("/modules"));
schemaContext = YangParserTestUtils.parseYangSources(testFiles);
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
when(MOUNT_POINT_SERVICE_HANDLER.get()).thenReturn(mock(DOMMountPointService.class));
}
.node(contAugmentQName);
final String uri = "instance-identifier-module:cont";
mockBodyReader(uri, this.jsonBodyReader, true);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream =
+ XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/json_augment_container.json");
final NormalizedNodeContext returnValue = this.jsonBodyReader.readFrom(null, null, null, this.mediaType, null,
inputStream);
.node(augmentChoice1QName).node(augChoice2II).node(augmentChoice2QName).node(containerQName);
final String uri = "instance-identifier-module:cont";
mockBodyReader(uri, this.jsonBodyReader, true);
- final InputStream inputStream = TestXmlBodyReader.class
+ final InputStream inputStream = XmlBodyReaderTest.class
.getResourceAsStream("/instanceidentifier/json/json_augment_choice_container.json");
final NormalizedNodeContext returnValue = this.jsonBodyReader.readFrom(null, null, null, this.mediaType, null,
inputStream);
* 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.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
-import org.opendaylight.controller.sal.rest.impl.test.providers.TestXmlBodyReader;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
+import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
+import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyReader;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
testFiles.addAll(TestRestconfUtils.loadFiles("/modules"));
testFiles.addAll(TestRestconfUtils.loadFiles("/foo-xml-test/yang"));
schemaContext = YangParserTestUtils.parseYangSources(testFiles);
- CONTROLLER_CONTEXT.setSchemas(schemaContext);
when(MOUNT_POINT_SERVICE_HANDLER.get()).thenReturn(mock(DOMMountPointService.class));
+ SchemaContextHandler.setActualSchemaContext(schemaContext);
}
@Test
private void runXmlTest(final boolean isPost, final String path) throws Exception {
mockBodyReader(path, xmlBodyReader, isPost);
- final InputStream inputStream = TestXmlBodyReader.class.getResourceAsStream("/foo-xml-test/foo.xml");
+ final InputStream inputStream = XmlBodyReaderTest.class.getResourceAsStream("/foo-xml-test/foo.xml");
final NormalizedNodeContext nnc = xmlBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
assertNotNull(nnc);
@Test
public void wrongRootElementTest() throws Exception {
mockBodyReader("instance-identifier-module:cont", this.xmlBodyReader, false);
- final InputStream inputStream = TestXmlBodyReader.class.getResourceAsStream(
- "/instanceidentifier/xml/bug7933.xml");
+ final InputStream inputStream =
+ XmlBodyReaderTest.class.getResourceAsStream("/instanceidentifier/xml/bug7933.xml");
try {
this.xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
Assert.fail("Test should fail due to malformed PUT operation message");
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<top-level-list xmlns="foo">\r
+ <key-leaf>key-value</key-leaf>\r
+ <ordinary-leaf>leaf-value</ordinary-leaf>\r
+</top-level-list>
\ No newline at end of file
--- /dev/null
+module foo {\r
+ namespace foo;\r
+ prefix foo;\r
+\r
+ revision 2017-08-09;\r
+\r
+ list top-level-list {\r
+ key key-leaf;\r
+\r
+ leaf key-leaf {\r
+ type string;\r
+ }\r
+\r
+ leaf ordinary-leaf {\r
+ type string;\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+module iid-value-module {
+ namespace "iid:value:module";
+
+ prefix "iidvm";
+ revision 2016-09-12 {
+ }
+
+ container cont-iid {
+ list iid-list{
+ key "iid-leaf";
+ leaf iid-leaf{
+ type instance-identifier;
+ }
+ }
+
+ list values-iid{
+ key "value-iid";
+ leaf value-iid{
+ type string;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+ "patch-id" : "Test merge operation",
+ "comment" : "This is test patch for merge operation on container",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "create",
+ "target": "/",
+ "value": {
+ "patch-cont": {
+ "my-list1": [
+ {
+ "name": "my-list1 - A",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ },
+ {
+ "name": "my-list1 - B",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "edit-id": "edit2",
+ "operation": "merge",
+ "target": "/",
+ "value": {
+ "patch-cont": {
+ "my-list1": {
+ "name": "my-list1 - Merged",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+ "patch-id" : "Test merge operation",
+ "comment" : "This is test patch for merge operation on list",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "replace",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "value": {
+ "my-list2": {
+ "name": "my-leaf20",
+ "my-leaf21": "I am leaf21-0",
+ "my-leaf22": "I am leaf22-0"
+ }
+ }
+ },
+ {
+ "edit-id": "edit2",
+ "operation": "merge",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf21']",
+ "value": {
+ "my-list2": {
+ "name": "my-leaf21",
+ "my-leaf21": "I am leaf21-1",
+ "my-leaf22": "I am leaf22-1"
+ }
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch for simple leaf value",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "replace",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']/instance-identifier-patch-module:name",
+ "value": {
+ "name": "my-leaf20"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "replace",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "value": {
+ "my-list2": {
+ "name": "my-leaf20",
+ "my-leaf21": "I am leaf21-0",
+ "my-leaf22": "I am leaf22-0"
+ }
+ }
+ },
+
+ {
+ "edit-id": "edit2",
+ "operation": "replace",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "value": {
+ "my-list2": {
+ "name": "my-leaf20",
+ "my-leaf21": "I am leaf21-1",
+ "my-leaf22": "I am leaf22-1",
+ "my-leaf-list": ["listelement"]
+ }
+ }
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+
+ "patch-id" : "test-patch",
+ "comment" : "Test to create and replace data in container directly using / sign as a target",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "create",
+ "target": "/",
+ "value": {
+ "patch-cont": {
+ "my-list1": [
+ {
+ "name": "my-list1 - A",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ },
+ {
+ "name": "my-list1 - B",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "edit-id": "edit2",
+ "operation": "replace",
+ "target": "/",
+ "value": {
+ "patch-cont": {
+ "my-list1": {
+ "name": "my-list1 - Replacing",
+ "my-leaf11": "I am leaf11-0",
+ "my-leaf12": "I am leaf12-1"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "value": {
+ "my-list2": [
+ {
+ "name": "my-leaf20",
+ "my-leaf21": "I am leaf20"
+ },
+ {
+ "name": "my-leaf21",
+ "my-leaf21": "I am leaf21-1",
+ "my-leaf22": "I am leaf21-2"
+ }
+ ]
+ },
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "operation": "create"
+ },
+ {
+ "edit-id": "edit2",
+ "operation": "delete",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']"
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "operation": "create"
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch",
+ "edit" : [
+ {
+ "edit-id": "edit2",
+ "operation": "delete",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']",
+ "value": {
+ "my-list2": [
+ {
+ "name": "my-leaf20"
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "augment-module:case-choice-case-container1": {
+ "augment-module:case-choice-case-leaf1": "stryng"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "augment-module:cont-augment": {
+ "augment-module:leaf1": "stryng"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "instance-identifier-module:cont1": {
+ "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\"lflst11_1\"]"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "instance-identifier-module:cont": {
+ "cont1": {
+ "augment-module:lst11": [
+ {
+ "keyvalue111":"value1",
+ "keyvalue112":"value2",
+ "augment-augment-module:lf111":"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111=\"value1\"][augment-module:keyvalue112=\"value2\"]/augment-augment-module:lf112",
+ "augment-augment-module:lf112":"lf112 value"
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "instance-identifier-module:cont": {
+ "cont1": {
+ "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\"lflst11_1\"]"
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<cont1 xmlns="instance:identifier:module"/>
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<foo-bar-container xmlns="bar:module">
+</foo-bar-container>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<foo-bar-container xmlns="foo:module">
+</foo-bar-container>
\ No newline at end of file
--- /dev/null
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test-patch</patch-id>
+ <comment>this is test patch</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>create</operation>
+ <target>/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf20</name>
+ <my-leaf21>I am leaf21-0</my-leaf21>
+ <my-leaf22>I am leaf22-0</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+ <edit>
+ <edit-id>edit2</edit-id>
+ <operation>create</operation>
+ <target>/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf21</name>
+ <my-leaf21>I am leaf21-1</my-leaf21>
+ <my-leaf22>I am leaf22-1</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test-patch</patch-id>
+ <comment>Test patch with absolute target path</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>create</operation>
+ <target>/instance-identifier-patch-module:patch-cont/my-list1/leaf1/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf20</name>
+ <my-leaf21>I am leaf21-0</my-leaf21>
+ <my-leaf22>I am leaf22-0</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+ <edit>
+ <edit-id>edit2</edit-id>
+ <operation>create</operation>
+ <target>/instance-identifier-patch-module:patch-cont/my-list1/leaf1/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf21</name>
+ <my-leaf21>I am leaf21-1</my-leaf21>
+ <my-leaf22>I am leaf22-1</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test-patch</patch-id>
+ <comment>Test to create and replace data in container directly using / sign as a target</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>create</operation>
+ <target>/</target>
+ <value>
+ <patch-cont xmlns="instance:identifier:patch:module">
+ <my-list1>
+ <name>my-list1 - A</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ <my-list1>
+ <name>my-list1 - B</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ </patch-cont>
+ </value>
+ </edit>
+ <edit>
+ <edit-id>edit2</edit-id>
+ <operation>replace</operation>
+ <target>/</target>
+ <value>
+ <patch-cont xmlns="instance:identifier:patch:module">
+ <my-list1>
+ <name>my-list1 - Replacing</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ </patch-cont>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>Test merge operation</patch-id>
+ <comment>This is test patch for merge operation on container</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>create</operation>
+ <target>/</target>
+ <value>
+ <patch-cont xmlns="instance:identifier:patch:module">
+ <my-list1>
+ <name>my-list1 - A</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ <my-list1>
+ <name>my-list1 - B</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ </patch-cont>
+ </value>
+ </edit>
+ <edit>
+ <edit-id>edit2</edit-id>
+ <operation>merge</operation>
+ <target>/</target>
+ <value>
+ <patch-cont xmlns="instance:identifier:patch:module">
+ <my-list1>
+ <name>my-list1 - Merged</name>
+ <my-leaf11>I am leaf11-0</my-leaf11>
+ <my-leaf12>I am leaf12-1</my-leaf12>
+ </my-list1>
+ </patch-cont>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>Test merge operation</patch-id>
+ <comment>This is test patch for merge operation on list</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>replace</operation>
+ <target>/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf20</name>
+ <my-leaf21>I am leaf21-0</my-leaf21>
+ <my-leaf22>I am leaf22-0</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+ <edit>
+ <edit-id>edit2</edit-id>
+ <operation>merge</operation>
+ <target>/my-list2</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf21</name>
+ <my-leaf21>I am leaf21-1</my-leaf21>
+ <my-leaf22>I am leaf22-1</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test-patch</patch-id>
+ <comment>Test patch with missing value node for create operation</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>create</operation>
+ <target>/my-list2</target>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<!--
+ ~ Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
+ <patch-id>test-patch</patch-id>
+ <comment>Test patch with not allowed value node for delete operation</comment>
+ <edit>
+ <edit-id>edit1</edit-id>
+ <operation>delete</operation>
+ <target>/my-list2/my-leaf21</target>
+ <value>
+ <my-list2 xmlns="instance:identifier:patch:module">
+ <name>my-leaf20</name>
+ <my-leaf21>I am leaf21-0</my-leaf21>
+ <my-leaf22>I am leaf22-0</my-leaf22>
+ </my-list2>
+ </value>
+ </edit>
+</yang-patch>
\ No newline at end of file
--- /dev/null
+<case-choice-case-container1 xmlns="augment:module">
+ <case-choice-case-leaf1>stryng</case-choice-case-leaf1>
+</case-choice-case-container1>
\ No newline at end of file
--- /dev/null
+<cont-augment xmlns="augment:module">
+ <leaf1>stryng</leaf1>
+</cont-augment>
\ No newline at end of file
--- /dev/null
+<cont1 xmlns="instance:identifier:module">
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_1</lflst11>
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_2</lflst11>
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_3</lflst11>
+ <lf11 xmlns:a="instance:identifier:module" xmlns:b="augment:module:leaf:list" xmlns="augment:module:leaf:list">/a:cont/a:cont1/b:lflst11[.="lflst11_1"]</lf11>
+</cont1>
\ No newline at end of file
--- /dev/null
+<cont xmlns="instance:identifier:module">
+ <cont1>
+ <lst11 xmlns="augment:module" xmlns:c="augment:augment:module">
+ <keyvalue111>value1</keyvalue111>
+ <keyvalue112>value2</keyvalue112>
+ <lf111 xmlns="augment:augment:module" xmlns:a="instance:identifier:module" xmlns:b="augment:module" >/a:cont/a:cont1/b:lst11[b:keyvalue111="value1"][b:keyvalue112="value2"]/c:lf112</lf111>
+ <lf112 xmlns="augment:augment:module">lf112 value</lf112>
+ </lst11>
+ </cont1>
+</cont>
--- /dev/null
+<cont xmlns="instance:identifier:module">
+ <cont1>
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_1</lflst11>
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_2</lflst11>
+ <lflst11 xmlns="augment:module:leaf:list">lflst11_3</lflst11>
+ <lf11 xmlns:a="instance:identifier:module" xmlns:b="augment:module:leaf:list" xmlns="augment:module:leaf:list">/a:cont/a:cont1/b:lflst11[.="lflst11_1"]</lf11>
+ </cont1>
+</cont>
--- /dev/null
+module augment-augment-module {
+ namespace "augment:augment:module";
+
+ prefix "aamodule";
+
+ import augment-module {prefix amodule; revision-date 2014-01-17;}
+ import instance-identifier-module {prefix imodule; revision-date 2014-01-17;}
+
+ revision 2014-01-17 {
+ }
+
+ augment "/imodule:cont/imodule:cont1/amodule:lst11" {
+ leaf lf111 {
+ type instance-identifier;
+ }
+ leaf lf112 {
+ type string;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module augment-module-leaf-list {
+ namespace "augment:module:leaf:list";
+
+ prefix "amodulelflst";
+
+ import instance-identifier-module {prefix imodule; revision-date 2014-01-17;}
+
+ revision 2014-01-27 {
+ }
+
+ augment "/imodule:cont/imodule:cont1" {
+ leaf-list lflst11 {
+ type string;
+ }
+ leaf lf11 {
+ type instance-identifier;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module augment-module {
+ namespace "augment:module";
+
+ prefix "amodule";
+
+ import instance-identifier-module {prefix imodule; revision-date 2014-01-17;}
+
+ revision 2014-01-17 {
+ }
+
+ augment "/imodule:cont/imodule:cont1" {
+ list lst11 {
+ key "keyvalue111 keyvalue112";
+ leaf keyvalue111 {
+ type string;
+ }
+ leaf keyvalue112 {
+ type string;
+ }
+ }
+ }
+
+ augment "/imodule:cont" {
+ container cont-augment {
+ leaf leaf1 {
+ type string;
+ }
+ }
+ }
+
+ augment "/imodule:cont" {
+ choice augment-choice1 {
+ case case1 {
+ container case-container1 {
+ leaf case-leaf1 {
+ type string;
+ }
+ }
+ }
+
+ case case2 {
+ container case-container2 {
+ leaf case-leaf2 {
+ type string;
+ }
+ }
+ }
+ }
+ }
+
+ augment "/imodule:cont/augment-choice1/case1" {
+ choice augment-choice2 {
+ case case11 {
+ container case-choice-case-container1 {
+ leaf case-choice-case-leaf1 {
+ type string;
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+module bar-module {
+ namespace "bar:module";
+
+ prefix "bar-module";
+ revision 2016-09-29 {
+ }
+
+ /* This container has the same name as container in foo-module */
+ container foo-bar-container {
+ }
+}
\ No newline at end of file
--- /dev/null
+module foo-module {
+ namespace "foo:module";
+
+ prefix "foo-module";
+ revision 2016-09-29 {
+ }
+
+ /* This container has the same name as container in bar-module */
+ container foo-bar-container {
+ }
+}
\ No newline at end of file
--- /dev/null
+module instance-identifier-module {
+ namespace "instance:identifier:module";
+
+ prefix "iimodule";
+ revision 2014-01-17 {
+ }
+
+ container cont {
+ container cont1 {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module instance-identifier-patch-module {
+ namespace "instance:identifier:patch:module";
+
+ prefix "iipmodule";
+ revision 2015-11-21 {
+ }
+
+ container patch-cont {
+ list my-list1 {
+
+ description "PATCH /restconf/config/instance-identifier-patch-module:patch-cont/my-list1/leaf1";
+
+ key name;
+
+ leaf name {
+ type string;
+ }
+
+ leaf my-leaf11 {
+ type string;
+ }
+
+ leaf my-leaf12 {
+ type string;
+ }
+
+ list my-list2 {
+ key name;
+
+ leaf name {
+ type string;
+ }
+
+ leaf my-leaf21 {
+ type string;
+ }
+
+ leaf my-leaf22 {
+ type string;
+ }
+ leaf-list my-leaf-list {
+ type string;
+ }
+ }
+ }
+ }
+}