From: Robert Varga Date: Sat, 10 Aug 2024 10:42:11 +0000 (+0200) Subject: Simplify NetconfOperationChainedExecution X-Git-Tag: v8.0.1~29 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=1b9ac27b9b2dd6653ab700030eb2a55c47f5962c;p=netconf.git Simplify NetconfOperationChainedExecution There is only a single implementation that reports being a termination point. Rather than having these checks, just use 'null' to indicate there is no subsequent operation. Change-Id: I0c46ea596aec4d18ed8afa0bd39d461a4ae64c52 Signed-off-by: Robert Varga --- diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/customrpc/SettableRpc.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/customrpc/SettableRpc.java index 49c922148a..8a282d18a1 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/customrpc/SettableRpc.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/customrpc/SettableRpc.java @@ -50,11 +50,11 @@ final class SettableRpc implements NetconfOperation { checkForError(document); document.getDocumentElement().setAttribute(XmlNetconfConstants.MESSAGE_ID, msgId); return document; - } else if (subsequentOperation.isExecutionTermination()) { + } else if (subsequentOperation != null) { + return subsequentOperation.execute(requestMessage); + } else { throw new DocumentedException("Mapping not found " + XmlUtil.toString(requestMessage), ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED, ErrorSeverity.ERROR); - } else { - return subsequentOperation.execute(requestMessage); } } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java index 8811302914..0a623939cb 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java @@ -50,7 +50,7 @@ public class Get extends AbstractNetconfOperation { @Override public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException { - if (subsequentOperation.isExecutionTermination()) { + if (subsequentOperation == null) { throw new DocumentedException(String.format("Subsequent netconf operation expected by %s", this), ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, ErrorSeverity.ERROR); } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpchandler/SettableRpc.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpchandler/SettableRpc.java index d4ef012400..1570af0d26 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpchandler/SettableRpc.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpchandler/SettableRpc.java @@ -49,11 +49,11 @@ class SettableRpc implements NetconfOperation { checkForError(document); document.getDocumentElement().setAttribute(XmlNetconfConstants.MESSAGE_ID, msgId); return document; - } else if (subsequentOperation.isExecutionTermination()) { - throw new DocumentedException("Mapping not found " + XmlUtil.toString(requestMessage), - ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED, ErrorSeverity.ERROR); - } else { + } else if (subsequentOperation != null) { return subsequentOperation.execute(requestMessage); + } else { + throw new DocumentedException("Mapping not found " + XmlUtil.toString(requestMessage), + ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED, ErrorSeverity.ERROR); } } diff --git a/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/AbstractNetconfOperationTest.java b/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/AbstractNetconfOperationTest.java index 9c450ad304..3dc3280806 100644 --- a/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/AbstractNetconfOperationTest.java +++ b/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/AbstractNetconfOperationTest.java @@ -42,7 +42,6 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStore; import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStoreFactory; import org.opendaylight.netconf.api.xml.XmlUtil; import org.opendaylight.netconf.server.api.operations.NetconfOperation; -import org.opendaylight.netconf.server.api.operations.NetconfOperationChainedExecution; import org.opendaylight.netconf.server.mdsal.CurrentSchemaContext; import org.opendaylight.netconf.server.mdsal.TransactionProvider; import org.opendaylight.netconf.test.util.NetconfXmlUnitRecursiveQualifier; @@ -210,7 +209,7 @@ abstract class AbstractNetconfOperationTest { } protected static Document executeOperation(final NetconfOperation op, final Document request) throws Exception { - final Document response = op.handle(request, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); + final Document response = op.handle(request, null); LOG.debug("Got response {}", response); return response; } diff --git a/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/RuntimeRpcTest.java b/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/RuntimeRpcTest.java index 4e9b2618ca..8501d3c83b 100644 --- a/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/RuntimeRpcTest.java +++ b/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/RuntimeRpcTest.java @@ -46,7 +46,6 @@ import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult; import org.opendaylight.netconf.api.DocumentedException; import org.opendaylight.netconf.api.xml.XmlUtil; import org.opendaylight.netconf.server.api.operations.HandlingPriority; -import org.opendaylight.netconf.server.api.operations.NetconfOperationChainedExecution; import org.opendaylight.netconf.server.mdsal.CurrentSchemaContext; import org.opendaylight.netconf.test.util.XmlFileLoader; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.SessionIdType; @@ -189,7 +188,7 @@ class RuntimeRpcTest { final HandlingPriority priority = rpc.canHandle(rpcDocument); assertNotNull(priority); - final Document response = rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); + final Document response = rpc.handle(rpcDocument, null); verifyResponse(response, RPC_REPLY_OK); } @@ -203,7 +202,7 @@ class RuntimeRpcTest { final HandlingPriority priority = rpc.canHandle(rpcDocument); assertNotNull(priority); - final Document response = rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); + final Document response = rpc.handle(rpcDocument, null); verifyResponse(response, XmlFileLoader.xmlFileToDocument("messages/mapping/rpcs/rpc-nonvoid-control.xml")); } @@ -216,7 +215,7 @@ class RuntimeRpcTest { final HandlingPriority priority = rpc.canHandle(rpcDocument); assertNotNull(priority); - final Document response = rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); + final Document response = rpc.handle(rpcDocument, null); verifyResponse(response, XmlFileLoader.xmlFileToDocument("messages/mapping/rpcs/rpc-container-control.xml")); } @@ -229,8 +228,7 @@ class RuntimeRpcTest { final HandlingPriority priority = rpc.canHandle(rpcDocument); assertNotNull(priority); - final DocumentedException e = assertThrows(DocumentedException.class, - () -> rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT)); + final DocumentedException e = assertThrows(DocumentedException.class, () -> rpc.handle(rpcDocument, null)); assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR); assertEquals(e.getErrorTag(), ErrorTag.OPERATION_FAILED); @@ -245,7 +243,7 @@ class RuntimeRpcTest { final HandlingPriority priority = rpc.canHandle(rpcDocument); assertNotNull(priority); - final Document response = rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); + final Document response = rpc.handle(rpcDocument, null); verifyResponse(response, RPC_REPLY_OK); } @@ -255,8 +253,7 @@ class RuntimeRpcTest { final RuntimeRpc rpc = new RuntimeRpc(SESSION_ID_FOR_REPORTING, currentSchemaContext, RPC_SERVICE_VOID_INVOKER); final Document rpcDocument = XmlFileLoader.xmlFileToDocument("messages/mapping/rpcs/rpc-bad-namespace.xml"); - final DocumentedException e = assertThrows(DocumentedException.class, - () -> rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT)); + final DocumentedException e = assertThrows(DocumentedException.class, () -> rpc.handle(rpcDocument, null)); assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR); assertEquals(e.getErrorTag(), ErrorTag.BAD_ELEMENT); diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperation.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperation.java index 3551d674d6..0b8fb6aab1 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperation.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperation.java @@ -24,12 +24,11 @@ public abstract class AbstractLastNetconfOperation extends AbstractNetconfOperat @Override protected Element handle(final Document document, final XmlElement operationElement, final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException { - if (!subsequentOperation.isExecutionTermination()) { - throw new DocumentedException(String.format( - "No netconf operation expected to be subsequent to %s, but is %s", this, subsequentOperation), - ErrorType.APPLICATION, ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR); + if (subsequentOperation != null) { + throw new DocumentedException( + "No netconf operation expected to be subsequent to %s, but is %s".formatted(this, subsequentOperation), + ErrorType.APPLICATION, ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR); } - return handleWithNoSubsequentOperations(document, operationElement); } diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractNetconfOperation.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractNetconfOperation.java index 99f8311195..14702480f4 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractNetconfOperation.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/AbstractNetconfOperation.java @@ -10,6 +10,7 @@ package org.opendaylight.netconf.server.api.operations; import static java.util.Objects.requireNonNull; import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.netconf.api.DocumentedException; import org.opendaylight.netconf.api.NamespaceURN; import org.opendaylight.netconf.api.messages.RpcMessage; @@ -84,8 +85,8 @@ public abstract class AbstractNetconfOperation implements NetconfOperation { protected abstract String getOperationName(); @Override - public Document handle(final Document requestMessage, - final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException { + public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation) + throws DocumentedException { final var requestElement = getRequestElementWithCheck(requestMessage); final var document = XmlUtil.newDocument(); final var operationElement = requestElement.getOnlyChildElement(); @@ -113,8 +114,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation { } protected abstract Element handle(Document document, XmlElement message, - NetconfOperationChainedExecution subsequentOperation) - throws DocumentedException; + @Nullable NetconfOperationChainedExecution subsequentOperation) throws DocumentedException; @Override public String toString() { diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperation.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperation.java index c6f1af826b..1ecbb788f3 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperation.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperation.java @@ -36,17 +36,13 @@ public interface NetconfOperation { @Nullable HandlingPriority canHandle(Document message) throws DocumentedException; /** - * Execute current netconf operation and trigger execution of subsequent - * operations. subsequentOperation parameter will provide information, if - * current operation is the termination point in execution. In case of - * last/singleton operation, subsequentOperation must indicate termination - * point. + * Execute current netconf operation and trigger execution of subsequent operations, if applicable. * * @param requestMessage request message - * @param subsequentOperation execution of subsequent netconf operation + * @param subsequentOperation execution of subsequent NETCONF operation, or {@code null} * @return {@code document} * @throws DocumentedException if operation fails */ - Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation) + Document handle(Document requestMessage, @Nullable NetconfOperationChainedExecution subsequentOperation) throws DocumentedException; } diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperationChainedExecution.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperationChainedExecution.java index 9a68d81fd7..9d654cccd8 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperationChainedExecution.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/api/operations/NetconfOperationChainedExecution.java @@ -11,34 +11,9 @@ import org.opendaylight.netconf.api.DocumentedException; import org.w3c.dom.Document; /** - * Single link in netconf operation execution chain. - * Wraps the execution of a single netconf operation. + * Single link in netconf operation execution chain. Wraps the execution of a single netconf operation. */ public interface NetconfOperationChainedExecution { - /** - * Check if this is termination point in operation execution. - * - * @return true if this is termination point in operation execution, false - * if there is a subsequent operation present that needs to be - * executed. - */ - boolean isExecutionTermination(); - /** - * Do not execute if this is termination point. - */ Document execute(Document requestMessage) throws DocumentedException; - - NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() { - @Override - public boolean isExecutionTermination() { - return true; - } - - @Override - public Document execute(final Document requestMessage) { - throw new IllegalStateException("This execution represents the termination point in operation execution " - + "and cannot be executed itself"); - } - }; } diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/mapping/operations/DefaultStartExi.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/mapping/operations/DefaultStartExi.java index 64a9c6b57a..f05a220f5a 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/mapping/operations/DefaultStartExi.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/mapping/operations/DefaultStartExi.java @@ -37,8 +37,8 @@ public class DefaultStartExi extends AbstractSingletonNetconfOperation implement } @Override - public Document handle(final Document message, - final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException { + public Document handle(final Document message, final NetconfOperationChainedExecution subsequentOperation) + throws DocumentedException { if (LOG.isDebugEnabled()) { LOG.debug("Received start-exi message {} ", XmlUtil.toString(message)); } @@ -54,8 +54,7 @@ public class DefaultStartExi extends AbstractSingletonNetconfOperation implement } @Override - protected Element handleWithNoSubsequentOperations(final Document document, - final XmlElement operationElement) { + protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) { final Element getSchemaResult = document.createElementNS(NamespaceURN.BASE, XmlNetconfConstants.OK); LOG.trace("{} operation successful", START_EXI); return getSchemaResult; diff --git a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImpl.java b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImpl.java index 6b644c8385..9ff2f34c44 100644 --- a/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImpl.java +++ b/protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImpl.java @@ -179,11 +179,6 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter, AutoC this.subsequentExecution = subsequentExecution; } - @Override - public boolean isExecutionTermination() { - return false; - } - @Override public Document execute(final Document message) throws DocumentedException { return netconfOperation.handle(message, subsequentExecution); @@ -195,15 +190,8 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter, AutoC final NetconfOperation netconfOperation = sortedByPriority.get(handlingPriority); final HandlingPriority subsequentHandlingPriority = sortedByPriority.lowerKey(handlingPriority); - NetconfOperationChainedExecution subsequentExecution = null; - - if (subsequentHandlingPriority != null) { - subsequentExecution = createExecutionChain(sortedByPriority, subsequentHandlingPriority); - } else { - subsequentExecution = EXECUTION_TERMINATION_POINT; - } - - return new NetconfOperationExecution(netconfOperation, subsequentExecution); + return new NetconfOperationExecution(netconfOperation, subsequentHandlingPriority == null ? null + : createExecutionChain(sortedByPriority, subsequentHandlingPriority)); } } diff --git a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/ConcurrentClientsTest.java b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/ConcurrentClientsTest.java index 0e7a0f66c6..cfd085d57a 100644 --- a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/ConcurrentClientsTest.java +++ b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/ConcurrentClientsTest.java @@ -85,6 +85,7 @@ import org.opendaylight.yangtools.yang.common.Uint16; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; +import org.xml.sax.SAXException; @ExtendWith(MockitoExtension.class) class ConcurrentClientsTest { @@ -238,7 +239,6 @@ class ConcurrentClientsTest { ? null : HandlingPriority.HANDLE_WITH_MAX_PRIORITY; } - @SuppressWarnings("checkstyle:IllegalCatch") @Override public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException { @@ -246,7 +246,7 @@ class ConcurrentClientsTest { counter.getAndIncrement(); try { return XmlUtil.readXmlToDocument(""); - } catch (Exception e) { + } catch (IOException | SAXException e) { throw new RuntimeException(e); } } diff --git a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperationTest.java b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperationTest.java index a7486f370d..d4413a3ad2 100644 --- a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperationTest.java +++ b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/api/operations/AbstractLastNetconfOperationTest.java @@ -60,10 +60,9 @@ class AbstractLastNetconfOperationTest { @Test void testHandle() { - NetconfOperationChainedExecution operation = mock(NetconfOperationChainedExecution.class); + final var operation = mock(NetconfOperationChainedExecution.class); doReturn("").when(operation).toString(); - doReturn(false).when(operation).isExecutionTermination(); assertThrows(DocumentedException.class, () -> netconfOperation.handle(null, null, operation)); } } diff --git a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImplTest.java b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImplTest.java index bf9f76e597..e4764cde23 100644 --- a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImplTest.java +++ b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/osgi/NetconfOperationRouterImplTest.java @@ -8,10 +8,10 @@ package org.opendaylight.netconf.server.osgi; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; @@ -77,37 +77,33 @@ class NetconfOperationRouterImplTest { void testOnNetconfMessage() throws Exception { doReturn(HandlingPriority.HANDLE_WITH_MAX_PRIORITY).when(maxPrioMock).canHandle(any(Document.class)); doReturn(XmlUtil.readXmlToDocument(MAX_PRIORITY_REPLY)).when(maxPrioMock).handle(any(Document.class), - any(NetconfOperationChainedExecution.class)); + any()); doReturn(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY).when(defaultPrioMock).canHandle(any(Document.class)); doReturn(XmlUtil.readXmlToDocument(DEFAULT_PRIORITY_REPLY)).when(defaultPrioMock).handle(any(Document.class), - any(NetconfOperationChainedExecution.class)); - final ArgumentCaptor highPriorityChainEx = - ArgumentCaptor.forClass(NetconfOperationChainedExecution.class); - final ArgumentCaptor defaultPriorityChainEx = - ArgumentCaptor.forClass(NetconfOperationChainedExecution.class); + isNull()); + final var highPriorityChainEx = ArgumentCaptor.forClass(NetconfOperationChainedExecution.class); - final Document document = operationRouter.onNetconfMessage(TEST_RPC_DOC, null); + final var document = operationRouter.onNetconfMessage(TEST_RPC_DOC, null); //max priority message is first in chain verify(maxPrioMock).handle(any(Document.class), highPriorityChainEx.capture()); - final NetconfOperationChainedExecution chainedExecution = highPriorityChainEx.getValue(); - assertFalse(chainedExecution.isExecutionTermination()); + final var chainedExecution = highPriorityChainEx.getValue(); + assertNotNull(chainedExecution); //execute next in chain - final Document execute = chainedExecution.execute(XmlUtil.newDocument()); + final var execute = chainedExecution.execute(XmlUtil.newDocument()); assertEquals(DEFAULT_PRIORITY_REPLY, XmlUtil.toString(execute).trim()); //default priority message is second and last - verify(defaultPrioMock).handle(any(Document.class), defaultPriorityChainEx.capture()); - assertTrue(defaultPriorityChainEx.getValue().isExecutionTermination()); + verify(defaultPrioMock).handle(any(Document.class), isNull()); assertEquals(MAX_PRIORITY_REPLY, XmlUtil.toString(document).trim()); } @Test void testOnNetconfMessageFail() { - final DocumentedException ex = assertThrows(DocumentedException.class, + final var ex = assertThrows(DocumentedException.class, () -> emptyOperationRouter.onNetconfMessage(TEST_RPC_DOC, null)); assertEquals(ErrorTag.OPERATION_NOT_SUPPORTED, ex.getErrorTag()); }