summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-22 12:13:27 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-22 17:06:49 +0000
commit6c2b81d1d39e734435cabd66518fff26bcd49aec (patch)
tree95e7ed816e8b6127f944a106b1a791658e3f9e8f /appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main
parent8c0057e9f185d0ca632c2072a182cbee46f92c50 (diff)
Test coverage in MessageAdapterImpl
Added test cases for untested portions of code Issue-ID: APPC-1481 Change-Id: Id61ec5c5824c3d9fecbfb83d47bfa0164ae96759 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main')
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java
index c0a52b141..8c518fec4 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +33,6 @@ import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang.ObjectUtils;
import org.onap.appc.domainmodel.lcm.ResponseContext;
@@ -69,14 +70,14 @@ public class MessageAdapterImpl implements MessageAdapter{
private Producer getProducer() {
configuration = ConfigurationFactory.getConfiguration();
- Properties properties=configuration.getProperties();
+ Properties properties = configuration.getProperties();
updateProperties(properties);
-
+
BundleContext ctx = FrameworkUtil.getBundle(MessageAdapterImpl.class).getBundleContext();
if (ctx != null) {
ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName());
if (svcRef != null) {
- producer = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopic,apiKey, apiSecret);
+ producer = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopic, apiKey, apiSecret);
}
}
return producer;
@@ -85,7 +86,7 @@ public class MessageAdapterImpl implements MessageAdapter{
private void updateProperties(Properties props) {
if (logger.isTraceEnabled()) {
- logger.trace("Entering to updateProperties with Properties = "+ ObjectUtils.toString(props));
+ logger.trace("Entering to updateProperties with Properties = " + ObjectUtils.toString(props));
}
pool = new HashSet<>();
if (props != null) {
@@ -124,18 +125,18 @@ public class MessageAdapterImpl implements MessageAdapter{
logger.debug("DMaaP Response = " + jsonMessage);
}
logger.debug("Before Invoking producer.post(): jsonMessage is::" + jsonMessage);
- success = producer.post(this.partition, jsonMessage);
+ success = producer.post(this.partition, jsonMessage);
logger.debug("After Invoking producer.post()");
} catch (JsonProcessingException e1) {
- logger.error("Error generating Json from DMaaP message "+ e1.getMessage());
- success= false;
+ logger.error("Error generating Json from DMaaP message " + e1.getMessage());
+ success = false;
}catch (Exception e){
- logger.error("Error sending message to DMaaP "+e.getMessage());
- success= false;
+ logger.error("Error sending message to DMaaP " + e.getMessage());
+ success = false;
}
logger.debug("Exiting MesageAdapterImpl.post()");
if (logger.isTraceEnabled()) {
- logger.trace("Exiting from post with (success = "+ ObjectUtils.toString(success)+")");
+ logger.trace("Exiting from post with (success = " + ObjectUtils.toString(success) + ")");
}
return success;
}