- private Document getConflictVersionDocument() throws SAXException, IOException {
- return XmlUtil.readXmlToDocument(
- "<rpc-reply message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
- "<rpc-error><error-info><error>" +
- ConflictingVersionException.class.getCanonicalName() +
- "</error></error-info></rpc-error>\n" +
- "</rpc-reply>"
- );
+ private NetconfOperationService getConflictingService() throws Exception {
+ NetconfOperationService service = getWorkingService(getOKDocument());
+ ConflictingVersionException cve = new ConflictingVersionException("");
+ try {
+ NetconfDocumentedException.wrap(cve);
+ throw new AssertionError("Should throw an exception");
+ }catch(NetconfDocumentedException e) {
+ NetconfOperation mockedOperation = service.getNetconfOperations().iterator().next();
+ doThrow(e).when(mockedOperation).handle(any(Document.class), any(NetconfOperationChainedExecution.class));
+ return service;
+ }