AbstractConfigTest - exposed BundleContext and ServiceRegistration mock.
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / XmlProvidersTest.java
index 0b8b5d48de1d6fe40bafaa5e82b61e854162fed6..9d004362d29d0b64b9a8636f51430ccfa46d8ca3 100644 (file)
@@ -24,6 +24,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.glassfish.jersey.client.ClientConfig;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.glassfish.jersey.test.TestProperties;
@@ -151,6 +152,21 @@ public class XmlProvidersTest extends JerseyTest {
                 Entity.entity("<SimpleNode>", new MediaType("application", "vnd.yang.api+xml")));
         assertEquals(400, response.getStatus());
     }
+    
+    @Test
+    public void testXmlToCompositeNode404NotFound() {
+        URI uri = null;
+        try {
+            uri = new URI("/datastore/" + URLEncoder.encode("ietf-interfaces:interfaces/interface/eth0", Charsets.US_ASCII.name()).toString());
+        } catch (UnsupportedEncodingException | URISyntaxException e) {
+            e.printStackTrace();
+        }
+        
+        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
+        
+        Response response = target(uri.toASCIIString()).request(MediaTypes.API+RestconfService.XML).get();
+        assertEquals(404, response.getStatus());
+    }
 
     @Override
     protected Application configure() {