diff options
Diffstat (limited to 'models-interactions')
3 files changed, 27 insertions, 26 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java index 8aac67bb0..45fbbca65 100644 --- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java +++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/beans/CdsActionRequest.java @@ -19,6 +19,8 @@ package org.onap.policy.controlloop.actor.cds.beans; import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; import java.util.Map; import lombok.Getter; import lombok.Setter; @@ -30,7 +32,8 @@ import org.slf4j.LoggerFactory; @Getter @Setter -public class CdsActionRequest { +public class CdsActionRequest implements Serializable { + private static final long serialVersionUID = -4172157702597791493L; private static final Logger LOGGER = LoggerFactory.getLogger(CdsActionRequest.class); private static final Coder CODER = new StandardCoder(); diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java index 6e2494b72..d8933c86c 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java @@ -142,7 +142,7 @@ public final class SoManager { final String vfModuleInstanceId, final SoRequest request) { return executors.submit(new AsyncSoRestCallThread(requestId, callback, serviceInstanceId, vnfInstanceId, - vfModuleInstanceId, request, this.url, this.user, this.password)); + vfModuleInstanceId, request, this)); } /** @@ -173,18 +173,16 @@ public final class SoManager { final SoCallback callback, final String serviceInstanceId, final String vnfInstanceId, final String vfModuleInstanceId, final SoRequest request, - final String url, - final String user, - final String password) { + final SoManager callingSoManager) { this.requestId = requestId; this.callback = callback; this.serviceInstanceId = serviceInstanceId; this.vnfInstanceId = vnfInstanceId; this.vfModuleInstanceId = vfModuleInstanceId; this.request = request; - this.baseUrl = url; - this.user = user; - this.password = password; + this.baseUrl = callingSoManager.url; + this.user = callingSoManager.user; + this.password = callingSoManager.password; } /** diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java index 11efd973d..f21fb6f38 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java @@ -21,12 +21,12 @@ package org.onap.policy.simulators; -import java.io.IOException; import java.util.Properties; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.GsonMessageBodyHandler; +import org.onap.policy.common.parameters.ParameterRuntimeException; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.network.NetworkUtil; @@ -49,11 +49,12 @@ public class Util { public static final int SDNCSIM_SERVER_PORT = 6670; public static final int DMAAPSIM_SERVER_PORT = 3904; + private static final String CANNOT_PROCESS_PARAMETERS = "cannot parse parameters "; private static final String CANNOT_CONNECT = "cannot connect to port "; private static final String LOCALHOST = "localhost"; private Util() { - // Prevent instantiation of thic class + // Prevent instantiation of this class } /** @@ -61,11 +62,10 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs */ public static HttpServletServer buildAaiSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() - .build(AAISIM_SERVER_NAME, LOCALHOST, AAISIM_SERVER_PORT, "/", false, true); + .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)) { @@ -79,11 +79,10 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs */ public static HttpServletServer buildSdncSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() - .build(SDNCSIM_SERVER_NAME, LOCALHOST, SDNCSIM_SERVER_PORT, "/", false, true); + .build(SDNCSIM_SERVER_NAME, LOCALHOST, SDNCSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", SdncSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); if (!NetworkUtil.isTcpPortOpen(LOCALHOST, testServer.getPort(), 5, 10000L)) { @@ -98,11 +97,10 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs */ public static HttpServletServer buildSoSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() - .build(SOSIM_SERVER_NAME, LOCALHOST, SOSIM_SERVER_PORT, "/", false, true); + .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)) { @@ -116,11 +114,10 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs */ public static HttpServletServer buildVfcSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() - .build(VFCSIM_SERVER_NAME, LOCALHOST, VFCSIM_SERVER_PORT, "/", false, true); + .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)) { @@ -134,11 +131,10 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs */ public static HttpServletServer buildGuardSim() throws InterruptedException { HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build(GUARDSIM_SERVER_NAME, - LOCALHOST, GUARDSIM_SERVER_PORT, "/", false, true); + LOCALHOST, GUARDSIM_SERVER_PORT, "/", false, true); testServer.setSerializationProvider(GsonMessageBodyHandler.class.getName()); testServer.addServletClass("/*", GuardSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); @@ -153,21 +149,25 @@ public class Util { * * @return the simulator * @throws InterruptedException if a thread is interrupted - * @throws IOException if an IO errror occurs - * @throws CoderException if the server parameters cannot be loaded */ - public static HttpServletServer buildDmaapSim() throws InterruptedException, CoderException { + public static HttpServletServer buildDmaapSim() throws InterruptedException { String json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json"); - DmaapSimParameterGroup params = new StandardCoder().decode(json, DmaapSimParameterGroup.class); + DmaapSimParameterGroup params = null; + try { + params = new StandardCoder().decode(json, DmaapSimParameterGroup.class); + } catch (CoderException ce) { + throw new ParameterRuntimeException( + CANNOT_PROCESS_PARAMETERS + "org/onap/policy/simulators/dmaap/DmaapParameters.json", ce); + } DmaapSimProvider.setInstance(new DmaapSimProvider(params)); Properties props = DmaapSimRestServer.getServerProperties(params.getRestServerParameters()); final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." - + params.getRestServerParameters().getName(); + + params.getRestServerParameters().getName(); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, - Integer.toString(DMAAPSIM_SERVER_PORT)); + Integer.toString(DMAAPSIM_SERVER_PORT)); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true"); HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build(props).get(0); |