diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-10-22 08:30:19 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-10-22 08:31:14 -0500 |
commit | e3093b8d1b19ad92a4af90df39a2087f40a687d4 (patch) | |
tree | cc2037c3479ba4e74898d9a2525c9ae47ff1c97b /auth | |
parent | c03496d36fc7e0a2978c84cb443550c565eedb84 (diff) |
Final Sonar reds
Issue-ID: AAF-580
Change-Id: I99de4518853504c2a211e92bce3dba70c8bc6a76
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth')
4 files changed, 1 insertions, 53 deletions
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java index bc81fc43..4a35ca24 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java @@ -197,7 +197,7 @@ public class JscepCA extends CA { trans.error().log(e,clients.info(item)); i=MAX_RETRY; // can't go any further } - } catch (InterruptedException|TransactionException|CertificateException|OperatorCreationException | CertStoreException e) { + } catch (Exception e) { trans.error().log(e); i=MAX_RETRY; } finally { diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java index 9af11152..ce87533e 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java @@ -291,33 +291,6 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void return c; } - public Content loadOrDefault(Trans trans, String targetDir, String targetFileName, String sourcePath, String mediaType) throws IOException { - try { - return load(trans.info(),targetDir,targetFileName,mediaType,0); - } catch (FileNotFoundException e) { - String targetPath = targetDir + '/' + targetFileName; - TimeTaken tt = trans.start("File doesn't exist; copy " + sourcePath + " to " + targetPath, Env.SUB); - try { - FileInputStream sourceFIS = new FileInputStream(sourcePath); - FileChannel sourceFC = sourceFIS.getChannel(); - File targetFile = new File(targetPath); - targetFile.getParentFile().mkdirs(); // ensure directory exists - FileOutputStream targetFOS = new FileOutputStream(targetFile); - try { - ByteBuffer bb = ByteBuffer.allocate((int)sourceFC.size()); - sourceFC.read(bb); - bb.flip(); // ready for reading - targetFOS.getChannel().write(bb); - } finally { - sourceFIS.close(); - targetFOS.close(); - } - } finally { - tt.done(); - } - return load(trans.info(),targetDir,targetFileName,mediaType,0); - } - } public void invalidate(String key) { content.remove(key); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_CachingFileAccess.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_CachingFileAccess.java index f0b38263..6d6e2da0 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_CachingFileAccess.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_CachingFileAccess.java @@ -24,13 +24,11 @@ package org.onap.aaf.auth.rserv.test; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.lang.reflect.Field; @@ -43,8 +41,6 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.onap.aaf.auth.rserv.CachingFileAccess; import org.onap.aaf.auth.rserv.HttpCode; import org.onap.aaf.auth.rserv.Match; @@ -150,26 +146,6 @@ public class JU_CachingFileAccess { } @Test - public void testLoadOrDefault() throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException, InstantiationException { - String filePath = "test/output_key"; - File keyfile = new File(filePath); - cachingFileAccess.loadOrDefault(trans, filePath, "-", null, null); - keyfile.delete(); - - Trans trans = mock(Trans.class); - - String filePath1 = "test/output_key.txt"; - //File keyfile1 = new File(filePath1); - doAnswer(new Answer<Void>() { - public Void answer(InvocationOnMock invocation) throws FileNotFoundException { - throw new FileNotFoundException(); - } - }).when(trans).info(); - //cachingFileAccess.loadOrDefault(trans, "bs", "also bs", "test", null); //TODO: Needs more testing AAF-111 - //keyfile1.delete(); - } - - @Test public void testInvalidate() { //NavigableMap<String,org.onap.aaf.auth.rserv.Content> content = new ConcurrentSkipListMap<>(); //Content con = mock(Content.class); diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh index 4a6b1c77..c6914a09 100644 --- a/auth/docker/drun.sh +++ b/auth/docker/drun.sh @@ -51,7 +51,6 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do "cm") PORTMAP="8150:8150" LINKS="--link aaf_cass:cassandra " - LINKS="--link aaf_cass:cassandra " ;; "hello") PORTMAP="8130:8130" |