Merge "Bug 2731: Discard changes only when transaction exist."
[controller.git] / opendaylight / netconf / config-netconf-connector / src / test / java / org / opendaylight / controller / netconf / confignetconfconnector / NetconfMappingTest.java
index b1222997fb8d944eeb6f4e4b489262e082698ecc..d6b5e62b27b59eb60e023c64603e56474145592d 100644 (file)
@@ -569,14 +569,14 @@ public class NetconfMappingTest extends AbstractConfigTest {
         commit();
     }
 
-    @Test(expected = NetconfDocumentedException.class)
+    @Test
     public void testEx2() throws Exception {
-        discard();
+        assertContainsElement(discard(), readXmlToElement("<ok xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>"));
     }
 
-    private void discard() throws ParserConfigurationException, SAXException, IOException, NetconfDocumentedException {
+    private Document discard() throws ParserConfigurationException, SAXException, IOException, NetconfDocumentedException {
         DiscardChanges discardOp = new DiscardChanges(transactionProvider, configRegistryClient, NETCONF_SESSION_ID);
-        executeOp(discardOp, "netconfMessages/discardChanges.xml");
+        return executeOp(discardOp, "netconfMessages/discardChanges.xml");
     }
 
     private void checkBinaryLeafEdited(final Document response) throws NodeTestException, SAXException, IOException {
@@ -716,7 +716,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
     }
 
     private Document get() throws NetconfDocumentedException, ParserConfigurationException, SAXException, IOException {
-        Get getOp = new Get(yangStoreSnapshot, configRegistryClient, NETCONF_SESSION_ID);
+        Get getOp = new Get(transactionProvider, yangStoreSnapshot, configRegistryClient, NETCONF_SESSION_ID);
         return executeOp(getOp, "netconfMessages/get.xml");
     }