From 12db2b732e1e7191c2f48e23f1e14f6d81bf2cee Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 2 Mar 2018 14:24:23 +0000 Subject: Reduce Technical Debt on drools-applications This commit mops up the technical debt issues in drools-applications that are reaistic to fix witout major surgery on the code. note: warnings on non compliant Java class names that are used in yaml serializaiton and deserailization are ignored. note: warnings on complexity figures for equals() methods are ignored. Issue-ID: POLICY-455 Change-Id: I99ccda4bd9932ceb5ccbcfd2778730234b55d7a5 Signed-off-by: liamfallon --- .../onap/policy/simulators/SoSimulatorJaxRs.java | 2 +- .../main/java/org/onap/policy/simulators/Util.java | 90 +++++++++++----------- 2 files changed, 48 insertions(+), 44 deletions(-) (limited to 'controlloop/common/simulators') diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java index e70a88517..eb12362ee 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java @@ -34,7 +34,7 @@ public class SoSimulatorJaxRs { @Path("/v5/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public String SoPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId) + public String soPostQuery(@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId) { // the requestID contained in the SO Response is a newly generated requestID diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java index cd45d3134..05afd1179 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/Util.java @@ -26,52 +26,56 @@ import org.onap.policy.drools.http.server.HttpServletServer; import org.onap.policy.drools.utils.NetworkUtil; public class Util { - public static final String AAISIM_SERVER_NAME = "aaiSim"; - public static final String SOSIM_SERVER_NAME = "soSim"; - public static final String VFCSIM_SERVER_NAME = "vfcSim"; - public static final String GUARDSIM_SERVER_NAME = "guardSim"; + private Util() { + // Prevent instantiation of thic class + } - public static final int AAISIM_SERVER_PORT = 6666; - public static final int SOSIM_SERVER_PORT = 6667; - public static final int VFCSIM_SERVER_PORT = 6668; - public static final int GUARDSIM_SERVER_PORT = 6669; + public static final String AAISIM_SERVER_NAME = "aaiSim"; + public static final String SOSIM_SERVER_NAME = "soSim"; + public static final String VFCSIM_SERVER_NAME = "vfcSim"; + public static final String GUARDSIM_SERVER_NAME = "guardSim"; - public static HttpServletServer buildAaiSim() throws InterruptedException, IOException { - final HttpServletServer testServer = HttpServletServer.factory.build(AAISIM_SERVER_NAME, - "localhost", AAISIM_SERVER_PORT, "/", false, true); - testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName()); - testServer.waitedStart(5000); - if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) - throw new IllegalStateException("cannot connect to port " + testServer.getPort()); - return testServer; - } + public static final int AAISIM_SERVER_PORT = 6666; + public static final int SOSIM_SERVER_PORT = 6667; + public static final int VFCSIM_SERVER_PORT = 6668; + public static final int GUARDSIM_SERVER_PORT = 6669; - public static HttpServletServer buildSoSim() throws InterruptedException, IOException { - final HttpServletServer testServer = HttpServletServer.factory.build(SOSIM_SERVER_NAME, - "localhost", SOSIM_SERVER_PORT, "/", false, true); - testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName()); - testServer.waitedStart(5000); - if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) - throw new IllegalStateException("cannot connect to port " + testServer.getPort()); - return testServer; - } + public static HttpServletServer buildAaiSim() throws InterruptedException, IOException { + final HttpServletServer testServer = HttpServletServer.factory.build(AAISIM_SERVER_NAME, + "localhost", AAISIM_SERVER_PORT, "/", false, true); + testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName()); + testServer.waitedStart(5000); + if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) + throw new IllegalStateException("cannot connect to port " + testServer.getPort()); + return testServer; + } - public static HttpServletServer buildVfcSim() throws InterruptedException, IOException { - final HttpServletServer testServer = HttpServletServer.factory.build(VFCSIM_SERVER_NAME, - "localhost", VFCSIM_SERVER_PORT, "/", false, true); - testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName()); - testServer.waitedStart(5000); - if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) - throw new IllegalStateException("cannot connect to port " + testServer.getPort()); - return testServer; - } + public static HttpServletServer buildSoSim() throws InterruptedException, IOException { + final HttpServletServer testServer = HttpServletServer.factory.build(SOSIM_SERVER_NAME, + "localhost", SOSIM_SERVER_PORT, "/", false, true); + testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName()); + testServer.waitedStart(5000); + if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) + throw new IllegalStateException("cannot connect to port " + testServer.getPort()); + return testServer; + } - public static HttpServletServer buildGuardSim() throws InterruptedException, IOException { - HttpServletServer testServer = HttpServletServer.factory.build(GUARDSIM_SERVER_NAME, "localhost", GUARDSIM_SERVER_PORT, "/", false, true); - testServer.addServletClass("/*", GuardSimulatorJaxRs.class.getName()); - testServer.waitedStart(5000); - if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) - throw new IllegalStateException("cannot connect to port " + testServer.getPort()); - return testServer; - } + public static HttpServletServer buildVfcSim() throws InterruptedException, IOException { + final HttpServletServer testServer = HttpServletServer.factory.build(VFCSIM_SERVER_NAME, + "localhost", VFCSIM_SERVER_PORT, "/", false, true); + testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName()); + testServer.waitedStart(5000); + if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) + throw new IllegalStateException("cannot connect to port " + testServer.getPort()); + return testServer; + } + + public static HttpServletServer buildGuardSim() throws InterruptedException, IOException { + HttpServletServer testServer = HttpServletServer.factory.build(GUARDSIM_SERVER_NAME, "localhost", GUARDSIM_SERVER_PORT, "/", false, true); + testServer.addServletClass("/*", GuardSimulatorJaxRs.class.getName()); + testServer.waitedStart(5000); + if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) + throw new IllegalStateException("cannot connect to port " + testServer.getPort()); + return testServer; + } } -- cgit 1.2.3-korg