+
+ //check abort after tx creation
+ edit("netconfMessages/editConfig.xml");
+ assertContainsElement(discard(), readXmlToElement("<ok xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>"));
+ }
+
+ @Test
+ public void testFailedDiscardChangesAbort() throws Exception {
+ final ConfigSubsystemFacade facade = mock(ConfigSubsystemFacade.class);
+ doThrow(new RuntimeException("Mocked runtime exception, Abort has to fail")).when(facade).abortConfiguration();
+
+ DiscardChanges discardOp = new DiscardChanges(facade, NETCONF_SESSION_ID);
+
+ try {
+ executeOp(discardOp, "netconfMessages/discardChanges.xml");
+ fail("Should've failed, abort on mocked is supposed to throw RuntimeException");
+ } catch (DocumentedException e) {
+ assertTrue(e.getErrorTag() == DocumentedException.ErrorTag.operation_failed);
+ assertTrue(e.getErrorSeverity() == DocumentedException.ErrorSeverity.error);
+ assertTrue(e.getErrorType() == DocumentedException.ErrorType.application);
+ }