summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller/provider/src/main/java/org/onap
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-27 09:59:54 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-27 20:21:44 +0000
commit8ed27a86af9811816db99195f65fb2a50e4f37b2 (patch)
tree59436c41296f981ebca0e85937554db6367c76f2 /appc-config/appc-flow-controller/provider/src/main/java/org/onap
parentabe5b13384dc8d275e8395899e02818ef7c8fae4 (diff)
Test coverage in DBService
Increase coverage from 71% to 98% Fix for Sonar major issue on branch coverage Issue-ID: APPC-1499 Change-Id: I74261af92b3263a03d29d476ad097182e6112ad9 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/main/java/org/onap')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/dbervices/FlowControlDBService.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/dbervices/FlowControlDBService.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/dbervices/FlowControlDBService.java
index 10c456426..946df7ce2 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/dbervices/FlowControlDBService.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/dbervices/FlowControlDBService.java
@@ -3,6 +3,8 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
@@ -38,14 +40,14 @@ public class FlowControlDBService {
private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlDBService.class);
private static final String QUERY_STR = "Query String : ";
private static final String FAILURE_PARAM = "FAILURE";
- private static final String GET_FLOW_REF_DATA_ERROR = "Error - while getting FlowReferenceData ";
+ protected static final String GET_FLOW_REF_DATA_ERROR = "Error - while getting FlowReferenceData ";
private static final String SELECT_AS_QUERY_STR = "select max(internal_version) as maxInternalVersion, artifact_name as artifactName from ";
private static final String WHERE_ART_NAME_QUERY_STR = " where artifact_name in (select artifact_name from ";
private static final String WHERE_VNF_TYPE_QUERY_STR = " where vnf_type= $";
private static final String SELECT_ART_CONTENT_QUERY_STR = "select artifact_content from ";
private static final String WHERE_ARTIFACT_NAME_QUERY_STR = " where artifact_name = $artifactName and internal_version = $maxInternalVersion ";
private static final String ARTIFACT_CONTENT_PARAM = "artifact-content";
- private static final String COUNT_PROTOCOL_PARAM = "count(protocol)";
+ protected static final String COUNT_PROTOCOL_PARAM = "count(protocol)";
private static final String WHERE_ACTION_QUERY_STR = " where action = '";
private static final String AND_ACTION_LEVEL_QUERY_STR = " and action_level = '";
@@ -165,7 +167,7 @@ public class FlowControlDBService {
public void populateModuleAndRPC(Transaction transaction, String vnfType) throws SvcLogicException {
String fn = "FlowControlDBService.populateModuleAndRPC ";
QueryStatus status;
- SvcLogicContext context = new SvcLogicContext();
+ SvcLogicContext context = getSvcLogicContext();
String protocolType = getProtocolType(transaction, vnfType, fn, context);
String key = "select execution_type, execution_module, execution_rpc from "
@@ -200,8 +202,9 @@ public class FlowControlDBService {
throw new SvcLogicException(GET_FLOW_REF_DATA_ERROR);
}
- log.debug(" Protocol Count " + context.getAttribute(COUNT_PROTOCOL_PARAM));
- protocolCount = Integer.parseInt(context.getAttribute(COUNT_PROTOCOL_PARAM));
+ String countProtocolParam = context.getAttribute(COUNT_PROTOCOL_PARAM);
+ log.debug(" Protocol Count " + countProtocolParam);
+ protocolCount = Integer.parseInt(countProtocolParam);
if (protocolCount == 1) {
protocolQuery = "select protocol from " + FlowControllerConstants.DB_PROTOCOL_REFERENCE
@@ -316,4 +319,8 @@ public class FlowControlDBService {
}
return localContext != null ? localContext.getAttribute(ARTIFACT_CONTENT_PARAM) : null;
}
+
+ protected SvcLogicContext getSvcLogicContext() {
+ return new SvcLogicContext();
+ }
}