diff options
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.java | 18 |
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. */ |