summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcae/common
diff options
context:
space:
mode:
authors00370346 <swarup.nayak1@huawei.com>2019-03-19 16:22:00 +0530
committers00370346 <swarup.nayak1@huawei.com>2019-03-19 19:43:26 +0530
commit82c26b5b8e7e92dfd9108684290e3a596b800e62 (patch)
tree3c7c308df7ee1b1e6637b1b9730ad662abf8c17c /src/main/java/org/onap/dcae/common
parentbe11dee889f5a740d584458b62804e5fd4296e53 (diff)
Issue-ID: DCAEGEN2-1055 RestConfCollector UnitTest
Change-Id: I513ddb61d710f12ab3ccc6fca2329f3f74b4e39c Signed-off-by: s00370346 <swarup.nayak1@huawei.com>
Diffstat (limited to 'src/main/java/org/onap/dcae/common')
-rwxr-xr-xsrc/main/java/org/onap/dcae/common/Constants.java4
-rwxr-xr-xsrc/main/java/org/onap/dcae/common/DataChangeEventListener.java2
-rw-r--r--src/main/java/org/onap/dcae/common/EventProcessor.java4
-rwxr-xr-xsrc/main/java/org/onap/dcae/common/RestapiCallNode.java8
-rwxr-xr-xsrc/main/java/org/onap/dcae/common/XmlParser.java2
5 files changed, 10 insertions, 10 deletions
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<String, String[]> streamidHash = new HashMap<>();
- public EventData ev;
+
private EventPublisher eventPublisher;
public EventProcessor(EventPublisher eventPublisher, Map<String, String[]> 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();
}