summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2017-09-07 10:52:29 +0300
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-09-07 13:53:33 +0000
commitb7375b2488df93ba9df57ad13ec628bbff663819 (patch)
treee8d372535ab98aa76814e16d301ac32efbeb0c75 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java
parent8bd8cee7d620406036e197f540439b1e226506d5 (diff)
Fixed a few static analysis violations
Fixed mostly not closing resources (InputStream, ResultSet) and catching Throwable instead of Exception in some modules. Issue-ID: SDC-291 Change-Id: I34e331cc3b45c4bb3a71c301f50e1706a7b623fd Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java6
2 files changed, 4 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
index 38f7a1c56e..5f1a67138d 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
@@ -42,7 +42,6 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
-import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
@@ -159,8 +158,8 @@ public class MonitoringMibEnricherTest {
}
private ByteBuffer getMibByteBuffer(String fileName) {
- InputStream mibFile = FileUtils.getFileInputStream(this.getClass().getResource(fileName));
- byte[] mibBytes = FileUtils.toByteArray(mibFile);
+ byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName),
+ stream -> FileUtils.toByteArray(stream));
return ByteBuffer.wrap(mibBytes);
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java
index aeefc91aa3..2f839a7946 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java
@@ -21,14 +21,12 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
-import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
public class ProcessArtifactEnricherTest {
@@ -112,8 +110,8 @@ public class ProcessArtifactEnricherTest {
}
private ByteBuffer getMibByteBuffer(String fileName) {
- InputStream mibFile = FileUtils.getFileInputStream(this.getClass().getResource(fileName));
- byte[] mibBytes = FileUtils.toByteArray(mibFile);
+ byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName),
+ stream -> FileUtils.toByteArray(stream));
return ByteBuffer.wrap(mibBytes);
}
}