From e63b7179e260e9f9db64101409b2872eab1fe639 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Wed, 27 Feb 2019 14:22:51 +0000 Subject: Purging of cached information The datafile collector has a cache will all previously published files. The cache is on regular intevals purged so that non used entries are removed so that it does not grow infinitely. Added a unit test. Change-Id: I8897fee4522c97031f735b1d6774803dcb73926b Issue-ID: DCAEGEN2-1118 Signed-off-by: PatrikBuhr --- .../onap/dcaegen2/collectors/datafile/ftp/SftpClientTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'datafile-dmaap-client') diff --git a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientTest.java b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientTest.java index 102388e2..90fb9336 100644 --- a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientTest.java +++ b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/SftpClientTest.java @@ -19,6 +19,7 @@ package org.onap.dcaegen2.collectors.datafile.ftp; import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.commons.io.IOUtils.toByteArray; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertTrue; import com.github.stefanbirkner.fakesftpserver.rule.FakeSftpServerRule; @@ -72,14 +73,9 @@ public class SftpClientTest { SftpClient sftpClient = new SftpClient(expectedFileServerData); sftpServer.putFile(REMOTE_DUMMY_FILE, DUMMY_CONTENT, UTF_8); - String errorMessage = ""; - try { - sftpClient.collectFile(REMOTE_DUMMY_FILE, LOCAL_DUMMY_FILE); - } catch (Exception e) { - errorMessage = e.getMessage(); - } - assertTrue(errorMessage.contains("Auth fail")); + assertThatThrownBy(() -> sftpClient.collectFile(REMOTE_DUMMY_FILE, LOCAL_DUMMY_FILE)) + .hasMessageContaining("Unable to get file from xNF"); } @Test -- cgit 1.2.3-korg