- InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/full-versions/test-data2/data2.xml");
- String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
- Entity<String> entity = Entity.entity(xml, Draft02.MediaTypes.DATA + XML);
+ when(
+ brokerFacade.commitConfigurationDataPut(any(DOMMountPoint.class), any(YangInstanceIdentifier.class),
+ any(NormalizedNode.class))).thenReturn(dummyFuture);
+
+ DOMMountPoint mountInstance = mock(DOMMountPoint.class);
+ when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
+ DOMMountPointService mockMountService = mock(DOMMountPointService.class);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(Optional.of(mountInstance));
+
+ ControllerContext.getInstance().setMountService(mockMountService);
+
+ String uri = "/config/ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont";
+ assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData2));
+
+ uri = "/config/ietf-interfaces:interfaces/yang-ext:mount/test-module:cont";
+ assertEquals(200, put(uri, MediaType.APPLICATION_XML, xmlData2));
+ }
+
+ @Test
+ public void putDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException {
+ CheckedFuture<Void, TransactionCommitFailedException> dummyFuture = mock(CheckedFuture.class);
+ when(
+ brokerFacade.commitConfigurationDataPut(any(DOMMountPoint.class), any(YangInstanceIdentifier.class),
+ any(NormalizedNode.class))).thenReturn(dummyFuture);