From 4f0f6f3a97b17d1e6914149c4c999d8801596c41 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 9 Aug 2018 12:07:50 +0200 Subject: [PATCH] Integrate MRI projects for Neon This patch bumps: - odlparent to 4.0.2 - yangtools to 2.1.2 - mdsal to 3.0.1 It deals with the fallout in following ways: - xmlunit -> xmlunit-legacy - fix unstubbed methods - migrate to java.util.Optional where needed - update test data to account for automatic list removal - update to sshd-2.0.0 - account for ietf-{inet,yang}-types moving - remove explicit null in blueprint - use isNull() instead of any(Class) where we want to match null - prevent UnnecessaryStubbingException in TestRestconfUtils class - remove jersey-related version overrides - reuse NoOpListenerRegistration JIRA: NETCONF-555 JIRA: NETCONF-564 Change-Id: Ib2b6bc8cfe868f1c268b243052429e6a10cfb5e8 Signed-off-by: Robert Varga Signed-off-by: Jakub Morvay --- .../features-netconf-connector/pom.xml | 2 +- .../netconf-connector/odl-message-bus/pom.xml | 2 +- .../odl-netconf-callhome-ssh/pom.xml | 2 +- .../odl-netconf-clustered-topology/pom.xml | 2 +- .../odl-netconf-connector-all/pom.xml | 2 +- .../odl-netconf-connector-ssh/pom.xml | 2 +- .../odl-netconf-connector/pom.xml | 4 +- .../odl-netconf-console/pom.xml | 2 +- .../odl-netconf-topology/pom.xml | 2 +- features/netconf-connector/pom.xml | 16 +--- features/netconf/features-netconf/pom.xml | 2 +- .../odl-aaa-netconf-plugin-no-cluster/pom.xml | 2 +- .../netconf/odl-aaa-netconf-plugin/pom.xml | 2 +- features/netconf/odl-netconf-all/pom.xml | 2 +- features/netconf/odl-netconf-api/pom.xml | 6 +- .../src/main/feature/feature.xml | 2 +- features/netconf/odl-netconf-client/pom.xml | 2 +- features/netconf/odl-netconf-impl/pom.xml | 2 +- .../netconf/odl-netconf-mapping-api/pom.xml | 2 +- features/netconf/odl-netconf-mdsal/pom.xml | 2 +- .../netconf/odl-netconf-monitoring/pom.xml | 2 +- .../netconf/odl-netconf-netty-util/pom.xml | 2 +- .../src/main/feature/feature.xml | 3 +- .../odl-netconf-notifications-api/pom.xml | 2 +- .../odl-netconf-notifications-impl/pom.xml | 4 +- features/netconf/odl-netconf-ssh/pom.xml | 2 +- features/netconf/odl-netconf-tcp/pom.xml | 2 +- features/netconf/odl-netconf-util/pom.xml | 10 ++- .../src/main/feature/feature.xml | 2 +- features/netconf/pom.xml | 2 +- features/pom.xml | 2 +- .../features-protocol-framework/pom.xml | 2 +- .../odl-protocol-framework/pom.xml | 4 +- features/protocol-framework/pom.xml | 2 +- features/restconf/features-restconf/pom.xml | 2 +- features/restconf/odl-mdsal-apidocs/pom.xml | 6 +- .../src/main/feature/feature.xml | 2 +- features/restconf/odl-restconf-all/pom.xml | 2 +- features/restconf/odl-restconf-base/pom.xml | 4 +- features/restconf/odl-restconf-common/pom.xml | 14 ++- .../src/main/feature/feature.xml | 6 +- .../odl-restconf-nb-rfc8040-all/pom.xml | 2 +- .../restconf/odl-restconf-nb-rfc8040/pom.xml | 2 +- features/restconf/odl-restconf-noauth/pom.xml | 2 +- features/restconf/odl-restconf/pom.xml | 2 +- .../odl-restconf/src/main/feature/feature.xml | 2 +- features/restconf/pom.xml | 2 +- features/yanglib/features-yanglib/pom.xml | 2 +- features/yanglib/odl-yanglib/pom.xml | 2 +- .../odl-yanglib/src/main/feature/feature.xml | 2 +- features/yanglib/pom.xml | 2 +- karaf/pom.xml | 2 +- .../protocol/NetconfCallHomeServer.java | 47 +++++----- .../NetconfCallHomeServerBuilder.java | 5 +- .../protocol/MinaSshNettyChannelTest.java | 8 +- .../protocol/NetconfCallHomeServerTest.java | 86 ++++++++++--------- .../IetfZeroTouchCallHomeServerProvider.java | 2 + netconf/mdsal-netconf-connector/pom.xml | 4 +- ...s_4_delete_children_operations_control.xml | 6 +- .../blueprint/mdsal-netconf-impl.xml | 1 - netconf/mdsal-netconf-monitoring/pom.xml | 4 +- netconf/mdsal-netconf-yang-library/pom.xml | 6 +- .../netconf/NetconfEventSourceMount.java | 10 +-- .../models/ietf-netconf-monitoring/pom.xml | 8 +- .../models/ietf-netconf-notifications/pom.xml | 8 +- netconf/models/ietf-netconf/pom.xml | 4 +- netconf/models/pom.xml | 2 +- netconf/netconf-api/pom.xml | 12 +-- netconf/netconf-artifacts/pom.xml | 2 +- .../NetconfClientDispatcherImplTest.java | 4 +- .../NetconfClientSessionNegotiatorTest.java | 45 +++++----- ...impleNetconfClientSessionListenerTest.java | 2 +- netconf/netconf-config/pom.xml | 2 +- .../NetconfCommandsImplCallsTest.java | 7 +- netconf/netconf-impl/pom.xml | 4 +- ...NetconfServerSessionNegotiatorFactory.java | 13 +-- .../NetconfServerSessionListenerTest.java | 20 ++--- .../operations/DefaultCloseSessionTest.java | 8 +- .../impl/osgi/NetconfImplActivatorTest.java | 17 ++-- netconf/netconf-monitoring/pom.xml | 4 +- .../osgi/NetconfMonitoringActivatorTest.java | 6 +- netconf/netconf-netty-util/pom.xml | 9 +- .../ssh/client/AsyncSshHandlerWriter.java | 6 +- .../nettyutil/AbstractNetconfSessionTest.java | 6 +- .../ssh/client/AsyncSshHandlerTest.java | 39 ++++----- netconf/netconf-notifications-impl/pom.xml | 4 +- .../impl/ops/NotificationsTransformUtil.java | 29 +++---- netconf/netconf-parent/pom.xml | 2 +- netconf/netconf-ssh/pom.xml | 4 +- .../netconf/ssh/RemoteNetconfCommand.java | 5 +- netconf/netconf-topology-config/pom.xml | 2 +- .../singleton/impl/ProxyDOMRpcService.java | 7 +- .../messages/rpc/InvokeRpcMessageReply.java | 10 +-- .../impl/MountPointEndToEndTest.java | 6 +- .../singleton/impl/NetconfNodeActorTest.java | 17 ++-- .../impl/NetconfTopologyManagerTest.java | 8 +- netconf/netconf-util/pom.xml | 4 +- netconf/pom.xml | 2 +- netconf/sal-netconf-connector/pom.xml | 10 +-- .../connect/netconf/sal/NetconfDeviceRpc.java | 23 +---- .../connect/netconf/NetconfDeviceTest.java | 20 ++--- .../netconf/SchemalessNetconfDeviceTest.java | 5 +- .../netconf/sal/KeepaliveSalFacadeTest.java | 18 ++-- .../sal/NetconfDeviceSalFacadeTest.java | 8 +- .../sal/NetconfDeviceTopologyAdapterTest.java | 6 +- .../sal/tx/NetconfDeviceWriteOnlyTxTest.java | 12 ++- .../netconf/util/NetconfBaseOpsTest.java | 22 ++--- netconf/tools/netconf-testtool/pom.xml | 8 +- netconf/tools/pom.xml | 2 +- netconf/yanglib/pom.xml | 2 +- pom.xml | 2 +- protocol-framework/pom.xml | 4 +- restconf/pom.xml | 2 +- restconf/restconf-artifacts/pom.xml | 2 +- .../errors/RestconfDocumentedException.java | 4 +- .../ietf-restconf-monitoring/pom.xml | 8 +- .../restconf-models/ietf-restconf/pom.xml | 8 +- restconf/restconf-models/pom.xml | 2 +- restconf/restconf-nb-bierman02/pom.xml | 11 +-- .../md/sal/rest/common/TestRestconfUtils.java | 11 ++- .../impl/test/InvokeRpcMethodTest.java | 13 +-- .../test/JSONRestconfServiceImplTest.java | 44 +++++----- .../impl/test/RestGetOperationTest.java | 16 ++-- .../impl/test/RestPostOperationTest.java | 6 +- .../restconf/impl/test/RestconfImplTest.java | 10 +-- .../listener-adapter-test/notif-del.json | 7 +- restconf/restconf-nb-rfc8040/pom.xml | 6 +- .../JSONRestconfServiceRfc8040ImplTest.java | 18 ++-- .../RestconfInvokeOperationsUtilTest.java | 2 +- .../listener-adapter-test/notif-del.json | 7 +- restconf/restconf-parent/pom.xml | 7 +- restconf/sal-rest-connector-config/pom.xml | 2 +- .../rest/doc/jaxrs/JaxbContextResolver.java | 2 - 133 files changed, 455 insertions(+), 541 deletions(-) diff --git a/features/netconf-connector/features-netconf-connector/pom.xml b/features/netconf-connector/features-netconf-connector/pom.xml index a4464bf8bd..e442f15bea 100644 --- a/features/netconf-connector/features-netconf-connector/pom.xml +++ b/features/netconf-connector/features-netconf-connector/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-message-bus/pom.xml b/features/netconf-connector/odl-message-bus/pom.xml index ff63191ad0..dea108a0c1 100644 --- a/features/netconf-connector/odl-message-bus/pom.xml +++ b/features/netconf-connector/odl-message-bus/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-callhome-ssh/pom.xml b/features/netconf-connector/odl-netconf-callhome-ssh/pom.xml index 7cc273da75..6491056f9a 100644 --- a/features/netconf-connector/odl-netconf-callhome-ssh/pom.xml +++ b/features/netconf-connector/odl-netconf-callhome-ssh/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-clustered-topology/pom.xml b/features/netconf-connector/odl-netconf-clustered-topology/pom.xml index af4a790d38..d87bf90287 100644 --- a/features/netconf-connector/odl-netconf-clustered-topology/pom.xml +++ b/features/netconf-connector/odl-netconf-clustered-topology/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-connector-all/pom.xml b/features/netconf-connector/odl-netconf-connector-all/pom.xml index f6843705ae..666a0172e0 100644 --- a/features/netconf-connector/odl-netconf-connector-all/pom.xml +++ b/features/netconf-connector/odl-netconf-connector-all/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-connector-ssh/pom.xml b/features/netconf-connector/odl-netconf-connector-ssh/pom.xml index 576334b346..5ac4d7a93d 100644 --- a/features/netconf-connector/odl-netconf-connector-ssh/pom.xml +++ b/features/netconf-connector/odl-netconf-connector-ssh/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-connector/pom.xml b/features/netconf-connector/odl-netconf-connector/pom.xml index 717770d273..8620440066 100644 --- a/features/netconf-connector/odl-netconf-connector/pom.xml +++ b/features/netconf-connector/odl-netconf-connector/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -28,7 +28,7 @@ org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 pom import diff --git a/features/netconf-connector/odl-netconf-console/pom.xml b/features/netconf-connector/odl-netconf-console/pom.xml index 609b2b80d9..dae6b19281 100644 --- a/features/netconf-connector/odl-netconf-console/pom.xml +++ b/features/netconf-connector/odl-netconf-console/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/odl-netconf-topology/pom.xml b/features/netconf-connector/odl-netconf-topology/pom.xml index a548ee6197..30479899d9 100644 --- a/features/netconf-connector/odl-netconf-topology/pom.xml +++ b/features/netconf-connector/odl-netconf-topology/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf-connector/pom.xml b/features/netconf-connector/pom.xml index 7756683f1d..f2b82d4858 100644 --- a/features/netconf-connector/pom.xml +++ b/features/netconf-connector/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent - 3.1.3 + 4.0.2 org.opendaylight.netconf @@ -22,9 +22,7 @@ 1.12.0-SNAPSHOT 1.9.0-SNAPSHOT - 0.10.0-SNAPSHOT - 2.6.0-SNAPSHOT - 0.14.0-SNAPSHOT + 3.0.1 1.6.0-SNAPSHOT 1.9.0-SNAPSHOT @@ -53,7 +51,7 @@ org.opendaylight.yangtools yangtools-artifacts - 2.0.10 + 2.1.2 pom import @@ -75,14 +73,6 @@ xml runtime - - org.opendaylight.mdsal.model - features-mdsal-model - ${mdsal.model.version} - features - xml - runtime - ${project.groupId} features-netconf diff --git a/features/netconf/features-netconf/pom.xml b/features/netconf/features-netconf/pom.xml index 643f425e7e..61cc976c52 100644 --- a/features/netconf/features-netconf/pom.xml +++ b/features/netconf/features-netconf/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-aaa-netconf-plugin-no-cluster/pom.xml b/features/netconf/odl-aaa-netconf-plugin-no-cluster/pom.xml index b31ab9ff39..4978bc34db 100644 --- a/features/netconf/odl-aaa-netconf-plugin-no-cluster/pom.xml +++ b/features/netconf/odl-aaa-netconf-plugin-no-cluster/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-aaa-netconf-plugin/pom.xml b/features/netconf/odl-aaa-netconf-plugin/pom.xml index 097edaab33..7046440045 100644 --- a/features/netconf/odl-aaa-netconf-plugin/pom.xml +++ b/features/netconf/odl-aaa-netconf-plugin/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-all/pom.xml b/features/netconf/odl-netconf-all/pom.xml index be2e6c3f1b..814673952c 100644 --- a/features/netconf/odl-netconf-all/pom.xml +++ b/features/netconf/odl-netconf-all/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-api/pom.xml b/features/netconf/odl-netconf-api/pom.xml index 41ab9f5ab2..10aa6976ef 100644 --- a/features/netconf/odl-netconf-api/pom.xml +++ b/features/netconf/odl-netconf-api/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -28,14 +28,14 @@ org.opendaylight.yangtools yangtools-artifacts - 2.0.10 + 2.1.2 pom import org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 pom import diff --git a/features/netconf/odl-netconf-api/src/main/feature/feature.xml b/features/netconf/odl-netconf-api/src/main/feature/feature.xml index 689267ef2f..b23837d4d4 100644 --- a/features/netconf/odl-netconf-api/src/main/feature/feature.xml +++ b/features/netconf/odl-netconf-api/src/main/feature/feature.xml @@ -8,6 +8,6 @@ --> - odl-yangtools-parser-api + odl-yangtools-parser-api diff --git a/features/netconf/odl-netconf-client/pom.xml b/features/netconf/odl-netconf-client/pom.xml index d86d60ee74..16f9e93772 100644 --- a/features/netconf/odl-netconf-client/pom.xml +++ b/features/netconf/odl-netconf-client/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-impl/pom.xml b/features/netconf/odl-netconf-impl/pom.xml index 272c7fbdd9..88fba1138d 100644 --- a/features/netconf/odl-netconf-impl/pom.xml +++ b/features/netconf/odl-netconf-impl/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-mapping-api/pom.xml b/features/netconf/odl-netconf-mapping-api/pom.xml index 2edb50945c..55fb481945 100644 --- a/features/netconf/odl-netconf-mapping-api/pom.xml +++ b/features/netconf/odl-netconf-mapping-api/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-mdsal/pom.xml b/features/netconf/odl-netconf-mdsal/pom.xml index 949d2f99df..bf3d9c9b61 100644 --- a/features/netconf/odl-netconf-mdsal/pom.xml +++ b/features/netconf/odl-netconf-mdsal/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-monitoring/pom.xml b/features/netconf/odl-netconf-monitoring/pom.xml index 1cad8890e1..37153399d5 100644 --- a/features/netconf/odl-netconf-monitoring/pom.xml +++ b/features/netconf/odl-netconf-monitoring/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-netty-util/pom.xml b/features/netconf/odl-netconf-netty-util/pom.xml index 5409635a17..ee7fa62eb2 100644 --- a/features/netconf/odl-netconf-netty-util/pom.xml +++ b/features/netconf/odl-netconf-netty-util/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-netty-util/src/main/feature/feature.xml b/features/netconf/odl-netconf-netty-util/src/main/feature/feature.xml index 12ba3b7bb9..c0eaa4f2d7 100644 --- a/features/netconf/odl-netconf-netty-util/src/main/feature/feature.xml +++ b/features/netconf/odl-netconf-netty-util/src/main/feature/feature.xml @@ -8,7 +8,6 @@ --> - ssh - odl-netty-4 + odl-apache-sshd diff --git a/features/netconf/odl-netconf-notifications-api/pom.xml b/features/netconf/odl-netconf-notifications-api/pom.xml index e342ce6f66..412d82ea50 100644 --- a/features/netconf/odl-netconf-notifications-api/pom.xml +++ b/features/netconf/odl-netconf-notifications-api/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-notifications-impl/pom.xml b/features/netconf/odl-netconf-notifications-impl/pom.xml index 8a5891b9cd..72164f63a6 100644 --- a/features/netconf/odl-netconf-notifications-impl/pom.xml +++ b/features/netconf/odl-netconf-notifications-impl/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -28,7 +28,7 @@ org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 pom import diff --git a/features/netconf/odl-netconf-ssh/pom.xml b/features/netconf/odl-netconf-ssh/pom.xml index 98549b45f9..1bd5c9e6fb 100644 --- a/features/netconf/odl-netconf-ssh/pom.xml +++ b/features/netconf/odl-netconf-ssh/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-tcp/pom.xml b/features/netconf/odl-netconf-tcp/pom.xml index fdade57c51..a7370b7299 100644 --- a/features/netconf/odl-netconf-tcp/pom.xml +++ b/features/netconf/odl-netconf-tcp/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/netconf/odl-netconf-util/pom.xml b/features/netconf/odl-netconf-util/pom.xml index f28f37d9e9..fdbdf5534c 100644 --- a/features/netconf/odl-netconf-util/pom.xml +++ b/features/netconf/odl-netconf-util/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -22,6 +22,12 @@ feature + + org.opendaylight.odlparent + odl-apache-sshd + xml + features + org.opendaylight.netconf odl-netconf-mapping-api @@ -32,7 +38,7 @@ org.opendaylight.yangtools odl-yangtools-codec - 2.0.10 + 2.1.2 xml features diff --git a/features/netconf/odl-netconf-util/src/main/feature/feature.xml b/features/netconf/odl-netconf-util/src/main/feature/feature.xml index 5e79a30644..1181590451 100644 --- a/features/netconf/odl-netconf-util/src/main/feature/feature.xml +++ b/features/netconf/odl-netconf-util/src/main/feature/feature.xml @@ -11,6 +11,6 @@ mvn:org.opendaylight.netconf/netconf-util/${project.version}/cfg/config - odl-yangtools-codec + odl-yangtools-codec diff --git a/features/netconf/pom.xml b/features/netconf/pom.xml index 2a94ada0f3..46416ec2f1 100644 --- a/features/netconf/pom.xml +++ b/features/netconf/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/features/pom.xml b/features/pom.xml index 5a1cbab85c..1233ce1df8 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/features/protocol-framework/features-protocol-framework/pom.xml b/features/protocol-framework/features-protocol-framework/pom.xml index f980956e5b..e5d2c0fade 100644 --- a/features/protocol-framework/features-protocol-framework/pom.xml +++ b/features/protocol-framework/features-protocol-framework/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features/protocol-framework/odl-protocol-framework/pom.xml b/features/protocol-framework/odl-protocol-framework/pom.xml index f0c7da2ea0..593c31b456 100644 --- a/features/protocol-framework/odl-protocol-framework/pom.xml +++ b/features/protocol-framework/odl-protocol-framework/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -32,7 +32,7 @@ org.opendaylight.odlparent - odl-guava-23 + odl-guava xml features diff --git a/features/protocol-framework/pom.xml b/features/protocol-framework/pom.xml index b289b3b769..d135db1bdc 100644 --- a/features/protocol-framework/pom.xml +++ b/features/protocol-framework/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/features/restconf/features-restconf/pom.xml b/features/restconf/features-restconf/pom.xml index 54c8695656..7fcbec86b8 100644 --- a/features/restconf/features-restconf/pom.xml +++ b/features/restconf/features-restconf/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-mdsal-apidocs/pom.xml b/features/restconf/odl-mdsal-apidocs/pom.xml index e327043319..6b1f91ae58 100644 --- a/features/restconf/odl-mdsal-apidocs/pom.xml +++ b/features/restconf/odl-mdsal-apidocs/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -26,8 +26,8 @@ org.opendaylight.odlparent - odl-jackson-2.8 - 3.1.3 + odl-jackson-2.9 + 4.0.2 xml features diff --git a/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml b/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml index 52ad5e11af..a2f522e779 100644 --- a/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml +++ b/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml @@ -8,6 +8,6 @@ --> - odl-jackson-2.8 + odl-jackson-2.9 diff --git a/features/restconf/odl-restconf-all/pom.xml b/features/restconf/odl-restconf-all/pom.xml index 12bfeeeba2..c75f5ee6da 100644 --- a/features/restconf/odl-restconf-all/pom.xml +++ b/features/restconf/odl-restconf-all/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-restconf-base/pom.xml b/features/restconf/odl-restconf-base/pom.xml index 7a3c9e952c..0963a98d48 100644 --- a/features/restconf/odl-restconf-base/pom.xml +++ b/features/restconf/odl-restconf-base/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -28,7 +28,7 @@ org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 pom import diff --git a/features/restconf/odl-restconf-common/pom.xml b/features/restconf/odl-restconf-common/pom.xml index 8e32b6a7ff..257baf5e94 100644 --- a/features/restconf/odl-restconf-common/pom.xml +++ b/features/restconf/odl-restconf-common/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 @@ -28,14 +28,14 @@ org.opendaylight.yangtools yangtools-artifacts - 2.0.10 + 2.1.2 pom import org.opendaylight.mdsal mdsal-artifacts - 2.6.0-SNAPSHOT + 3.0.1 pom import @@ -106,10 +106,6 @@ org.opendaylight.netconf ietf-restconf - - org.opendaylight.mdsal.model - rfc7895 - org.opendaylight.netconf ietf-restconf-monitoring @@ -126,8 +122,8 @@ org.opendaylight.odlparent - odl-jackson-2.8 - 3.1.3 + odl-jackson-2.9 + 4.0.2 xml features diff --git a/features/restconf/odl-restconf-common/src/main/feature/feature.xml b/features/restconf/odl-restconf-common/src/main/feature/feature.xml index 6142eb1008..35984eb7b4 100644 --- a/features/restconf/odl-restconf-common/src/main/feature/feature.xml +++ b/features/restconf/odl-restconf-common/src/main/feature/feature.xml @@ -8,8 +8,8 @@ --> - odl-karaf-feat-jetty - odl-jackson-2.8 - odl-yangtools-export + odl-karaf-feat-jetty + odl-jackson-2.9 + odl-yangtools-export diff --git a/features/restconf/odl-restconf-nb-rfc8040-all/pom.xml b/features/restconf/odl-restconf-nb-rfc8040-all/pom.xml index 6d8b68c678..96b41d20ec 100644 --- a/features/restconf/odl-restconf-nb-rfc8040-all/pom.xml +++ b/features/restconf/odl-restconf-nb-rfc8040-all/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-restconf-nb-rfc8040/pom.xml b/features/restconf/odl-restconf-nb-rfc8040/pom.xml index f879e33c81..6a5278109b 100644 --- a/features/restconf/odl-restconf-nb-rfc8040/pom.xml +++ b/features/restconf/odl-restconf-nb-rfc8040/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-restconf-noauth/pom.xml b/features/restconf/odl-restconf-noauth/pom.xml index c86fd811d5..ce776f9f00 100644 --- a/features/restconf/odl-restconf-noauth/pom.xml +++ b/features/restconf/odl-restconf-noauth/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-restconf/pom.xml b/features/restconf/odl-restconf/pom.xml index 26189cda90..3d05b6e724 100644 --- a/features/restconf/odl-restconf/pom.xml +++ b/features/restconf/odl-restconf/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/restconf/odl-restconf/src/main/feature/feature.xml b/features/restconf/odl-restconf/src/main/feature/feature.xml index db943789d2..df674b122e 100644 --- a/features/restconf/odl-restconf/src/main/feature/feature.xml +++ b/features/restconf/odl-restconf/src/main/feature/feature.xml @@ -8,6 +8,6 @@ --> - odl-jackson-2.8 + odl-jackson-2.9 diff --git a/features/restconf/pom.xml b/features/restconf/pom.xml index a4408ea607..1f8b9e3173 100644 --- a/features/restconf/pom.xml +++ b/features/restconf/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 features-restconf-aggregator diff --git a/features/yanglib/features-yanglib/pom.xml b/features/yanglib/features-yanglib/pom.xml index befc40b7de..9fb86740a0 100644 --- a/features/yanglib/features-yanglib/pom.xml +++ b/features/yanglib/features-yanglib/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.odlparent feature-repo-parent - 3.1.3 + 4.0.2 diff --git a/features/yanglib/odl-yanglib/pom.xml b/features/yanglib/odl-yanglib/pom.xml index 12c71d4a39..345c4bfe01 100644 --- a/features/yanglib/odl-yanglib/pom.xml +++ b/features/yanglib/odl-yanglib/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent single-feature-parent - 3.1.3 + 4.0.2 diff --git a/features/yanglib/odl-yanglib/src/main/feature/feature.xml b/features/yanglib/odl-yanglib/src/main/feature/feature.xml index 9612d49133..b837020548 100644 --- a/features/yanglib/odl-yanglib/src/main/feature/feature.xml +++ b/features/yanglib/odl-yanglib/src/main/feature/feature.xml @@ -8,6 +8,6 @@ --> - odl-karaf-feat-jetty + odl-karaf-feat-jetty diff --git a/features/yanglib/pom.xml b/features/yanglib/pom.xml index 366e7f735e..2edb401773 100644 --- a/features/yanglib/pom.xml +++ b/features/yanglib/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/karaf/pom.xml b/karaf/pom.xml index ef3b83d1c6..735a91a971 100644 --- a/karaf/pom.xml +++ b/karaf/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.odlparent karaf4-parent - 3.1.3 + 4.0.2 org.opendaylight.netconf diff --git a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServer.java b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServer.java index a3e2db5054..62b37ddb72 100644 --- a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServer.java +++ b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServer.java @@ -5,10 +5,11 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.callhome.protocol; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + +import com.google.common.annotations.VisibleForTesting; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -22,11 +23,10 @@ import org.apache.sshd.client.session.SessionFactory; import org.apache.sshd.common.future.SshFutureListener; import org.apache.sshd.common.io.IoAcceptor; import org.apache.sshd.common.io.IoServiceFactory; -import org.apache.sshd.common.io.mina.MinaServiceFactory; -import org.apache.sshd.common.io.nio2.Nio2ServiceFactory; import org.apache.sshd.common.kex.KeyExchange; import org.apache.sshd.common.session.Session; import org.apache.sshd.common.session.SessionListener; +import org.apache.sshd.netty.NettyIoServiceFactory; import org.opendaylight.netconf.callhome.protocol.CallHomeSessionContext.Factory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,38 +35,40 @@ public class NetconfCallHomeServer implements AutoCloseable, ServerKeyVerifier { private static final Logger LOG = LoggerFactory.getLogger(NetconfCallHomeServer.class); - private final IoAcceptor acceptor; - private final SshClient client; private final CallHomeAuthorizationProvider authProvider; - private final CallHomeSessionContext.Factory sessionFactory; + private final IoServiceFactory serviceFactory; private final InetSocketAddress bindAddress; private final StatusRecorder recorder; + private final Factory sessionFactory; + private final IoAcceptor acceptor; + private final SshClient client; NetconfCallHomeServer(final SshClient sshClient, final CallHomeAuthorizationProvider authProvider, final Factory factory, final InetSocketAddress socketAddress, final StatusRecorder recorder) { - this.client = Preconditions.checkNotNull(sshClient); - this.authProvider = Preconditions.checkNotNull(authProvider); - this.sessionFactory = Preconditions.checkNotNull(factory); + this(sshClient, authProvider, factory, socketAddress, recorder, + new NettyIoServiceFactory(factory.getNettyGroup())); + } + + @VisibleForTesting + NetconfCallHomeServer(final SshClient sshClient, final CallHomeAuthorizationProvider authProvider, + final Factory factory, final InetSocketAddress socketAddress, final StatusRecorder recorder, + final IoServiceFactory serviceFactory) { + this.client = requireNonNull(sshClient); + this.authProvider = requireNonNull(authProvider); + this.sessionFactory = requireNonNull(factory); this.bindAddress = socketAddress; this.recorder = recorder; + this.serviceFactory = requireNonNull(serviceFactory); sshClient.setServerKeyVerifier(this); sshClient.addSessionListener(createSessionListener()); - this.acceptor = createServiceFactory(sshClient).createAcceptor(new SessionFactory(sshClient)); - } - - private IoServiceFactory createServiceFactory(final SshClient sshClient) { - try { - return createMinaServiceFactory(sshClient); - } catch (NoClassDefFoundError e) { - LOG.warn("Mina is not available, defaulting to NIO."); - return new Nio2ServiceFactory(sshClient, sshClient.getScheduledExecutorService(), false); - } + acceptor = serviceFactory.createAcceptor(new SessionFactory(sshClient)); } - protected IoServiceFactory createMinaServiceFactory(final SshClient sshClient) { - return new MinaServiceFactory(sshClient, sshClient.getScheduledExecutorService(), false); + @VisibleForTesting + SshClient getClient() { + return client; } SessionListener createSessionListener() { @@ -186,5 +188,6 @@ public class NetconfCallHomeServer implements AutoCloseable, ServerKeyVerifier { @Override public void close() { acceptor.close(true); + serviceFactory.close(true); } } diff --git a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServerBuilder.java b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServerBuilder.java index decb759689..73d4c5b473 100644 --- a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServerBuilder.java +++ b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServerBuilder.java @@ -5,12 +5,11 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.callhome.protocol; import com.google.common.base.Optional; +import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.EventLoopGroup; -import io.netty.channel.local.LocalEventLoopGroup; import io.netty.util.HashedWheelTimer; import java.net.InetSocketAddress; import java.util.concurrent.TimeUnit; @@ -117,7 +116,7 @@ public class NetconfCallHomeServerBuilder implements Builder props = new HashMap<>(); props.put("nio-workers", "1"); - Mockito.doReturn(props).when(mockSshClient).getProperties(); - Mockito.doReturn("test").when(mockSession).toString(); + doReturn(props).when(mockSshClient).getProperties(); + doReturn(EVENT_LOOP_GROUP).when(mockFactory).getNettyGroup(); instance = new NetconfCallHomeServer( - mockSshClient, mockCallHomeAuthProv, mockFactory, mockAddress, mockStatusRecorder); + mockSshClient, mockCallHomeAuthProv, mockFactory, MOCK_ADDRESS, mockStatusRecorder); } @Test @@ -81,12 +111,12 @@ public class NetconfCallHomeServerTest { for (int pass = 0; pass < evt.length; pass++) { // given AuthFuture mockAuthFuture = mock(AuthFuture.class); - Mockito.doReturn(null).when(mockAuthFuture).addListener(any(SshFutureListener.class)); + doReturn(null).when(mockAuthFuture).addListener(any(SshFutureListener.class)); CallHomeSessionContext mockContext = mock(CallHomeSessionContext.class); - Mockito.doNothing().when(mockContext).openNetconfChannel(); - Mockito.doReturn(mockContext).when(mockSession).getAttribute(any(Session.AttributeKey.class)); + doNothing().when(mockContext).openNetconfChannel(); + doReturn(mockContext).when(mockSession).getAttribute(any(Session.AttributeKey.class)); SessionListener listener = instance.createSessionListener(); - Mockito.doReturn(mockAuthFuture).when(mockContext).authorize(); + doReturn(mockAuthFuture).when(mockContext).authorize(); // when listener.sessionEvent(mockSession, evt[pass]); // then @@ -102,10 +132,8 @@ public class NetconfCallHomeServerTest { ClientSessionImpl mockClientSession = mock(ClientSessionImpl.class); Mockito.doReturn("test").when(mockClientSession).toString(); SocketAddress mockSocketAddr = mock(SocketAddress.class); - Mockito.doReturn("testAddr").when(mockSocketAddr).toString(); PublicKey mockPublicKey = mock(PublicKey.class); - Mockito.doReturn("test").when(mockAuth).toString(); Mockito.doReturn(true).when(mockAuth).isServerAllowed(); Mockito.doReturn("some-session-name").when(mockAuth).getSessionName(); @@ -133,29 +161,6 @@ public class NetconfCallHomeServerTest { assertFalse(instance.verifyServerKey(mockClientSession, mockSocketAddr, mockPublicKey)); } - static class TestableCallHomeServer extends NetconfCallHomeServer { - static IoServiceFactory minaServiceFactory; - - static SshClient factoryHook(final SshClient client, final IoServiceFactory minaFactory) { - minaServiceFactory = minaFactory; - return client; - } - - SshClient client; - - TestableCallHomeServer(final SshClient sshClient, final CallHomeAuthorizationProvider authProvider, - final CallHomeSessionContext.Factory factory, final InetSocketAddress socketAddress, - final IoServiceFactory minaFactory, final StatusRecorder recorder) { - super(factoryHook(sshClient, minaFactory), authProvider, factory, socketAddress, recorder); - client = sshClient; - } - - @Override - protected IoServiceFactory createMinaServiceFactory(final SshClient sshClient) { - return minaServiceFactory; - } - } - @Test public void bindShouldStartTheClientAndBindTheAddress() throws IOException { // given @@ -163,14 +168,13 @@ public class NetconfCallHomeServerTest { IoServiceFactory mockMinaFactory = mock(IoServiceFactory.class); Mockito.doReturn(mockAcceptor).when(mockMinaFactory).createAcceptor(any(IoHandler.class)); - Mockito.doReturn(mockAcceptor).when(mockMinaFactory).createAcceptor(any(IoHandler.class)); - Mockito.doNothing().when(mockAcceptor).bind(mockAddress); - instance = new TestableCallHomeServer( - mockSshClient, mockCallHomeAuthProv, mockFactory, mockAddress, mockMinaFactory, mockStatusRecorder); + Mockito.doNothing().when(mockAcceptor).bind(any(SocketAddress.class)); + instance = new NetconfCallHomeServer( + mockSshClient, mockCallHomeAuthProv, mockFactory, MOCK_ADDRESS, mockStatusRecorder, mockMinaFactory); // when instance.bind(); // then verify(mockSshClient, times(1)).start(); - verify(mockAcceptor, times(1)).bind(mockAddress); + verify(mockAcceptor, times(1)).bind(MOCK_ADDRESS); } } diff --git a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/IetfZeroTouchCallHomeServerProvider.java b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/IetfZeroTouchCallHomeServerProvider.java index 30a10cd5fa..8bb21ffa51 100644 --- a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/IetfZeroTouchCallHomeServerProvider.java +++ b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/IetfZeroTouchCallHomeServerProvider.java @@ -11,6 +11,7 @@ package org.opendaylight.netconf.callhome.mount; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; import com.google.common.util.concurrent.ListenableFuture; +import io.netty.channel.nio.NioEventLoopGroup; import java.io.IOException; import java.net.InetSocketAddress; import java.util.Collection; @@ -106,6 +107,7 @@ public class IetfZeroTouchCallHomeServerProvider implements AutoCloseable, DataT if (port > 0) { builder.setBindAddress(new InetSocketAddress(port)); } + builder.setNettyGroup(new NioEventLoopGroup()); server = builder.build(); server.bind(); mountDispacher.createTopology(); diff --git a/netconf/mdsal-netconf-connector/pom.xml b/netconf/mdsal-netconf-connector/pom.xml index 488d7e71b9..6706a7a765 100644 --- a/netconf/mdsal-netconf-connector/pom.xml +++ b/netconf/mdsal-netconf-connector/pom.xml @@ -81,8 +81,8 @@ test - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy test diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete_children_operations_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete_children_operations_control.xml index 6ffb450bc9..ce4fd13a3a 100644 --- a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete_children_operations_control.xml +++ b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/editConfigs/editConfig_merge_multiple_operations_4_delete_children_operations_control.xml @@ -7,7 +7,5 @@ --> - - - - \ No newline at end of file + + diff --git a/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml b/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml index 9d785eedde..8f41697528 100755 --- a/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml +++ b/netconf/mdsal-netconf-impl/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-impl.xml @@ -67,7 +67,6 @@ - mockito-configuration - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types org.slf4j diff --git a/netconf/mdsal-netconf-yang-library/pom.xml b/netconf/mdsal-netconf-yang-library/pom.xml index 7d62436610..f88ca7ab30 100644 --- a/netconf/mdsal-netconf-yang-library/pom.xml +++ b/netconf/mdsal-netconf-yang-library/pom.xml @@ -32,11 +32,11 @@ sal-binding-api - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types - org.opendaylight.mdsal.model + org.opendaylight.mdsal.binding.model.ietf rfc7895 diff --git a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java index 177cb704ee..5ef20aeb54 100644 --- a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java +++ b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java @@ -63,9 +63,7 @@ class NetconfEventSourceMount { final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create(); moduleInfoBackedContext.addModuleInfos(Collections.singletonList(org.opendaylight.yang.gen.v1.urn.ietf.params .xml.ns.netmod.notification.rev080714.$YangModuleInfoImpl.getInstance())); - final Optional schemaContextOptional = moduleInfoBackedContext.tryToCreateSchemaContext(); - Preconditions.checkState(schemaContextOptional.isPresent()); - SchemaContext notificationsSchemaCtx = schemaContextOptional.get(); + SchemaContext notificationsSchemaCtx = moduleInfoBackedContext.tryToCreateSchemaContext().get(); final JavassistUtils javassist = JavassistUtils.forClassPool(ClassPool.getDefault()); CODEC_REGISTRY = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(javassist)); @@ -89,7 +87,7 @@ class NetconfEventSourceMount { this.dataBroker = getService(mountPoint, DOMDataBroker.class); } - private static T getService(DOMMountPoint mountPoint, Class service) { + private static T getService(final DOMMountPoint mountPoint, final Class service) { final Optional optional = mountPoint.getService(service); Preconditions.checkState(optional.isPresent(), "Service not present on mount point: %s", service.getName()); return optional.get(); @@ -166,8 +164,8 @@ class NetconfEventSourceMount { * @return ListenerRegistration * @see DOMNotificationService#registerNotificationListener(DOMNotificationListener, SchemaPath...) */ - ListenerRegistration registerNotificationListener(DOMNotificationListener listener, - SchemaPath notificationPath) { + ListenerRegistration registerNotificationListener(final DOMNotificationListener listener, + final SchemaPath notificationPath) { return notificationService.registerNotificationListener(listener, notificationPath); } diff --git a/netconf/models/ietf-netconf-monitoring/pom.xml b/netconf/models/ietf-netconf-monitoring/pom.xml index ef1ef3e4df..2c9cc9188c 100644 --- a/netconf/models/ietf-netconf-monitoring/pom.xml +++ b/netconf/models/ietf-netconf-monitoring/pom.xml @@ -24,12 +24,8 @@ - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 diff --git a/netconf/models/ietf-netconf-notifications/pom.xml b/netconf/models/ietf-netconf-notifications/pom.xml index 34406c4cd5..e2ab8493c7 100644 --- a/netconf/models/ietf-netconf-notifications/pom.xml +++ b/netconf/models/ietf-netconf-notifications/pom.xml @@ -29,12 +29,8 @@ ${project.version} - org.opendaylight.mdsal.model - ietf-yang-types-20130715 - - - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 diff --git a/netconf/models/ietf-netconf/pom.xml b/netconf/models/ietf-netconf/pom.xml index e300ff626a..77080eedf5 100644 --- a/netconf/models/ietf-netconf/pom.xml +++ b/netconf/models/ietf-netconf/pom.xml @@ -24,8 +24,8 @@ - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types diff --git a/netconf/models/pom.xml b/netconf/models/pom.xml index f9d6ae80cb..855497d754 100644 --- a/netconf/models/pom.xml +++ b/netconf/models/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/netconf/netconf-api/pom.xml b/netconf/netconf-api/pom.xml index f60435d284..51d2063d2e 100644 --- a/netconf/netconf-api/pom.xml +++ b/netconf/netconf-api/pom.xml @@ -36,12 +36,8 @@ protocol-framework - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 org.opendaylight.yangtools @@ -52,8 +48,8 @@ mockito-configuration - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy test diff --git a/netconf/netconf-artifacts/pom.xml b/netconf/netconf-artifacts/pom.xml index 8b47380730..3befd836ad 100644 --- a/netconf/netconf-artifacts/pom.xml +++ b/netconf/netconf-artifacts/pom.xml @@ -14,7 +14,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientDispatcherImplTest.java b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientDispatcherImplTest.java index 45019fede4..3a1e0d7024 100644 --- a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientDispatcherImplTest.java +++ b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientDispatcherImplTest.java @@ -9,7 +9,7 @@ package org.opendaylight.netconf.client; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import io.netty.channel.Channel; @@ -47,6 +47,8 @@ public class NetconfClientDispatcherImplTest { ChannelPromise promise = Mockito.mock(ChannelPromise.class); doReturn(promise).when(chf).addListener(any(GenericFutureListener.class)); doReturn(thr).when(chf).cause(); + doReturn(true).when(chf).isDone(); + doReturn(false).when(chf).isSuccess(); Long timeout = 200L; NetconfHelloMessageAdditionalHeader header = diff --git a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorTest.java b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorTest.java index 7b84cb0be4..b25de514c7 100644 --- a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorTest.java +++ b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorTest.java @@ -8,12 +8,11 @@ package org.opendaylight.netconf.client; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -30,6 +29,7 @@ import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelProgressivePromise; import io.netty.channel.ChannelPromise; import io.netty.channel.EventLoop; +import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.ssl.SslHandler; import io.netty.util.HashedWheelTimer; import io.netty.util.Timer; @@ -46,6 +46,7 @@ import org.opendaylight.netconf.api.NetconfMessage; import org.opendaylight.netconf.api.messages.NetconfHelloMessage; import org.opendaylight.netconf.api.xml.XmlUtil; import org.opendaylight.netconf.nettyutil.handler.ChunkedFramingMechanismEncoder; +import org.opendaylight.netconf.nettyutil.handler.NetconfEXIToMessageDecoder; import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder; import org.opendaylight.netconf.nettyutil.handler.NetconfXMLToMessageDecoder; import org.opendaylight.netconf.nettyutil.handler.exi.EXIParameters; @@ -82,8 +83,8 @@ public class NetconfClientSessionNegotiatorTest { doReturn("").when(ret).toString(); doReturn(future).when(ret).newPromise(); doReturn(future).when(ret).close(); - doReturn(future).when(ret).writeAndFlush(anyObject()); - doReturn(future).when(ret).writeAndFlush(anyObject(), anyObject()); + doReturn(future).when(ret).writeAndFlush(any()); + doReturn(future).when(ret).writeAndFlush(any(), any()); doReturn(true).when(ret).isOpen(); doReturn(pipeline).when(ret).pipeline(); doReturn("").when(pipeline).toString(); @@ -107,10 +108,14 @@ public class NetconfClientSessionNegotiatorTest { doReturn(handler).when(pipeline).replace(anyString(), anyString(), any(ChunkedFramingMechanismEncoder.class)); NetconfXMLToHelloMessageDecoder messageDecoder = new NetconfXMLToHelloMessageDecoder(); - doReturn(messageDecoder).when(pipeline).replace(anyString(), anyString(), any(NetconfXMLToMessageDecoder - .class)); - doReturn(pipeline).when(pipeline).replace(any(ChannelHandler.class), anyString(), any(NetconfClientSession - .class)); + doReturn(messageDecoder).when(pipeline).replace(anyString(), anyString(), + any(NetconfXMLToMessageDecoder.class)); + doReturn(pipeline).when(pipeline).replace(any(ChannelHandler.class), anyString(), + any(NetconfClientSession.class)); + doReturn(null).when(pipeline).replace(anyString(), anyString(), + any(MessageToByteEncoder.class)); + doReturn(null).when(pipeline).replace(anyString(), anyString(), + any(NetconfEXIToMessageDecoder.class)); return pipeline; } @@ -118,7 +123,7 @@ public class NetconfClientSessionNegotiatorTest { final EventLoop eventLoop = mock(EventLoop.class); doReturn(eventLoop).when(channel).eventLoop(); doAnswer(invocation -> { - invocation.getArgumentAt(0, Runnable.class).run(); + invocation.getArgument(0).run(); return null; }).when(eventLoop).execute(any(Runnable.class)); } @@ -152,21 +157,21 @@ public class NetconfClientSessionNegotiatorTest { @Test public void testNetconfClientSessionNegotiator() throws NetconfDocumentedException { Promise promise = mock(Promise.class); - doReturn(promise).when(promise).setSuccess(anyObject()); + doReturn(promise).when(promise).setSuccess(any()); NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null); negotiator.channelActive(null); Set caps = Sets.newSet("a", "b"); NetconfHelloMessage helloServerMessage = NetconfHelloMessage.createServerHello(caps, 10); negotiator.handleMessage(helloServerMessage); - verify(promise).setSuccess(anyObject()); + verify(promise).setSuccess(any()); } @Test public void testNegotiatorWhenChannelActiveHappenAfterHandleMessage() throws Exception { Promise promise = mock(Promise.class); doReturn(false).when(promise).isDone(); - doReturn(promise).when(promise).setSuccess(anyObject()); + doReturn(promise).when(promise).setSuccess(any()); NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null); Set caps = Sets.newSet("a", "b"); NetconfHelloMessage helloServerMessage = NetconfHelloMessage.createServerHello(caps, 10); @@ -174,7 +179,7 @@ public class NetconfClientSessionNegotiatorTest { negotiator.handleMessage(helloServerMessage); negotiator.channelActive(null); - verify(promise).setSuccess(anyObject()); + verify(promise).setSuccess(any()); } @@ -182,7 +187,7 @@ public class NetconfClientSessionNegotiatorTest { public void testNetconfClientSessionNegotiatorWithEXI() throws Exception { Promise promise = mock(Promise.class); NetconfStartExiMessage exiMessage = NetconfStartExiMessage.create(EXIParameters.empty(), "msg-id"); - doReturn(promise).when(promise).setSuccess(anyObject()); + doReturn(promise).when(promise).setSuccess(any()); NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, exiMessage); negotiator.channelActive(null); @@ -190,7 +195,7 @@ public class NetconfClientSessionNegotiatorTest { NetconfHelloMessage message = NetconfHelloMessage.createServerHello(caps, 10); doAnswer(invocationOnMock -> { - channelInboundHandlerAdapter = (ChannelInboundHandlerAdapter) invocationOnMock.getArguments()[2]; + channelInboundHandlerAdapter = invocationOnMock.getArgument(2); return null; }).when(pipeline).addAfter(anyString(), anyString(), any(ChannelHandler.class)); @@ -200,7 +205,7 @@ public class NetconfClientSessionNegotiatorTest { Document expectedResult = XmlFileLoader.xmlFileToDocument("netconfMessages/rpc-reply_ok.xml"); channelInboundHandlerAdapter.channelRead(handlerContext, new NetconfMessage(expectedResult)); - verify(promise).setSuccess(anyObject()); + verify(promise).setSuccess(any()); // two calls for exiMessage, 2 for hello message verify(pipeline, times(4)).replace(anyString(), anyString(), any(ChannelHandler.class)); @@ -209,7 +214,7 @@ public class NetconfClientSessionNegotiatorTest { @Test public void testNetconfClientSessionNegotiatorGetCached() throws Exception { Promise promise = mock(Promise.class); - doReturn(promise).when(promise).setSuccess(anyObject()); + doReturn(promise).when(promise).setSuccess(any()); NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class); NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null); diff --git a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListenerTest.java b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListenerTest.java index 68c1a762f0..ec891fcbdd 100644 --- a/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListenerTest.java +++ b/netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListenerTest.java @@ -61,7 +61,7 @@ public class SimpleNetconfClientSessionListenerTest { final EventLoop eventLoop = mock(EventLoop.class); doReturn(eventLoop).when(channel).eventLoop(); doAnswer(invocation -> { - invocation.getArgumentAt(0, Runnable.class).run(); + invocation.getArgument(0).run(); return null; }).when(eventLoop).execute(any(Runnable.class)); } diff --git a/netconf/netconf-config/pom.xml b/netconf/netconf-config/pom.xml index a57a3c51ad..577341f520 100644 --- a/netconf/netconf-config/pom.xml +++ b/netconf/netconf-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent bundle-parent - 3.1.3 + 4.0.2 diff --git a/netconf/netconf-console/src/test/java/org/opendaylight/netconf/console/commands/NetconfCommandsImplCallsTest.java b/netconf/netconf-console/src/test/java/org/opendaylight/netconf/console/commands/NetconfCommandsImplCallsTest.java index 2ceb066808..ccbcc41a60 100644 --- a/netconf/netconf-console/src/test/java/org/opendaylight/netconf/console/commands/NetconfCommandsImplCallsTest.java +++ b/netconf/netconf-console/src/test/java/org/opendaylight/netconf/console/commands/NetconfCommandsImplCallsTest.java @@ -10,8 +10,9 @@ package org.opendaylight.netconf.console.commands; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; @@ -122,7 +123,7 @@ public class NetconfCommandsImplCallsTest { netconfUpdateDeviceCommand.execute(); - verify(netconfCommands, times(1)).updateDevice(anyString(), anyString(), anyString(), + verify(netconfCommands, times(1)).updateDevice(isNull(), isNull(), isNull(), hashMapArgumentCaptor.capture()); assertTrue(hashMapArgumentCaptor.getValue().containsKey(NetconfConsoleConstants.NETCONF_IP)); diff --git a/netconf/netconf-impl/pom.xml b/netconf/netconf-impl/pom.xml index b1c3457fb4..c617dd19c2 100644 --- a/netconf/netconf-impl/pom.xml +++ b/netconf/netconf-impl/pom.xml @@ -110,8 +110,8 @@ - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy test diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java index 3dfd48b656..dbe9c0b7ee 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiatorFactory.java @@ -30,8 +30,6 @@ import org.opendaylight.protocol.framework.SessionNegotiator; import org.opendaylight.protocol.framework.SessionNegotiatorFactory; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorFactory { @@ -48,9 +46,15 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF private final NetconfOperationServiceFactory aggregatedOpService; private final long connectionTimeoutMillis; private final NetconfMonitoringService monitoringService; - private static final Logger LOG = LoggerFactory.getLogger(NetconfServerSessionNegotiatorFactory.class); private final Set baseCapabilities; + public NetconfServerSessionNegotiatorFactory(final Timer timer, + final NetconfOperationServiceFactory netconfOperationProvider, + final SessionIdProvider idProvider, final long connectionTimeoutMillis, + final NetconfMonitoringService monitoringService) { + this(timer, netconfOperationProvider, idProvider, connectionTimeoutMillis, monitoringService, null); + } + public NetconfServerSessionNegotiatorFactory(final Timer timer, final NetconfOperationServiceFactory netconfOperationProvider, final SessionIdProvider idProvider, final long connectionTimeoutMillis, @@ -65,7 +69,6 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF baseCapabilities); } - private static ImmutableSet validateBaseCapabilities(final Set baseCapabilities) { // Check base capabilities to be supported by the server final Sets.SetView unknownBaseCaps = Sets.difference(baseCapabilities, DEFAULT_BASE_CAPABILITIES); @@ -111,7 +114,6 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF final NetconfOperationRouter operationRouter = new NetconfOperationRouterImpl(service, monitoringService, netconfSessionIdForReporting); return new NetconfServerSessionListener(operationRouter, monitoringService, service); - } protected NetconfOperationService getOperationServiceForAddress(final String netconfSessionIdForReporting, @@ -132,5 +134,4 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF public static Set transformCapabilities(final Capabilities capabilities) { return Sets.newHashSet(Collections2.transform(capabilities.getCapability(), Uri::getValue)); } - } diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java index e7d5bb3e2d..316bfd3eb8 100644 --- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java +++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/NetconfServerSessionListenerTest.java @@ -8,8 +8,8 @@ package org.opendaylight.netconf.impl; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -18,11 +18,11 @@ import static org.mockito.Mockito.verify; import io.netty.channel.embedded.EmbeddedChannel; import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; -import org.hamcrest.CustomMatcher; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.netconf.api.NetconfMessage; @@ -154,17 +154,7 @@ public class NetconfServerSessionListenerTest { verify(monitoringListener).onSessionEvent(argThat(sessionEventIs(SessionEvent.Type.NOTIFICATION))); } - private CustomMatcher sessionEventIs(final SessionEvent.Type type) { - return new CustomMatcher(type.name()) { - @Override - public boolean matches(final Object item) { - if (!(item instanceof SessionEvent)) { - return false; - } - final SessionEvent e = (SessionEvent) item; - return e.getType().equals(type) && e.getSession().equals(session); - } - }; + private ArgumentMatcher sessionEventIs(final SessionEvent.Type type) { + return event -> event.getType().equals(type) && event.getSession().equals(session); } - } diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java index 1293329456..deddd88033 100644 --- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java +++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java @@ -8,8 +8,8 @@ package org.opendaylight.netconf.impl.mapping.operations; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -40,7 +40,7 @@ public class DefaultCloseSessionTest { final EventLoop eventLoop = mock(EventLoop.class); doReturn(eventLoop).when(channel).eventLoop(); doAnswer(invocation -> { - invocation.getArgumentAt(0, Runnable.class).run(); + invocation.getArgument(0).run(); return null; }).when(eventLoop).execute(any(Runnable.class)); doReturn(true).when(eventLoop).inEventLoop(); @@ -62,7 +62,7 @@ public class DefaultCloseSessionTest { final ChannelPromise sendFuture = mock(ChannelPromise.class); doAnswer(invocation -> { - invocation.getArgumentAt(0, GenericFutureListener.class).operationComplete(sendFuture); + invocation.getArgument(0).operationComplete(sendFuture); return null; }).when(sendFuture).addListener(any(GenericFutureListener.class)); doReturn(sendFuture).when(channel).newPromise(); diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfImplActivatorTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfImplActivatorTest.java index 5f8c6d2aa4..4e6a94c083 100644 --- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfImplActivatorTest.java +++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfImplActivatorTest.java @@ -8,8 +8,8 @@ package org.opendaylight.netconf.impl.osgi; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; @@ -36,17 +36,22 @@ public class NetconfImplActivatorTest { private ServiceReference reference; @Mock private ServiceRegistration registration; + @Mock + private ServiceRegistration monRegistration; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); doReturn(filter).when(bundle).createFilter(anyString()); - doNothing().when(bundle).addServiceListener(any(ServiceListener.class), anyString()); + doNothing().when(bundle).addServiceListener(any(ServiceListener.class), any()); ServiceReference[] refs = {}; - doReturn(refs).when(bundle).getServiceReferences(anyString(), anyString()); - doReturn(Arrays.asList(refs)).when(bundle).getServiceReferences(any(Class.class), anyString()); + doReturn(refs).when(bundle).getServiceReferences(anyString(), any()); + doReturn(Arrays.asList(refs)).when(bundle).getServiceReferences(any(Class.class), any()); doReturn("").when(bundle).getProperty(anyString()); + doReturn(monRegistration).when(bundle).registerService(any(Class.class), + any(NetconfMonitoringServiceImpl.class), any(Dictionary.class)); + doNothing().when(monRegistration).unregister(); doReturn(registration).when(bundle).registerService(any(Class.class), any(AggregatedNetconfOperationServiceFactory.class), any(Dictionary.class)); doNothing().when(registration).unregister(); @@ -57,7 +62,7 @@ public class NetconfImplActivatorTest { public void testStart() throws Exception { NetconfImplActivator activator = new NetconfImplActivator(); activator.start(bundle); - verify(bundle).registerService(any(Class.class), any(AggregatedNetconfOperationServiceFactory.class), + verify(bundle).registerService(any(Class.class), any(NetconfMonitoringServiceImpl.class), any(Dictionary.class)); activator.stop(bundle); } diff --git a/netconf/netconf-monitoring/pom.xml b/netconf/netconf-monitoring/pom.xml index 0b184088da..66f3c5ffd0 100644 --- a/netconf/netconf-monitoring/pom.xml +++ b/netconf/netconf-monitoring/pom.xml @@ -47,8 +47,8 @@ mockito-configuration - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types org.slf4j diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java index 6bf3be9f9e..c80937bb15 100644 --- a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java +++ b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java @@ -8,8 +8,8 @@ package org.opendaylight.netconf.monitoring.osgi; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; @@ -39,7 +39,7 @@ public class NetconfMonitoringActivatorTest { doNothing().when(context).addServiceListener(any(ServiceListener.class), anyString()); ServiceReference[] refs = new ServiceReference[2]; doReturn(Arrays.asList(refs)).when(context).getServiceReferences(any(Class.class), anyString()); - doReturn(refs).when(context).getServiceReferences(anyString(), anyString()); + doReturn(refs).when(context).getServiceReferences(anyString(), any()); doNothing().when(context).removeServiceListener(any(ServiceListener.class)); } diff --git a/netconf/netconf-netty-util/pom.xml b/netconf/netconf-netty-util/pom.xml index ad1c0ce312..0f7254bd24 100644 --- a/netconf/netconf-netty-util/pom.xml +++ b/netconf/netconf-netty-util/pom.xml @@ -57,7 +57,10 @@ org.apache.sshd sshd-core - 1.6.0 + + + org.apache.sshd + sshd-netty com.siemens.ct.exi @@ -73,8 +76,8 @@ slf4j-api - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy org.opendaylight.yangtools diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java index 96e54942df..f35372742e 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java @@ -12,6 +12,7 @@ import com.google.common.base.Preconditions; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Deque; import java.util.LinkedList; @@ -85,7 +86,7 @@ public final class AsyncSshHandlerWriter implements AutoCloseable { if (LOG.isTraceEnabled()) { LOG.trace("Writing request on channel: {}, message: {}", ctx.channel(), byteBufToString(byteBufMsg)); } - asyncIn.write(toBuffer(byteBufMsg)).addListener(future -> { + asyncIn.writePacket(toBuffer(byteBufMsg)).addListener(future -> { // synchronized block due to deadlock that happens on ssh window resize // writes and pending writes would lock the underlyinch channel session // window resize write would try to write the message on an already locked channelSession, @@ -122,8 +123,7 @@ public final class AsyncSshHandlerWriter implements AutoCloseable { writePendingIfAny(); }); - } catch (final WritePendingException e) { - + } catch (final IOException | WritePendingException e) { if (!wasPending) { queueRequest(ctx, byteBufMsg, promise); } diff --git a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionTest.java b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionTest.java index 3626fc008b..e978850545 100644 --- a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionTest.java +++ b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionTest.java @@ -9,8 +9,8 @@ package org.opendaylight.netconf.nettyutil; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -80,7 +80,7 @@ public class AbstractNetconfSessionTest { doReturn(eventLoop).when(channel).eventLoop(); doAnswer(invocation -> { - invocation.getArgumentAt(0, Runnable.class).run(); + invocation.getArgument(0).run(); return null; }).when(eventLoop).execute(any(Runnable.class)); diff --git a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java index 4023ece6db..bec8a3e021 100644 --- a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java +++ b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java @@ -5,13 +5,12 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.nettyutil.handler.ssh.client; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -57,7 +56,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler; @@ -218,8 +216,7 @@ public class AsyncSshHandlerTest { @Override public void onSuccess(final SshFutureListener result) { doReturn(new IllegalStateException()).when(mockedReadFuture).getException(); - doReturn(mockedReadFuture).when(mockedReadFuture) - .removeListener(Matchers.any()); + doReturn(mockedReadFuture).when(mockedReadFuture).removeListener(any()); doReturn(true).when(asyncOut).isClosing(); doReturn(true).when(asyncOut).isClosed(); result.operationComplete(mockedReadFuture); @@ -249,8 +246,7 @@ public class AsyncSshHandlerTest { @Override public void onSuccess(final SshFutureListener result) { doReturn(new IllegalStateException()).when(mockedReadFuture).getException(); - doReturn(mockedReadFuture).when(mockedReadFuture) - .removeListener(Matchers.any()); + doReturn(mockedReadFuture).when(mockedReadFuture).removeListener(any()); result.operationComplete(mockedReadFuture); } }, MoreExecutors.directExecutor()); @@ -294,7 +290,7 @@ public class AsyncSshHandlerTest { final IoInputStream asyncOut = getMockedIoInputStream(); final IoOutputStream asyncIn = getMockedIoOutputStream(); - final IoWriteFuture ioWriteFuture = asyncIn.write(null); + final IoWriteFuture ioWriteFuture = asyncIn.writePacket(new ByteArrayBuffer()); Futures.addCallback(stubAddListener(ioWriteFuture), new SuccessFutureListener() { @Override @@ -327,7 +323,7 @@ public class AsyncSshHandlerTest { final IoInputStream asyncOut = getMockedIoInputStream(); final IoOutputStream asyncIn = getMockedIoOutputStream(); - final IoWriteFuture ioWriteFuture = asyncIn.write(null); + final IoWriteFuture ioWriteFuture = asyncIn.writePacket(new ByteArrayBuffer()); final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn); final ClientSession sshSession = getMockedSshSession(subsystemChannel); @@ -351,10 +347,10 @@ public class AsyncSshHandlerTest { final ChannelPromise secondWritePromise = getMockedPromise(); // now make write throw pending exception - doThrow(org.apache.sshd.common.io.WritePendingException.class).when(asyncIn).write(any(Buffer.class)); + doThrow(org.apache.sshd.common.io.WritePendingException.class).when(asyncIn).writePacket(any(Buffer.class)); asyncSshHandler.write(ctx, Unpooled.copiedBuffer(new byte[]{0, 1, 2, 3, 4, 5}), secondWritePromise); - doReturn(ioWriteFuture).when(asyncIn).write(any(Buffer.class)); + doReturn(ioWriteFuture).when(asyncIn).writePacket(any(Buffer.class)); verifyZeroInteractions(firstWritePromise, secondWritePromise); @@ -376,7 +372,7 @@ public class AsyncSshHandlerTest { final IoInputStream asyncOut = getMockedIoInputStream(); final IoOutputStream asyncIn = getMockedIoOutputStream(); - final IoWriteFuture ioWriteFuture = asyncIn.write(null); + final IoWriteFuture ioWriteFuture = asyncIn.writePacket(new ByteArrayBuffer()); final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn); final ClientSession sshSession = getMockedSshSession(subsystemChannel); @@ -396,7 +392,7 @@ public class AsyncSshHandlerTest { final ChannelPromise secondWritePromise = getMockedPromise(); // now make write throw pending exception - doThrow(org.apache.sshd.common.io.WritePendingException.class).when(asyncIn).write(any(Buffer.class)); + doThrow(org.apache.sshd.common.io.WritePendingException.class).when(asyncIn).writePacket(any(Buffer.class)); for (int i = 0; i < 1001; i++) { asyncSshHandler.write(ctx, Unpooled.copiedBuffer(new byte[]{0, 1, 2, 3, 4, 5}), secondWritePromise); } @@ -490,10 +486,10 @@ public class AsyncSshHandlerTest { return subsystemChannel; } - private static IoOutputStream getMockedIoOutputStream() { + private static IoOutputStream getMockedIoOutputStream() throws IOException { final IoOutputStream mock = mock(IoOutputStream.class); final IoWriteFuture ioWriteFuture = mock(IoWriteFuture.class); - doReturn(ioWriteFuture).when(ioWriteFuture).addListener(Matchers.any()); + doReturn(ioWriteFuture).when(ioWriteFuture).addListener(any()); doReturn(true).when(ioWriteFuture).isWritten(); Futures.addCallback(stubAddListener(ioWriteFuture), new SuccessFutureListener() { @@ -503,7 +499,7 @@ public class AsyncSshHandlerTest { } }, MoreExecutors.directExecutor()); - doReturn(ioWriteFuture).when(mock).write(any(Buffer.class)); + doReturn(ioWriteFuture).when(mock).writePacket(any(Buffer.class)); doReturn(false).when(mock).isClosed(); doReturn(false).when(mock).isClosing(); return mock; @@ -513,10 +509,11 @@ public class AsyncSshHandlerTest { final IoInputStream mock = mock(IoInputStream.class); final IoReadFuture ioReadFuture = mock(IoReadFuture.class); doReturn(null).when(ioReadFuture).getException(); - doReturn(ioReadFuture).when(ioReadFuture).removeListener(Matchers.any()); + doReturn(ioReadFuture).when(ioReadFuture).removeListener(any()); + doReturn(ioReadFuture).when(mock).read(any()); doReturn(5).when(ioReadFuture).getRead(); doReturn(new ByteArrayBuffer(new byte[]{0, 1, 2, 3, 4})).when(ioReadFuture).getBuffer(); - doReturn(ioReadFuture).when(ioReadFuture).addListener(Matchers.any()); + doReturn(ioReadFuture).when(ioReadFuture).addListener(any()); // Always success for read Futures.addCallback(stubAddListener(ioReadFuture), new SuccessFutureListener() { diff --git a/netconf/netconf-notifications-impl/pom.xml b/netconf/netconf-notifications-impl/pom.xml index 2d60e0c4be..f2c2eeb94a 100644 --- a/netconf/netconf-notifications-impl/pom.xml +++ b/netconf/netconf-notifications-impl/pom.xml @@ -58,8 +58,8 @@ slf4j-api - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy org.opendaylight.yangtools diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java index ade7a35648..c9ceabda4a 100644 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java +++ b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java @@ -5,10 +5,8 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.notifications.impl.ops; -import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.Collections2; import com.google.common.collect.Iterables; @@ -16,6 +14,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.IOException; import java.util.Collections; import java.util.Date; +import java.util.Optional; import javassist.ClassPool; import javax.xml.stream.XMLStreamException; import javax.xml.transform.dom.DOMResult; @@ -33,22 +32,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.model.api.RpcDefinition; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaPath; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Document; public final class NotificationsTransformUtil { - - private static final Logger LOG = LoggerFactory.getLogger(NotificationsTransformUtil.class); - - private NotificationsTransformUtil() {} - static final SchemaContext NOTIFICATIONS_SCHEMA_CTX; static final BindingNormalizedNodeCodecRegistry CODEC_REGISTRY; static final RpcDefinition CREATE_SUBSCRIPTION_RPC; static { - final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create(); moduleInfoBackedContext.addModuleInfos(Collections.singletonList($YangModuleInfoImpl.getInstance())); moduleInfoBackedContext.addModuleInfos(Collections.singletonList(org.opendaylight.yang.gen.v1.urn.ietf.params @@ -67,6 +58,10 @@ public final class NotificationsTransformUtil { NOTIFICATIONS_SCHEMA_CTX)); } + private NotificationsTransformUtil() { + + } + @SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "Unrecognised NullableDecl") private static RpcDefinition findCreateSubscriptionRpc() { return Iterables.getFirst(Collections2.filter(NOTIFICATIONS_SCHEMA_CTX.getOperations(), @@ -76,17 +71,17 @@ public final class NotificationsTransformUtil { /** * Transform base notification for capabilities into NetconfNotification. */ - public static NetconfNotification transform(final Notification notification, SchemaPath path) { - return transform(notification, Optional.absent(), path); + public static NetconfNotification transform(final Notification notification, final SchemaPath path) { + return transform(notification, Optional.empty(), path); } - public static NetconfNotification transform(final Notification notification, - final Date eventTime, SchemaPath path) { - return transform(notification, Optional.fromNullable(eventTime), path); + public static NetconfNotification transform(final Notification notification, final Date eventTime, + final SchemaPath path) { + return transform(notification, Optional.ofNullable(eventTime), path); } - private static NetconfNotification transform(final Notification notification, - final Optional eventTime, SchemaPath path) { + private static NetconfNotification transform(final Notification notification, final Optional eventTime, + final SchemaPath path) { final ContainerNode containerNode = CODEC_REGISTRY.toNormalizedNodeNotification(notification); final DOMResult result = new DOMResult(XmlUtil.newDocument()); try { diff --git a/netconf/netconf-parent/pom.xml b/netconf/netconf-parent/pom.xml index 5b7423a756..49b1c04ce1 100644 --- a/netconf/netconf-parent/pom.xml +++ b/netconf/netconf-parent/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.mdsal binding-parent - 0.14.0-SNAPSHOT + 3.0.1 diff --git a/netconf/netconf-ssh/pom.xml b/netconf/netconf-ssh/pom.xml index 0fff720423..4fdaafe6c2 100644 --- a/netconf/netconf-ssh/pom.xml +++ b/netconf/netconf-ssh/pom.xml @@ -40,8 +40,8 @@ - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types com.google.guava diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/RemoteNetconfCommand.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/RemoteNetconfCommand.java index 733d81af1f..36313786b1 100644 --- a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/RemoteNetconfCommand.java +++ b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/RemoteNetconfCommand.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.ssh; import com.google.common.base.Preconditions; @@ -23,11 +22,11 @@ import java.net.SocketAddress; import org.apache.sshd.common.NamedFactory; import org.apache.sshd.common.io.IoInputStream; import org.apache.sshd.common.io.IoOutputStream; -import org.apache.sshd.server.AsyncCommand; -import org.apache.sshd.server.Command; import org.apache.sshd.server.Environment; import org.apache.sshd.server.ExitCallback; import org.apache.sshd.server.SessionAware; +import org.apache.sshd.server.command.AsyncCommand; +import org.apache.sshd.server.command.Command; import org.apache.sshd.server.session.ServerSession; import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader; import org.slf4j.Logger; diff --git a/netconf/netconf-topology-config/pom.xml b/netconf/netconf-topology-config/pom.xml index ed04cc141e..5248951b13 100644 --- a/netconf/netconf-topology-config/pom.xml +++ b/netconf/netconf-topology-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent bundle-parent - 3.1.3 + 4.0.2 diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java index 17ea6cf243..8056ad79d3 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java @@ -13,6 +13,7 @@ import akka.actor.ActorSystem; import akka.dispatch.OnComplete; import akka.pattern.Patterns; import akka.util.Timeout; +import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.SettableFuture; @@ -48,7 +49,7 @@ public class ProxyDOMRpcService implements DOMRpcService { private final ExceptionMapper domRpcExceptionMapper = new ExceptionMapper("invokeRpc", DOMRpcException.class) { @Override - protected DOMRpcException newWithCause(String message, Throwable cause) { + protected DOMRpcException newWithCause(final String message, final Throwable cause) { return new ClusteringRpcException(id + ": Exception during remote rpc invocation.", cause); } }; @@ -92,12 +93,12 @@ public class ProxyDOMRpcService implements DOMRpcService { return; } - final Collection errors = ((InvokeRpcMessageReply) response).getRpcErrors(); + final Collection errors = ((InvokeRpcMessageReply) response).getRpcErrors(); final NormalizedNodeMessage normalizedNodeMessageResult = ((InvokeRpcMessageReply) response).getNormalizedNodeMessage(); final DOMRpcResult result; if (normalizedNodeMessageResult == null) { - result = new DefaultDOMRpcResult(errors); + result = new DefaultDOMRpcResult(ImmutableList.copyOf(errors)); } else { result = new DefaultDOMRpcResult(normalizedNodeMessageResult.getNode(), errors); } diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java index 2f05f006a4..e43ab4030d 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java @@ -26,11 +26,11 @@ public class InvokeRpcMessageReply implements Serializable { private static final long serialVersionUID = 1L; @SuppressFBWarnings("SE_BAD_FIELD") - private final Collection rpcErrors; + private final Collection rpcErrors; private final NormalizedNodeMessage normalizedNodeMessage; public InvokeRpcMessageReply(@Nullable final NormalizedNodeMessage normalizedNodeMessage, - @Nonnull final Collection rpcErrors) { + @Nonnull final Collection rpcErrors) { this.normalizedNodeMessage = normalizedNodeMessage; this.rpcErrors = Objects.requireNonNull(rpcErrors); } @@ -41,7 +41,7 @@ public class InvokeRpcMessageReply implements Serializable { } @Nonnull - public Collection getRpcErrors() { + public Collection getRpcErrors() { return rpcErrors; } @@ -64,7 +64,7 @@ public class InvokeRpcMessageReply implements Serializable { } @Override - public void writeExternal(ObjectOutput out) throws IOException { + public void writeExternal(final ObjectOutput out) throws IOException { out.writeInt(invokeRpcMessageReply.getRpcErrors().size()); for (final RpcError rpcError : invokeRpcMessageReply.getRpcErrors()) { out.writeObject(rpcError); @@ -73,7 +73,7 @@ public class InvokeRpcMessageReply implements Serializable { } @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { final int size = in.readInt(); final Collection rpcErrors = new LinkedList<>(); for (int i = 0; i < size; i++) { diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java index c23046e86f..4fcf8aa0b6 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java @@ -14,7 +14,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; @@ -508,8 +508,8 @@ public class MountPointEndToEndTest { assertEquals(result.getResult(), actual.getResult()); assertEquals(result.getErrors().size(), actual.getErrors().size()); - Iterator iter1 = result.getErrors().iterator(); - Iterator iter2 = actual.getErrors().iterator(); + Iterator iter1 = result.getErrors().iterator(); + Iterator iter2 = actual.getErrors().iterator(); while (iter1.hasNext() && iter2.hasNext()) { RpcError err1 = iter1.next(); RpcError err2 = iter2.next(); diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java index 321f5817aa..694853e6f7 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java @@ -12,9 +12,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.after; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; @@ -56,7 +56,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.opendaylight.controller.cluster.schema.provider.impl.YangTextSchemaSourceSerializationProxy; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; @@ -543,7 +542,7 @@ public class NetconfNodeActorTest { return slaveRef; } - private void initializeMaster(List sourceIdentifiers) { + private void initializeMaster(final List sourceIdentifiers) { masterRef.tell(new CreateInitialMasterActorData(mockDOMDataBroker, sourceIdentifiers, mockDOMRpcService), testKit.getRef()); @@ -561,13 +560,7 @@ public class NetconfNodeActorTest { } private static PotentialSchemaSource withSourceId(final SourceIdentifier identifier) { - return argThat(new ArgumentMatcher>() { - @Override - public boolean matches(final Object argument) { - final PotentialSchemaSource potentialSchemaSource = (PotentialSchemaSource) argument; - return identifier.equals(potentialSchemaSource.getSourceIdentifier()); - } - }); + return argThat(argument -> identifier.equals(argument.getSourceIdentifier())); } private static String convertStreamToString(final InputStream is) { diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java index ca7b766323..c61d1f8e93 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java @@ -9,7 +9,7 @@ package org.opendaylight.netconf.topology.singleton.impl; import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -192,7 +192,7 @@ public class NetconfTopologyManagerTest { final DataObjectModification dataObjectModification1 = mock(DataObjectModification.class); doReturn(WRITE).when(dataObjectModification1).getModificationType(); doReturn(node1).when(dataObjectModification1).getDataAfter(); - doReturn(new InstanceIdentifier.IdentifiableItem<>(Node.class, new NodeKey(nodeId1))) + doReturn(InstanceIdentifier.IdentifiableItem.of(Node.class, new NodeKey(nodeId1))) .when(dataObjectModification1).getIdentifier(); final NetconfNode netconfNode2 = new NetconfNodeBuilder() @@ -206,7 +206,7 @@ public class NetconfTopologyManagerTest { final DataObjectModification dataObjectModification2 = mock(DataObjectModification.class); doReturn(WRITE).when(dataObjectModification2).getModificationType(); doReturn(node2).when(dataObjectModification2).getDataAfter(); - doReturn(new InstanceIdentifier.IdentifiableItem<>(Node.class, new NodeKey(nodeId2))) + doReturn(InstanceIdentifier.IdentifiableItem.of(Node.class, new NodeKey(nodeId2))) .when(dataObjectModification2).getIdentifier(); final NetconfTopologyContext mockContext1 = mock(NetconfTopologyContext.class); @@ -349,7 +349,7 @@ public class NetconfTopologyManagerTest { final DataObjectModification dataObjectModification = mock(DataObjectModification.class); doReturn(WRITE).when(dataObjectModification).getModificationType(); doReturn(node).when(dataObjectModification).getDataAfter(); - doReturn(new InstanceIdentifier.IdentifiableItem<>(Node.class, new NodeKey(nodeId))) + doReturn(InstanceIdentifier.IdentifiableItem.of(Node.class, new NodeKey(nodeId))) .when(dataObjectModification).getIdentifier(); final NetconfTopologyContext mockContext = mock(NetconfTopologyContext.class); diff --git a/netconf/netconf-util/pom.xml b/netconf/netconf-util/pom.xml index e41d2f3f0a..3b697f4bb5 100644 --- a/netconf/netconf-util/pom.xml +++ b/netconf/netconf-util/pom.xml @@ -45,8 +45,8 @@ slf4j-api - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy test diff --git a/netconf/pom.xml b/netconf/pom.xml index 4c170c7d9e..e4f4fb379e 100644 --- a/netconf/pom.xml +++ b/netconf/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/netconf/sal-netconf-connector/pom.xml b/netconf/sal-netconf-connector/pom.xml index 9a49ee1fa6..f285c84f48 100644 --- a/netconf/sal-netconf-connector/pom.xml +++ b/netconf/sal-netconf-connector/pom.xml @@ -40,7 +40,7 @@ ietf-netconf-notifications - org.opendaylight.mdsal.model + org.opendaylight.mdsal.binding.model.ietf rfc7895 @@ -92,8 +92,8 @@ yang-data-codec-xml - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-inet-types org.opendaylight.mdsal.model @@ -104,8 +104,8 @@ slf4j-api - xmlunit - xmlunit + org.xmlunit + xmlunit-legacy ${project.groupId} diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java index 2eb98bb305..0d880f2dc5 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java @@ -27,6 +27,7 @@ import org.opendaylight.netconf.api.NetconfMessage; import org.opendaylight.netconf.sal.connect.api.MessageTransformer; import org.opendaylight.netconf.sal.connect.api.RemoteDeviceCommunicator; import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.concepts.NoOpListenerRegistration; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -77,25 +78,7 @@ public final class NetconfDeviceRpc implements DOMRpcService { listener.onRpcAvailable(Collections2.transform(schemaContext.getOperations(), input -> DOMRpcIdentifier.create(input.getPath()))); - return new NoOpListenerRegistration<>(listener); - } - - private static final class NoOpListenerRegistration - implements ListenerRegistration { - private final T listener; - - NoOpListenerRegistration(final T listener) { - this.listener = requireNonNull(listener); - } - - @Override - public T getInstance() { - return listener; - } - - @Override - public void close() { - // NOOP, no rpcs appear and disappear in this implementation - } + // NOOP, no rpcs appear and disappear in this implementation + return NoOpListenerRegistration.of(listener); } } diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDeviceTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDeviceTest.java index a7e0de26db..47e38a7a2d 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDeviceTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDeviceTest.java @@ -8,9 +8,10 @@ package org.opendaylight.netconf.sal.connect.netconf; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyCollectionOf; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyCollectionOf; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.after; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; @@ -161,8 +162,7 @@ public class NetconfDeviceTest { device.onRemoteSessionUp(sessionCaps, listener); Mockito.verify(facade, Mockito.timeout(5000)).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), - any(DOMActionService.class)); + any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), isNull()); Mockito.verify(schemaFactory, times(2)).createSchemaContext(anyCollectionOf(SourceIdentifier.class)); } @@ -249,8 +249,7 @@ public class NetconfDeviceTest { device.onRemoteSessionUp(sessionCaps, listener); Mockito.verify(facade, Mockito.timeout(5000)).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), - any(DOMActionService.class)); + any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class), isNull()); Mockito.verify(schemaFactory, times(1)).createSchemaContext(anyCollectionOf(SourceIdentifier.class)); } @@ -329,7 +328,7 @@ public class NetconfDeviceTest { verify(schemaContextProviderFactory, timeout(5000)).createSchemaContext(any(Collection.class)); verify(facade, timeout(5000)).onDeviceConnected( any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), - any(DOMActionService.class)); + isNull()); device.onRemoteSessionDown(); verify(facade, timeout(5000)).onDeviceDisconnected(); @@ -339,7 +338,7 @@ public class NetconfDeviceTest { verify(schemaContextProviderFactory, timeout(5000).times(2)).createSchemaContext(any(Collection.class)); verify(facade, timeout(5000).times(2)).onDeviceConnected( any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), - any(DOMActionService.class)); + isNull()); } @Test @@ -402,8 +401,7 @@ public class NetconfDeviceTest { final ArgumentCaptor argument = ArgumentCaptor.forClass(NetconfSessionPreferences.class); verify(facade, timeout(5000)) - .onDeviceConnected(any(SchemaContext.class), argument.capture(), any(DOMRpcService.class), - any(DOMActionService.class)); + .onDeviceConnected(any(SchemaContext.class), argument.capture(), any(DOMRpcService.class), isNull()); final NetconfDeviceCapabilities netconfDeviceCaps = argument.getValue().getNetconfDeviceCapabilities(); netconfDeviceCaps.getResolvedCapabilities() diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/SchemalessNetconfDeviceTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/SchemalessNetconfDeviceTest.java index 07bed0593d..3466294510 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/SchemalessNetconfDeviceTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/SchemalessNetconfDeviceTest.java @@ -8,7 +8,8 @@ package org.opendaylight.netconf.sal.connect.netconf; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -59,7 +60,7 @@ public class SchemalessNetconfDeviceTest { any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class)); device.onNotification(netconfMessage); - verify(facade).onNotification(any(DOMNotification.class)); + verify(facade).onNotification(isNull()); device.onRemoteSessionDown(); verify(facade).onDeviceDisconnected(); diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacadeTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacadeTest.java index 30a67cb79c..1c91423521 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacadeTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacadeTest.java @@ -7,7 +7,8 @@ */ package org.opendaylight.netconf.sal.connect.netconf.sal; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -102,13 +103,16 @@ public class KeepaliveSalFacadeTest { final DOMRpcResult result = new DefaultDOMRpcResult(Builders.containerBuilder().withNodeIdentifier( new YangInstanceIdentifier.NodeIdentifier(NetconfMessageTransformUtil.NETCONF_RUNNING_QNAME)).build()); + doReturn(Futures.immediateCheckedFuture(result)) + .when(deviceRpc).invokeRpc(any(SchemaPath.class), isNull()); + doReturn(Futures.immediateCheckedFuture(result)) .when(deviceRpc).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); keepaliveSalFacade.onDeviceConnected(null, null, deviceRpc); verify(underlyingSalFacade).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), any()); + isNull(), isNull(), any(DOMRpcService.class), isNull()); verify(deviceRpc, timeout(15000).times(5)).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); } @@ -121,8 +125,7 @@ public class KeepaliveSalFacadeTest { keepaliveSalFacade.onDeviceConnected(null, null, deviceRpc); - verify(underlyingSalFacade).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), any()); + verify(underlyingSalFacade).onDeviceConnected(isNull(), isNull(), any(DOMRpcService.class), isNull()); // Should disconnect the session verify(listener, timeout(15000).times(1)).disconnect(); @@ -139,8 +142,8 @@ public class KeepaliveSalFacadeTest { keepaliveSalFacade.onDeviceConnected(null, null, deviceRpc); - verify(underlyingSalFacade).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), any()); + verify(underlyingSalFacade).onDeviceConnected(isNull(), isNull(), any(DOMRpcService.class), isNull()); + // Shouldn't disconnect the session verify(listener, times(0)).disconnect(); @@ -153,8 +156,7 @@ public class KeepaliveSalFacadeTest { invocationOnMock -> { proxyRpc = (DOMRpcService) invocationOnMock.getArguments()[2]; return null; - }).when(underlyingSalFacade).onDeviceConnected( - any(SchemaContext.class), any(NetconfSessionPreferences.class), any(DOMRpcService.class), any()); + }).when(underlyingSalFacade).onDeviceConnected(isNull(), isNull(), any(DOMRpcService.class), isNull()); doReturn(Futures.immediateFailedCheckedFuture(new IllegalStateException("illegal-state"))) .when(deviceRpc).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java index c96a6741d1..d93e24e158 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java @@ -8,8 +8,9 @@ package org.opendaylight.netconf.sal.connect.netconf.sal; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -23,7 +24,6 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.controller.md.sal.dom.api.DOMActionService; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.api.DOMNotification; import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; @@ -97,7 +97,7 @@ public class NetconfDeviceSalFacadeTest { verify(mountInstance, times(1)).onTopologyDeviceConnected(eq(schemaContext), any(DOMDataBroker.class), eq(deviceRpc), any(NetconfDeviceNotificationService.class), - any(DOMActionService.class)); + isNull()); verify(netconfDeviceTopologyAdapter, times(1)).updateDeviceData(true, netconfSessionPreferences.getNetconfDeviceCapabilities()); } diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java index 91879669b3..7461a14849 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java @@ -8,7 +8,7 @@ package org.opendaylight.netconf.sal.connect.netconf.sal; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; @@ -116,7 +116,7 @@ public class NetconfDeviceTopologyAdapterTest { verify(txChain, times(2)).newWriteOnlyTransaction(); verify(writeTx, times(1)) - .put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(NetconfNode.class)); + .put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); adapter.close(); adapter = new NetconfDeviceTopologyAdapter(id, transactionChain); //not a mock @@ -140,7 +140,7 @@ public class NetconfDeviceTopologyAdapterTest { verify(txChain, times(2)).newWriteOnlyTransaction(); verify(writeTx, times(1)) - .put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(NetconfNode.class)); + .put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); verify(writeTx, times(1)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); } diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java index 583ab79b6e..95e177a1f1 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java @@ -9,8 +9,9 @@ package org.opendaylight.netconf.sal.connect.netconf.sal.tx; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.atMost; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.inOrder; @@ -88,6 +89,9 @@ public class NetconfDeviceWriteOnlyTxTest { @Test public void testDiscardChanges() throws InterruptedException { + doReturn(Futures.immediateCheckedFuture(new DefaultDOMRpcResult((NormalizedNode) null))) + .when(rpc).invokeRpc(any(SchemaPath.class), isNull()); + final WriteCandidateTx tx = new WriteCandidateTx(id, new NetconfBaseOps(rpc, mock(SchemaContext.class)), false); try { @@ -100,7 +104,7 @@ public class NetconfDeviceWriteOnlyTxTest { inOrder.verify(rpc).invokeRpc(toPath(NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME), NetconfMessageTransformUtil.COMMIT_RPC_CONTENT); inOrder.verify(rpc).invokeRpc(eq(toPath(NetconfMessageTransformUtil.NETCONF_DISCARD_CHANGES_QNAME)), - any(NormalizedNode.class)); + isNull()); inOrder.verify(rpc).invokeRpc(toPath(NetconfMessageTransformUtil.NETCONF_UNLOCK_QNAME), NetconfBaseOps.getUnLockContent(NETCONF_CANDIDATE_QNAME)); return; @@ -168,7 +172,7 @@ public class NetconfDeviceWriteOnlyTxTest { @Test public void testListenerCancellation() throws Exception { doReturn(Futures.immediateCheckedFuture(new DefaultDOMRpcResult((NormalizedNode) null))) - .when(rpc).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); + .when(rpc).invokeRpc(any(SchemaPath.class), isNull()); final WriteCandidateTx tx = new WriteCandidateTx( id, new NetconfBaseOps(rpc, BaseSchema.BASE_NETCONF_CTX.getSchemaContext()), false); final TxListener listener = mock(TxListener.class); diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOpsTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOpsTest.java index 4ece5f4ae3..47e12ca608 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOpsTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOpsTest.java @@ -8,9 +8,9 @@ package org.opendaylight.netconf.sal.connect.netconf.util; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -22,11 +22,10 @@ import java.util.ArrayList; import java.util.List; import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; @@ -268,7 +267,7 @@ public class NetconfBaseOpsTest { } } - private static class NetconfMessageMatcher extends BaseMatcher { + private static class NetconfMessageMatcher implements ArgumentMatcher { private final Document expected; @@ -277,11 +276,7 @@ public class NetconfBaseOpsTest { } @Override - public boolean matches(final Object item) { - if (!(item instanceof NetconfMessage)) { - return false; - } - final NetconfMessage message = (NetconfMessage) item; + public boolean matches(final NetconfMessage message) { final Document actualDoc = removeAttrs(message.getDocument()); actualDoc.normalizeDocument(); expected.normalizeDocument(); @@ -289,11 +284,6 @@ public class NetconfBaseOpsTest { return diff.similar(); } - @Override - public void describeTo(final Description description) { - description.appendText(XmlUtil.toString(expected)); - } - private static Document removeAttrs(final Document input) { final Document copy = XmlUtil.newDocument(); copy.appendChild(copy.importNode(input.getDocumentElement(), true)); diff --git a/netconf/tools/netconf-testtool/pom.xml b/netconf/tools/netconf-testtool/pom.xml index 785fc63439..9b659c328a 100644 --- a/netconf/tools/netconf-testtool/pom.xml +++ b/netconf/tools/netconf-testtool/pom.xml @@ -98,12 +98,8 @@ netconf-client - org.opendaylight.mdsal.model - ietf-yang-types-20130715 - - - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 ${project.groupId} diff --git a/netconf/tools/pom.xml b/netconf/tools/pom.xml index a96b375e33..85e438e0dc 100644 --- a/netconf/tools/pom.xml +++ b/netconf/tools/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/netconf/yanglib/pom.xml b/netconf/yanglib/pom.xml index f3288dc3e9..4daffcdf45 100644 --- a/netconf/yanglib/pom.xml +++ b/netconf/yanglib/pom.xml @@ -47,7 +47,7 @@ guava - org.opendaylight.mdsal.model + org.opendaylight.mdsal.binding.model.ietf rfc7895 diff --git a/pom.xml b/pom.xml index 13a0be6d76..591144c3c2 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/protocol-framework/pom.xml b/protocol-framework/pom.xml index d66078b4ba..741e57ffe4 100644 --- a/protocol-framework/pom.xml +++ b/protocol-framework/pom.xml @@ -7,7 +7,7 @@ org.opendaylight.odlparent bundle-parent - 3.1.3 + 4.0.2 @@ -48,7 +48,7 @@ org.opendaylight.yangtools mockito-configuration - 2.0.10 + 2.1.2 test diff --git a/restconf/pom.xml b/restconf/pom.xml index 919bad178b..c2f1fe2f24 100644 --- a/restconf/pom.xml +++ b/restconf/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/restconf/restconf-artifacts/pom.xml b/restconf/restconf-artifacts/pom.xml index 2bbac47576..d4e76d1f10 100644 --- a/restconf/restconf-artifacts/pom.xml +++ b/restconf/restconf-artifacts/pom.xml @@ -13,7 +13,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java index 3f1f458fb3..0d1868e03d 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java @@ -139,7 +139,7 @@ public class RestconfDocumentedException extends WebApplicationException { * Constructs an instance with the given RpcErrors. */ public RestconfDocumentedException(final String message, final Throwable cause, - final Collection rpcErrors) { + final Collection rpcErrors) { this(message, cause, convertToRestconfErrors(rpcErrors)); } @@ -162,7 +162,7 @@ public class RestconfDocumentedException extends WebApplicationException { status = null; } - private static List convertToRestconfErrors(final Collection rpcErrors) { + private static List convertToRestconfErrors(final Collection rpcErrors) { final List errorList = Lists.newArrayList(); if (rpcErrors != null) { for (RpcError rpcError : rpcErrors) { diff --git a/restconf/restconf-models/ietf-restconf-monitoring/pom.xml b/restconf/restconf-models/ietf-restconf-monitoring/pom.xml index 7f0bdf2ace..0420879932 100644 --- a/restconf/restconf-models/ietf-restconf-monitoring/pom.xml +++ b/restconf/restconf-models/ietf-restconf-monitoring/pom.xml @@ -25,12 +25,8 @@ - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 diff --git a/restconf/restconf-models/ietf-restconf/pom.xml b/restconf/restconf-models/ietf-restconf/pom.xml index 6cb9892c99..2d50442a05 100644 --- a/restconf/restconf-models/ietf-restconf/pom.xml +++ b/restconf/restconf-models/ietf-restconf/pom.xml @@ -25,12 +25,8 @@ - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 diff --git a/restconf/restconf-models/pom.xml b/restconf/restconf-models/pom.xml index 8407178fba..55ae9bb364 100644 --- a/restconf/restconf-models/pom.xml +++ b/restconf/restconf-models/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/restconf/restconf-nb-bierman02/pom.xml b/restconf/restconf-nb-bierman02/pom.xml index ff5c2e3b4a..5a0eb09af4 100644 --- a/restconf/restconf-nb-bierman02/pom.xml +++ b/restconf/restconf-nb-bierman02/pom.xml @@ -32,7 +32,6 @@ org.glassfish.jersey.bundles.repackaged jersey-guava - 2.6 test @@ -88,12 +87,8 @@ ietf-restconf - org.opendaylight.mdsal.model - ietf-yang-types-20130715 - - - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 + org.opendaylight.mdsal.binding.model.ietf + rfc6991 org.slf4j @@ -121,7 +116,7 @@ yang-model-export - org.opendaylight.mdsal.model + org.opendaylight.mdsal.binding.model.ietf rfc7895 diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/md/sal/rest/common/TestRestconfUtils.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/md/sal/rest/common/TestRestconfUtils.java index 8ef05653da..f5eb340cf4 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/md/sal/rest/common/TestRestconfUtils.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/md/sal/rest/common/TestRestconfUtils.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.md.sal.rest.common; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -66,17 +66,16 @@ public final class TestRestconfUtils { } public static ControllerContext newControllerContext(SchemaContext schemaContext, DOMMountPoint mountInstance) { + final DOMMountPointService mockMountService = mock(DOMMountPointService.class); + if (mountInstance != null) { doReturn(schemaContext).when(mountInstance).getSchemaContext(); + doReturn(Optional.fromNullable(mountInstance)).when(mockMountService) + .getMountPoint(any(YangInstanceIdentifier.class)); } - final DOMMountPointService mockMountService = mock(DOMMountPointService.class); - doReturn(Optional.fromNullable(mountInstance)).when(mockMountService) - .getMountPoint(any(YangInstanceIdentifier.class)); - DOMSchemaService mockSchemaService = mock(DOMSchemaService.class); doReturn(schemaContext).when(mockSchemaService).getGlobalContext(); - doReturn(ImmutableClassToInstanceMap.of()).when(mockSchemaService).getExtensions(); DOMSchemaService mockDomSchemaService = mock(DOMSchemaService.class); doReturn(ImmutableClassToInstanceMap.of()).when(mockDomSchemaService).getExtensions(); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java index 8bbfae9342..1053e73d63 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java @@ -13,8 +13,9 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -164,7 +165,7 @@ public class InvokeRpcMethodTest { final QName qname = QName.create("(http://netconfcentral.org/ns/toaster?revision=2009-11-20)cancel-toast"); final SchemaPath type = SchemaPath.create(true, qname); - when(brokerFacade.invokeRpc(eq(type), any(NormalizedNode.class))).thenReturn(future); + when(brokerFacade.invokeRpc(eq(type), isNull())).thenReturn(future); try { this.restconfImpl.invokeRpc("toaster:cancel-toast", "", uriInfo); @@ -211,7 +212,7 @@ public class InvokeRpcMethodTest { final SchemaPath path = SchemaPath.create(true, QName.create("(http://netconfcentral.org/ns/toaster?revision=2009-11-20)cancel-toast")); - when(brokerFacade.invokeRpc(eq(path), any(NormalizedNode.class))).thenReturn(future); + when(brokerFacade.invokeRpc(eq(path), isNull())).thenReturn(future); try { this.restconfImpl.invokeRpc("toaster:cancel-toast", "", uriInfo); @@ -233,7 +234,7 @@ public class InvokeRpcMethodTest { final QName qname = QName.create("(http://netconfcentral.org/ns/toaster?revision=2009-11-20)cancel-toast"); final SchemaPath path = SchemaPath.create(true, qname); - when(brokerFacade.invokeRpc(eq(path), any(NormalizedNode.class))).thenReturn(future); + when(brokerFacade.invokeRpc(eq(path), isNull())).thenReturn(future); final NormalizedNodeContext output = this.restconfImpl.invokeRpc("toaster:cancel-toast", "", uriInfo); assertNotNull(output); @@ -352,7 +353,7 @@ public class InvokeRpcMethodTest { final DOMRpcResult result = new DefaultDOMRpcResult(container); final CheckedFuture future = Futures.immediateCheckedFuture(result); - when(brokerFacade.invokeRpc(eq(rpcDef.getPath()), any(NormalizedNode.class))).thenReturn(future); + when(brokerFacade.invokeRpc(eq(rpcDef.getPath()), isNull())).thenReturn(future); final NormalizedNodeContext output = this.restconfImpl.invokeRpc("toaster:testOutput", "", uriInfo); assertNotNull(output); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/JSONRestconfServiceImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/JSONRestconfServiceImplTest.java index 5f45287441..df815ad1d2 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/JSONRestconfServiceImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/JSONRestconfServiceImplTest.java @@ -12,11 +12,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Matchers.notNull; -import static org.mockito.Matchers.same; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.notNull; +import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -137,8 +137,8 @@ public class JSONRestconfServiceImplTest { public void testPut() throws Exception { final PutResult result = mock(PutResult.class); when(brokerFacade.commitConfigurationDataPut(notNull(SchemaContext.class), - notNull(YangInstanceIdentifier.class), notNull(NormalizedNode.class), Mockito.anyString(), - Mockito.anyString())).thenReturn(result); + notNull(YangInstanceIdentifier.class), notNull(NormalizedNode.class), isNull(), isNull())) + .thenReturn(result); when(result.getFutureOfPutData()) .thenReturn(Futures.immediateCheckedFuture(null)); when(result.getStatus()).thenReturn(Status.OK); @@ -150,7 +150,7 @@ public class JSONRestconfServiceImplTest { ArgumentCaptor.forClass(YangInstanceIdentifier.class); final ArgumentCaptor capturedNode = ArgumentCaptor.forClass(NormalizedNode.class); verify(brokerFacade).commitConfigurationDataPut(notNull(SchemaContext.class), capturedPath.capture(), - capturedNode.capture(), Mockito.anyString(), Mockito.anyString()); + capturedNode.capture(), isNull(), isNull()); verifyPath(capturedPath.getValue(), INTERFACES_QNAME, INTERFACE_QNAME, new Object[]{INTERFACE_QNAME, NAME_QNAME, "eth0"}); @@ -170,8 +170,8 @@ public class JSONRestconfServiceImplTest { public void testPutBehindMountPoint() throws Exception { final PutResult result = mock(PutResult.class); when(brokerFacade.commitMountPointDataPut(notNull(DOMMountPoint.class), - notNull(YangInstanceIdentifier.class), notNull(NormalizedNode.class), Mockito.anyString(), - Mockito.anyString())).thenReturn(result); + notNull(YangInstanceIdentifier.class), notNull(NormalizedNode.class), isNull(), isNull())) + .thenReturn(result); when(result.getFutureOfPutData()).thenReturn(Futures.immediateCheckedFuture(null)); when(result.getStatus()).thenReturn(Status.OK); final String uriPath = "ietf-interfaces:interfaces/yang-ext:mount/test-module:cont/cont1"; @@ -183,7 +183,7 @@ public class JSONRestconfServiceImplTest { ArgumentCaptor.forClass(YangInstanceIdentifier.class); final ArgumentCaptor capturedNode = ArgumentCaptor.forClass(NormalizedNode.class); verify(brokerFacade).commitMountPointDataPut(same(mockMountPoint), capturedPath.capture(), - capturedNode.capture(), Mockito.anyString(), Mockito.anyString()); + capturedNode.capture(), isNull(), isNull()); verifyPath(capturedPath.getValue(), TEST_CONT_QNAME, TEST_CONT1_QNAME); @@ -217,7 +217,7 @@ public class JSONRestconfServiceImplTest { public void testPost() throws Exception { doReturn(Futures.immediateCheckedFuture(null)).when(brokerFacade).commitConfigurationDataPost( any(SchemaContext.class), any(YangInstanceIdentifier.class), any(NormalizedNode.class), - Mockito.anyString(), Mockito.anyString()); + isNull(), isNull()); final String uriPath = null; final String payload = loadData("/parts/ietf-interfaces_interfaces_absolute_path.json"); @@ -228,7 +228,7 @@ public class JSONRestconfServiceImplTest { ArgumentCaptor.forClass(YangInstanceIdentifier.class); final ArgumentCaptor capturedNode = ArgumentCaptor.forClass(NormalizedNode.class); verify(brokerFacade).commitConfigurationDataPost(notNull(SchemaContext.class), capturedPath.capture(), - capturedNode.capture(), Mockito.anyString(), Mockito.anyString()); + capturedNode.capture(), isNull(), isNull()); verifyPath(capturedPath.getValue(), INTERFACES_QNAME); @@ -258,7 +258,7 @@ public class JSONRestconfServiceImplTest { public void testPostBehindMountPoint() throws Exception { doReturn(Futures.immediateCheckedFuture(null)).when(brokerFacade).commitConfigurationDataPost( notNull(DOMMountPoint.class), notNull(YangInstanceIdentifier.class), notNull(NormalizedNode.class), - Mockito.anyString(), Mockito.anyString()); + isNull(), isNull()); final String uriPath = "ietf-interfaces:interfaces/yang-ext:mount/test-module:cont"; final String payload = loadData("/full-versions/testCont1Data.json"); @@ -269,7 +269,7 @@ public class JSONRestconfServiceImplTest { ArgumentCaptor.forClass(YangInstanceIdentifier.class); final ArgumentCaptor capturedNode = ArgumentCaptor.forClass(NormalizedNode.class); verify(brokerFacade).commitConfigurationDataPost(same(mockMountPoint), capturedPath.capture(), - capturedNode.capture(), Mockito.anyString(), Mockito.anyString()); + capturedNode.capture(), isNull(), isNull()); verifyPath(capturedPath.getValue(), TEST_CONT_QNAME, TEST_CONT1_QNAME); @@ -285,7 +285,7 @@ public class JSONRestconfServiceImplTest { public void testPostFailure() throws Throwable { doReturn(Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException("mock"))).when(brokerFacade) .commitConfigurationDataPost(any(SchemaContext.class), any(YangInstanceIdentifier.class), - any(NormalizedNode.class), Mockito.anyString(), Mockito.anyString()); + any(NormalizedNode.class), isNull(), isNull()); final String uriPath = null; final String payload = loadData("/parts/ietf-interfaces_interfaces_absolute_path.json"); @@ -445,7 +445,7 @@ public class JSONRestconfServiceImplTest { final DOMRpcResult expResult = new DefaultDOMRpcResult((NormalizedNode)null); doReturn(Futures.immediateCheckedFuture(expResult)).when(brokerFacade).invokeRpc(any(SchemaPath.class), - any(NormalizedNode.class)); + isNull()); final String uriPath = "toaster:cancel-toast"; @@ -453,7 +453,7 @@ public class JSONRestconfServiceImplTest { assertEquals("Output present", false, output.isPresent()); - verify(brokerFacade).invokeRpc(eq(path), isNull(NormalizedNode.class)); + verify(brokerFacade).invokeRpc(eq(path), isNull()); } @Test @@ -465,7 +465,7 @@ public class JSONRestconfServiceImplTest { .withChild(ImmutableNodes.leafNode(TEXT_OUT_QNAME, "foo")).build(); final DOMRpcResult expResult = new DefaultDOMRpcResult(outputNode); doReturn(Futures.immediateCheckedFuture(expResult)).when(brokerFacade).invokeRpc(any(SchemaPath.class), - any(NormalizedNode.class)); + isNull()); final String uriPath = "toaster:testOutput"; @@ -475,7 +475,7 @@ public class JSONRestconfServiceImplTest { assertNotNull("Returned null response", output.get()); assertThat("Missing \"textOut\"", output.get(), containsString("\"textOut\":\"foo\"")); - verify(brokerFacade).invokeRpc(eq(path), isNull(NormalizedNode.class)); + verify(brokerFacade).invokeRpc(eq(path), isNull()); } @Test(expected = OperationFailedException.class) @@ -499,7 +499,7 @@ public class JSONRestconfServiceImplTest { if (datastoreType == LogicalDatastoreType.CONFIGURATION) { doReturn(entryNode).when(brokerFacade).readConfigurationData(notNull(YangInstanceIdentifier.class), - Mockito.anyString()); + isNull()); } else { doReturn(entryNode).when(brokerFacade).readOperationalData(notNull(YangInstanceIdentifier.class)); } @@ -519,7 +519,7 @@ public class JSONRestconfServiceImplTest { final ArgumentCaptor capturedPath = ArgumentCaptor.forClass(YangInstanceIdentifier.class); if (datastoreType == LogicalDatastoreType.CONFIGURATION) { - verify(brokerFacade).readConfigurationData(capturedPath.capture(), Mockito.anyString()); + verify(brokerFacade).readConfigurationData(capturedPath.capture(), isNull()); } else { verify(brokerFacade).readOperationalData(capturedPath.capture()); } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java index d8b7c52962..3ee8778419 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java @@ -14,8 +14,9 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -40,7 +41,6 @@ import org.glassfish.jersey.test.JerseyTest; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import org.mockito.Mockito; import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader; @@ -169,8 +169,7 @@ public class RestGetOperationTest extends JerseyTest { @Test public void getDataWithUrlMountPoint() throws Exception { when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), any(YangInstanceIdentifier.class), - Mockito.anyString())).thenReturn( - prepareCnDataForMountPointTest(false)); + isNull())).thenReturn(prepareCnDataForMountPointTest(false)); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); String uri = "/config/ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/cont1"; @@ -192,7 +191,7 @@ public class RestGetOperationTest extends JerseyTest { public void getDataWithSlashesBehindMountPoint() throws Exception { final YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList(); when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), eq(awaitedInstanceIdentifier), - Mockito.anyString())).thenReturn(prepareCnDataForSlashesBehindMountPointTest()); + isNull())).thenReturn(prepareCnDataForSlashesBehindMountPointTest()); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); @@ -222,8 +221,7 @@ public class RestGetOperationTest extends JerseyTest { @Test public void getDataMountPointIntoHighestElement() throws Exception { when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), any(YangInstanceIdentifier.class), - Mockito.anyString())).thenReturn( - prepareCnDataForMountPointTest(true)); + isNull())).thenReturn(prepareCnDataForMountPointTest(true)); when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule); @@ -610,7 +608,7 @@ public class RestGetOperationTest extends JerseyTest { @SuppressWarnings("unchecked") private void mockReadConfigurationDataMethod() { - when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class), Mockito.anyString())) + when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class), isNull())) .thenReturn(answerFromGet); } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java index 0701636fff..4f68adbdb4 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java @@ -8,7 +8,8 @@ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -31,7 +32,6 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; import org.opendaylight.netconf.sal.rest.api.Draft02; @@ -151,7 +151,7 @@ public class RestPostOperationTest extends JerseyTest { @Test public void createConfigurationDataNullTest() throws UnsupportedEncodingException { when(brokerFacade.commitConfigurationDataPost(any(SchemaContext.class), any(YangInstanceIdentifier.class), - any(NormalizedNode.class), Mockito.anyString(), Mockito.anyString())) + any(NormalizedNode.class), isNull(), isNull())) .thenReturn(Futures.immediateCheckedFuture(null)); //FIXME : find who is set schemaContext diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java index 6067e419d7..59474e3991 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java @@ -9,8 +9,9 @@ package org.opendaylight.controller.sal.restconf.impl.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -53,7 +54,6 @@ import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; @@ -129,7 +129,7 @@ public class RestconfImplTest { public void testExample() throws FileNotFoundException, ParseException { @SuppressWarnings("rawtypes") final NormalizedNode normalizedNodeData = TestUtils.prepareNormalizedNodeWithIetfInterfacesInterfacesData(); - when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(normalizedNodeData); + when(brokerFacade.readOperationalData(isNull())).thenReturn(normalizedNodeData); assertEquals(normalizedNodeData, brokerFacade.readOperationalData(null)); } @@ -155,7 +155,7 @@ public class RestconfImplTest { .invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); this.restconfImpl.invokeRpc("randomId", ctx, uriInfo); this.restconfImpl.invokeRpc("ietf-netconf", ctx, uriInfo); - verify(rpcService, times(2)).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class)); + verify(rpcService, times(2)).invokeRpc(any(SchemaPath.class), isNull()); } /** diff --git a/restconf/restconf-nb-bierman02/src/test/resources/listener-adapter-test/notif-del.json b/restconf/restconf-nb-bierman02/src/test/resources/listener-adapter-test/notif-del.json index 19afc1dec5..dbadab2dc8 100644 --- a/restconf/restconf-nb-bierman02/src/test/resources/listener-adapter-test/notif-del.json +++ b/restconf/restconf-nb-bierman02/src/test/resources/listener-adapter-test/notif-del.json @@ -3,12 +3,7 @@ "data-changed-notification": { "data-change-event": [ { - "data": { - "patch-cont": { - "xmlns": "instance:identifier:patch:module" - } - }, - "operation": "updated", + "operation": "deleted", "path": "/instance-identifier-patch-module:patch-cont" }, { diff --git a/restconf/restconf-nb-rfc8040/pom.xml b/restconf/restconf-nb-rfc8040/pom.xml index 75c2dc10df..4500cf4e64 100644 --- a/restconf/restconf-nb-rfc8040/pom.xml +++ b/restconf/restconf-nb-rfc8040/pom.xml @@ -32,7 +32,7 @@ restconf-common - org.opendaylight.mdsal.model + org.opendaylight.mdsal.binding.model.ietf rfc7895 @@ -74,8 +74,8 @@ - org.opendaylight.mdsal.model - ietf-yang-types-20130715 + org.opendaylight.mdsal.binding.model.ietf + rfc6991-ietf-yang-types diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040ImplTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040ImplTest.java index 7e82357cf5..0fe0e08f84 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040ImplTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040ImplTest.java @@ -12,10 +12,10 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Matchers.notNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -494,8 +494,7 @@ public class JSONRestconfServiceRfc8040ImplTest { final SchemaPath path = SchemaPath.create(true, CANCEL_TOAST_QNAME); final DOMRpcResult expResult = new DefaultDOMRpcResult((NormalizedNode)null); - doReturn(Futures.immediateCheckedFuture(expResult)).when(mockRpcService).invokeRpc(eq(path), - any(NormalizedNode.class)); + doReturn(Futures.immediateCheckedFuture(expResult)).when(mockRpcService).invokeRpc(eq(path), isNull()); final String uriPath = "toaster:cancel-toast"; @@ -503,7 +502,7 @@ public class JSONRestconfServiceRfc8040ImplTest { assertEquals("Output present", false, output.isPresent()); - verify(mockRpcService).invokeRpc(eq(path), isNull(NormalizedNode.class)); + verify(mockRpcService).invokeRpc(eq(path), isNull()); } @Test @@ -514,8 +513,7 @@ public class JSONRestconfServiceRfc8040ImplTest { .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_OUTPUT_QNAME)) .withChild(ImmutableNodes.leafNode(TEXT_OUT_QNAME, "foo")).build(); final DOMRpcResult expResult = new DefaultDOMRpcResult(outputNode); - doReturn(Futures.immediateCheckedFuture(expResult)).when(mockRpcService).invokeRpc(eq(path), - any(NormalizedNode.class)); + doReturn(Futures.immediateCheckedFuture(expResult)).when(mockRpcService).invokeRpc(eq(path), isNull()); final String uriPath = "toaster:testOutput"; @@ -525,7 +523,7 @@ public class JSONRestconfServiceRfc8040ImplTest { assertNotNull("Returned null response", output.get()); assertThat("Missing \"textOut\"", output.get(), containsString("\"textOut\":\"foo\"")); - verify(mockRpcService).invokeRpc(eq(path), isNull(NormalizedNode.class)); + verify(mockRpcService).invokeRpc(eq(path), isNull()); } @Test(expected = OperationFailedException.class) diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtilTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtilTest.java index 7ee842679a..5285d85cda 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtilTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtilTest.java @@ -65,7 +65,7 @@ public class RestconfInvokeOperationsUtilTest { final DOMRpcResult rpcResult = RestconfInvokeOperationsUtil.invokeRpc(DATA.input, DATA.errorRpc, serviceHandler); assertNull(rpcResult.getResult()); - final Collection errorList = rpcResult.getErrors(); + final Collection errorList = rpcResult.getErrors(); assertEquals(1, errorList.size()); final RpcError actual = errorList.iterator().next(); assertEquals("No implementation of RPC " + DATA.errorRpc.toString() + " available.", actual.getMessage()); diff --git a/restconf/restconf-nb-rfc8040/src/test/resources/listener-adapter-test/notif-del.json b/restconf/restconf-nb-rfc8040/src/test/resources/listener-adapter-test/notif-del.json index 8c2af38b35..a7cb21379d 100644 --- a/restconf/restconf-nb-rfc8040/src/test/resources/listener-adapter-test/notif-del.json +++ b/restconf/restconf-nb-rfc8040/src/test/resources/listener-adapter-test/notif-del.json @@ -3,12 +3,7 @@ "data-changed-notification": { "data-change-event": [ { - "data": { - "patch-cont": { - "xmlns": "instance:identifier:patch:module" - } - }, - "operation": "updated", + "operation": "deleted", "path": "/instance-identifier-patch-module:patch-cont" }, { diff --git a/restconf/restconf-parent/pom.xml b/restconf/restconf-parent/pom.xml index 12ebebc3ba..3772336123 100644 --- a/restconf/restconf-parent/pom.xml +++ b/restconf/restconf-parent/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.mdsal binding-parent - 0.14.0-SNAPSHOT + 3.0.1 @@ -50,11 +50,6 @@ pom import - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-grizzly2 - 2.6 - diff --git a/restconf/sal-rest-connector-config/pom.xml b/restconf/sal-rest-connector-config/pom.xml index 3b5442a364..4e61357e05 100644 --- a/restconf/sal-rest-connector-config/pom.xml +++ b/restconf/sal-rest-connector-config/pom.xml @@ -12,7 +12,7 @@ org.opendaylight.odlparent odlparent-lite - 3.1.3 + 4.0.2 diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/jaxrs/JaxbContextResolver.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/jaxrs/JaxbContextResolver.java index a8baa7774c..bb9b50565d 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/jaxrs/JaxbContextResolver.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/jaxrs/JaxbContextResolver.java @@ -7,7 +7,6 @@ */ package org.opendaylight.netconf.sal.rest.doc.jaxrs; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; @@ -25,7 +24,6 @@ public class JaxbContextResolver implements ContextResolver { public JaxbContextResolver() { ctx = new ObjectMapper(); - ctx.getSerializationConfig().withSerializationInclusion(JsonInclude.Include.ALWAYS); } @Override -- 2.36.6