From 7581c93cbe2aedde587be766628b3a2d5b6258b0 Mon Sep 17 00:00:00 2001 From: Oleg Mitsura Date: Wed, 10 Apr 2019 22:32:11 -0400 Subject: netconf-executor: NetconfSessionImplTest improvements Issue-ID: CCSDK-1126 Change-Id: Ied0360a37f8f22801c63c2aeb70ee73d45cc7b4b Signed-off-by: Oleg Mitsura --- .../functions/netconf/executor/core/NetconfSessionImplTest.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin') diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt index 1f526f445..f5fd5410a 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt @@ -168,7 +168,6 @@ class NetconfSessionImplTest { } - @Ignore //TODO undo close method removal @Test fun `disconnect wraps exception from ssh closing error`() { val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true) @@ -295,7 +294,6 @@ class NetconfSessionImplTest { } } - @Ignore //TODO revert back on getFutureFromSendMessage @Test fun `syncRpc throws NetconfException if TimeoutException is caught`() { val expectedExceptionMsg = "$deviceInfo: Timed out while waiting for reply for request $formattedRequest after ${deviceInfo.replyTimeout} sec." @@ -310,23 +308,23 @@ class NetconfSessionImplTest { } } - @Ignore @Test fun `syncRpc throws NetconfException if ExecutionException is caught`() { val expectedExceptionMsg = "$deviceInfo: Closing session $sessionId for request $formattedRequest" assertFailsWith(exceptionClass = NetconfException::class, message = expectedExceptionMsg) { - val netconfSessionSpy = spyk(netconfSession) + val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = false) val futureRet: CompletableFuture = CompletableFuture.completedFuture(futureMsg) every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws - ExecutionException("exec exception", Exception("nested exception")) //TODO revert getFutureFromSendMessage back + ExecutionException("exec exception", Exception("nested exception")) + every { netconfSessionSpy["close"]() as Unit } just Runs every { netconfSessionSpy.checkAndReestablish() } just Runs + netconfSessionSpy.setSession(mockClientSession) //call the method netconfSessionSpy.syncRpc("0", "0") } } - @Ignore //TODO revert back on getFutureFromSendMessage @Test fun `syncRpc throws NetconfException if caught ExecutionException and failed to close SSH session`() { val expectedExceptionMsg = "$deviceInfo: Closing session $sessionId for request $formattedRequest" @@ -525,7 +523,6 @@ class NetconfSessionImplTest { verify { mockSshClient.close() } } - @Ignore @Test fun `disconnect wraps IOException if channel doesn't close`() { //this test is equivalent to others every { rpcService.closeSession(false) } returns SUCCESSFUL_DEVICE_RESPONSE -- cgit 1.2.3-korg