diff options
author | efiacor <fiachra.corcoran@est.tech> | 2019-07-25 11:05:54 +0000 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2019-07-25 11:05:54 +0000 |
commit | f09604a09059d6c3ecf05b253c9058c1a2e81ca2 (patch) | |
tree | ad5c6e1abffdc7cf30404df8af8b9c11f8d71a0e /datarouter-node/src/main | |
parent | f20778ffa99aa9c6f30a0f84112a5392b259ea63 (diff) |
FINAL unit test covergae commit
Change-Id: Ieb9e9d49931c253b89026ed4884edbdc8d6c6024
Issue-ID: DMAAP-1226
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Diffstat (limited to 'datarouter-node/src/main')
-rw-r--r-- | datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java | 2 | ||||
-rw-r--r-- | datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java index 7ed35928..193fa65e 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java @@ -296,7 +296,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { * @param httpURLConnection connection used to make request * @return AN Outpustream that can be used to send your data. */ - private OutputStream getOutputStream(HttpURLConnection httpURLConnection) throws IOException { + OutputStream getOutputStream(HttpURLConnection httpURLConnection) throws IOException { OutputStream outputStream = null; try { outputStream = httpURLConnection.getOutputStream(); diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java index 786befce..00922e0a 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java @@ -24,13 +24,18 @@ package org.onap.dmaap.datarouter.node; +import static java.lang.System.exit; + import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; +import java.nio.file.Files; +import java.util.Objects; import java.util.Properties; import java.util.Timer; import org.onap.dmaap.datarouter.node.eelf.EelfMsgs; @@ -134,13 +139,12 @@ public class NodeConfigManager implements DeliveryQueueHelper { */ //Disable and enable protocols*/ enabledprotocols = ((drNodeProperties.getProperty("NodeHttpsProtocols")).trim()).split("\\|"); - try { provhost = (new URL(provurl)).getHost(); } catch (Exception e) { NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER); eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, e, provurl); - System.exit(1); + exit(1); } eelfLogger.info("NODE0303 Provisioning server is " + provhost); eventlogurl = drNodeProperties.getProperty("LogUploadURL", "https://feeds-drtr.web.att.com/internal/logs"); @@ -151,9 +155,11 @@ public class NodeConfigManager implements DeliveryQueueHelper { spooldir = drNodeProperties.getProperty("SpoolDir", "spool"); File fdir = new File(spooldir + "/f"); fdir.mkdirs(); - for (File junk : fdir.listFiles()) { - if (junk.isFile()) { - junk.delete(); + for (File junk : Objects.requireNonNull(fdir.listFiles())) { + try { + Files.deleteIfExists(junk.toPath()); + } catch (IOException e) { + eelfLogger.error("NODE0313 Failed to clear junk files from " + fdir.getPath()); } } logdir = drNodeProperties.getProperty("LogDir", "logs"); @@ -181,7 +187,7 @@ public class NodeConfigManager implements DeliveryQueueHelper { NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER); eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile); eelfLogger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile); - System.exit(1); + exit(1); } eelfLogger.info("NODE0304 My certificate says my name is " + myname); pid = new PublishId(myname); |