aboutsummaryrefslogtreecommitdiffstats
path: root/aai-els-onap-logging
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-12-19 11:55:44 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-12-22 15:11:57 +0100
commit03c062dc0d583fff34c17801e1d46a72dfe4c831 (patch)
tree8b7a6f78f5cbcd2f4cb4b064f076f021ef9fbd67 /aai-els-onap-logging
parentd5a889f9661e89289344ed736600bc7222095379 (diff)
Refactor ErrorLogHelper
- change is designed to not make any changes to the serialised objects [1] - introduce common error response object that is used for both service and policy, xml + json format - separate creation of error response and the marshalling of it - increase test coverage - use jackson object mappers for marshalling json and xml objects instead of custom MapperUtil - make code more functional - use more descriptive variable names [1] only the internal representation changes to account for both Service- and PolicyException Issue-ID: AAI-3695 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: I1e82bf4f0706704679d14aac98969fa00beed758
Diffstat (limited to 'aai-els-onap-logging')
-rw-r--r--aai-els-onap-logging/pom.xml10
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ErrorMessage.java41
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ExceptionType.java36
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Fault.java36
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Info.java31
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyException.java39
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyFault.java33
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java31
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceException.java34
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceFault.java33
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java372
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java94
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java127
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java81
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java81
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java376
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/ObjectFactory.java93
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java372
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ObjectFactory.java93
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java81
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java81
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java127
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java46
-rw-r--r--aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java545
-rw-r--r--aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/InfoTest.java67
-rw-r--r--aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/ObjectFactoryTest.java51
-rw-r--r--aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java199
27 files changed, 662 insertions, 2548 deletions
diff --git a/aai-els-onap-logging/pom.xml b/aai-els-onap-logging/pom.xml
index d678e5b6..e3a6cbcc 100644
--- a/aai-els-onap-logging/pom.xml
+++ b/aai-els-onap-logging/pom.xml
@@ -126,6 +126,16 @@
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.30</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ErrorMessage.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ErrorMessage.java
new file mode 100644
index 00000000..3b4aab65
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ErrorMessage.java
@@ -0,0 +1,41 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import java.util.List;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.extern.jackson.Jacksonized;
+
+@Data
+@Builder
+@Jacksonized
+public class ErrorMessage {
+ private String messageId;
+ private String text;
+
+ @JacksonXmlElementWrapper(localName = "variables")
+ @JacksonXmlProperty(localName = "variable")
+ private List<String> variables;
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ExceptionType.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ExceptionType.java
new file mode 100644
index 00000000..fc0b0242
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ExceptionType.java
@@ -0,0 +1,36 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public enum ExceptionType {
+ SERVICE("serviceException"),
+ POLICY("policyException");
+ private final String type;
+
+ @JsonValue
+ public String getType() {
+ return type;
+ }
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Fault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Fault.java
new file mode 100644
index 00000000..acccaa26
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Fault.java
@@ -0,0 +1,36 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@XmlRootElement
+public class Fault {
+ private Map<ExceptionType, ErrorMessage> requestError;
+} \ No newline at end of file
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Info.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Info.java
new file mode 100644
index 00000000..cad47315
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/Info.java
@@ -0,0 +1,31 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+@Data
+@AllArgsConstructor
+public class Info {
+ private List<ErrorMessage> errorMessages;
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyException.java
new file mode 100644
index 00000000..0dd3ec01
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyException.java
@@ -0,0 +1,39 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.extern.jackson.Jacksonized;
+
+@Data
+@Builder
+@Jacksonized
+@AllArgsConstructor
+@NoArgsConstructor
+public class PolicyException {
+ private String messageId;
+ private String text;
+ private List<String> variables;
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyFault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyFault.java
new file mode 100644
index 00000000..3137a260
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/PolicyFault.java
@@ -0,0 +1,33 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import lombok.Data;
+
+@Data
+public class PolicyFault {
+
+ private RequestError requestError;
+
+ @Data
+ public class RequestError {
+ private PolicyException policyException;
+ }
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java
new file mode 100644
index 00000000..96602906
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/RequestError.java
@@ -0,0 +1,31 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.Value;
+import java.util.Map;
+
+@NoArgsConstructor
+@AllArgsConstructor
+public class RequestError {
+ private Map<String, ErrorMessage> exceptionMessage;
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceException.java
new file mode 100644
index 00000000..47fae22d
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceException.java
@@ -0,0 +1,34 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import java.util.List;
+import lombok.Builder;
+import lombok.Data;
+import lombok.extern.jackson.Jacksonized;
+
+@Data
+@Builder
+@Jacksonized
+public class ServiceException {
+ private String messageId;
+ private String text;
+ private List<String> variables;
+} \ No newline at end of file
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceFault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceFault.java
new file mode 100644
index 00000000..5fdad100
--- /dev/null
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/errorResponse/ServiceFault.java
@@ -0,0 +1,33 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2023 Deutsche Telekom. 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.aai.domain.errorResponse;
+
+import lombok.Data;
+
+@Data
+public class ServiceFault {
+
+ private RequestError requestError;
+
+ @Data
+ public class RequestError {
+ private ServiceException serviceException;
+ }
+}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java
deleted file mode 100644
index f356275e..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.02.11 at 04:54:39 PM EST
-//
-
-package org.onap.aai.domain.restPolicyException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.*;
-
-/**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="requestError">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="policyException">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"requestError"})
-@XmlRootElement(name = "Fault")
-public class Fault {
-
- @XmlElement(required = true)
- protected RequestError requestError;
-
- /**
- * Gets the value of the requestError property.
- *
- * @return
- * possible object is
- * {@link RequestError }
- *
- */
- public RequestError getRequestError() {
- return requestError;
- }
-
- /**
- * Sets the value of the requestError property.
- *
- * @param value
- * allowed object is
- * {@link RequestError }
- *
- */
- public void setRequestError(RequestError value) {
- this.requestError = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="policyException">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"policyException"})
- public static class RequestError {
-
- @XmlElement(required = true)
- protected PolicyException policyException;
-
- /**
- * Gets the value of the policyException property.
- *
- * @return
- * possible object is
- * {@link PolicyException }
- *
- */
- public PolicyException getPolicyException() {
- return policyException;
- }
-
- /**
- * Sets the value of the policyException property.
- *
- * @param value
- * allowed object is
- * {@link PolicyException }
- *
- */
- public void setPolicyException(PolicyException value) {
- this.policyException = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"messageId", "text", "variables"})
- public static class PolicyException {
-
- @XmlElement(required = true)
- protected String messageId;
- @XmlElement(required = true)
- protected String text;
- @XmlElement(required = true)
- protected Variables variables;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the text property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the value of the text property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setText(String value) {
- this.text = value;
- }
-
- /**
- * Gets the value of the variables property.
- *
- * @return
- * possible object is
- * {@link Variables }
- *
- */
- public Variables getVariables() {
- return variables;
- }
-
- /**
- * Sets the value of the variables property.
- *
- * @param value
- * allowed object is
- * {@link Variables }
- *
- */
- public void setVariables(Variables value) {
- this.variables = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"variable"})
- public static class Variables {
-
- protected List<String> variable;
-
- /**
- * Gets the value of the variable property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the variable property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getVariable().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- * @return the variable
- */
- public List<String> getVariable() {
- if (variable == null) {
- variable = new ArrayList<>();
- }
- return this.variable;
- }
-
- }
-
- }
-
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java
deleted file mode 100644
index 613c76d8..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.02.11 at 04:54:39 PM EST
-//
-
-package org.onap.aai.domain.restPolicyException;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.onap.aai.domain.restPolicyException package.
- * <p>
- * An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
- * org.onap.aai.domain.restPolicyException
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * a
- * * Create an instance of {@link Fult }.
- *
- * @return the fault
- */
- public Fault createFault() {
- return new Fault();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError }
- *
- * @return the request error
- */
- public Fault.RequestError createFaultRequestError() {
- return new Fault.RequestError();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError.PolicyException }
- *
- * @return the policy exception
- */
- public Fault.RequestError.PolicyException createFaultRequestErrorPolicyException() {
- return new Fault.RequestError.PolicyException();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError.PolicyException.Variables }
- *
- * @return the variables
- */
- public Fault.RequestError.PolicyException.Variables createFaultRequestErrorPolicyExceptionVariables() {
- return new Fault.RequestError.PolicyException.Variables();
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java
deleted file mode 100644
index 16f52ef2..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restPolicyException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"messageId", "text", "variables"})
-public class PolicyException {
-
- @JsonProperty("messageId")
- private String messageId;
- @JsonProperty("text")
- private String text;
- @JsonProperty("variables")
- private List<String> variables = new ArrayList<String>();
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the message id.
- *
- * @return The messageId
- */
- @JsonProperty("messageId")
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the message id.
- *
- * @param messageId The messageId
- */
- @JsonProperty("messageId")
- public void setMessageId(String messageId) {
- this.messageId = messageId;
- }
-
- /**
- * Gets the text.
- *
- * @return The text
- */
- @JsonProperty("text")
- public String getText() {
- return text;
- }
-
- /**
- * Sets the text.
- *
- * @param text The text
- */
- @JsonProperty("text")
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Gets the variables.
- *
- * @return The variables
- */
- @JsonProperty("variables")
- public List<String> getVariables() {
- return variables;
- }
-
- /**
- * Sets the variables.
- *
- * @param variables The variables
- */
- @JsonProperty("variables")
- public void setVariables(List<String> variables) {
- this.variables = variables;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java
deleted file mode 100644
index 708a1117..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restPolicyException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"requestError"})
-public class RESTResponse {
-
- @JsonProperty("requestError")
- private RequestError requestError;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the request error.
- *
- * @return The requestError
- */
- @JsonProperty("requestError")
- public RequestError getRequestError() {
- return requestError;
- }
-
- /**
- * Sets the request error.
- *
- * @param requestError The requestError
- */
- @JsonProperty("requestError")
- public void setRequestError(RequestError requestError) {
- this.requestError = requestError;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java
deleted file mode 100644
index 717c1059..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restPolicyException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"policyException"})
-public class RequestError {
-
- @JsonProperty("policyException")
- private PolicyException policyException;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the policy exception.
- *
- * @return The policyException
- */
- @JsonProperty("policyException")
- public PolicyException getPolicyException() {
- return policyException;
- }
-
- /**
- * Sets the policy exception.
- *
- * @param policyException The policyException
- */
- @JsonProperty("policyException")
- public void setPolicyException(PolicyException policyException) {
- this.policyException = policyException;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java
deleted file mode 100644
index 3685e5aa..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.10.28 at 05:53:17 PM EDT
-//
-
-package org.onap.aai.domain.restResponseInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.*;
-
-/**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="responseMessages" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="responseMessage" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"responseMessages"})
-@XmlRootElement(name = "Info")
-public class Info {
-
- protected ResponseMessages responseMessages;
-
- /**
- * Gets the value of the responseMessages property.
- *
- * @return
- * possible object is
- * {@link ResponseMessages }
- *
- */
- public ResponseMessages getResponseMessages() {
- return responseMessages;
- }
-
- /**
- * Sets the value of the responseMessages property.
- *
- * @param value
- * allowed object is
- * {@link ResponseMessages }
- *
- */
- public void setResponseMessages(ResponseMessages value) {
- this.responseMessages = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="responseMessage" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"responseMessage"})
- public static class ResponseMessages {
-
- protected List<ResponseMessage> responseMessage;
-
- /**
- * Gets the value of the responseMessage property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the responseMessage property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getResponseMessage().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link ResponseMessage }
- *
- * @return the response message
- */
- public List<ResponseMessage> getResponseMessage() {
- if (responseMessage == null) {
- responseMessage = new ArrayList<>();
- }
- return this.responseMessage;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"messageId", "text", "variables"})
- public static class ResponseMessage {
-
- @XmlElement(required = true)
- protected String messageId;
- @XmlElement(required = true)
- protected String text;
- @XmlElement(required = true)
- protected Variables variables;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the text property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the value of the text property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setText(String value) {
- this.text = value;
- }
-
- /**
- * Gets the value of the variables property.
- *
- * @return
- * possible object is
- * {@link Variables }
- *
- */
- public Variables getVariables() {
- return variables;
- }
-
- /**
- * Sets the value of the variables property.
- *
- * @param value
- * allowed object is
- * {@link Variables }
- *
- */
- public void setVariables(Variables value) {
- this.variables = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"variable"})
- public static class Variables {
-
- protected List<String> variable;
-
- /**
- * Gets the value of the variable property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the variable property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getVariable().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- * @return the variable
- */
- public List<String> getVariable() {
- if (variable == null) {
- variable = new ArrayList<>();
- }
- return this.variable;
- }
-
- }
-
- }
-
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/ObjectFactory.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/ObjectFactory.java
deleted file mode 100644
index 4efafb23..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/ObjectFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.10.28 at 05:53:17 PM EDT
-//
-
-package org.onap.aai.domain.restResponseInfo;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.onap.aai.domain.restResponseInfo package.
- * <p>
- * An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
- * org.onap.aai.domain.restResponseInfo
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link Info }.
- *
- * @return the info
- */
- public Info createInfo() {
- return new Info();
- }
-
- /**
- * Create an instance of {@link Info.ResponseMessages }
- *
- * @return the response messages
- */
- public Info.ResponseMessages createInfoResponseMessages() {
- return new Info.ResponseMessages();
- }
-
- /**
- * Create an instance of {@link Info.ResponseMessages.ResponseMessage }
- *
- * @return the response message
- */
- public Info.ResponseMessages.ResponseMessage createInfoResponseMessagesResponseMessage() {
- return new Info.ResponseMessages.ResponseMessage();
- }
-
- /**
- * Create an instance of {@link Info.ResponseMessages.ResponseMessage.Variables }
- *
- * @return the variables
- */
- public Info.ResponseMessages.ResponseMessage.Variables createInfoResponseMessagesResponseMessageVariables() {
- return new Info.ResponseMessages.ResponseMessage.Variables();
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java
deleted file mode 100644
index 36a8cb79..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.02.11 at 04:54:29 PM EST
-//
-
-package org.onap.aai.domain.restServiceException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.*;
-
-/**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="requestError">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="serviceException">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"requestError"})
-@XmlRootElement(name = "Fault")
-public class Fault {
-
- @XmlElement(required = true)
- protected RequestError requestError;
-
- /**
- * Gets the value of the requestError property.
- *
- * @return
- * possible object is
- * {@link RequestError }
- *
- */
- public RequestError getRequestError() {
- return requestError;
- }
-
- /**
- * Sets the value of the requestError property.
- *
- * @param value
- * allowed object is
- * {@link RequestError }
- *
- */
- public void setRequestError(RequestError value) {
- this.requestError = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="serviceException">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"serviceException"})
- public static class RequestError {
-
- @XmlElement(required = true)
- protected ServiceException serviceException;
-
- /**
- * Gets the value of the serviceException property.
- *
- * @return
- * possible object is
- * {@link ServiceException }
- *
- */
- public ServiceException getServiceException() {
- return serviceException;
- }
-
- /**
- * Sets the value of the serviceException property.
- *
- * @param value
- * allowed object is
- * {@link ServiceException }
- *
- */
- public void setServiceException(ServiceException value) {
- this.serviceException = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"messageId", "text", "variables"})
- public static class ServiceException {
-
- @XmlElement(required = true)
- protected String messageId;
- @XmlElement(required = true)
- protected String text;
- @XmlElement(required = true)
- protected Variables variables;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the text property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the value of the text property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setText(String value) {
- this.text = value;
- }
-
- /**
- * Gets the value of the variables property.
- *
- * @return
- * possible object is
- * {@link Variables }
- *
- */
- public Variables getVariables() {
- return variables;
- }
-
- /**
- * Sets the value of the variables property.
- *
- * @param value
- * allowed object is
- * {@link Variables }
- *
- */
- public void setVariables(Variables value) {
- this.variables = value;
- }
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"variable"})
- public static class Variables {
-
- protected List<String> variable;
-
- /**
- * Gets the value of the variable property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the variable property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getVariable().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- * @return the variable
- */
- public List<String> getVariable() {
- if (variable == null) {
- variable = new ArrayList<String>();
- }
- return this.variable;
- }
-
- }
-
- }
-
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ObjectFactory.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ObjectFactory.java
deleted file mode 100644
index 95eb2cba..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ObjectFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.02.11 at 04:54:29 PM EST
-//
-
-package org.onap.aai.domain.restServiceException;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.onap.aai.domain.restServiceException package.
- * <p>
- * An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
- * org.onap.aai.domain.restServiceException
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link Fault }.
- *
- * @return the fault
- */
- public Fault createFault() {
- return new Fault();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError }
- *
- * @return the request error
- */
- public Fault.RequestError createFaultRequestError() {
- return new Fault.RequestError();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError.ServiceException }
- *
- * @return the service exception
- */
- public Fault.RequestError.ServiceException createFaultRequestErrorServiceException() {
- return new Fault.RequestError.ServiceException();
- }
-
- /**
- * Create an instance of {@link Fault.RequestError.ServiceException.Variables }
- *
- * @return the variables
- */
- public Fault.RequestError.ServiceException.Variables createFaultRequestErrorServiceExceptionVariables() {
- return new Fault.RequestError.ServiceException.Variables();
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java
deleted file mode 100644
index a0687637..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restServiceException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"requestError"})
-public class RESTResponse {
-
- @JsonProperty("requestError")
- private RequestError requestError;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the request error.
- *
- * @return The requestError
- */
- @JsonProperty("requestError")
- public RequestError getRequestError() {
- return requestError;
- }
-
- /**
- * Sets the request error.
- *
- * @param requestError The requestError
- */
- @JsonProperty("requestError")
- public void setRequestError(RequestError requestError) {
- this.requestError = requestError;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java
deleted file mode 100644
index cff5f69d..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restServiceException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"serviceException"})
-public class RequestError {
-
- @JsonProperty("serviceException")
- private ServiceException serviceException;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the service exception.
- *
- * @return The serviceException
- */
- @JsonProperty("serviceException")
- public ServiceException getServiceException() {
- return serviceException;
- }
-
- /**
- * Sets the service exception.
- *
- * @param serviceException The serviceException
- */
- @JsonProperty("serviceException")
- public void setServiceException(ServiceException serviceException) {
- this.serviceException = serviceException;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java
deleted file mode 100644
index e3339fae..00000000
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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.aai.domain.restServiceException;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({"messageId", "text", "variables"})
-public class ServiceException {
-
- @JsonProperty("messageId")
- private String messageId;
- @JsonProperty("text")
- private String text;
- @JsonProperty("variables")
- private List<String> variables = new ArrayList<String>();
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the message id.
- *
- * @return The messageId
- */
- @JsonProperty("messageId")
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the message id.
- *
- * @param messageId The messageId
- */
- @JsonProperty("messageId")
- public void setMessageId(String messageId) {
- this.messageId = messageId;
- }
-
- /**
- * Gets the text.
- *
- * @return The text
- */
- @JsonProperty("text")
- public String getText() {
- return text;
- }
-
- /**
- * Sets the text.
- *
- * @param text The text
- */
- @JsonProperty("text")
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Gets the variables.
- *
- * @return The variables
- */
- @JsonProperty("variables")
- public List<String> getVariables() {
- return variables;
- }
-
- /**
- * Sets the variables.
- *
- * @param variables The variables
- */
- @JsonProperty("variables")
- public void setVariables(List<String> variables) {
- this.variables = variables;
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
-}
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java
index 320d5630..e302cd5a 100644
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java
@@ -5,6 +5,7 @@
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright © 2018 IBM.
+ * Modifications Copyright (C) 2023 Deutsche Telekom SA.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,10 +32,6 @@ import org.onap.aai.logging.ErrorObjectNotFoundException;
public class AAIException extends Exception {
- private static final String UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE =
- " - update error.properties before using this exception code";
- private static final String FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE =
- "Failed to instantiate AAIException with code=";
public static final String DEFAULT_EXCEPTION_CODE = "AAI_4000";
private static final long serialVersionUID = 1L;
@@ -50,12 +47,7 @@ public class AAIException extends Exception {
this.code = DEFAULT_EXCEPTION_CODE;
this.templateVars = new LinkedList<>();
- try {
- this.errorObject = ErrorLogHelper.getErrorObject(getCode());
- } catch (ErrorObjectNotFoundException e) {
- throw new RuntimeException(FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE + getCode()
- + UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE);
- }
+ this.errorObject = ErrorLogHelper.getErrorObject(getCode());
}
/**
@@ -68,13 +60,7 @@ public class AAIException extends Exception {
this.code = code;
this.templateVars = new LinkedList<>();
-
- try {
- this.errorObject = ErrorLogHelper.getErrorObject(getCode());
- } catch (ErrorObjectNotFoundException e) {
- throw new RuntimeException(FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE + getCode()
- + UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE);
- }
+ this.errorObject = ErrorLogHelper.getErrorObject(getCode());
}
/**
@@ -88,14 +74,8 @@ public class AAIException extends Exception {
this.code = code;
this.templateVars = new LinkedList<>();
-
- try {
- this.errorObject = ErrorLogHelper.getErrorObject(getCode());
- errorObject.setDetails(details);
- } catch (ErrorObjectNotFoundException e) {
- throw new RuntimeException(FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE + getCode()
- + UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE);
- }
+ this.errorObject = ErrorLogHelper.getErrorObject(getCode());
+ errorObject.setDetails(details);
}
/**
@@ -109,13 +89,7 @@ public class AAIException extends Exception {
this.code = code;
this.templateVars = new LinkedList<>();
-
- try {
- this.errorObject = ErrorLogHelper.getErrorObject(getCode());
- } catch (ErrorObjectNotFoundException e) {
- throw new RuntimeException(FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE + getCode()
- + UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE);
- }
+ this.errorObject = ErrorLogHelper.getErrorObject(getCode());
}
/**
@@ -130,13 +104,7 @@ public class AAIException extends Exception {
this.code = code;
this.templateVars = new LinkedList<>();
-
- try {
- this.errorObject = ErrorLogHelper.getErrorObject(getCode());
- } catch (ErrorObjectNotFoundException e) {
- throw new RuntimeException(FAILED_TO_INSTANTIATE_AAI_EXCEPTION_WITH_CODE + getCode()
- + UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE);
- }
+ this.errorObject = ErrorLogHelper.getErrorObject(getCode());
}
public String getCode() {
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java
index 1cdee738..97548d99 100644
--- a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java
+++ b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java
@@ -3,6 +3,7 @@
* org.onap.aai
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Deutsche Telekom SA.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,22 +24,25 @@ package org.onap.aai.logging;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringWriter;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
import java.util.Properties;
+import java.util.Map.Entry;
import javax.ws.rs.core.MediaType;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
import org.apache.commons.lang3.StringUtils;
+import org.onap.aai.domain.errorResponse.ErrorMessage;
+import org.onap.aai.domain.errorResponse.ExceptionType;
+import org.onap.aai.domain.errorResponse.Fault;
+import org.onap.aai.domain.errorResponse.Info;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.util.AAIConstants;
-import org.onap.aai.util.MapperUtil;
import org.onap.logging.filter.base.Constants;
import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -46,6 +50,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+
/**
*
* This classes loads the application error properties file
@@ -56,6 +64,8 @@ import org.slf4j.MDC;
public class ErrorLogHelper {
private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLogHelper.class);
private static final HashMap<String, ErrorObject> ERROR_OBJECTS = new HashMap<String, ErrorObject>();
+ private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final XmlMapper xmlMapper = new XmlMapper();
static {
try {
@@ -75,17 +85,17 @@ public class ErrorLogHelper {
*/
public static void loadProperties() throws IOException, ErrorObjectFormatException {
final String filePath = AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + "error.properties";
- final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("error.properties");
+ final InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("error.properties");
final Properties properties = new Properties();
- try (final FileInputStream fis = new FileInputStream(filePath)) {
+ try (final FileInputStream fileInputStream = new FileInputStream(filePath)) {
LOGGER.info("Found the error.properties in the following location: {}",
AAIConstants.AAI_HOME_ETC_APP_PROPERTIES);
- properties.load(fis);
+ properties.load(fileInputStream);
} catch (Exception ex) {
LOGGER.info("Unable to find the error.properties from filesystem so using file in jar");
- if (is != null) {
- properties.load(is);
+ if (inputStream != null) {
+ properties.load(inputStream);
} else {
LOGGER.error("Expected to find the error.properties in the jar but unable to find it");
}
@@ -123,7 +133,7 @@ public class ErrorLogHelper {
* @throws IOException
* @throws ErrorObjectNotFoundException
*/
- public static ErrorObject getErrorObject(String code) throws ErrorObjectNotFoundException {
+ public static ErrorObject getErrorObject(String code) {
if (code == null)
throw new IllegalArgumentException("Key cannot be null");
@@ -145,17 +155,16 @@ public class ErrorLogHelper {
* If no error object is embedded in the AAIException, one will be created using the error object from the
* AAIException.
*
- * @param are must have a restError value whose numeric value must match what should be returned in the REST API
+ * @param aaiException must have a restError value whose numeric value must match what should be returned in the REST API
* @param variables optional list of variables to flesh out text in error string
* @return appropriately formatted JSON response per the REST API spec.
* @throws IOException
* @deprecated
*/
- public static String getRESTAPIErrorResponse(AAIException are, ArrayList<String> variables) {
- List<MediaType> acceptHeaders = new ArrayList<MediaType>();
- acceptHeaders.add(MediaType.APPLICATION_JSON_TYPE);
+ public static String getRESTAPIErrorResponse(AAIException aaiException, ArrayList<String> variables) {
+ List<MediaType> acceptHeaders = Collections.singletonList(MediaType.APPLICATION_JSON_TYPE);
- return getRESTAPIErrorResponse(acceptHeaders, are, variables);
+ return getRESTAPIErrorResponse(acceptHeaders, aaiException, variables);
}
/**
@@ -164,287 +173,146 @@ public class ErrorLogHelper {
* This allows lower level exception detail to be returned to the client to help troubleshoot the problem.
* If no error object is embedded in the AAIException, one will be created using the error object from the
* AAIException.
+ *
+ * @param aaiException
+ * @param variables
+ * @return
+ */
+ public static Fault getErrorResponse(AAIException aaiException,
+ ArrayList<String> variables) {
+ final ErrorObject restErrorObject = getRestErrorObject(aaiException);
+ final String text = createText(restErrorObject);
+ final int placeholderCount = StringUtils.countMatches(restErrorObject.getErrorText(), "%");
+ variables = checkAndEnrichVariables(aaiException, variables, placeholderCount);
+
+ if (aaiException.getErrorObject().getCategory().equals("1")) {
+ return createPolicyFault(aaiException, text, variables);
+ } else {
+ return createServiceFault(aaiException, text, variables);
+ }
+ }
+
+ /**
*
- * @param acceptHeadersOrig the accept headers orig
- * @param are must have a restError value whose numeric value must match what should be returned in the REST API
+ * @param acceptHeaders the accept headers orig
+ * @param aaiException must have a restError value whose numeric value must match what should be returned in the REST API
* @param variables optional list of variables to flesh out text in error string
* @return appropriately formatted JSON response per the REST API spec.
+ * @deprecated in favor of {@link #getErrorResponse(AAIException, ArrayList)}
*/
- public static String getRESTAPIErrorResponse(List<MediaType> acceptHeadersOrig, AAIException are,
+ @Deprecated
+ public static String getRESTAPIErrorResponse(List<MediaType> acceptHeaders, AAIException aaiException,
ArrayList<String> variables) {
- StringBuilder text = new StringBuilder();
- String response = null;
-
- List<MediaType> acceptHeaders = new ArrayList<MediaType>();
+ List<MediaType> validAcceptHeaders = new ArrayList<MediaType>();
// we might have an exception but no accept header, so we'll set default to JSON
boolean foundValidAcceptHeader = false;
- for (MediaType mt : acceptHeadersOrig) {
- if (MediaType.APPLICATION_XML_TYPE.isCompatible(mt) || MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
- acceptHeaders.add(mt);
+ for (MediaType mediaType : acceptHeaders) {
+ if (MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType) || MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) {
+ validAcceptHeaders.add(mediaType);
foundValidAcceptHeader = true;
}
}
if (foundValidAcceptHeader == false) {
// override the exception, client needs to set an appropriate Accept header
- are = new AAIException("AAI_4014");
- acceptHeaders.add(MediaType.APPLICATION_JSON_TYPE);
+ aaiException = new AAIException("AAI_4014");
+ validAcceptHeaders.add(MediaType.APPLICATION_JSON_TYPE);
}
- final ErrorObject eo = are.getErrorObject();
-
- int restErrorCode = Integer.parseInt(eo.getRESTErrorCode());
-
- ErrorObject restErrorObject;
+ MediaType mediaType = validAcceptHeaders.stream()
+ .filter(MediaType.APPLICATION_JSON_TYPE::isCompatible)
+ .findAny()
+ .orElse(MediaType.APPLICATION_XML_TYPE);
+ Fault fault = getErrorResponse(aaiException, variables);
try {
- restErrorObject = ErrorLogHelper.getErrorObject("AAI_" + restErrorCode);
- } catch (ErrorObjectNotFoundException e) {
- LOGGER.warn("Failed to find related error object AAI_" + restErrorCode + " for error object "
- + eo.getErrorCode() + "; using AAI_" + restErrorCode);
- restErrorObject = eo;
+ return MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)
+ ? objectMapper.writeValueAsString(fault)
+ : xmlMapper.writeValueAsString(fault);
+ } catch (JsonProcessingException ex) {
+ LOGGER.error(
+ "We were unable to create a rest exception to return on an API because of a parsing error "
+ + ex.getMessage());
}
+ return null;
+ }
+ private static String createText(ErrorObject restErrorObject) {
+ final StringBuilder text = new StringBuilder();
text.append(restErrorObject.getErrorText());
// We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n
// This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the
// error, are ordered based on the error string.
- int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%");
- text.append(" (msg=%").append(localDataIndex + 1).append(") (ec=%").append(localDataIndex + 2).append(")");
-
- if (variables == null) {
- variables = new ArrayList<String>();
- }
-
- if (variables.size() < localDataIndex) {
- ErrorLogHelper.logError("AAI_4011", "data missing for rest error");
- while (variables.size() < localDataIndex) {
- variables.add("null");
- }
- }
-
- // This will put the error code and error text into the right positions
- if (are.getMessage() == null || are.getMessage().length() == 0) {
- variables.add(localDataIndex++, eo.getErrorText());
- } else {
- variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage());
- }
- variables.add(localDataIndex, eo.getErrorCodeString());
-
- for (MediaType mediaType : acceptHeaders) {
- if (MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType)) {
- JAXBContext context = null;
- try {
- if (eo.getCategory().equals("1")) {
-
- context = JAXBContext.newInstance(org.onap.aai.domain.restPolicyException.Fault.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
-
- org.onap.aai.domain.restPolicyException.ObjectFactory factory =
- new org.onap.aai.domain.restPolicyException.ObjectFactory();
- org.onap.aai.domain.restPolicyException.Fault fault = factory.createFault();
- org.onap.aai.domain.restPolicyException.Fault.RequestError requestError =
- factory.createFaultRequestError();
- org.onap.aai.domain.restPolicyException.Fault.RequestError.PolicyException policyException =
- factory.createFaultRequestErrorPolicyException();
- org.onap.aai.domain.restPolicyException.Fault.RequestError.PolicyException.Variables polvariables =
- factory.createFaultRequestErrorPolicyExceptionVariables();
-
- policyException.setMessageId("POL" + eo.getRESTErrorCode());
- policyException.setText(text.toString());
- for (int i = 0; i < variables.size(); i++) {
- polvariables.getVariable().add(variables.get(i));
- }
- policyException.setVariables(polvariables);
- requestError.setPolicyException(policyException);
- fault.setRequestError(requestError);
-
- StringWriter sw = new StringWriter();
- m.marshal(fault, sw);
-
- response = sw.toString();
-
- } else {
-
- context = JAXBContext.newInstance(org.onap.aai.domain.restServiceException.Fault.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
-
- org.onap.aai.domain.restServiceException.ObjectFactory factory =
- new org.onap.aai.domain.restServiceException.ObjectFactory();
- org.onap.aai.domain.restServiceException.Fault fault = factory.createFault();
- org.onap.aai.domain.restServiceException.Fault.RequestError requestError =
- factory.createFaultRequestError();
- org.onap.aai.domain.restServiceException.Fault.RequestError.ServiceException serviceException =
- factory.createFaultRequestErrorServiceException();
- org.onap.aai.domain.restServiceException.Fault.RequestError.ServiceException.Variables svcvariables =
- factory.createFaultRequestErrorServiceExceptionVariables();
- serviceException.setMessageId("SVC" + eo.getRESTErrorCode());
- serviceException.setText(text.toString());
- for (int i = 0; i < variables.size(); i++) {
- svcvariables.getVariable().add(variables.get(i));
- }
- serviceException.setVariables(svcvariables);
- requestError.setServiceException(serviceException);
- fault.setRequestError(requestError);
-
- StringWriter sw = new StringWriter();
- m.marshal(fault, sw);
-
- response = sw.toString();
-
- }
- } catch (Exception ex) {
- LOGGER.error(
- "We were unable to create a rest exception to return on an API because of a parsing error "
- + ex.getMessage());
- }
- } else {
- try {
- if (eo.getCategory().equals("1")) {
- org.onap.aai.domain.restPolicyException.RESTResponse restresp =
- new org.onap.aai.domain.restPolicyException.RESTResponse();
- org.onap.aai.domain.restPolicyException.RequestError reqerr =
- new org.onap.aai.domain.restPolicyException.RequestError();
- org.onap.aai.domain.restPolicyException.PolicyException polexc =
- new org.onap.aai.domain.restPolicyException.PolicyException();
- polexc.setMessageId("POL" + eo.getRESTErrorCode());
- polexc.setText(text.toString());
- polexc.setVariables(variables);
- reqerr.setPolicyException(polexc);
- restresp.setRequestError(reqerr);
- response = (MapperUtil.writeAsJSONString((Object) restresp));
-
- } else {
- org.onap.aai.domain.restServiceException.RESTResponse restresp =
- new org.onap.aai.domain.restServiceException.RESTResponse();
- org.onap.aai.domain.restServiceException.RequestError reqerr =
- new org.onap.aai.domain.restServiceException.RequestError();
- org.onap.aai.domain.restServiceException.ServiceException svcexc =
- new org.onap.aai.domain.restServiceException.ServiceException();
- svcexc.setMessageId("SVC" + eo.getRESTErrorCode());
- svcexc.setText(text.toString());
- svcexc.setVariables(variables);
- reqerr.setServiceException(svcexc);
- restresp.setRequestError(reqerr);
- response = (MapperUtil.writeAsJSONString((Object) restresp));
- }
- } catch (Exception ex) {
- LOGGER.error(
- "We were unable to create a rest exception to return on an API because of a parsing error "
- + ex.getMessage());
- }
- }
- }
-
- return response;
+ int placeholderCount = StringUtils.countMatches(restErrorObject.getErrorText(), "%");
+ text.append(" (msg=%").append(placeholderCount + 1).append(") (ec=%").append(placeholderCount + 2).append(")");
+ return text.toString();
}
/**
* Gets the RESTAPI error response with logging.
*
- * @param acceptHeadersOrig the accept headers orig
- * @param are the are
+ * @param acceptHeaders the accept headers orig
+ * @param aaiException the are
* @param variables the variables
*/
- public static String getRESTAPIErrorResponseWithLogging(List<MediaType> acceptHeadersOrig, AAIException are,
+ public static String getRESTAPIErrorResponseWithLogging(List<MediaType> acceptHeaders, AAIException aaiException,
ArrayList<String> variables) {
- String response = ErrorLogHelper.getRESTAPIErrorResponse(acceptHeadersOrig, are, variables);
- logException(are);
- return response;
+ logException(aaiException);
+ return ErrorLogHelper.getRESTAPIErrorResponse(acceptHeaders, aaiException, variables);
}
/**
* Gets the RESTAPI info response.
*
- * @param acceptHeaders the accept headers
- * @param areList the are list
+ * @param acceptHeaders this param is ignored
+ * @param aaiExceptionsMap the map of AAIException
* @return the RESTAPI info response
+ * @deprecated {@link ErrorLogHelper#}
+ * @deprecated in favor of {@link #getRestApiInfoResponse(HashMap)}
*/
- public static Object getRESTAPIInfoResponse(List<MediaType> acceptHeaders,
- HashMap<AAIException, ArrayList<String>> areList) {
-
- Object respObj = null;
-
- org.onap.aai.domain.restResponseInfo.ObjectFactory factory =
- new org.onap.aai.domain.restResponseInfo.ObjectFactory();
- org.onap.aai.domain.restResponseInfo.Info info = factory.createInfo();
- org.onap.aai.domain.restResponseInfo.Info.ResponseMessages responseMessages =
- factory.createInfoResponseMessages();
- Iterator<Entry<AAIException, ArrayList<String>>> it = areList.entrySet().iterator();
-
- while (it.hasNext()) {
- Entry<AAIException, ArrayList<String>> pair = (Entry<AAIException, ArrayList<String>>) it.next();
- AAIException are = pair.getKey();
- ArrayList<String> variables = pair.getValue();
-
- StringBuilder text = new StringBuilder();
-
- ErrorObject eo = are.getErrorObject();
-
- int restErrorCode = Integer.parseInt(eo.getRESTErrorCode());
- ErrorObject restErrorObject;
- try {
- restErrorObject = ErrorLogHelper.getErrorObject("AAI_" + String.format("%04d", restErrorCode));
- } catch (ErrorObjectNotFoundException e) {
- restErrorObject = eo;
- }
- text.append(restErrorObject.getErrorText());
+ @Deprecated
+ public static Object getRESTAPIInfoResponse(ArrayList<MediaType> acceptHeaders,
+ Map<AAIException, ArrayList<String>> aaiExceptionsMap) {
+ return (Object) getRestApiInfoResponse(aaiExceptionsMap);
+ }
- // We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n
- // This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the
- // error, are ordered based on the error string.
- int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%");
- text.append(" (msg=%").append(localDataIndex + 1).append(") (rc=%").append(localDataIndex + 2).append(")");
+ /**
+ * Gets the RESTAPI info response.
+ *
+ * @param acceptHeaders the accept headers
+ * @param aaiExceptionsMap the are list
+ * @return the RESTAPI info response
+ */
+ public static Info getRestApiInfoResponse(
+ Map<AAIException, ArrayList<String>> aaiExceptionsMap) {
+ List<ErrorMessage> errorMessages = aaiExceptionsMap.entrySet().stream()
+ .map(entry -> createResponseMessage(entry))
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ return new Info(errorMessages);
+ }
- if (variables == null) {
- variables = new ArrayList<String>();
- }
+ private static ErrorMessage createResponseMessage(Entry<AAIException, ArrayList<String>> entry) {
+ AAIException aaiException = entry.getKey();
+ ArrayList<String> variables = entry.getValue();
- if (variables.size() < localDataIndex) {
- ErrorLogHelper.logError("AAI_4011", "data missing for rest error");
- while (variables.size() < localDataIndex) {
- variables.add("null");
- }
- }
+ ErrorObject restErrorObject = getRestErrorObject(aaiException);
+ final String text = createText(restErrorObject);
+ final int placeholderCount = StringUtils.countMatches(aaiException.getErrorObject().getErrorText(), "%");
+ variables = checkAndEnrichVariables(aaiException, variables, placeholderCount);
- // This will put the error code and error text into the right positions
- if (are.getMessage() == null) {
- variables.add(localDataIndex++, eo.getErrorText());
- } else {
- variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage());
- }
- variables.add(localDataIndex, eo.getErrorCodeString());
-
- try {
- org.onap.aai.domain.restResponseInfo.Info.ResponseMessages.ResponseMessage responseMessage =
- factory.createInfoResponseMessagesResponseMessage();
- org.onap.aai.domain.restResponseInfo.Info.ResponseMessages.ResponseMessage.Variables infovariables =
- factory.createInfoResponseMessagesResponseMessageVariables();
-
- responseMessage.setMessageId("INF" + eo.getRESTErrorCode());
- responseMessage.setText(text.toString());
- for (int i = 0; i < variables.size(); i++) {
- infovariables.getVariable().add(variables.get(i));
- }
-
- responseMessage.setVariables(infovariables);
- responseMessages.getResponseMessage().add(responseMessage);
-
- } catch (Exception ex) {
- LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error "
- + ex.getMessage());
- }
+ try {
+ return ErrorMessage.builder()
+ .messageId("INF" + aaiException.getErrorObject().getRESTErrorCode())
+ .text(text)
+ .variables(variables)
+ .build();
+ } catch (Exception ex) {
+ LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error "
+ + ex.getMessage());
+ return null;
}
-
- info.setResponseMessages(responseMessages);
- respObj = (Object) info;
-
- return respObj;
}
/**
@@ -454,125 +322,16 @@ public class ErrorLogHelper {
* If no error object is embedded in the AAIException, one will be created using the error object from the
* AAIException.
*
- * @param are must have a restError value whose numeric value must match what should be returned in the REST API
+ * @param aaiException must have a restError value whose numeric value must match what should be returned in the REST API
* @param variables optional list of variables to flesh out text in error string
* @return appropriately formatted JSON response per the REST API spec.
*/
- public static String getRESTAPIPolicyErrorResponseXML(AAIException are, ArrayList<String> variables) {
-
- StringBuilder text = new StringBuilder();
- String response = null;
- JAXBContext context = null;
-
- ErrorObject eo = are.getErrorObject();
-
- int restErrorCode = Integer.parseInt(eo.getRESTErrorCode());
- ErrorObject restErrorObject;
- try {
- restErrorObject = ErrorLogHelper.getErrorObject("AAI_" + restErrorCode);
- } catch (ErrorObjectNotFoundException e) {
- restErrorObject = eo;
- }
-
- text.append(restErrorObject.getErrorText());
-
- // We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n
- // This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the
- // error, are ordered based on the error string.
- int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%");
- text.append(" (msg=%").append(localDataIndex + 1).append(") (ec=%").append(localDataIndex + 2).append(")");
-
- if (variables == null) {
- variables = new ArrayList<String>();
- }
-
- if (variables.size() < localDataIndex) {
- ErrorLogHelper.logError("AAI_4011", "data missing for rest error");
- while (variables.size() < localDataIndex) {
- variables.add("null");
- }
- }
-
- // This will put the error code and error text into the right positions
- if (are.getMessage() == null) {
- variables.add(localDataIndex++, eo.getErrorText());
- } else {
- variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage());
- }
- variables.add(localDataIndex, eo.getErrorCodeString());
-
- try {
- if (eo.getCategory().equals("1")) {
-
- context = JAXBContext.newInstance(org.onap.aai.domain.restPolicyException.Fault.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
-
- org.onap.aai.domain.restPolicyException.ObjectFactory factory =
- new org.onap.aai.domain.restPolicyException.ObjectFactory();
- org.onap.aai.domain.restPolicyException.Fault fault = factory.createFault();
- org.onap.aai.domain.restPolicyException.Fault.RequestError requestError =
- factory.createFaultRequestError();
- org.onap.aai.domain.restPolicyException.Fault.RequestError.PolicyException policyException =
- factory.createFaultRequestErrorPolicyException();
- org.onap.aai.domain.restPolicyException.Fault.RequestError.PolicyException.Variables polvariables =
- factory.createFaultRequestErrorPolicyExceptionVariables();
-
- policyException.setMessageId("POL" + eo.getRESTErrorCode());
- policyException.setText(text.toString());
- for (int i = 0; i < variables.size(); i++) {
- polvariables.getVariable().add(variables.get(i));
- }
- policyException.setVariables(polvariables);
- requestError.setPolicyException(policyException);
- fault.setRequestError(requestError);
-
- StringWriter sw = new StringWriter();
- m.marshal(fault, sw);
-
- response = sw.toString();
-
- } else {
-
- context = JAXBContext.newInstance(org.onap.aai.domain.restServiceException.Fault.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
-
- org.onap.aai.domain.restServiceException.ObjectFactory factory =
- new org.onap.aai.domain.restServiceException.ObjectFactory();
- org.onap.aai.domain.restServiceException.Fault fault = factory.createFault();
- org.onap.aai.domain.restServiceException.Fault.RequestError requestError =
- factory.createFaultRequestError();
- org.onap.aai.domain.restServiceException.Fault.RequestError.ServiceException serviceException =
- factory.createFaultRequestErrorServiceException();
- org.onap.aai.domain.restServiceException.Fault.RequestError.ServiceException.Variables svcvariables =
- factory.createFaultRequestErrorServiceExceptionVariables();
- serviceException.setMessageId("POL" + eo.getRESTErrorCode());
- serviceException.setText(text.toString());
- for (int i = 0; i < variables.size(); i++) {
- svcvariables.getVariable().add(variables.get(i));
- }
- serviceException.setVariables(svcvariables);
- requestError.setServiceException(serviceException);
- fault.setRequestError(requestError);
-
- StringWriter sw = new StringWriter();
- m.marshal(fault, sw);
-
- response = sw.toString();
-
- }
- } catch (Exception ex) {
- LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error "
- + ex.getMessage());
- }
- return response;
+ public static String getRESTAPIPolicyErrorResponseXML(AAIException aaiException, ArrayList<String> variables) {
+ return getRESTAPIErrorResponse(Collections.singletonList(MediaType.APPLICATION_XML_TYPE), aaiException, variables);
}
- public static void logException(AAIException e) {
- final ErrorObject errorObject = e.getErrorObject();
+ public static void logException(AAIException aaiException) {
+ final ErrorObject errorObject = aaiException.getErrorObject();
/*
* String severityCode = errorObject.getSeverityCode(errorObject.getSeverity());
*
@@ -586,13 +345,13 @@ public class ErrorLogHelper {
*/
String stackTrace = "";
try {
- stackTrace = LogFormatTools.getStackTop(e);
+ stackTrace = LogFormatTools.getStackTop(aaiException);
} catch (Exception a) {
// ignore
}
final String errorMessage = new StringBuilder().append(errorObject.getErrorText()).append(":")
.append(errorObject.getRESTErrorCode()).append(":").append(errorObject.getHTTPResponseCode())
- .append(":").append(e.getMessage()).toString().replaceAll("\\n", "^");
+ .append(":").append(aaiException.getMessage()).toString().replaceAll("\\n", "^");
MDCSetup mdcSetup = new MDCSetup();
mdcSetup.setResponseStatusCode(errorObject.getHTTPResponseCode().getStatusCode());
@@ -622,4 +381,50 @@ public class ErrorLogHelper {
public static void logError(String code, String message) {
logException(new AAIException(code, message));
}
+
+ private static ErrorObject getRestErrorObject(AAIException aaiException) {
+ final int restErrorCode = Integer.parseInt(aaiException.getErrorObject().getRESTErrorCode());
+ return ErrorLogHelper.getErrorObject("AAI_" + restErrorCode);
+ }
+
+ public static Fault createPolicyFault(AAIException aaiException, String text, List<String> variables) {
+ return createFault(aaiException, text, variables, ExceptionType.POLICY);
+ }
+ public static Fault createServiceFault(AAIException aaiException, String text, List<String> variables) {
+ return createFault(aaiException, text, variables, ExceptionType.SERVICE);
+ }
+ private static Fault createFault(AAIException aaiException, String text, List<String> variables, ExceptionType exceptionType) {
+ String typePrefix = ExceptionType.POLICY.equals(exceptionType) ? "POL" : "SVC";
+ Map<ExceptionType, ErrorMessage> requestError = Collections.singletonMap(exceptionType,
+ ErrorMessage.builder()
+ .messageId(typePrefix+ aaiException.getErrorObject().getRESTErrorCode())
+ .text(text)
+ .variables(variables)
+ .build());
+ return new Fault(requestError);
+ }
+
+ private static ArrayList<String> checkAndEnrichVariables(AAIException aaiException, ArrayList<String> variables, int placeholderCount) {
+ final ErrorObject errorObject = aaiException.getErrorObject();
+ if (variables == null) {
+ variables = new ArrayList<String>();
+ }
+
+ // int placeholderCount = StringUtils.countMatches(errorObject.getErrorText(), "%");
+ if (variables.size() < placeholderCount) {
+ ErrorLogHelper.logError("AAI_4011", "data missing for rest error");
+ while (variables.size() < placeholderCount) {
+ variables.add("null");
+ }
+ }
+
+ // This will put the error code and error text into the right positions
+ if (aaiException.getMessage() == null || aaiException.getMessage().length() == 0) {
+ variables.add(placeholderCount++, errorObject.getErrorText());
+ } else {
+ variables.add(placeholderCount++, errorObject.getErrorText() + ":" + aaiException.getMessage());
+ }
+ variables.add(placeholderCount, errorObject.getErrorCodeString());
+ return variables;
+ }
}
diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/InfoTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/InfoTest.java
deleted file mode 100644
index 6e1b0ea4..00000000
--- a/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/InfoTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.10.28 at 05:53:17 PM EDT
-//
-
-package org.onap.aai.domain.restResponseInfo;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.Test;
-
-public class InfoTest {
- private Info info = new Info();
-
- @Test
- public void infoTest() {
- Info.ResponseMessages responseMessages = info.getResponseMessages();
- if (responseMessages == null)
- responseMessages = new Info.ResponseMessages();
-
- List<Info.ResponseMessages.ResponseMessage> list = responseMessages.getResponseMessage();
- Info.ResponseMessages.ResponseMessage respMsg = new Info.ResponseMessages.ResponseMessage();
-
- respMsg.setMessageId("1");
- respMsg.setText("textValue");
-
- Info.ResponseMessages.ResponseMessage.Variables vars = new Info.ResponseMessages.ResponseMessage.Variables();
- vars.getVariable().add("var1");
- vars.getVariable().add("var2");
-
- respMsg.setVariables(vars);
- list.add(respMsg);
- info.setResponseMessages(responseMessages);
-
- Info.ResponseMessages responseMessages1 = info.getResponseMessages();
- List<Info.ResponseMessages.ResponseMessage> list1 = responseMessages1.getResponseMessage();
- Info.ResponseMessages.ResponseMessage respMsg1 = list1.get(0);
- assertTrue(respMsg1.getMessageId().equals("1"));
- assertTrue(respMsg1.getText().equals("textValue"));
- assertTrue(respMsg1.getVariables().getVariable().contains("var1"));
- assertTrue(respMsg1.getVariables().getVariable().contains("var2"));
- }
-
-}
diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/ObjectFactoryTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/ObjectFactoryTest.java
deleted file mode 100644
index fe95d183..00000000
--- a/aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/ObjectFactoryTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 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=========================================================
- */
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2015.10.28 at 05:53:17 PM EDT
-//
-
-package org.onap.aai.domain.restResponseInfo;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-public class ObjectFactoryTest {
- private ObjectFactory objectFactory = new ObjectFactory();
-
- @Test
- public void objectFactoryTest() {
- Info.ResponseMessages.ResponseMessage.Variables variables =
- objectFactory.createInfoResponseMessagesResponseMessageVariables();
- Info.ResponseMessages.ResponseMessage responseMessage =
- objectFactory.createInfoResponseMessagesResponseMessage();
- Info.ResponseMessages responseMessages = objectFactory.createInfoResponseMessages();
- Info info = objectFactory.createInfo();
-
- assertNotNull(variables);
- assertNotNull(responseMessage);
- assertNotNull(responseMessages);
- assertNotNull(info);
- }
-
-}
diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java
index 99522771..fcbd86e0 100644
--- a/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java
+++ b/aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java
@@ -3,6 +3,7 @@
* org.onap.aai
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Deutsche Telekom SA.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,44 +27,54 @@ import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.ws.rs.core.MediaType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aai.domain.restPolicyException.PolicyException;
-import org.onap.aai.domain.restPolicyException.RESTResponse;
-import org.onap.aai.domain.restPolicyException.RequestError;
-import org.onap.aai.domain.restServiceException.ServiceException;
+import org.onap.aai.domain.errorResponse.ErrorMessage;
+import org.onap.aai.domain.errorResponse.ExceptionType;
+import org.onap.aai.domain.errorResponse.Fault;
+import org.onap.aai.domain.errorResponse.Info;
+import org.onap.aai.domain.errorResponse.ServiceFault;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.util.LogFile;
-import org.onap.aai.util.MapperUtil;
import org.slf4j.MDC;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+
+@SuppressWarnings("deprecation")
public class ErrorLogHelperTest {
- private static final String ErrorLogFileName = "error.log";
+ private static final String errorLogFileName = "error.log";
+ private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final XmlMapper xmlMapper = new XmlMapper();
@Before
public void init() {
System.setProperty("AJSC_HOME", ".");
-
}
@After
public void cleanup() throws IOException {
MDC.clear();
- LogFile.deleteContents(ErrorLogFileName);
+ LogFile.deleteContents(errorLogFileName);
}
@Test
public void logErrorTest() throws IOException, InterruptedException {
// ||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110
ErrorLogHelper.logError("AAI_6110");
- sleep(5000);
- String logContents = LogFile.getContents(ErrorLogFileName);
+ sleep(2000);
+ String logContents = LogFile.getContents(errorLogFileName);
assertNotNull(logContents);
@@ -80,8 +91,8 @@ public class ErrorLogHelperTest {
// ||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110 message
String errorMessage = "Object is referenced by additional objects";
ErrorLogHelper.logError("AAI_6110", errorMessage);
- sleep(5000);
- String logContents = LogFile.getContents(ErrorLogFileName);
+ sleep(3000);
+ String logContents = LogFile.getContents(errorLogFileName);
assertNotNull(logContents);
@@ -93,58 +104,112 @@ public class ErrorLogHelperTest {
}
@Test
- public void getRESTAPIPolicyErrorResponseTest() throws AAIException {
+ public void getRESTAPIPolicyErrorResponseXmlTest() throws AAIException, JsonMappingException, JsonProcessingException {
+ // AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
+ List<MediaType> headers = Collections.singletonList(MediaType.APPLICATION_XML_TYPE);
+ ArrayList<String> variables = new ArrayList<String>();
+
+ AAIException aaiException = new AAIException("AAI_3102");
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaiException, variables);
+ assertNotNull(errorResponse);
+ assertTrue(errorResponse.contains("<Fault>"));
+ assertTrue(errorResponse.contains("<policyException>"));
+ assertTrue(errorResponse.contains("<variables>"));
+ assertTrue(errorResponse.contains("<variable>"));
+
+ Fault restResponse = xmlMapper.readValue(errorResponse, Fault.class);
+ assertNotNull(restResponse);
+
+ ErrorMessage policyErrorMessage = restResponse.getRequestError().get(ExceptionType.POLICY);
+ assertEquals("POL3102", policyErrorMessage.getMessageId());
+ assertEquals("Error parsing input performing %1 on %2 (msg=%3) (ec=%4)", policyErrorMessage.getText());
+ assertEquals("null", policyErrorMessage.getVariables().get(0));
+ assertEquals("null", policyErrorMessage.getVariables().get(1));
+ assertEquals("Error parsing input performing %1 on %2", policyErrorMessage.getVariables().get(2));
+ assertEquals("ERR.5.1.3102", policyErrorMessage.getVariables().get(3));
+ }
+
+ @Test
+ public void getRESTAPIServiceErrorResponseXmlTest() throws AAIException, JsonMappingException, JsonProcessingException {
+ // AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
+ List<MediaType> headers = Collections.singletonList(MediaType.APPLICATION_XML_TYPE);
+ ArrayList<String> variables = new ArrayList<String>();
+
+ AAIException aaiException = new AAIException("AAI_3009");
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaiException, variables);
+ assertNotNull(errorResponse);
+
+ Fault restResponse = xmlMapper.readValue(errorResponse, Fault.class);
+ assertNotNull(restResponse);
+
+ ErrorMessage serviceErrorMessage = restResponse.getRequestError().get(ExceptionType.SERVICE);
+ assertEquals("SVC3009", serviceErrorMessage.getMessageId());
+ assertEquals("Malformed URL (msg=%1) (ec=%2)", serviceErrorMessage.getText());
+ assertEquals("Malformed URL", serviceErrorMessage.getVariables().get(0));
+ assertEquals("ERR.5.6.3009", serviceErrorMessage.getVariables().get(1));
+ }
+
+ @Test
+ public void getRESTAPIPolicyErrorResponseJsonTest() throws AAIException, JsonMappingException, JsonProcessingException {
// AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2:300
- ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
+ List<MediaType> headers = Collections.singletonList(MediaType.APPLICATION_JSON_TYPE);
ArrayList<String> args = new ArrayList<String>(Arrays.asList("PUT", "resource"));
- AAIException aaie = new AAIException("AAI_3002");
- String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaie, args);
+ AAIException aaiException = new AAIException("AAI_3002");
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaiException, args);
assertNotNull(errorResponse);
+ assertTrue(errorResponse.contains("policyException"));
- RESTResponse resp = MapperUtil.readAsObjectOf(RESTResponse.class, errorResponse);
- RequestError requestError = resp.getRequestError();
- assertNotNull(requestError);
- PolicyException policyException = requestError.getPolicyException();
- assertNotNull(policyException);
- assertEquals("POL3002", policyException.getMessageId());
+ Fault restResponse = objectMapper.readValue(errorResponse, Fault.class);
+ assertNotNull(restResponse);
+
+ ErrorMessage policyErrorMessage = restResponse.getRequestError().get(ExceptionType.POLICY);
+ assertEquals("POL3002", policyErrorMessage.getMessageId());
- List<String> vars = policyException.getVariables();
- assertTrue(vars.contains("PUT"));
- assertTrue(vars.contains("resource"));
+ List<String> variables = policyErrorMessage.getVariables();
+ assertEquals("PUT", variables.get(0));
+ assertEquals("resource", variables.get(1));
+ assertEquals("Error writing output performing %1 on %2", variables.get(2));
+ assertEquals("ERR.5.1.3002", variables.get(3));
}
@Test
- public void getRESTAPIServiceErrorResponseTest() throws AAIException {
+ public void getRESTAPIServiceErrorResponseJsonTest() throws AAIException, JsonMappingException, JsonProcessingException {
// AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
- ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
- ArrayList<String> args = new ArrayList<String>();
+ List<MediaType> headers = Collections.singletonList(MediaType.APPLICATION_JSON_TYPE);
+ ArrayList<String> variables = new ArrayList<String>();
- AAIException aaie = new AAIException("AAI_3009");
- String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaie, args);
+ AAIException aaiException = new AAIException("AAI_3009");
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaiException, variables);
assertNotNull(errorResponse);
+ assertTrue(errorResponse.contains("serviceException"));
- org.onap.aai.domain.restServiceException.RESTResponse resp =
- MapperUtil.readAsObjectOf(org.onap.aai.domain.restServiceException.RESTResponse.class, errorResponse);
- org.onap.aai.domain.restServiceException.RequestError requestError = resp.getRequestError();
+ org.onap.aai.domain.errorResponse.Fault restResponse =
+ objectMapper.readValue(errorResponse, org.onap.aai.domain.errorResponse.Fault.class);
+
+ Map<ExceptionType, ErrorMessage> requestError = restResponse.getRequestError();
assertNotNull(requestError);
- ServiceException serviceException = requestError.getServiceException();
- assertNotNull(serviceException);
- assertEquals("SVC3009", serviceException.getMessageId());
-
+ ErrorMessage errorMessage = requestError.get(ExceptionType.SERVICE);
+ assertEquals("SVC3009", errorMessage.getMessageId());
+ assertEquals("Malformed URL (msg=%1) (ec=%2)", errorMessage.getText());
+ assertEquals("Malformed URL", errorMessage.getVariables().get(0));
+ assertEquals("ERR.5.6.3009", errorMessage.getVariables().get(1));
+
+ ServiceFault serviceFault = objectMapper.readValue(errorResponse, ServiceFault.class);
+ assertEquals("SVC3009", serviceFault.getRequestError().getServiceException().getMessageId());
}
@Test
public void getRESTAPIServiceErrorResponseWithLoggingTest() throws IOException, InterruptedException {
// AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
- ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
- ArrayList<String> args = new ArrayList<String>();
+ List<MediaType> headers = Collections.singletonList(MediaType.APPLICATION_JSON_TYPE);
+ ArrayList<String> variables = new ArrayList<String>();
- AAIException aaie = new AAIException("AAI_3009");
- String errorResponse = ErrorLogHelper.getRESTAPIErrorResponseWithLogging(headers, aaie, args);
- sleep(5000);
+ AAIException aaiException = new AAIException("AAI_3009");
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponseWithLogging(headers, aaiException, variables);
+ sleep(2000);
assertNotNull(errorResponse);
- String logContents = LogFile.getContents(ErrorLogFileName);
+ String logContents = LogFile.getContents(errorLogFileName);
assertNotNull(logContents);
String logContentParts[] = logContents.split("\\|");
@@ -154,4 +219,52 @@ public class ErrorLogHelperTest {
}
+ @Test
+ public void thatErrorObjectCanBeRetrieved() throws ErrorObjectNotFoundException {
+ ErrorObject errorObject = ErrorLogHelper.getErrorObject("AAI_3000");
+ assertEquals("3000", errorObject.getErrorCode());
+ assertEquals("3000", errorObject.getRESTErrorCode());
+ assertEquals("Invalid input performing %1 on %2", errorObject.getErrorText());
+ assertEquals("2", errorObject.getCategory());
+ assertEquals("INFO", errorObject.getSeverity());
+ }
+
+ @Test
+ public void thatInvalidErrorCodeWillReturnDefaultException() throws ErrorObjectNotFoundException {
+ ErrorObject errorObject = ErrorLogHelper.getErrorObject("AAI_1234");
+ assertEquals("4000", errorObject.getErrorCode());
+ assertEquals("3002", errorObject.getRESTErrorCode());
+ assertEquals("Internal Error", errorObject.getErrorText());
+ assertEquals("4", errorObject.getCategory());
+ assertEquals("ERROR", errorObject.getSeverity());
+ }
+
+ @Test
+ public void thatInvalidMediaTypeWillReturnInvalidAcceptHeaderException() throws ErrorObjectNotFoundException, JsonMappingException, JsonProcessingException {
+ String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(Collections.singletonList(MediaType.TEXT_PLAIN_TYPE), new AAIException(), new ArrayList<>());
+
+ Fault restResponse = objectMapper.readValue(errorResponse, Fault.class);
+ assertNotNull(restResponse);
+
+ ErrorMessage serviceErrorMessage = restResponse.getRequestError().get(ExceptionType.SERVICE);
+ List<String> variables = serviceErrorMessage.getVariables();
+ assertEquals("SVC3000", serviceErrorMessage.getMessageId());
+ assertEquals("null", variables.get(0));
+ assertEquals("null", variables.get(1));
+ assertEquals("Invalid Accept header", variables.get(2));
+ assertEquals("4.0.4014", variables.get(3));
+ }
+
+ @Test
+ public void thatRestApiInfoResponseCanBeRetrieved() {
+ Map<AAIException, ArrayList<String>> aaiExceptionsMap = new HashMap<>();
+ aaiExceptionsMap.put(new AAIException("AAI_0002", "OK"), new ArrayList<String>(Arrays.asList("someApp", "someTransactionId")));
+ Info info = ErrorLogHelper.getRestApiInfoResponse(aaiExceptionsMap);
+ ErrorMessage errorMessage = info.getErrorMessages().get(0);
+ assertEquals("INF0001", errorMessage.getMessageId());
+ assertEquals("Internal Error (msg=%1) (ec=%2)", errorMessage.getText());
+ assertEquals("Successful health check:OK", errorMessage.getVariables().get(0));
+ assertEquals("0.0.0002", errorMessage.getVariables().get(1));
+ }
+
}