summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java18
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java90
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/CdsResponse.java1
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/api/CdsProcessorListener.java13
-rw-r--r--models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java10
-rw-r--r--models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java91
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java12
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java18
9 files changed, 139 insertions, 118 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
index 28a1676ed..eb82ae231 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
@@ -87,6 +87,8 @@ public class CdsActorServiceProviderTest {
// Setup policy
policy = new Policy();
Map<String, String> payloadMap = new HashMap<String, String>() {
+ private static final long serialVersionUID = 1L;
+
{
put(CdsActorConstants.KEY_CBA_NAME, CDS_BLUEPRINT_NAME);
put(CdsActorConstants.KEY_CBA_VERSION, CDS_BLUEPRINT_VERSION);
@@ -124,7 +126,7 @@ public class CdsActorServiceProviderTest {
@Test
public void testActor() {
- assertEquals(cdsActor.actor(), CdsActorConstants.CDS_ACTOR);
+ assertEquals(CdsActorConstants.CDS_ACTOR, cdsActor.actor());
}
@Test
@@ -147,7 +149,7 @@ public class CdsActorServiceProviderTest {
assertTrue(cdsRequest.hasCommonHeader());
CommonHeader commonHeader = cdsRequest.getCommonHeader();
assertEquals(commonHeader.getRequestId(), REQUEST_ID.toString());
- assertEquals(commonHeader.getSubRequestId(), SUBREQUEST_ID);
+ assertEquals(SUBREQUEST_ID, commonHeader.getSubRequestId());
assertTrue(cdsRequest.hasPayload());
Struct cdsPayload = cdsRequest.getPayload();
@@ -155,24 +157,24 @@ public class CdsActorServiceProviderTest {
assertTrue(cdsRequest.hasActionIdentifiers());
ActionIdentifiers actionIdentifiers = cdsRequest.getActionIdentifiers();
- assertEquals(actionIdentifiers.getActionName(), CDS_RECIPE);
- assertEquals(actionIdentifiers.getBlueprintName(), CDS_BLUEPRINT_NAME);
- assertEquals(actionIdentifiers.getBlueprintVersion(), CDS_BLUEPRINT_VERSION);
+ assertEquals(CDS_RECIPE, actionIdentifiers.getActionName());
+ assertEquals(CDS_BLUEPRINT_NAME, actionIdentifiers.getBlueprintName());
+ assertEquals(CDS_BLUEPRINT_VERSION, actionIdentifiers.getBlueprintVersion());
}
@Test
public void testRecipePayloads() {
- assertEquals(cdsActor.recipePayloads("").size(), 0);
+ assertEquals(0, cdsActor.recipePayloads("").size());
}
@Test
public void testRecipes() {
- assertEquals(cdsActor.recipes().size(), 0);
+ assertEquals(0, cdsActor.recipes().size());
}
@Test
public void testRecipeTargets() {
- assertEquals(cdsActor.recipeTargets("").size(), 0);
+ assertEquals(0, cdsActor.recipeTargets("").size());
}
@Test
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
index ca0c1867f..7024231e3 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java
@@ -62,12 +62,17 @@ public class AaiCqResponse {
properties.put(JAXBContextProperties.JSON_INCLUDE_ROOT, false);
// Define JAXB context
try {
- jaxbContext =
- JAXBContextFactory
- .createContext(
- new Class[] {Vserver.class, GenericVnf.class, VfModule.class,
- CloudRegion.class, ServiceInstance.class, Tenant.class, ModelVer.class},
- properties);
+ // @formatter:off
+ jaxbContext = JAXBContextFactory.createContext(new Class[] {
+ Vserver.class,
+ GenericVnf.class,
+ VfModule.class,
+ CloudRegion.class,
+ ServiceInstance.class,
+ Tenant.class,
+ ModelVer.class
+ }, properties);
+ // @formatter:on
unmarshaller = jaxbContext.createUnmarshaller();
} catch (JAXBException e) {
LOGGER.error("Could not initialize JAXBContext", e);
@@ -81,8 +86,7 @@ public class AaiCqResponse {
/**
* Constructor creates a custom query response from a valid json string.
*
- * @param jsonString
- * A&AI Custom Query response JSON string
+ * @param jsonString A&AI Custom Query response JSON string
*/
public AaiCqResponse(String jsonString) {
@@ -98,8 +102,8 @@ public class AaiCqResponse {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject("vserver").toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject("vserver").toString()));
// Getting the vserver pojo again from the json
Vserver vserver = this.getAaiObject(json, Vserver.class);
@@ -110,8 +114,8 @@ public class AaiCqResponse {
if (resultsArray.getJSONObject(i).has(GENERIC_VNF)) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject(GENERIC_VNF).toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject(GENERIC_VNF).toString()));
// Getting the generic vnf pojo again from the json
GenericVnf genericVnf = this.getAaiObject(json, GenericVnf.class);
@@ -124,8 +128,8 @@ public class AaiCqResponse {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject("service-instance").toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject("service-instance").toString()));
// Getting the employee pojo again from the json
ServiceInstance serviceInstance = this.getAaiObject(json, ServiceInstance.class);
@@ -137,8 +141,8 @@ public class AaiCqResponse {
if (resultsArray.getJSONObject(i).has(VF_MODULE)) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject(VF_MODULE).toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject(VF_MODULE).toString()));
// Getting the vf module pojo again from the json
VfModule vfModule = this.getAaiObject(json, VfModule.class);
@@ -150,8 +154,8 @@ public class AaiCqResponse {
if (resultsArray.getJSONObject(i).has("cloud-region")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject("cloud-region").toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject("cloud-region").toString()));
// Getting the cloud region pojo again from the json
CloudRegion cloudRegion = this.getAaiObject(json, CloudRegion.class);
@@ -163,8 +167,8 @@ public class AaiCqResponse {
if (resultsArray.getJSONObject(i).has("tenant")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject("tenant").toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject("tenant").toString()));
// Getting the tenant pojo again from the json
Tenant tenant = this.getAaiObject(json, Tenant.class);
@@ -176,8 +180,8 @@ public class AaiCqResponse {
if (resultsArray.getJSONObject(i).has("model-ver")) {
// Create the StreamSource by creating StringReader using the
// JSON input
- StreamSource json = new StreamSource(new StringReader(
- resultsArray.getJSONObject(i).getJSONObject("model-ver").toString()));
+ StreamSource json = new StreamSource(
+ new StringReader(resultsArray.getJSONObject(i).getJSONObject("model-ver").toString()));
// Getting the ModelVer pojo again from the json
ModelVer modelVer = this.getAaiObject(json, ModelVer.class);
@@ -209,8 +213,7 @@ public class AaiCqResponse {
/**
* Get list of A&AI objects in the custom query.
*
- * @param classOfResponse
- * Class of the type of A&AI objects to be returned
+ * @param classOfResponse Class of the type of A&AI objects to be returned
* @return List A&AI objects matching the class
*/
@SuppressWarnings("unchecked")
@@ -292,8 +295,7 @@ public class AaiCqResponse {
/**
* Returns a generic Vnf matching vnf name.
*
- * @param vnfName
- * Name of the vnf to match
+ * @param vnfName Name of the vnf to match
* @return generic Vnf
*/
public GenericVnf getGenericVnfByVnfName(String vnfName) {
@@ -318,8 +320,7 @@ public class AaiCqResponse {
/**
* Returns a generic Vnf matching model invariant ID.
*
- * @param modelInvariantId
- * Name of the vnf to match
+ * @param modelInvariantId Name of the vnf to match
* @return generic Vnf
*/
public GenericVnf getGenericVnfByModelInvariantId(String modelInvariantId) {
@@ -344,8 +345,7 @@ public class AaiCqResponse {
/**
* Returns a generic Vnf of a given VF Module ID.
*
- * @param vfModuleModelInvariantId
- * of the vf module for which vnf is to be returned
+ * @param vfModuleModelInvariantId of the vf module for which vnf is to be returned
* @return generic Vnf
*/
public GenericVnf getGenericVnfByVfModuleModelInvariantId(String vfModuleModelInvariantId) {
@@ -355,7 +355,7 @@ public class AaiCqResponse {
// Iterate through all the vfModules of that generic Vnf
for (VfModule vfMod : genVnf.getVfModules().getVfModule()) {
if (vfMod.getModelInvariantId() != null
- && vfMod.getModelInvariantId().equals(vfModuleModelInvariantId)) {
+ && vfMod.getModelInvariantId().equals(vfModuleModelInvariantId)) {
return genVnf;
}
}
@@ -502,8 +502,7 @@ public class AaiCqResponse {
VfModule vfModule = null;
for (VfModule vfMod : this.getAllVfModules()) {
- if (vfMod.getModelInvariantId() != null
- && vfModelInvariantId.equals(vfMod.getModelInvariantId())) {
+ if (vfMod.getModelInvariantId() != null && vfModelInvariantId.equals(vfMod.getModelInvariantId())) {
vfModule = vfMod;
}
@@ -560,28 +559,25 @@ public class AaiCqResponse {
}
/**
- * Get the count of vfModules matching customizationId, InvariantId and
- * VersionId.
+ * Get the count of vfModules matching customizationId, InvariantId and VersionId.
*
- * @param custId
- * ModelCustomizationId
- * @param invId
- * ModelInvariantId
- * @param verId
- * ModelVersionId
+ * @param custId ModelCustomizationId
+ * @param invId ModelInvariantId
+ * @param verId ModelVersionId
* @return Returns the count of vf modules
*/
public int getVfModuleCount(String custId, String invId, String verId) {
List<VfModule> vfModuleList = this.getAllVfModules();
int count = 0;
for (VfModule vfModule : vfModuleList) {
- if (vfModule.getModelCustomizationId() != null && vfModule.getModelInvariantId() != null
- && vfModule.getModelVersionId() != null) {
- if (vfModule.getModelCustomizationId().equals(custId)
- && vfModule.getModelInvariantId().equals(invId)
+ if (vfModule.getModelCustomizationId() == null || vfModule.getModelInvariantId() == null
+ || vfModule.getModelVersionId() == null) {
+ continue;
+ }
+
+ if (vfModule.getModelCustomizationId().equals(custId) && vfModule.getModelInvariantId().equals(invId)
&& vfModule.getModelVersionId().equals(verId)) {
- count = count + 1;
- }
+ count = count + 1;
}
}
return count;
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/CdsResponse.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/CdsResponse.java
index fca1aa2e9..499d1a7c9 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/CdsResponse.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/CdsResponse.java
@@ -31,6 +31,7 @@ import lombok.ToString;
@Setter
@ToString
public class CdsResponse implements Serializable {
+ private static final long serialVersionUID = 2590429952699969650L;
private String requestId;
private String status;
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/api/CdsProcessorListener.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/api/CdsProcessorListener.java
index c07c559c4..fb4c6ed79 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/api/CdsProcessorListener.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/api/CdsProcessorListener.java
@@ -26,7 +26,9 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu
* the received messages appropriately, it needs to implement {@link CdsProcessorListener}.
* </p>
*
- * <p>Here is a sample implementation of a listener:
+ * <p>
+ * Here is a sample implementation of a listener:
+ *
* <pre>
* new CdsProcessorListener {
*
@@ -49,11 +51,10 @@ public interface CdsProcessorListener {
/**
* Implements the workflow upon receiving the message from the server side.
*
- * <p>Note that the CDS client-server communication is configured to use a streaming approach, which means when
- * client
- * sends an event, the server can reply with multiple sub-responses until full completion of the processing. Hence,
- * it is up to the implementation of this method to process the received message using {@link
- * ExecutionServiceOutput#getStatus()#getEventType()}</p>
+ * <p>Note that the CDS client-server communication is configured to use a streaming approach, which means when a
+ * client sends an event, the server can reply with multiple sub-responses until full completion of the processing.
+ * Hence, it is up to the implementation of this method to process the received message using the
+ * getStatus().getEventType() method of {@link ExecutionServiceOutput}
*
* @param message ExecutionServiceOutput received by the CDS grpc server
*/
diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
index 2ee47a9fc..643c629b3 100644
--- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
+++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java
@@ -41,9 +41,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestManager {
-
private static final Logger logger = LoggerFactory.getLogger(RestManager.class);
+ // Constants for string literals
+ private static final String CONTENT_TYPE = "Content-Type";
+
public class Pair<A, B> {
public final A first;
public final B second;
@@ -69,7 +71,7 @@ public class RestManager {
Map<String, String> headers, String contentType, String body) {
HttpPut put = new HttpPut(url);
addHeaders(put, username, password, headers);
- put.addHeader("Content-Type", contentType);
+ put.addHeader(CONTENT_TYPE, contentType);
try {
StringEntity input = new StringEntity(body);
input.setContentType(contentType);
@@ -96,7 +98,7 @@ public class RestManager {
Map<String, String> headers, String contentType, String body) {
HttpPost post = new HttpPost(url);
addHeaders(post, username, password, headers);
- post.addHeader("Content-Type", contentType);
+ post.addHeader(CONTENT_TYPE, contentType);
try {
StringEntity input = new StringEntity(body);
input.setContentType(contentType);
@@ -141,7 +143,7 @@ public class RestManager {
HttpDeleteWithBody delete = new HttpDeleteWithBody(url);
addHeaders(delete, username, password, headers);
if (body != null && !body.isEmpty()) {
- delete.addHeader("Content-Type", contentType);
+ delete.addHeader(CONTENT_TYPE, contentType);
try {
StringEntity input = new StringEntity(body);
input.setContentType(contentType);
diff --git a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java
index 406e35d33..14382f0e9 100644
--- a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java
+++ b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java
@@ -125,45 +125,7 @@ public final class VfcManager implements Runnable {
}
try {
- VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class);
- NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetails.second);
- String body = Serialization.gsonPretty.toJson(response);
- logger.debug("Response to VFC Heal post:");
- logger.debug(body);
-
- String jobId = response.getJobId();
- int attemptsLeft = 20;
-
- String urlGet = vfcUrlBase + "/jobs/" + jobId;
- VfcResponse responseGet = null;
-
- while (attemptsLeft-- > 0) {
- NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", "VFC", urlGet);
- Pair<Integer, String> httpDetailsGet = restManager.get(urlGet, username, password, headers);
- responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.second, VfcResponse.class);
- NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetailsGet.second);
- responseGet.setRequestId(vfcRequest.getRequestId().toString());
- body = Serialization.gsonPretty.toJson(responseGet);
- logger.debug("Response to VFC Heal get:");
- logger.debug(body);
-
- String responseStatus = responseGet.getResponseDescriptor().getStatus();
- if (httpDetailsGet.first == 200
- && ("finished".equalsIgnoreCase(responseStatus) || "error".equalsIgnoreCase(responseStatus))) {
- logger.debug("VFC Heal Status {}", responseGet.getResponseDescriptor().getStatus());
- this.callback.onResponse(responseGet);
- break;
- }
- Thread.sleep(20000);
- }
- boolean isTimeout = (attemptsLeft <= 0) && (responseGet != null)
- && (responseGet.getResponseDescriptor() != null);
- isTimeout = isTimeout && (responseGet.getResponseDescriptor().getStatus() != null)
- && (!responseGet.getResponseDescriptor().getStatus().isEmpty());
- if (isTimeout) {
- logger.debug("VFC timeout. Status: ({})", responseGet.getResponseDescriptor().getStatus());
- this.callback.onResponse(responseGet);
- }
+ handleVfcResponse(headers, httpDetails, vfcUrl);
} catch (JsonSyntaxException e) {
logger.error("Failed to deserialize into VfcResponse {}", e.getLocalizedMessage(), e);
} catch (InterruptedException e) {
@@ -175,6 +137,57 @@ public final class VfcManager implements Runnable {
}
/**
+ * Handle a VFC response message.
+ *
+ * @param headers the headers in the response
+ * @param httpDetails the HTTP details in the response
+ * @param vfcUrl the response URL
+ * @throws InterruptedException on errors in the response
+ */
+ private void handleVfcResponse(Map<String, String> headers, Pair<Integer, String> httpDetails, String vfcUrl)
+ throws InterruptedException {
+ VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class);
+ NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetails.second);
+ String body = Serialization.gsonPretty.toJson(response);
+ logger.debug("Response to VFC Heal post:");
+ logger.debug(body);
+
+ String jobId = response.getJobId();
+ int attemptsLeft = 20;
+
+ String urlGet = vfcUrlBase + "/jobs/" + jobId;
+ VfcResponse responseGet = null;
+
+ while (attemptsLeft-- > 0) {
+ NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", "VFC", urlGet);
+ Pair<Integer, String> httpDetailsGet = restManager.get(urlGet, username, password, headers);
+ responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.second, VfcResponse.class);
+ NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetailsGet.second);
+ responseGet.setRequestId(vfcRequest.getRequestId().toString());
+ body = Serialization.gsonPretty.toJson(responseGet);
+ logger.debug("Response to VFC Heal get:");
+ logger.debug(body);
+
+ String responseStatus = responseGet.getResponseDescriptor().getStatus();
+ if (httpDetailsGet.first == 200
+ && ("finished".equalsIgnoreCase(responseStatus) || "error".equalsIgnoreCase(responseStatus))) {
+ logger.debug("VFC Heal Status {}", responseGet.getResponseDescriptor().getStatus());
+ this.callback.onResponse(responseGet);
+ return;
+ }
+ Thread.sleep(20000);
+ }
+ boolean isTimeout = (attemptsLeft <= 0) && (responseGet != null)
+ && (responseGet.getResponseDescriptor() != null);
+ isTimeout = isTimeout && (responseGet.getResponseDescriptor().getStatus() != null)
+ && (!responseGet.getResponseDescriptor().getStatus().isEmpty());
+ if (isTimeout) {
+ logger.debug("VFC timeout. Status: ({})", responseGet.getResponseDescriptor().getStatus());
+ this.callback.onResponse(responseGet);
+ }
+ }
+
+ /**
* Protected setter for rest manager to allow mocked rest manager to be used for testing.
*
* @param restManager the test REST manager
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
index 756253c47..793babf24 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
@@ -157,8 +157,8 @@ public class AaiSimulatorJaxRs {
@Produces("application/json")
public String getByVnfName(@QueryParam("vnf-name") final String vnfName) {
if (GETFAIL.equals(vnfName)) {
- return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found"
- + " for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/"
+ return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not"
+ + " found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/"
+ "generic-vnf\",\"Node Not Found:No Node of type generic-vnf found at network/generic-vnfs"
+ "/generic-vnf\",\"ERR.5.4.6114\"]}}}";
}
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 6c1a05753..11efd973d 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
@@ -63,7 +63,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
* @throws IOException if an IO errror occurs
*/
- public static HttpServletServer buildAaiSim() throws InterruptedException, IOException {
+ public static HttpServletServer buildAaiSim() throws InterruptedException {
final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory()
.build(AAISIM_SERVER_NAME, LOCALHOST, AAISIM_SERVER_PORT, "/", false, true);
testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName());
@@ -81,7 +81,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
* @throws IOException if an IO errror occurs
*/
- public static HttpServletServer buildSdncSim() throws InterruptedException, IOException {
+ public static HttpServletServer buildSdncSim() throws InterruptedException {
final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory()
.build(SDNCSIM_SERVER_NAME, LOCALHOST, SDNCSIM_SERVER_PORT, "/", false, true);
testServer.addServletClass("/*", SdncSimulatorJaxRs.class.getName());
@@ -100,7 +100,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
* @throws IOException if an IO errror occurs
*/
- public static HttpServletServer buildSoSim() throws InterruptedException, IOException {
+ public static HttpServletServer buildSoSim() throws InterruptedException {
final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory()
.build(SOSIM_SERVER_NAME, LOCALHOST, SOSIM_SERVER_PORT, "/", false, true);
testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName());
@@ -118,7 +118,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
* @throws IOException if an IO errror occurs
*/
- public static HttpServletServer buildVfcSim() throws InterruptedException, IOException {
+ public static HttpServletServer buildVfcSim() throws InterruptedException {
final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory()
.build(VFCSIM_SERVER_NAME, LOCALHOST, VFCSIM_SERVER_PORT, "/", false, true);
testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName());
@@ -136,7 +136,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
* @throws IOException if an IO errror occurs
*/
- public static HttpServletServer buildGuardSim() throws InterruptedException, IOException {
+ public static HttpServletServer buildGuardSim() throws InterruptedException {
HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build(GUARDSIM_SERVER_NAME,
LOCALHOST, GUARDSIM_SERVER_PORT, "/", false, true);
testServer.setSerializationProvider(GsonMessageBodyHandler.class.getName());
@@ -156,7 +156,7 @@ public class Util {
* @throws IOException if an IO errror occurs
* @throws CoderException if the server parameters cannot be loaded
*/
- public static HttpServletServer buildDmaapSim() throws InterruptedException, IOException, CoderException {
+ public static HttpServletServer buildDmaapSim() throws InterruptedException, CoderException {
String json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json");
DmaapSimParameterGroup params = new StandardCoder().decode(json, DmaapSimParameterGroup.class);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
index 4f33d079f..5b77f4704 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java
@@ -91,12 +91,18 @@ public class PdpUpdateMessageHandler {
* @return boolean flag which tells if the information is same or not
*/
private boolean checkIfAlreadyHandled(final PdpUpdate pdpUpdateMsg, final PdpStatus pdpStatusContext) {
- return null != pdpStatusContext.getPdpGroup()
- && pdpStatusContext.getPdpGroup().equals(pdpUpdateMsg.getPdpGroup())
- && null != pdpStatusContext.getPdpSubgroup()
- && pdpStatusContext.getPdpSubgroup().equals(pdpUpdateMsg.getPdpSubgroup())
- && null != pdpStatusContext.getPolicies() && new PdpMessageHandler()
- .getToscaPolicyIdentifiers(pdpUpdateMsg.getPolicies()).equals(pdpStatusContext.getPolicies());
+ if (pdpStatusContext.getPdpGroup() == null
+ || !pdpStatusContext.getPdpGroup().equals(pdpUpdateMsg.getPdpGroup())) {
+ return false;
+ }
+
+ if (pdpStatusContext.getPdpSubgroup() == null
+ || !pdpStatusContext.getPdpSubgroup().equals(pdpUpdateMsg.getPdpSubgroup())) {
+ return false;
+ }
+
+ return null != pdpStatusContext.getPolicies() && new PdpMessageHandler()
+ .getToscaPolicyIdentifiers(pdpUpdateMsg.getPolicies()).equals(pdpStatusContext.getPolicies());
}
/**