From 140980d872f84e854d636a21ca872b251b15891b Mon Sep 17 00:00:00 2001 From: Charles Cole Date: Fri, 20 Oct 2017 08:52:59 -0500 Subject: Fix handling of aai 'get' errors Now reject an event if the AAI get query for the event fails. Added test cases for this behavior. Fixed some issues from my previous pull request. Issue-Id: POLICY-314 Change-Id: I674e95302a271423c307a88d061064e12e491a7a Signed-off-by: Charles Cole --- .../java/org/onap/policy/aai/AAIGETResponse.java | 3 ++ .../main/java/org/onap/policy/aai/AAIManager.java | 2 +- .../org/onap/policy/aai/AAINQRequestError.java | 2 +- .../org/onap/policy/aai/AAINQServiceExcept.java | 39 ++++++++++++++++++++++ .../org/onap/policy/aai/AAINQServiceException.java | 39 ---------------------- 5 files changed, 44 insertions(+), 41 deletions(-) create mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java (limited to 'controlloop/common/model-impl') diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java index 46a4e5080..caba0596f 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java @@ -45,6 +45,9 @@ public class AAIGETResponse implements Serializable { @SerializedName("relationship-list") public RelationshipList relationshipList; + + @SerializedName("requestError") + public AAINQRequestError requestError; public AAIGETResponse() { } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java index 6a0fb3adb..e22fe00e3 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java @@ -49,7 +49,7 @@ public final class AAIManager { String requestJson = Serialization.gsonPretty.toJson(request); netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, System.lineSeparator(), requestJson); Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", requestJson); - logger.debug("RESTManager.post after"); + logger.debug("RESTManager.post after"); if (httpDetails == null) { logger.info("AAI POST Null Response to " + url); diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java index f6439cc4a..f2498fb6e 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java @@ -29,5 +29,5 @@ public class AAINQRequestError implements Serializable { private static final long serialVersionUID = -7742674155387022932L; @SerializedName("serviceException") - public AAINQServiceException serviceException; + public AAINQServiceExcept serviceExcept; } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java new file mode 100644 index 000000000..acee98f04 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.aai; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class AAINQServiceExcept implements Serializable { + + private static final long serialVersionUID = 2858343404484338546L; + + @SerializedName("messageId") + public String messageId; + + @SerializedName("text") + public String text; + + @SerializedName("variables") + public String[] variables; +} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java deleted file mode 100644 index 64d407de4..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; - -import com.google.gson.annotations.SerializedName; - -public class AAINQServiceException implements Serializable { - - private static final long serialVersionUID = 2858343404484338546L; - - @SerializedName("messageId") - public String messageId; - - @SerializedName("text") - public String text; - - @SerializedName("variables") - public String[] variables; -} -- cgit 1.2.3-korg