- public void testXmlToCompositeNodeProvider() throws ParserConfigurationException, SAXException, IOException {
- URI uri = null;
- try {
- uri = new URI("/operations/" + URLEncoder.encode("ietf-interfaces:interfaces/interface/eth0", Charsets.US_ASCII.name()).toString());
- } catch (UnsupportedEncodingException | URISyntaxException e) {
- e.printStackTrace();
- }
+ public void testBadFormatXmlToCompositeNodeProvider() throws UnsupportedEncodingException, URISyntaxException {
+ String uri = createUri("/operations/", "ietf-interfaces:interfaces/interface/eth0");
+
+ Response response = target(uri).request(MediaTypes.API + RestconfService.XML).post(
+ Entity.entity("<SimpleNode/>", MEDIA_TYPE));
+ assertEquals(400, response.getStatus());
+
+ response = target(uri).request(MediaTypes.API + RestconfService.XML).post(
+ Entity.entity("<SimpleNode>", MEDIA_TYPE));
+ assertEquals(400, response.getStatus());
+ }
+
+ @Test
+ public void testXmlToCompositeNode404NotFound() throws UnsupportedEncodingException, URISyntaxException {
+ String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
+
+ when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
+
+ Response response = target(uri).request(MediaTypes.API+RestconfService.XML).get();
+ assertEquals(404, response.getStatus());
+ }
+
+ @Test
+ public void testXmlToCompositeNode400() throws UnsupportedEncodingException, URISyntaxException {
+ String uri = createUri("/datastore/", "simple-nodes:user/name");
+
+ when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
+
+ Response response = target(uri).request(MediaTypes.API+RestconfService.XML).get();
+ assertEquals(400, response.getStatus());
+ }
+
+ @Test
+ public void testRpcResultCommitedToStatusCodes() throws UnsupportedEncodingException {