aboutsummaryrefslogtreecommitdiffstats
path: root/client/client-monitoring/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-10-01 15:05:58 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-10-01 15:06:07 +0100
commit0bfa9b4dfe33aa70fa921aa5e5c684790fd030d6 (patch)
treef9992a354e3d37216c61c6f82252b43276e629a5 /client/client-monitoring/src/main
parentacb59c7b0ccbb86f4c38a94b72e7bab73b2acf8f (diff)
Refactor monitoring REST tests to remove PowerMock
Removed PowerMock from tests becasue coverage of PowerMock is not counted by JaCoCO. It was easier to remove PowerMock than to try and hack the build get PowerMock coverage counted. Issue-ID: POLICY-1034 Change-Id: Ifc3e1ff93b2bfcb5619a5af6dec320d2de992f87 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'client/client-monitoring/src/main')
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
index 07e2efd13..c5c4b1291 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
@@ -89,7 +89,7 @@ public class ApexMonitoringRestResource {
public Response createSession(@QueryParam("hostName") final String hostName, @QueryParam("port") final int port) {
final Gson gson = new Gson();
final String host = hostName + ":" + port;
- final EngineServiceFacade engineServiceFacade = new EngineServiceFacade(hostName, port);
+ final EngineServiceFacade engineServiceFacade = getEngineServiceFacade(hostName, port);
try {
engineServiceFacade.init();
@@ -175,7 +175,7 @@ public class ApexMonitoringRestResource {
@Path("startstop/")
public Response startStop(@QueryParam("hostName") final String hostName, @QueryParam("port") final int port,
@QueryParam("engineId") final String engineId, @QueryParam("startstop") final String startStop) {
- final EngineServiceFacade engineServiceFacade = new EngineServiceFacade(hostName, port);
+ final EngineServiceFacade engineServiceFacade = getEngineServiceFacade(hostName, port);
try {
engineServiceFacade.init();
@@ -227,7 +227,7 @@ public class ApexMonitoringRestResource {
public Response periodiceventStartStop(@QueryParam("hostName") final String hostName,
@QueryParam("port") final int port, @QueryParam("engineId") final String engineId,
@QueryParam("startstop") final String startStop, @QueryParam("period") final long period) {
- final EngineServiceFacade engineServiceFacade = new EngineServiceFacade(hostName, port);
+ final EngineServiceFacade engineServiceFacade = getEngineServiceFacade(hostName, port);
final String host = hostName + ":" + port;
try {
engineServiceFacade.init();
@@ -312,6 +312,18 @@ public class ApexMonitoringRestResource {
return valueList;
}
+
+ /**
+ * Get an engine service facade for sending REST requests. This method is package because it is used by unit test.
+ *
+ * @param hostName the host name of the Apex engine
+ * @param port the port of the Apex engine
+ * @return the engine service facade
+ */
+ protected EngineServiceFacade getEngineServiceFacade(final String hostName, final int port) {
+ return new EngineServiceFacade(hostName, port);
+ }
+
/**
* A list of values that uses a FIFO sliding window of a fixed size.
*/