From 82c26b5b8e7e92dfd9108684290e3a596b800e62 Mon Sep 17 00:00:00 2001 From: s00370346 Date: Tue, 19 Mar 2019 16:22:00 +0530 Subject: Issue-ID: DCAEGEN2-1055 RestConfCollector UnitTest Change-Id: I513ddb61d710f12ab3ccc6fca2329f3f74b4e39c Signed-off-by: s00370346 --- src/main/java/org/onap/dcae/common/Constants.java | 4 ++-- src/main/java/org/onap/dcae/common/DataChangeEventListener.java | 2 +- src/main/java/org/onap/dcae/common/EventProcessor.java | 4 ++-- src/main/java/org/onap/dcae/common/RestapiCallNode.java | 8 ++++---- src/main/java/org/onap/dcae/common/XmlParser.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/main/java/org/onap/dcae/common') diff --git a/src/main/java/org/onap/dcae/common/Constants.java b/src/main/java/org/onap/dcae/common/Constants.java index 1fe5624..4c2c7b5 100755 --- a/src/main/java/org/onap/dcae/common/Constants.java +++ b/src/main/java/org/onap/dcae/common/Constants.java @@ -25,7 +25,7 @@ public class Constants { public static final String KDEFAULT_REQUESTBODY = "requestBody"; public static final String KSETTING_REST_API_URL = "restapiUrl"; public static final String KSETTING_REST_UNAME = "restapiUser"; - public static final String KSETTING_REST_PASSWORD = "restapiPassword"; + public static final String KSETTING_REST_PASSWD = "restapiPassword"; public static final String KSETTING_HTTP_METHOD = "httpMethod"; public static final String KSETTING_RESP_PREFIX = "responsePrefix"; public static final String KSETTING_SKIP_SENDING = "skipSending"; @@ -44,5 +44,5 @@ public class Constants { public static final String KSETTING_TRUST_STORE_FILENAME = "trustStoreFileName"; public static final String KSETTING_TRUST_STORE_PASSWORD = "trustStorePassword"; public static final String KSETTING_KEY_STORE_FILENAME = "keyStoreFileName"; - public static final String KSETTING_KEY_STORE_PASSWORD = "keyStorePassword"; + public static final String KSETTING_KEY_STORE_PASSWD = "keyStorePassword"; } diff --git a/src/main/java/org/onap/dcae/common/DataChangeEventListener.java b/src/main/java/org/onap/dcae/common/DataChangeEventListener.java index 6e13f73..2492c21 100755 --- a/src/main/java/org/onap/dcae/common/DataChangeEventListener.java +++ b/src/main/java/org/onap/dcae/common/DataChangeEventListener.java @@ -61,7 +61,7 @@ public class DataChangeEventListener implements EventListener { log.info("Received heart beat "); } } catch (Exception e) { - e.printStackTrace(); + log.info("InboundEvent event is malformed"); } } diff --git a/src/main/java/org/onap/dcae/common/EventProcessor.java b/src/main/java/org/onap/dcae/common/EventProcessor.java index bb0f095..164aed3 100644 --- a/src/main/java/org/onap/dcae/common/EventProcessor.java +++ b/src/main/java/org/onap/dcae/common/EventProcessor.java @@ -36,7 +36,7 @@ public class EventProcessor implements Runnable { private static final Logger log = LoggerFactory.getLogger(EventProcessor.class); private Map streamidHash = new HashMap<>(); - public EventData ev; + private EventPublisher eventPublisher; public EventProcessor(EventPublisher eventPublisher, Map streamidHash) { @@ -48,7 +48,7 @@ public class EventProcessor implements Runnable { @Override public void run() { try { - + EventData ev; while (true) { ev = RestConfCollector.fProcessingInputQueue.take(); diff --git a/src/main/java/org/onap/dcae/common/RestapiCallNode.java b/src/main/java/org/onap/dcae/common/RestapiCallNode.java index af0245d..01da72d 100755 --- a/src/main/java/org/onap/dcae/common/RestapiCallNode.java +++ b/src/main/java/org/onap/dcae/common/RestapiCallNode.java @@ -265,7 +265,7 @@ public class RestapiCallNode { byte[] encoded = Files.readAllBytes(Paths.get(fileName)); return new String(encoded, "UTF-8"); } catch (IOException | SecurityException e) { - throw new Exception("Unable to read file " + fileName + e.getLocalizedMessage(), e); + throw new IOException("Unable to read file " + fileName + e.getLocalizedMessage(), e); } } @@ -289,14 +289,14 @@ public class RestapiCallNode { if (p.restapiUser != null && p.restapiPassword != null) { client.addFilter(new HTTPDigestAuthFilter(p.restapiUser, p.restapiPassword)); } else { - throw new Exception("oAUTH authentication type selected but all restapiUser and restapiPassword " + + throw new SecurityException("oAUTH authentication type selected but all restapiUser and restapiPassword " + "parameters doesn't exist", new Throwable()); } } else if (p.authtype == AuthType.BASIC) { if (p.restapiUser != null && p.restapiPassword != null) { client.addFilter(new HTTPBasicAuthFilter(p.restapiUser, p.restapiPassword)); } else { - throw new Exception("oAUTH authentication type selected but all restapiUser and restapiPassword " + + throw new SecurityException("oAUTH authentication type selected but all restapiUser and restapiPassword " + "parameters doesn't exist", new Throwable()); } } else if (p.authtype == AuthType.OAUTH) { @@ -310,7 +310,7 @@ public class RestapiCallNode { .consumerSecret(p.oAuthConsumerSecret); client.addFilter(new OAuthClientFilter(client.getProviders(), params, secrets)); } else { - throw new Exception("oAUTH authentication type selected but all oAuthConsumerKey, voAuthConsumerSecret " + + throw new SecurityException("oAUTH authentication type selected but all oAuthConsumerKey, voAuthConsumerSecret " + "and oAuthSignatureMethod parameters doesn't exist", new Throwable()); } } diff --git a/src/main/java/org/onap/dcae/common/XmlParser.java b/src/main/java/org/onap/dcae/common/XmlParser.java index 06a4a66..a9902d2 100755 --- a/src/main/java/org/onap/dcae/common/XmlParser.java +++ b/src/main/java/org/onap/dcae/common/XmlParser.java @@ -59,7 +59,7 @@ public class XmlParser { InputStream in = new ByteArrayInputStream(s.getBytes()); saxParser.parse(in, handler); } catch (ParserConfigurationException | IOException | SAXException | NumberFormatException e) { - throw new Exception("Unable to convert XML to properties" + e.getLocalizedMessage(), e); + throw new IOException("Unable to convert XML to properties" + e.getLocalizedMessage(), e); } return handler.getProperties(); } -- cgit 1.2.3-korg