summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-design-services/provider/src/main
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-14 13:38:23 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-14 16:29:22 +0000
commit19bb17c4b16ee955cdec6db9ddc2af25845df062 (patch)
treee4f15ad6e22940d1c7725e73ea7f4d5f6ef5a119 /appc-inbound/appc-design-services/provider/src/main
parent6d9bedf2ed048a7715f0b6927683d904db9524b1 (diff)
Test coverage in XInterfaceService
Increased coverage from 68% to 100% Issue-ID: APPC-1436 Change-Id: If9f1670ba9955325bf938d7edf3d7d67bb48088c Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-inbound/appc-design-services/provider/src/main')
-rw-r--r--appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/xinterface/XInterfaceService.java53
1 files changed, 28 insertions, 25 deletions
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/xinterface/XInterfaceService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/xinterface/XInterfaceService.java
index 42f13243d..4e93af149 100644
--- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/xinterface/XInterfaceService.java
+++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/xinterface/XInterfaceService.java
@@ -31,31 +31,34 @@ import com.att.eelf.configuration.EELFManager;
import com.google.common.base.Strings;
public class XInterfaceService {
-
- private final EELFLogger log = EELFManager.getInstance().getLogger(XInterfaceService.class);
-
- public static XInterfaceService getInstance() {
- return new XInterfaceService();
- }
-
- public String execute(String action, String payload) throws Exception {
- // File targetFile = new File("/tmp/" + action + "-response.txt" );
- String interfaceResponse = null;
- try {
- if (Strings.isNullOrEmpty(payload))
- throw new Exception("Payload is null or empty..");
- if (DesignServiceConstants.GETINSTARDATA.equalsIgnoreCase(action)) {
- XResponseProcessor xResponseProcessor = new XResponseProcessor();
- interfaceResponse =
- xResponseProcessor.parseResponse(payload, DesignServiceConstants.GETINSTARDATA);
- } else {
- throw new Exception("No Such Action, Please enter valid Action");
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
+
+ private final EELFLogger log = EELFManager.getInstance().getLogger(XInterfaceService.class);
+
+ public static XInterfaceService getInstance() {
+ return new XInterfaceService();
+ }
+
+ public String execute(String action, String payload) throws Exception {
+ String interfaceResponse = null;
+ try {
+ if (Strings.isNullOrEmpty(payload))
+ throw new Exception("Payload is null or empty..");
+ if (DesignServiceConstants.GETINSTARDATA.equalsIgnoreCase(action)) {
+ XResponseProcessor xResponseProcessor = getXResponseProcessor();
+ interfaceResponse =
+ xResponseProcessor.parseResponse(payload, DesignServiceConstants.GETINSTARDATA);
+ } else {
+ throw new Exception("No Such Action, Please enter valid Action");
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw e;
+ }
+ return interfaceResponse;
+ }
+
+ protected XResponseProcessor getXResponseProcessor() {
+ return new XResponseProcessor();
}
- return interfaceResponse;
- }
}