From 677dbc87455c77e9d3184519ddbd550c74cc41e8 Mon Sep 17 00:00:00 2001 From: "Bansal, Nitin (nb121v)" Date: Thu, 5 Apr 2018 09:39:39 -0400 Subject: [PATCH 01/16] Enabling 2 way ssl with spring boot Change-Id: I2e8cefc59dcfc330c3e511bcd5a8f66336c39674 Issue-ID: AAI-802 Signed-off-by: Bansal, Nitin (nb121v) --- src/main/bin/start.sh | 20 ++++++++++++++++++++ src/main/docker/Dockerfile | 6 ------ src/main/resources/application.properties | 8 +------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh index fecadcc..a54059b 100644 --- a/src/main/bin/start.sh +++ b/src/main/bin/start.sh @@ -9,6 +9,26 @@ if [ -z "$CONFIG_HOME" ]; then exit 1 fi +if [ -z "$KEY_STORE_PASSWORD" ]; then + echo "KEY_STORE_PASSWORD must be set in order to start up process" + exit 1 +else + ## Extract java jar to DEOBFUSCATE the password. + CURR_D=`pwd` + cd $BASEDIR + jar xf data-router.jar + sudo java -cp ./BOOT-INF/lib/jetty-util-9.4.8.v20171121.jar org.eclipse.jetty.util.security.Password $KEY_STORE_PASSWORD > pass.txt 2>> pass.txt + PASS=`sed "2q;d" pass.txt` + sudo rm pass.txt + cd $CURR_D +fi + +## tomcat_keystore to p12 +keytool -importkeystore -noprompt -deststorepass $PASS -destkeypass $PASS -srckeystore $BASEDIR/config/auth/tomcat_keystore -destkeystore $BASEDIR/config/auth/onap.p12 -deststoretype PKCS12 -srcstorepass $PASS + +## import into cacerts +sudo keytool -importkeystore -noprompt -deststorepass changeit -destkeypass changeit -destkeystore /$JAVA_HOME/jre/lib/security/cacerts -srckeystore $BASEDIR/config/auth/onap.p12 -srcstoretype PKCS12 -srcstorepass $PASS -alias tomcat + PROPS="-DAJSC_HOME=$AJSC_HOME" PROPS="$PROPS -DAJSC_CONF_HOME=$AJSC_CONF_HOME" diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 8963fa8..b4e638a 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -28,12 +28,6 @@ COPY data-router.jar $MICRO_HOME/ COPY bundleconfig-local $MICRO_HOME/bundleconfig COPY bundleconfig-local/etc/logback.xml $MICRO_HOME/bundleconfig/etc -# Create the aai user -RUN mkdir /opt/aaihome && \ - groupadd -g 492381 aaiadmin && \ - useradd -r -u 341790 -g 492381 -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \ - chown -R aaiadmin:aaiadmin $MICRO_HOME -USER aaiadmin EXPOSE 9502 9502 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a046f4e..13ba49c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,11 +3,5 @@ server.ssl.key-store=file:${CONFIG_HOME}/auth/tomcat_keystore server.ssl.enabled=true server.port=9502 -server.ssl.client-auth=want - +server.ssl.client-auth=need server.ssl.enabled-protocols=TLSv1.1,TLSv1.2 - -#server.ssl.trust-store=C:\\ONAP\\spring\\data-router\\dynamic\\auth\\tomcat_keystore -#server.ssl.trust-store-password=onapSecret -#server.ssl.client-auth=want -server.ssl.key-store-type=JKS \ No newline at end of file -- 2.16.6 From 082e1ce2aa473ba1f11371fda85a720a6e05513c Mon Sep 17 00:00:00 2001 From: Eric Debeau Date: Tue, 10 Apr 2018 19:55:20 +0000 Subject: [PATCH 02/16] Correct INFO.yaml to pass YAML Lint Change-Id: I6476f7673a91704b8e2fcc45073f62140721c699 Issue-ID: AAI-1022 Signed-off-by: Eric Debeau --- INFO.yaml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/INFO.yaml b/INFO.yaml index 3a7e3e8..911e04e 100644 --- a/INFO.yaml +++ b/INFO.yaml @@ -15,37 +15,37 @@ issue_tracking: key: 'AAI' meetings: - type: 'zoom' - agenda: 'https://wiki.onap.org/display/DW/AAI+Meeting+Notes' - url: 'https://wiki.onap.org/pages/viewpage.action?pageId=8227676' - server: 'n/a' - channel: 'n/a' - repeats: 'weekly' - time: '14:00 UTC' + agenda: 'https://wiki.onap.org/display/DW/AAI+Meeting+Notes' + url: 'https://wiki.onap.org/pages/viewpage.action?pageId=8227676' + server: 'n/a' + channel: 'n/a' + repeats: 'weekly' + time: '14:00 UTC' committers: - <<: *onap_releng_ptl - name: 'Manisha Aggarwal' - email: 'ma9181@att.com' - company: 'ATT' - id: 'ma9181' - timezone: 'America/New York' + email: 'ma9181@att.com' + company: 'ATT' + id: 'ma9181' + timezone: 'America/New York' - name: 'Steven Blimkie' - email: 'Steven.Blimkie@amdocs.com' - company: 'Amdocs' - id: 'sblimkie' - timezone: 'America/Toronto' + email: 'Steven.Blimkie@amdocs.com' + company: 'Amdocs' + id: 'sblimkie' + timezone: 'America/Toronto' - name: 'Tian Lee' - email: 'TianL@amdocs.com' - company: 'Amdocs' - id: 'TianL' - timezone: 'Europe/London' + email: 'TianL@amdocs.com' + company: 'Amdocs' + id: 'TianL' + timezone: 'Europe/London' - name: 'Venkata Harish Kajur' - email: 'vk250x@att.com' - company: 'ATT' - id: 'vk250x' - timezone: 'America/New York' + email: 'vk250x@att.com' + company: 'ATT' + id: 'vk250x' + timezone: 'America/New York' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' changes: - type: 'removal' - name: 'Steve Smokowski' - link: 'https://lists.onap.org/pipermail/onap-tsc/2018-February/004361.html' + name: 'Steve Smokowski' + link: 'https://lists.onap.org/pipermail/onap-tsc/2018-February/004361.html' -- 2.16.6 From 79b58148dfc588f48241c87e48a72fe8dd7c88b4 Mon Sep 17 00:00:00 2001 From: Shwetank Dave Date: Wed, 18 Apr 2018 12:42:58 -0400 Subject: [PATCH 03/16] Update springboot to 1.5.12.RELEASE Change-Id: I25ef66fb1b2dde0a104fc43bc18273bb258b74db Issue-ID: AAI-1044 Signed-off-by: Shwetank Dave --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 99bca06..9c8a804 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE + 1.5.12.RELEASE org.onap.aai.data-router -- 2.16.6 From 4e901d497c9c82495cd008737467de82325f9a45 Mon Sep 17 00:00:00 2001 From: Shwetank Dave Date: Mon, 23 Apr 2018 10:03:14 -0400 Subject: [PATCH 04/16] Remove snapshot dependencies Upgrading router-core snapshot dependency to 1.2.0 release. Upgrading aai-schema snapshot dependency to 1.2.2 release. Change-Id: Iae8bc299d2e4eed7bada4038b7f7338b359011f8 Issue-ID: AAI-1092 Signed-off-by: Shwetank Dave --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9c8a804..d7179cf 100644 --- a/pom.xml +++ b/pom.xml @@ -165,12 +165,12 @@ limitations under the License. org.onap.aai.aai-common aai-schema - 1.2.2-SNAPSHOT + 1.2.2 org.onap.aai.router-core router-core - 1.2.0-SNAPSHOT + 1.2.0 -- 2.16.6 From c27118c25252ac114b4464825e595f9310a642af Mon Sep 17 00:00:00 2001 From: Jimmy Forsyth Date: Fri, 4 May 2018 08:37:04 -0400 Subject: [PATCH 05/16] Upversion data-router and prep for release Issue-ID: AAI-1122 Change-Id: Ifc349bb7614ee4f9022681d5d90ae15021e0fadb Signed-off-by: Jimmy Forsyth --- pom.xml | 4 ++-- version.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d7179cf..738bb8d 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ limitations under the License. org.onap.aai.data-router data-router - 1.2.0-SNAPSHOT + 1.2.1-SNAPSHOT aai-data-router @@ -165,7 +165,7 @@ limitations under the License. org.onap.aai.aai-common aai-schema - 1.2.2 + 1.2.4 org.onap.aai.router-core diff --git a/version.properties b/version.properties index faf06bb..688582d 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=2 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} -- 2.16.6 From 46e5c160c70b7c579b2d0c58ca433369724b991f Mon Sep 17 00:00:00 2001 From: Jimmy Forsyth Date: Mon, 7 May 2018 18:10:53 -0400 Subject: [PATCH 06/16] Exclude httpclient 4.5 and force 4.5.5 Issue-ID: AAI-1125 Change-Id: I8ddcc66d5c70a18d2c28db5a498c34a339bb5ac5 Signed-off-by: Jimmy Forsyth --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 738bb8d..dc51bde 100644 --- a/pom.xml +++ b/pom.xml @@ -170,7 +170,7 @@ limitations under the License. org.onap.aai.router-core router-core - 1.2.0 + 1.2.1 @@ -365,7 +365,7 @@ limitations under the License. org.apache.httpcomponents httpclient - 4.5 + 4.5.5 org.apache.httpcomponents -- 2.16.6 From a96d7ed54bdc68ddc0f4f113e5810b9798fe2432 Mon Sep 17 00:00:00 2001 From: Jimmy Forsyth Date: Tue, 8 May 2018 13:33:49 -0400 Subject: [PATCH 07/16] Upversion data-router after release Issue-ID: AAI-1125 Change-Id: I84497cb0233c58831e838c751e822b734c6d90c7 Signed-off-by: Jimmy Forsyth --- pom.xml | 2 +- version.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dc51bde..c599882 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ limitations under the License. org.onap.aai.data-router data-router - 1.2.1-SNAPSHOT + 1.2.2-SNAPSHOT aai-data-router diff --git a/version.properties b/version.properties index 688582d..1f3ede1 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=2 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} -- 2.16.6 From 91b69e60a1d0cdbb9cba24d20ac956ba13ff8e34 Mon Sep 17 00:00:00 2001 From: Jimmy Forsyth Date: Wed, 23 May 2018 13:33:15 -0400 Subject: [PATCH 08/16] Upversion for Casablanca Issue-ID: AAI-1169 Change-Id: I44c4845b0ae35798237e6d0036f41325a1f81ce3 Signed-off-by: Jimmy Forsyth --- pom.xml | 6 +++--- version.properties | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index c599882..7c7b0d6 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ limitations under the License. org.onap.aai.data-router data-router - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT aai-data-router @@ -165,12 +165,12 @@ limitations under the License. org.onap.aai.aai-common aai-schema - 1.2.4 + 1.3.0-SNAPSHOT org.onap.aai.router-core router-core - 1.2.1 + 1.3.0-SNAPSHOT diff --git a/version.properties b/version.properties index 1f3ede1..a254b21 100644 --- a/version.properties +++ b/version.properties @@ -3,8 +3,8 @@ # because they are used in Jenkins, whose plug-in doesn't support major=1 -minor=2 -patch=2 +minor=3 +patch=0 base_version=${major}.${minor}.${patch} -- 2.16.6 From b6e36aeb27f0275e0f2e7668f49f817982914374 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 16 Apr 2018 12:57:21 -0700 Subject: [PATCH 09/16] Pin jnr-unixsocket for Docker plugin to 0.13 The current verison of jnr-unixsocket is 0.12 from the Docker plugin however in order to be able the images for ARM64, it needs the newer version which has support for it. There is work upstream to switch the version to 0.18[0] however it seems that this is still pending, so we can pin it for now until that merges. [0]: https://github.com/spotify/docker-maven-plugin/pull/379 Change-Id: Id79a08d71b4d60d156979fbcfc42a6ba390c9d1c Issue-ID: CIMAN-154 Signed-off-by: Mohammed Naser --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 7c7b0d6..297ee8d 100644 --- a/pom.xml +++ b/pom.xml @@ -287,6 +287,13 @@ limitations under the License. com.spotify docker-maven-plugin 0.4.11 + + + com.github.jnr + jnr-unixsocket + 0.13 + + true docker-hub -- 2.16.6 From 7753d7e90f5d91b143043a642e90dd30806da2ba Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 16 Apr 2018 12:58:21 -0700 Subject: [PATCH 10/16] Dynamically determine image architecture The image architecture is currently hardcoded, this patch removes that hardcoded value to allow for ARM64 builds to go through. Change-Id: I9245037abfe32a8b7efd83b7558755f94c22df6e Issue-ID: CIMAN-154 Signed-off-by: Mohammed Naser --- src/main/docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index b4e638a..6ccffec 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y software-properties-common ## sudo -E is required to preserve the environment. If you remove that line, it will most like freeze at this step RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk ## Setup JAVA_HOME, this is useful for docker commandline -ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-amd64 +ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture) RUN export JAVA_HOME # Build up the deployment folder structure @@ -31,4 +31,4 @@ COPY bundleconfig-local/etc/logback.xml $MICRO_HOME/bundleconfig/etc EXPOSE 9502 9502 -CMD ["/opt/app/data-router/bin/start.sh"] \ No newline at end of file +CMD ["/opt/app/data-router/bin/start.sh"] -- 2.16.6 From 72da66902a3efaff3068ed2b3f4f7eb3bb5fe43f Mon Sep 17 00:00:00 2001 From: da490c Date: Tue, 12 Jun 2018 23:11:15 -0400 Subject: [PATCH 11/16] Fix Spike Event Processing with Common Format Issue-ID: AAI-1215 Change-Id: Ic6b575e9194d00cc0da9229cdb532869357e37e5 Signed-off-by: da490c --- pom.xml | 25 +- .../datarouter/entity/SpikeAggregationEntity.java | 26 +- .../aai/datarouter/entity/SpikeEventHeader.java | 80 ++++++ .../onap/aai/datarouter/entity/SpikeEventMeta.java | 104 ++++++++ .../aai/datarouter/entity/SpikeEventVertex.java | 28 +-- .../policy/AbstractSpikeEntityEventProcessor.java | 278 +++++++++++++++++++-- .../aai/datarouter/policy/EntityEventPolicy.java | 8 + .../policy/SpikeAggregateGenericVnfProcessor.java | 66 ++--- .../policy/SpikeAutosuggestIndexProcessor.java | 116 ++------- .../datarouter/policy/SpikeEntityEventPolicy.java | 253 +++++++++++-------- .../policy/SpikeEntitySearchProcessor.java | 58 ++--- .../aai/datarouter/util/VersionedOxmEntities.java | 4 + .../policy/EntityEventPolicyStubbed.java | 65 +++-- .../datarouter/policy/EntityEventPolicyTest.java | 23 +- .../datarouter/policy/InMemorySearchDatastore.java | 10 +- .../SpikeAggregateGenericVnfProcessorStubbed.java | 65 +++-- .../SpikeAggregateGenericVnfProcessorTest.java | 88 ++++--- .../policy/SpikeAutosuggestProcessorStubbed.java | 65 +++-- .../policy/SpikeAutosuggestProcessorTest.java | 105 +++++--- .../policy/SpikeEntityEventPolicyStubbed.java | 65 +++-- .../policy/SpikeEntityEventPolicyTest.java | 93 ++++--- .../policy/SpikeEntitySearchProcessorStubbed.java | 66 +++-- .../policy/SpikeEntitySearchProcessorTest.java | 133 +++++----- src/test/resources/generic-vnf-spike-event.json | 31 +++ src/test/resources/optical-router-spike-event.json | 24 ++ ...pserver-missing-mandtory-field-spike-event.json | 28 +++ .../pserver-missing-primary-key-spike-event.json | 29 +++ src/test/resources/pserver-spike-event.json | 30 +++ src/test/resources/vserver-spike-event.json | 31 +++ 29 files changed, 1331 insertions(+), 666 deletions(-) create mode 100644 src/main/java/org/onap/aai/datarouter/entity/SpikeEventHeader.java create mode 100644 src/main/java/org/onap/aai/datarouter/entity/SpikeEventMeta.java create mode 100644 src/test/resources/generic-vnf-spike-event.json create mode 100644 src/test/resources/optical-router-spike-event.json create mode 100644 src/test/resources/pserver-missing-mandtory-field-spike-event.json create mode 100644 src/test/resources/pserver-missing-primary-key-spike-event.json create mode 100644 src/test/resources/pserver-spike-event.json create mode 100644 src/test/resources/vserver-spike-event.json diff --git a/pom.xml b/pom.xml index 297ee8d..917a635 100644 --- a/pom.xml +++ b/pom.xml @@ -307,11 +307,26 @@ limitations under the License. + + com.mycila + license-maven-plugin + 3.0 + +
License.txt
+ + src/main/java/** + src/test/java/** + +
+ + + + format + + process-sources + + +
--> org.sonatype.plugins nexus-staging-maven-plugin diff --git a/src/main/java/org/onap/aai/datarouter/entity/SpikeAggregationEntity.java b/src/main/java/org/onap/aai/datarouter/entity/SpikeAggregationEntity.java index 5aff3ce..bb52802 100644 --- a/src/main/java/org/onap/aai/datarouter/entity/SpikeAggregationEntity.java +++ b/src/main/java/org/onap/aai/datarouter/entity/SpikeAggregationEntity.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import org.onap.aai.datarouter.util.NodeUtils; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -36,6 +37,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode; * The Class SpikeAggregationEntity. Mimics functionality of SPIKEUI's AggregationEntity */ public class SpikeAggregationEntity implements DocumentStoreDataEntity, Serializable { + + private Map attributes = new HashMap<>(); + + @JsonIgnore + private ObjectMapper mapper = new ObjectMapper(); + + private String id; private String link; private String lastmodTimestamp; @@ -68,28 +76,23 @@ public class SpikeAggregationEntity implements DocumentStoreDataEntity, Serializ } - Map attributes = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); /** * Instantiates a new aggregation entity. */ public SpikeAggregationEntity() {} - public void deriveFields(JsonNode uebPayload) { + public void deriveFields(JsonNode entityProperties) { this.setId(NodeUtils.generateUniqueShaDigest(link)); this.setLastmodTimestamp(Long.toString(System.currentTimeMillis())); - JsonNode entityNode = uebPayload.get("vertex").get("properties"); - Iterator> nodes = entityNode.fields(); + Iterator> nodes = entityProperties.fields(); while (nodes.hasNext()) { Map.Entry entry = (Map.Entry) nodes.next(); attributes.put(entry.getKey(), entry.getValue().asText()); } } - - @Override public String getAsJson() { ObjectNode rootNode = mapper.createObjectNode(); @@ -105,7 +108,12 @@ public class SpikeAggregationEntity implements DocumentStoreDataEntity, Serializ @Override public String toString() { - return "AggregationEntity [id=" + id + ", link=" + link + ", attributes=" + attributes - + ", mapper=" + mapper + "]"; + return "SpikeAggregationEntity [" + + (attributes != null ? "attributes=" + attributes + ", " : "") + + (id != null ? "id=" + id + ", " : "") + (link != null ? "link=" + link + ", " : "") + + (lastmodTimestamp != null ? "lastmodTimestamp=" + lastmodTimestamp : "") + "]"; } + + + } diff --git a/src/main/java/org/onap/aai/datarouter/entity/SpikeEventHeader.java b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventHeader.java new file mode 100644 index 0000000..476b54e --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventHeader.java @@ -0,0 +1,80 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.entity; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class SpikeEventHeader { + + @JsonProperty("request-id") + private String requestId; + + private String timestamp; + + @JsonProperty("source-name") + private String sourceName; + + @JsonProperty("event-type") + private String eventType; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + @Override + public String toString() { + return "SpikeEventHeader [" + (requestId != null ? "requestId=" + requestId + ", " : "") + + (timestamp != null ? "timestamp=" + timestamp + ", " : "") + + (sourceName != null ? "sourceName=" + sourceName + ", " : "") + + (eventType != null ? "eventType=" + eventType : "") + "]"; + } + +} diff --git a/src/main/java/org/onap/aai/datarouter/entity/SpikeEventMeta.java b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventMeta.java new file mode 100644 index 0000000..40c4acc --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventMeta.java @@ -0,0 +1,104 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.entity; + +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.json.JSONObject; + +public class SpikeEventMeta { + + private JSONObject eventEntity; + private JSONObject eventHeader; + private JSONObject eventBody; + private JSONObject spikeVertex; + private JSONObject vertexProperties; + private SpikeEventVertex spikeEventVertex; + private DynamicJAXBContext oxmJaxbContext; + private String bodyOperationType; + + public JSONObject getEventEntity() { + return eventEntity; + } + + public void setEventEntity(JSONObject eventEntity) { + this.eventEntity = eventEntity; + } + + public JSONObject getEventHeader() { + return eventHeader; + } + + public void setEventHeader(JSONObject eventHeader) { + this.eventHeader = eventHeader; + } + + public JSONObject getEventBody() { + return eventBody; + } + + public void setEventBody(JSONObject eventBody) { + this.eventBody = eventBody; + } + + public JSONObject getSpikeVertex() { + return spikeVertex; + } + + public void setSpikeVertex(JSONObject spikeVertex) { + this.spikeVertex = spikeVertex; + } + + public JSONObject getVertexProperties() { + return vertexProperties; + } + + public void setVertexProperties(JSONObject vertexProperties) { + this.vertexProperties = vertexProperties; + } + + public SpikeEventVertex getSpikeEventVertex() { + return spikeEventVertex; + } + + public void setSpikeEventVertex(SpikeEventVertex spikeEventVertex) { + this.spikeEventVertex = spikeEventVertex; + } + + public DynamicJAXBContext getOxmJaxbContext() { + return oxmJaxbContext; + } + + public void setOxmJaxbContext(DynamicJAXBContext oxmJaxbContext) { + this.oxmJaxbContext = oxmJaxbContext; + } + + public String getBodyOperationType() { + return bodyOperationType; + } + + public void setBodyOperationType(String bodyOperationType) { + this.bodyOperationType = bodyOperationType; + } + + + + +} diff --git a/src/main/java/org/onap/aai/datarouter/entity/SpikeEventVertex.java b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventVertex.java index 43b3816..2350f93 100644 --- a/src/main/java/org/onap/aai/datarouter/entity/SpikeEventVertex.java +++ b/src/main/java/org/onap/aai/datarouter/entity/SpikeEventVertex.java @@ -20,31 +20,29 @@ */ package org.onap.aai.datarouter.entity; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - /** * A convenience POJO for mapping the Vertex from a Spike Event. * - * @author salmaA */ -@JsonIgnoreProperties(ignoreUnknown = true) public class SpikeEventVertex { - private String key; + private final String key; private String schemaVersion; - private String type; + private final String type; + private final String entityLink; - - public String getKey() { - return key; + public SpikeEventVertex(String type, String key) { + this.type = type; + this.key = key; + this.entityLink = type + "/" + key; } - public void setKey(String key) { - this.key = key; + public String getKey() { + return key; } public String getSchemaVersion() { @@ -59,12 +57,8 @@ public class SpikeEventVertex { return type; } - public void setType(String type) { - this.type = type; - } - public String getEntityLink() { - return this.type + "/" + this.key; + return entityLink; } - + } diff --git a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java index 9627365..6d04ed6 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java @@ -33,9 +33,11 @@ import java.util.Map; import org.apache.camel.Exchange; import org.apache.camel.Processor; +import org.apache.http.conn.routing.RouteInfo.LayerType; import org.eclipse.persistence.dynamic.DynamicType; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.oxm.MediaType; import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.cl.api.Logger; @@ -44,6 +46,7 @@ import org.onap.aai.cl.mdc.MdcContext; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SpikeEventEntity; +import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; @@ -51,6 +54,8 @@ import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; import org.onap.aai.datarouter.util.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; +import org.onap.aai.datarouter.util.Version; +import org.onap.aai.datarouter.util.VersionedOxmEntities; import org.onap.aai.restclient.client.Headers; import org.onap.aai.restclient.client.OperationResult; import org.onap.aai.restclient.rest.HttpUtil; @@ -59,30 +64,41 @@ import org.slf4j.MDC; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; public abstract class AbstractSpikeEntityEventProcessor implements Processor { protected static final String additionalInfo = "Response of SpikeEntityEventPolicy"; private Collection externalOxmModelProcessors; - - protected final String ACTION_CREATE = "create"; - private final String EVENT_VERTEX = "vertex"; - public final static String ACTION_DELETE = "delete"; - protected final String ACTION_UPDATE = "update"; protected final String PROCESS_SPIKE_EVENT = "Process Spike Event"; - private final String OPERATION_KEY = "operation"; + protected static final String UPDATE_NOTIFICATION = "update-notification"; + protected static final String SPIKE = "SPIKE"; + + protected static final String HEADER_KEY = "header"; + protected static final String EVENT_TYPE_KEY = "event-type"; + protected static final String SOURCE_NAME_KEY = "source-name"; + protected static final String BODY_KEY = "body"; + protected static final String OPERATION_KEY = "operation"; + + protected static final String VERTEX_KEY = "vertex"; + protected static final String VERTEX_PROPERTIES_KEY = "properties"; + protected static final String VERTEX_KEY_KEY = "key"; + protected static final String VERTEX_TYPE_KEY = "type"; + protected static final String VERTEX_SCHEMA_VERSION_KEY = "schema-version"; + + protected static final String CREATE = "create"; + protected static final String DELETE = "delete"; + protected static final String UPDATE = "update"; + protected enum ResponseType { SUCCESS, PARTIAL_SUCCESS, FAILURE; } - private final List SUPPORTED_ACTIONS = - Arrays.asList(ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE); + protected final List SUPPORTED_ACTIONS = Arrays.asList(CREATE, UPDATE, DELETE); - Map oxmVersionContextMap = new HashMap<>(); - private String oxmVersion = null; + protected Map oxmVersionContextMap = new HashMap<>(); + protected String oxmVersion = null; /** Agent for communicating with the Search Service. */ protected SearchServiceAgent searchAgent = null; @@ -268,9 +284,9 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { // Load the UEB payload data, any errors will result in a failure and discard - JSONObject spikeObjVertex = getUebContentAsJson(uebPayload, EVENT_VERTEX); + JSONObject spikeObjVertex = getUebContentAsJson(uebPayload, VERTEX_KEY); if (spikeObjVertex == null) { - returnWithError(exchange, uebPayload, "Payload is missing " + EVENT_VERTEX); + returnWithError(exchange, uebPayload, "Payload is missing " + VERTEX_KEY); return null; } @@ -336,7 +352,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { String action, String uebPayload, String oxmEntityType, List searchableAttr) { String entityPrimaryKeyFieldName = - getEntityPrimaryKeyFieldName(oxmJaxbContext, uebPayload, oxmEntityType, entityType); + getEntityPrimaryKeyFieldName(oxmJaxbContext, oxmEntityType, entityType); if (entityPrimaryKeyFieldName == null) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload missing primary key attribute"); @@ -346,7 +362,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { return null; } String entityPrimaryKeyFieldValue = lookupValueUsingKey(uebPayload, entityPrimaryKeyFieldName); - if (entityPrimaryKeyFieldValue.isEmpty()) { + if (entityPrimaryKeyFieldValue == null || entityPrimaryKeyFieldValue.isEmpty()) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload missing primary value attribute"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, @@ -425,8 +441,8 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { // Make sure that were were actually passed in a valid string. if (payload == null || payload.isEmpty()) { - logger.debug(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, EVENT_VERTEX); - logger.error(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, EVENT_VERTEX); + logger.debug(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, VERTEX_KEY); + logger.error(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, VERTEX_KEY); return eventVertex; } @@ -448,7 +464,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { } - private String getEntityPrimaryKeyFieldName(DynamicJAXBContext oxmJaxbContext, String payload, + private String getEntityPrimaryKeyFieldName(DynamicJAXBContext oxmJaxbContext, String oxmEntityType, String entityType) { DynamicType entity = oxmJaxbContext.getDynamicType(oxmEntityType); @@ -478,9 +494,9 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { try { jsonNode = mapper.readTree(mapper.getJsonFactory().createJsonParser(payload)); } catch (IOException e) { - logger.debug(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, EVENT_VERTEX + " missing", + logger.debug(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, VERTEX_KEY + " missing", payload); - logger.error(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, EVENT_VERTEX + " missing", + logger.error(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, VERTEX_KEY + " missing", ""); } @@ -634,8 +650,8 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { String entityId = eventEntity.getId(); - if ((action.equalsIgnoreCase(ACTION_CREATE) && entityId != null) - || action.equalsIgnoreCase(ACTION_UPDATE)) { + if ((action.equalsIgnoreCase(CREATE) && entityId != null) + || action.equalsIgnoreCase(UPDATE)) { // Run the GET to retrieve the ETAG from the search service OperationResult storedEntity = searchAgent.getDocument(index, entityId); @@ -653,11 +669,11 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { // Write the entity to the search service. // PUT searchAgent.putDocument(index, entityId, eventEntity.getAsJson(), headers); - } else if (action.equalsIgnoreCase(ACTION_CREATE)) { + } else if (action.equalsIgnoreCase(CREATE)) { // Write the entry to the search service. searchAgent.postDocument(index, eventEntity.getAsJson(), headers); - } else if (action.equalsIgnoreCase(ACTION_DELETE)) { + } else if (action.equalsIgnoreCase(DELETE)) { // Run the GET to retrieve the ETAG from the search service OperationResult storedEntity = searchAgent.getDocument(index, entityId); @@ -670,6 +686,13 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { logger.error(EntityEventPolicyMsgs.NO_ETAG_AVAILABLE_FAILURE, index, entityId); } + /* + * The Spring-Boot version of the search-data-service rejects the DELETE operation unless + * we specify a Content-Type. + */ + + headers.put("Content-Type", Arrays.asList(MediaType.APPLICATION_JSON.getMediaType())); + searchAgent.deleteDocument(index, eventEntity.getId(), headers); } else { logger.error(EntityEventPolicyMsgs.NO_ETAG_AVAILABLE_FAILURE, index, entityId); @@ -682,4 +705,211 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { action); } } + + protected SpikeEventMeta processSpikeEvent(Exchange exchange) { + + SpikeEventMeta meta = new SpikeEventMeta(); + Object eventPayloadObj = null; + String eventPayload = null; + try { + eventPayloadObj = exchange.getIn().getBody(); + + /* + * It is expected that mainJson will have multiple top level objects: - header - body - result + */ + if (eventPayloadObj == null) { + returnWithError(exchange, null, "Invalid Payload"); + return null; + } + + eventPayload = (String)eventPayloadObj; + + meta.setEventEntity(new JSONObject(eventPayload)); + } catch (JSONException exc) { + returnWithError(exchange, eventPayload, "Invalid Payload"); + return null; + } + + JSONObject eventHeader = meta.getEventEntity().getJSONObject(HEADER_KEY); + + if (eventHeader == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + HEADER_KEY); + return null; + } + + meta.setEventHeader(eventHeader); + + /* + * Only process SPIKE update-notification events + */ + + final String sourceName = eventHeader.getString(SOURCE_NAME_KEY); + final String eventType = eventHeader.getString(EVENT_TYPE_KEY); + + if (!(SPIKE.equals(sourceName) && UPDATE_NOTIFICATION.equals(eventType))) { + // drop event + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Ignoring event with sourceName='" + + sourceName + "' and eventType='" + eventType + "'. Payload=" + eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Ignoring event with sourceName='" + sourceName + "' and eventType='" + eventType + "'."); + + /* + * I don't think ignoring a non-applicable event constitutes a failure. + */ + + setResponse(exchange, ResponseType.SUCCESS, additionalInfo); + return null; + } + + JSONObject eventBody = meta.getEventEntity().getJSONObject(BODY_KEY); + + if (eventBody == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + BODY_KEY); + return null; + } + + meta.setEventBody(eventBody); + + String action = eventBody.getString(OPERATION_KEY); + if (action == null || !SUPPORTED_ACTIONS.contains(action.toLowerCase())) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, + "Unrecognized action '" + action + "'", eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Unrecognized action '" + action + "'"); + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + meta.setBodyOperationType(action); + + // Load the event body data, any errors will result in a failure and discard + + JSONObject spikeVertex = eventBody.getJSONObject(VERTEX_KEY); + if (spikeVertex == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + VERTEX_KEY); + return null; + } + + meta.setSpikeVertex(spikeVertex); + + SpikeEventVertex spikeEventVertex = null; + try { + spikeEventVertex = initializeSpikeEventVertex(spikeVertex); + } catch (JSONException exc) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, + "Error initializating spike event. Error: " + exc.getMessage(), eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Error initializating spike event. Error: " + exc.getMessage()); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + meta.setSpikeEventVertex(spikeEventVertex); + + DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); + if (oxmJaxbContext == null) { + logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", + eventPayload); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + meta.setOxmJaxbContext(oxmJaxbContext); + + String entityType = spikeEventVertex.getType(); + if (entityType == null || entityType.isEmpty()) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, + "Payload header missing entity type", eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Payload header missing entity type"); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + /* + * test if entityType is in the model + */ + + VersionedOxmEntities oxmEntities = + EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion)); + + if (oxmEntities != null && !oxmEntities.getEntityTypeLookup().containsKey(entityType)) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "No matching OXM Descriptor for entity-type='" + entityType + "'", + eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "No matching OXM Descriptor for entity-type='" + entityType + "'"); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + + String entityKey = spikeEventVertex.getKey(); + if (entityKey == null || entityKey.isEmpty()) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Payload vertex missing entity key", + eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Payload vertex missing entity key"); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + String entityLink = spikeEventVertex.getEntityLink(); + if (entityLink == null || entityLink.isEmpty()) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, + "Payload header missing entity link", eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Payload header missing entity link"); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + JSONObject vertexProperties = null; + try { + + vertexProperties = spikeVertex.getJSONObject(VERTEX_PROPERTIES_KEY); + + } catch (JSONException exc) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, + "Payload header missing " + VERTEX_PROPERTIES_KEY, eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Payload header missing " + VERTEX_PROPERTIES_KEY); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return null; + } + + meta.setVertexProperties(vertexProperties); + + // log the fact that all data are in good shape + logger.info(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_NONVERBOSE, action, entityType); + logger.debug(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_VERBOSE, action, entityType, + eventPayload); + + return meta; + + } + + protected SpikeEventVertex initializeSpikeEventVertex(JSONObject vertexObject) throws JSONException { + + /* + * These are all critical keys + */ + + final String vertexType = vertexObject.getString(VERTEX_TYPE_KEY); + final String vertexKey = vertexObject.getString(VERTEX_KEY_KEY); + final String vertexSchemaVersion = vertexObject.getString(VERTEX_SCHEMA_VERSION_KEY); + + SpikeEventVertex eventVertex = new SpikeEventVertex(vertexType, vertexKey); + eventVertex.setSchemaVersion(vertexSchemaVersion); + logger.debug(EntityEventPolicyMsgs.UEB_EVENT_HEADER_PARSED, eventVertex.toString()); + + return eventVertex; + + } + } diff --git a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java index 793588f..d54fbe7 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java @@ -37,6 +37,7 @@ import org.apache.camel.Processor; import org.eclipse.persistence.dynamic.DynamicType; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.oxm.MediaType; import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.datarouter.entity.AaiEventEntity; @@ -1000,6 +1001,13 @@ public class EntityEventPolicy implements Processor { logger.error(EntityEventPolicyMsgs.NO_ETAG_AVAILABLE_FAILURE, index, entityId); } + + /* + * The Spring-Boot version of the search-data-service rejects the DELETE operation unless + * we specify a Content-Type. + */ + + headers.put("Content-Type", Arrays.asList(MediaType.APPLICATION_JSON.getMediaType())); searchAgent.deleteDocument(index, eventEntity.getId(), headers); } else { diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessor.java index c2f7d25..b1a5a87 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessor.java @@ -21,13 +21,11 @@ package org.onap.aai.datarouter.policy; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.List; import org.apache.camel.Exchange; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; import org.onap.aai.datarouter.entity.SpikeAggregationEntity; -import org.onap.aai.datarouter.entity.SpikeEventVertex; +import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import com.fasterxml.jackson.databind.JsonNode; @@ -37,13 +35,11 @@ public class SpikeAggregateGenericVnfProcessor extends AbstractSpikeEntityEventP public static final String additionalInfo = "Response of SpikeEntityEventPolicy"; - /** Agent for communicating with the Search Service. */ - public SpikeAggregateGenericVnfProcessor(SpikeEventPolicyConfig config) throws FileNotFoundException { super(config); } - + @Override protected void startup() { // Create the indexes in the search service if they do not already exist. @@ -55,55 +51,31 @@ public class SpikeAggregateGenericVnfProcessor extends AbstractSpikeEntityEventP public void process(Exchange exchange) throws Exception { long startTime = System.currentTimeMillis(); - String uebPayload = getExchangeBody(exchange); - if (uebPayload == null) { - return; - } - JsonNode uebAsJson = null; - try { - uebAsJson = mapper.readTree(uebPayload); - } catch (IOException e) { - returnWithError(exchange, uebPayload, "Invalid Payload"); - return; - } - - String action = getSpikeEventAction(exchange, uebPayload); - if (action == null) { - return; - } - SpikeEventVertex eventVertex = populateEventVertex(exchange, uebPayload); - if (eventVertex == null) { - return; - } - String entityType = getEntityType(exchange, eventVertex, uebPayload); - if (entityType == null) { - return; - } - String entityLink = getEntityLink(exchange, eventVertex, uebPayload); - if (entityLink == null) { - return; - } - DynamicJAXBContext oxmJaxbContext = readOxm(exchange, uebPayload); - if (oxmJaxbContext == null) { + + SpikeEventMeta meta = processSpikeEvent(exchange); + + if (meta == null) { return; } - String oxmEntityType = getOxmEntityType(entityType); - List searchableAttr = getSearchableAttibutes(oxmJaxbContext, oxmEntityType, entityType, uebPayload, - exchange); + + String oxmEntityType = getOxmEntityType(meta.getSpikeEventVertex().getType()); + + List searchableAttr = getSearchableAttibutes(meta.getOxmJaxbContext(), oxmEntityType, + meta.getSpikeEventVertex().getType(), meta.getEventEntity().toString(), exchange); + if (searchableAttr == null) { return; } - - // log the fact that all data are in good shape - logger.info(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_NONVERBOSE, action, entityType); - logger.debug(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_VERBOSE, action, entityType, - uebPayload); + JsonNode propertiesNode = + mapper.readValue(meta.getVertexProperties().toString(), JsonNode.class); SpikeAggregationEntity spikeAgregationEntity = new SpikeAggregationEntity(); - spikeAgregationEntity.setLink(entityLink); - spikeAgregationEntity.deriveFields(uebAsJson); - handleSearchServiceOperation(spikeAgregationEntity, action, searchIndexName); + spikeAgregationEntity.setLink(meta.getSpikeEventVertex().getEntityLink()); + spikeAgregationEntity.deriveFields(propertiesNode); + + handleSearchServiceOperation(spikeAgregationEntity, meta.getBodyOperationType(), + searchIndexName); long stopTime = System.currentTimeMillis(); metricsLogger.info(EntityEventPolicyMsgs.OPERATION_RESULT_NO_ERRORS, PROCESS_SPIKE_EVENT, diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java index 4340eb8..c33e668 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java @@ -21,20 +21,15 @@ package org.onap.aai.datarouter.policy; import java.io.FileNotFoundException; -import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.camel.Exchange; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.json.JSONException; -import org.json.JSONObject; import org.onap.aai.datarouter.entity.OxmEntityDescriptor; -import org.onap.aai.datarouter.entity.SpikeEventVertex; +import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.entity.SuggestionSearchEntity; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; @@ -44,21 +39,18 @@ import org.onap.aai.datarouter.util.VersionedOxmEntities; import com.fasterxml.jackson.databind.JsonNode; - public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProcessor { public static final String additionalInfo = "Response of SpikeEntityEventPolicy"; - private final String EVENT_VERTEX = "vertex"; - - private String oxmVersion = null; + private static final String PROCESS_SPIKE_EVENT = "Process Spike Event"; + /** Agent for communicating with the Search Service. */ public SpikeAutosuggestIndexProcessor(SpikeEventPolicyConfig config) throws FileNotFoundException { super(config); - parseLatestOxmVersion(); } @Override @@ -71,76 +63,30 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc @Override public void process(Exchange exchange) throws Exception { - long startTime = System.currentTimeMillis(); - String uebPayload = getExchangeBody(exchange); - if (uebPayload == null) { - return; - } - JsonNode uebAsJson = null; - try { - uebAsJson = mapper.readTree(uebPayload); - } catch (IOException e) { - returnWithError(exchange, uebPayload, "Invalid Payload"); - return; - } + long startTime = System.currentTimeMillis(); - String action = getSpikeEventAction(exchange, uebPayload); - if (action == null) { - return; - } - JSONObject uebObjEntity = getUebContentAsJson(uebPayload, EVENT_VERTEX); - if (uebObjEntity == null) { - returnWithError(exchange, uebPayload, "Payload is missing " + EVENT_VERTEX); - return; - } + SpikeEventMeta meta = processSpikeEvent(exchange); - SpikeEventVertex eventVertex = populateEventVertex(exchange, uebPayload); - if (eventVertex == null) { - return; - } - String entityType = getEntityType(exchange, eventVertex, uebPayload); - if (entityType == null) { - return; - } - String entityLink = getEntityLink(exchange, eventVertex, uebPayload); - if (entityLink == null) { - return; - } - DynamicJAXBContext oxmJaxbContext = readOxm(exchange, uebPayload); - if (oxmJaxbContext == null) { + if ( meta == null ) { return; } - String oxmEntityType = getOxmEntityType(entityType); - List searchableAttr = getSearchableAttibutes(oxmJaxbContext, oxmEntityType, entityType, uebPayload, - exchange); - if (searchableAttr == null) { - return; - } - - // log the fact that all data are in good shape - logger.info(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_NONVERBOSE, action, entityType); - logger.debug(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_VERBOSE, action, entityType, - uebPayload); - - + /* * Use the versioned OXM Entity class to get access to cross-entity reference helper collections */ VersionedOxmEntities oxmEntities = EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion)); - /* - * Process for autosuggestable entities - */ if (oxmEntities != null) { Map rootDescriptor = oxmEntities.getSuggestableEntityDescriptors(); if (!rootDescriptor.isEmpty()) { List suggestibleAttrInPayload = new ArrayList<>(); - List suggestibleAttrInOxm = extractSuggestableAttr(oxmEntities, entityType); + List suggestibleAttrInOxm = + extractSuggestableAttr(oxmEntities, meta.getSpikeEventVertex().getType()); if (suggestibleAttrInOxm != null) { - for (String attr: suggestibleAttrInOxm){ - if ( uebAsJson.get("vertex").get("properties").has(attr) ){ + for (String attr : suggestibleAttrInOxm) { + if (meta.getVertexProperties().has(attr)) { suggestibleAttrInPayload.add(attr); } } @@ -149,24 +95,26 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc if (suggestibleAttrInPayload.isEmpty()) { return; } - List suggestionAliases = extractAliasForSuggestableEntity(oxmEntities, entityType); + List suggestionAliases = extractAliasForSuggestableEntity(oxmEntities, meta.getSpikeEventVertex().getType()); /* * It was decided to silently ignore DELETE requests for resources we don't allow to be * deleted. e.g. auto-suggestion deletion is not allowed while aggregation deletion is. */ - if (!ACTION_DELETE.equalsIgnoreCase(action)) { + if (!DELETE.equalsIgnoreCase(meta.getBodyOperationType())) { List> listOfValidPowerSetElements = SearchSuggestionPermutation.getNonEmptyUniqueLists(suggestibleAttrInPayload); - + + JsonNode propertiesNode = mapper.readValue(meta.getVertexProperties().toString(), JsonNode.class); + // Now we have a list containing the power-set (minus empty element) for the status that are // available in the payload. Try inserting a document for every combination. for (ArrayList list : listOfValidPowerSetElements) { SuggestionSearchEntity suggestionSearchEntity = new SuggestionSearchEntity(); - suggestionSearchEntity.setEntityType(entityType); + suggestionSearchEntity.setEntityType(meta.getSpikeEventVertex().getType()); suggestionSearchEntity.setSuggestableAttr(list); suggestionSearchEntity.setEntityTypeAliases(suggestionAliases); - suggestionSearchEntity.setFilterBasedPayloadFromResponse(uebAsJson.get("vertex").get("properties"), + suggestionSearchEntity.setFilterBasedPayloadFromResponse(propertiesNode, suggestibleAttrInOxm, list); suggestionSearchEntity.setSuggestionInputPermutations( suggestionSearchEntity.generateSuggestionInputPermutations()); @@ -180,7 +128,7 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc + e.getLocalizedMessage()); } - handleSearchServiceOperation(suggestionSearchEntity, action, searchIndexName); + handleSearchServiceOperation(suggestionSearchEntity, meta.getBodyOperationType(), searchIndexName); } } } @@ -192,7 +140,7 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc setResponse(exchange, ResponseType.SUCCESS, additionalInfo); return; } - + public List extractSuggestableAttr(VersionedOxmEntities oxmEntities, String entityType) { // Extract suggestable attributeshandleTopographicalData Map rootDescriptor = oxmEntities.getSuggestableEntityDescriptors(); @@ -225,28 +173,4 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc return desc.getAlias(); } - private void parseLatestOxmVersion() { - int latestVersion = -1; - if (oxmVersionContextMap != null) { - Iterator it = oxmVersionContextMap.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = (Map.Entry) it.next(); - - String version = pair.getKey().toString(); - int versionNum = Integer.parseInt(version.substring(1, version.length())); - - if (versionNum > latestVersion) { - latestVersion = versionNum; - oxmVersion = pair.getKey().toString(); - } - - logger.info(EntityEventPolicyMsgs.PROCESS_OXM_MODEL_FOUND, pair.getKey().toString()); - } - } else { - logger.error(EntityEventPolicyMsgs.PROCESS_OXM_MODEL_MISSING, ""); - } - } - - - } diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java index 36bb142..caee8b4 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java @@ -30,21 +30,23 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.eclipse.persistence.dynamic.DynamicType; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.oxm.MediaType; import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; -import org.onap.aai.datarouter.entity.SpikeEventEntity; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; -import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.entity.OxmEntityDescriptor; +import org.onap.aai.datarouter.entity.SpikeEventEntity; +import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; @@ -68,17 +70,38 @@ public class SpikeEntityEventPolicy implements Processor { private Collection externalOxmModelProcessors; - - private static final String ACTION_CREATE = "create"; - private static final String EVENT_VERTEX = "vertex"; - private static final String ACTION_DELETE = "delete"; - private static final String ACTION_UPDATE = "update"; + /** + * Note (8-June-2018): + * + * At present we don't need to support every event-type that could be present in the spike-events. + * The only one we want is a SPIKE "update-notification". In the future perhaps we need to add some + * configurability to the camel-route itself with a json camel filtering component so that routing + * logic can be modified as part of the camel route spring-xml instead of hard-coding the + * event filtering in here. + */ + private static final String PROCESS_SPIKE_EVENT = "Process Spike Event"; + + private static final String UPDATE_NOTIFICATION = "update-notification"; + private static final String SPIKE = "SPIKE"; + + private static final String HEADER_KEY = "header"; + private static final String EVENT_TYPE_KEY = "event-type"; + private static final String SOURCE_NAME_KEY = "source-name"; + private static final String BODY_KEY = "body"; private static final String OPERATION_KEY = "operation"; + private static final String VERTEX_KEY = "vertex"; + private static final String VERTEX_KEY_KEY = "key"; + private static final String VERTEX_TYPE_KEY = "type"; + private static final String VERTEX_SCHEMA_VERSION_KEY = "schema-version"; + + private static final String CREATE = "create"; + private static final String DELETE = "delete"; + private static final String UPDATE = "update"; private static final List SUPPORTED_ACTIONS = - Arrays.asList(ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE); + Arrays.asList(CREATE, UPDATE, DELETE); Map oxmVersionContextMap = new HashMap<>(); private String oxmVersion = null; @@ -122,7 +145,7 @@ public class SpikeEntityEventPolicy implements Processor { private void parseLatestOxmVersion() { int latestVersion = -1; if (oxmVersionContextMap != null) { - Iterator it = oxmVersionContextMap.entrySet().iterator(); + Iterator> it = oxmVersionContextMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); @@ -148,6 +171,7 @@ public class SpikeEntityEventPolicy implements Processor { logger.info(EntityEventPolicyMsgs.ENTITY_EVENT_POLICY_REGISTERED); } + /** * Convert object to json. @@ -177,65 +201,109 @@ public class SpikeEntityEventPolicy implements Processor { setResponse(exchange, ResponseType.FAILURE, additionalInfo); } - public boolean isJSONValid(String test) { + @Override + public void process(Exchange exchange) /*throws Exception*/ { + + long startTime = System.currentTimeMillis(); + + final String eventPayload = exchange.getIn().getBody().toString(); + JSONObject mainJson = null; + try { - new JSONObject(test); - } catch (JSONException ex) { - return false; + + /* + * It is expected that mainJson will have multiple top level objects: + * - header + * - body + * - result + */ + + mainJson = new JSONObject(eventPayload); + } catch (JSONException exc) { + returnWithError(exchange, eventPayload, "Invalid Payload"); + return; } - return true; - } + + JSONObject eventHeader = mainJson.getJSONObject(HEADER_KEY); - @Override - public void process(Exchange exchange) throws Exception { + if (eventHeader == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + HEADER_KEY); + return; + } + + /* + * Only process SPIKE update-notification events + */ + + final String sourceName = eventHeader.getString(SOURCE_NAME_KEY); + final String eventType = eventHeader.getString(EVENT_TYPE_KEY); - long startTime = System.currentTimeMillis(); - String uebPayload = exchange.getIn().getBody().toString(); - if (uebPayload == null || !isJSONValid(uebPayload)) { - uebPayload = exchange.getIn().getBody(String.class); - if (uebPayload == null || !isJSONValid(uebPayload)) { - returnWithError(exchange, uebPayload, "Invalid Payload"); - return; - } + if (!(SPIKE.equals(sourceName) && UPDATE_NOTIFICATION.equals(eventType))) { + // drop event + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Ignoring event with sourceName='" + + sourceName + "' and eventType='" + eventType + "'. Payload=" + eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Ignoring event with sourceName='" + sourceName + "' and eventType='" + eventType + "'."); + + /* + * I don't think ignoring a non-applicable event constitutes a failure. + */ + + setResponse(exchange, ResponseType.SUCCESS, additionalInfo); + return; } + + JSONObject eventBody = mainJson.getJSONObject(BODY_KEY); + if (eventBody == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + BODY_KEY); + return; + } - JSONObject mainJson = new JSONObject(uebPayload); - String action = mainJson.getString(OPERATION_KEY); + String action = eventBody.getString(OPERATION_KEY); if (action == null || !SUPPORTED_ACTIONS.contains(action.toLowerCase())) { logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Unrecognized action '" + action + "'", uebPayload); + "Unrecognized action '" + action + "'", eventPayload); logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Unrecognized action '" + action + "'"); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; } - // Load the UEB payload data, any errors will result in a failure and discard - - JSONObject spikeObjVertex = getUebContentAsJson(uebPayload, EVENT_VERTEX); - if (spikeObjVertex == null) { - returnWithError(exchange, uebPayload, "Payload is missing " + EVENT_VERTEX); + // Load the event body data, any errors will result in a failure and discard + + JSONObject spikeVertex = eventBody.getJSONObject(VERTEX_KEY); + if (spikeVertex == null) { + returnWithError(exchange, eventPayload, "Payload is missing " + VERTEX_KEY); return; } - SpikeEventVertex eventVertex = initializeSpikeEventVertex(spikeObjVertex.toString()); + SpikeEventVertex eventVertex = null; + try { + eventVertex = initializeSpikeEventVertex(spikeVertex); + } catch (JSONException exc) { + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Error initializating spike event. Error: " + exc.getMessage(), + eventPayload); + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, + "Error initializating spike event. Error: " + exc.getMessage()); + + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + return; + } DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); if (oxmJaxbContext == null) { logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); - logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", uebPayload); + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; } - - String entityType = eventVertex.getType(); if (entityType == null || entityType.isEmpty()) { logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Payload header missing entity type", uebPayload); + "Payload header missing entity type", eventPayload); logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload header missing entity type"); @@ -246,7 +314,7 @@ public class SpikeEntityEventPolicy implements Processor { String entityKey = eventVertex.getKey(); if (entityKey == null || entityKey.isEmpty()) { logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Payload vertex missing entity key", - uebPayload); + eventPayload); logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload vertex missing entity key"); @@ -256,7 +324,7 @@ public class SpikeEntityEventPolicy implements Processor { String entityLink = eventVertex.getEntityLink(); if (entityLink == null || entityLink.isEmpty()) { logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Payload header missing entity link", uebPayload); + "Payload header missing entity link", eventPayload); logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload header missing entity link"); @@ -267,8 +335,7 @@ public class SpikeEntityEventPolicy implements Processor { // log the fact that all data are in good shape logger.info(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_NONVERBOSE, action, entityType); logger.debug(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_VERBOSE, action, entityType, - uebPayload); - + eventPayload); // Process for building SpikeEventEntity object String[] entityTypeArr = entityType.split("-"); @@ -276,7 +343,7 @@ public class SpikeEntityEventPolicy implements Processor { for (String entityWord : entityTypeArr) { oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1); } - + List searchableAttr = getOxmAttributes(oxmJaxbContext, oxmEntityType, entityType, "searchable"); if (searchableAttr == null) { @@ -284,28 +351,28 @@ public class SpikeEntityEventPolicy implements Processor { "Searchable attribute not found for payload entity type '" + entityType + "'"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Searchable attribute not found for payload entity type '" + entityType + "'", - uebPayload); + eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; } String entityPrimaryKeyFieldName = - getEntityPrimaryKeyFieldName(oxmJaxbContext, uebPayload, oxmEntityType, entityType); + getEntityPrimaryKeyFieldName(oxmJaxbContext, eventPayload, oxmEntityType, entityType); if (entityPrimaryKeyFieldName == null) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload missing primary key attribute"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Payload missing primary key attribute", uebPayload); + "Payload missing primary key attribute", eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; } - String entityPrimaryKeyFieldValue = lookupValueUsingKey(uebPayload, entityPrimaryKeyFieldName); - if (entityPrimaryKeyFieldValue.isEmpty()) { + String entityPrimaryKeyFieldValue = lookupValueUsingKey(eventPayload, entityPrimaryKeyFieldName); + if (entityPrimaryKeyFieldValue == null || entityPrimaryKeyFieldValue.isEmpty()) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload missing primary value attribute"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Payload missing primary value attribute", uebPayload); + "Payload missing primary value attribute", eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; @@ -321,12 +388,14 @@ public class SpikeEntityEventPolicy implements Processor { spikeEventEntity.setEntityPrimaryKeyValue(entityPrimaryKeyFieldValue); spikeEventEntity.setEntityType(entityType); spikeEventEntity.setLink(entityLink); + + System.out.println(spikeEventEntity); - if (!getSearchTags(spikeEventEntity, searchableAttr, uebPayload, action)) { + if (!getSearchTags(spikeEventEntity, searchableAttr, eventPayload, action)) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, "Payload missing searchable attribute for entity type '" + entityType + "'"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, - "Payload missing searchable attribute for entity type '" + entityType + "'", uebPayload); + "Payload missing searchable attribute for entity type '" + entityType + "'", eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; @@ -338,7 +407,7 @@ public class SpikeEntityEventPolicy implements Processor { } catch (NoSuchAlgorithmException e) { logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Cannot create unique SHA digest"); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "Cannot create unique SHA digest", - uebPayload); + eventPayload); setResponse(exchange, ResponseType.FAILURE, additionalInfo); return; @@ -363,60 +432,19 @@ public class SpikeEntityEventPolicy implements Processor { exchange.getOut().setBody(additionalInfo); } + private SpikeEventVertex initializeSpikeEventVertex(JSONObject vertexObject) throws JSONException { - /* - * Load the UEB JSON payload, any errors would result to a failure case response. - */ - private JSONObject getUebContentAsJson(String payload, String contentKey) { - - JSONObject uebJsonObj; - JSONObject uebObjContent; - - try { - uebJsonObj = new JSONObject(payload); - } catch (JSONException e) { - logger.debug(EntityEventPolicyMsgs.UEB_INVALID_PAYLOAD_JSON_FORMAT, payload); - logger.error(EntityEventPolicyMsgs.UEB_INVALID_PAYLOAD_JSON_FORMAT, payload); - return null; - } - - if (uebJsonObj.has(contentKey)) { - uebObjContent = uebJsonObj.getJSONObject(contentKey); - } else { - logger.debug(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, contentKey); - logger.error(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, contentKey); - return null; - } - - return uebObjContent; - } - - - private SpikeEventVertex initializeSpikeEventVertex(String payload) { - - SpikeEventVertex eventVertex = null; - ObjectMapper mapper = new ObjectMapper(); + /* + * These are all critical keys + */ - // Make sure that were were actually passed in a valid string. - if (payload == null || payload.isEmpty()) { - logger.debug(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, EVENT_VERTEX); - logger.error(EntityEventPolicyMsgs.UEB_FAILED_TO_PARSE_PAYLOAD, EVENT_VERTEX); + final String vertexType = vertexObject.getString(VERTEX_TYPE_KEY); + final String vertexKey = vertexObject.getString(VERTEX_KEY_KEY); + final String vertexSchemaVersion = vertexObject.getString(VERTEX_SCHEMA_VERSION_KEY); - return eventVertex; - } - - // Marshal the supplied string into a UebEventHeader object. - try { - eventVertex = mapper.readValue(payload, SpikeEventVertex.class); - } catch (JsonProcessingException e) { - logger.error(EntityEventPolicyMsgs.UEB_FAILED_UEBEVENTHEADER_CONVERSION, e.toString()); - } catch (Exception e) { - logger.error(EntityEventPolicyMsgs.UEB_FAILED_UEBEVENTHEADER_CONVERSION, e.toString()); - } - - if (eventVertex != null) { - logger.debug(EntityEventPolicyMsgs.UEB_EVENT_HEADER_PARSED, eventVertex.toString()); - } + SpikeEventVertex eventVertex = new SpikeEventVertex(vertexType, vertexKey); + eventVertex.setSchemaVersion(vertexSchemaVersion); + logger.debug(EntityEventPolicyMsgs.UEB_EVENT_HEADER_PARSED, eventVertex.toString()); return eventVertex; @@ -453,9 +481,9 @@ public class SpikeEntityEventPolicy implements Processor { try { jsonNode = mapper.readTree(mapper.getJsonFactory().createJsonParser(payload)); } catch (IOException e) { - logger.debug(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, EVENT_VERTEX + " missing", + logger.debug(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, VERTEX_KEY + " missing", payload); - logger.error(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, EVENT_VERTEX + " missing", + logger.error(EntityEventPolicyMsgs.FAILED_TO_PARSE_UEB_PAYLOAD, VERTEX_KEY + " missing", ""); } @@ -584,8 +612,8 @@ public class SpikeEntityEventPolicy implements Processor { String entityId = eventEntity.getId(); - if ((action.equalsIgnoreCase(ACTION_CREATE) && entityId != null) - || action.equalsIgnoreCase(ACTION_UPDATE)) { + if ((action.equalsIgnoreCase(CREATE) && entityId != null) + || action.equalsIgnoreCase(UPDATE)) { // Run the GET to retrieve the ETAG from the search service OperationResult storedEntity = searchAgent.getDocument(index, entityId); @@ -603,11 +631,11 @@ public class SpikeEntityEventPolicy implements Processor { // Write the entity to the search service. // PUT searchAgent.putDocument(index, entityId, eventEntity.getAsJson(), headers); - } else if (action.equalsIgnoreCase(ACTION_CREATE)) { + } else if (action.equalsIgnoreCase(CREATE)) { // Write the entry to the search service. searchAgent.postDocument(index, eventEntity.getAsJson(), headers); - } else if (action.equalsIgnoreCase(ACTION_DELETE)) { + } else if (action.equalsIgnoreCase(DELETE)) { // Run the GET to retrieve the ETAG from the search service OperationResult storedEntity = searchAgent.getDocument(index, entityId); @@ -619,6 +647,13 @@ public class SpikeEntityEventPolicy implements Processor { } else { logger.error(EntityEventPolicyMsgs.NO_ETAG_AVAILABLE_FAILURE, index, entityId); } + + /* + * The Spring-Boot version of the search-data-service rejects the DELETE operation unless + * we specify a Content-Type. + */ + + headers.put("Content-Type", Arrays.asList(MediaType.APPLICATION_JSON.getMediaType())); searchAgent.deleteDocument(index, eventEntity.getId(), headers); } else { diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessor.java index e9c6b06..8b43b1b 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessor.java @@ -24,23 +24,20 @@ import java.io.FileNotFoundException; import java.util.List; import org.apache.camel.Exchange; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; import org.onap.aai.datarouter.entity.SpikeEventEntity; -import org.onap.aai.datarouter.entity.SpikeEventVertex; +import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; public class SpikeEntitySearchProcessor extends AbstractSpikeEntityEventProcessor { public static final String additionalInfo = "Response of SpikeEntityEventPolicy"; - private static final String searchIndexSchema = ""; - + private static final String PROCESS_SPIKE_EVENT = "Process Spike Event"; /** Agent for communicating with the Search Service. */ - public SpikeEntitySearchProcessor(SpikeEventPolicyConfig config) - throws FileNotFoundException { + public SpikeEntitySearchProcessor(SpikeEventPolicyConfig config) throws FileNotFoundException { super(config); } @@ -56,53 +53,33 @@ public class SpikeEntitySearchProcessor extends AbstractSpikeEntityEventProcesso public void process(Exchange exchange) throws Exception { long startTime = System.currentTimeMillis(); - String uebPayload = getExchangeBody(exchange); - if (uebPayload == null) { - return; - } - String action = getSpikeEventAction(exchange, uebPayload); - if (action == null) { - return; - } - SpikeEventVertex eventVertex = populateEventVertex(exchange, uebPayload); - if (eventVertex == null) { - return; - } - String entityType = getEntityType(exchange, eventVertex, uebPayload); - if (entityType == null) { - return; - } - String entityLink = getEntityLink(exchange, eventVertex, uebPayload); - if (entityLink == null) { - return; - } - DynamicJAXBContext oxmJaxbContext = readOxm(exchange, uebPayload); - if (oxmJaxbContext == null) { + SpikeEventMeta meta = processSpikeEvent(exchange); + + if (meta == null) { return; } - String oxmEntityType = getOxmEntityType(entityType); - List searchableAttr = getSearchableAttibutes(oxmJaxbContext, oxmEntityType, entityType, uebPayload, - exchange); + + String oxmEntityType = getOxmEntityType(meta.getSpikeEventVertex().getType()); + List searchableAttr = getSearchableAttibutes(meta.getOxmJaxbContext(), oxmEntityType, + meta.getSpikeEventVertex().getType(), meta.getEventEntity().toString(), exchange); if (searchableAttr == null) { return; } - // log the fact that all data are in good shape - logger.info(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_NONVERBOSE, action, entityType); - logger.debug(EntityEventPolicyMsgs.PROCESS_ENTITY_EVENT_POLICY_VERBOSE, action, entityType, - uebPayload); SpikeEventEntity spikeEventEntity = new SpikeEventEntity(); - spikeEventEntity.setEntityType(entityType); - spikeEventEntity.setLink(entityLink); - spikeEventEntity = populateSpikeEventEntity(exchange, spikeEventEntity, oxmJaxbContext, - entityType, action, uebPayload, oxmEntityType,searchableAttr); + spikeEventEntity.setEntityType(meta.getSpikeEventVertex().getType()); + spikeEventEntity.setLink(meta.getSpikeEventVertex().getEntityLink()); + spikeEventEntity = populateSpikeEventEntity(exchange, spikeEventEntity, + meta.getOxmJaxbContext(), meta.getSpikeEventVertex().getType(), meta.getBodyOperationType(), + meta.getVertexProperties().toString(), oxmEntityType, searchableAttr); + if (spikeEventEntity == null) { return; } - handleSearchServiceOperation(spikeEventEntity, action, searchIndexName); + handleSearchServiceOperation(spikeEventEntity, meta.getBodyOperationType(), searchIndexName); long stopTime = System.currentTimeMillis(); metricsLogger.info(EntityEventPolicyMsgs.OPERATION_RESULT_NO_ERRORS, PROCESS_SPIKE_EVENT, String.valueOf(stopTime - startTime)); @@ -110,6 +87,7 @@ public class SpikeEntitySearchProcessor extends AbstractSpikeEntityEventProcesso return; } + /* * This is not for this Scope. We get back to it later. (updateCerInEntity) private void * updateSearchEntityWithCrossEntityReference(SpikeEventEntity spikeEventEntity) { try { diff --git a/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java b/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java index 06e1ab5..fc34437 100644 --- a/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java +++ b/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java @@ -341,5 +341,9 @@ public class VersionedOxmEntities { return sb.toString(); } + + public Map getEntityTypeLookup() { + return entityTypeLookup; + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java index 02f8ed7..9e10aee 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java +++ b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyStubbed.java @@ -27,30 +27,43 @@ import org.onap.aai.datarouter.policy.EntityEventPolicy; import org.onap.aai.datarouter.policy.EntityEventPolicyConfig; public class EntityEventPolicyStubbed extends EntityEventPolicy { - - - public EntityEventPolicyStubbed(EntityEventPolicyConfig config) throws FileNotFoundException { - super(config); - - } - - protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) { - //Stub out the actual call to Search Data service and instead store/update documents in memory - try { - switch (action.toLowerCase()) { - case "create": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "update": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "delete": - InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1 - break; - default: - break; - } - } catch (Exception ex) { - } - } + + private InMemorySearchDatastore searchDb; + + public EntityEventPolicyStubbed(EntityEventPolicyConfig config) throws FileNotFoundException { + super(config); + + } + + public InMemorySearchDatastore getSearchDb() { + return searchDb; + } + + public EntityEventPolicyStubbed withSearchDb(InMemorySearchDatastore searchDb) { + this.searchDb = searchDb; + return this; + } + + protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, + String index) { + // Stub out the actual call to Search Data service and instead store/update documents in memory + try { + switch (action.toLowerCase()) { + case "create": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "update": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "delete": + searchDb.remove(eventEntity.getId()); // they are executed if variable == c1 + break; + default: + break; + } + } catch (Exception ex) { + } + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyTest.java b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyTest.java index 9d87b6e..adf8ce2 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyTest.java +++ b/src/test/java/org/onap/aai/datarouter/policy/EntityEventPolicyTest.java @@ -41,8 +41,9 @@ import org.powermock.api.mockito.PowerMockito; public class EntityEventPolicyTest { - EntityEventPolicy policy; - String eventJson; + private EntityEventPolicy policy; + private String eventJson; + private InMemorySearchDatastore searchDb; @SuppressWarnings("unchecked") @Before @@ -51,13 +52,9 @@ public class EntityEventPolicyTest { PowerMockito.when(config.getSearchKeystorePwd()).thenReturn("password"); PowerMockito.when(config.getSourceDomain()).thenReturn("JUNIT"); + searchDb = new InMemorySearchDatastore(); + policy = new EntityEventPolicyStubbed(config).withSearchDb(searchDb); - SearchServiceAgent searchServiceAgent = PowerMockito.mock(SearchServiceAgent.class); - - PowerMockito.whenNew(SearchServiceAgent.class).withAnyArguments().thenReturn(searchServiceAgent); - - - policy = new EntityEventPolicyStubbed(config); FileInputStream event = new FileInputStream( new File("src/test/resources/aai_event.json")); eventJson = IOUtils.toString(event, "UTF-8"); @@ -68,16 +65,16 @@ public class EntityEventPolicyTest { policy.process(getExchangeEvent("event1","create")); policy.process(getExchangeEvent("event2","create")); - assertNotNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("event1"))); - assertNotNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("event2"))); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("event1"))); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("event2"))); policy.process(getExchangeEvent("event1","update")); policy.process(getExchangeEvent("event2","update")); - assertNotNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("event1"))); - assertNotNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("event2"))); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("event1"))); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("event2"))); policy.process(getExchangeEvent("event2","delete")); - assertNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("event2"))); + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("event2"))); } private Exchange getExchangeEvent(String link,String action){ diff --git a/src/test/java/org/onap/aai/datarouter/policy/InMemorySearchDatastore.java b/src/test/java/org/onap/aai/datarouter/policy/InMemorySearchDatastore.java index 874cce8..bcca308 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/InMemorySearchDatastore.java +++ b/src/test/java/org/onap/aai/datarouter/policy/InMemorySearchDatastore.java @@ -24,21 +24,21 @@ import java.util.concurrent.ConcurrentHashMap; public final class InMemorySearchDatastore { - private final static ConcurrentHashMap documents = new ConcurrentHashMap(); + private final ConcurrentHashMap documents = new ConcurrentHashMap(); - public static ConcurrentHashMap getAll() { + public ConcurrentHashMap getAll() { return documents; } - public static void put(String key, String value) { + public void put(String key, String value) { documents.put(key, value); } - public static String get(String key) { + public String get(String key) { return documents.get(key); } - public static void remove(String key) { + public void remove(String key) { documents.remove(key); } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java index ffc264b..730a32b 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorStubbed.java @@ -25,30 +25,43 @@ import java.io.FileNotFoundException; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; public class SpikeAggregateGenericVnfProcessorStubbed extends SpikeAggregateGenericVnfProcessor { - - - public SpikeAggregateGenericVnfProcessorStubbed(SpikeEventPolicyConfig config) throws FileNotFoundException { - super(config); - - } - - protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) { - //Stub out the actual call to Search Data service and instead store/update documents in memory - try { - switch (action.toLowerCase()) { - case "create": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "update": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "delete": - InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1 - break; - default: - break; - } - } catch (Exception ex) { - } - } + + private InMemorySearchDatastore searchDb; + + public SpikeAggregateGenericVnfProcessorStubbed(SpikeEventPolicyConfig config) + throws FileNotFoundException { + super(config); + } + + public SpikeAggregateGenericVnfProcessorStubbed withSearchDb(InMemorySearchDatastore searchDb) { + this.searchDb = searchDb; + return this; + } + + public InMemorySearchDatastore getSearchDb() { + return searchDb; + } + + protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, + String index) { + // Stub out the actual call to Search Data service and instead store/update documents in memory + try { + switch (action.toLowerCase()) { + case "create": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "update": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "delete": + searchDb.remove(eventEntity.getId()); // they are executed if variable == c1 + break; + default: + break; + } + } catch (Exception ex) { + } + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorTest.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorTest.java index d1c01af..03970bd 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorTest.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeAggregateGenericVnfProcessorTest.java @@ -34,68 +34,80 @@ import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.util.SearchServiceAgent; import org.powermock.api.mockito.PowerMockito; - - public class SpikeAggregateGenericVnfProcessorTest { - SpikeAggregateGenericVnfProcessor policy; - String eventJson; - + private SpikeAggregateGenericVnfProcessor policy; + private InMemorySearchDatastore searchDb; - @SuppressWarnings("unchecked") @Before public void init() throws Exception { SpikeEventPolicyConfig config = PowerMockito.mock(SpikeEventPolicyConfig.class); PowerMockito.when(config.getSearchKeystorePwd()).thenReturn("password"); PowerMockito.when(config.getSourceDomain()).thenReturn("JUNIT"); + searchDb = new InMemorySearchDatastore(); + policy = new SpikeAggregateGenericVnfProcessorStubbed(config).withSearchDb(searchDb); + } - SearchServiceAgent searchServiceAgent = PowerMockito.mock(SearchServiceAgent.class); - PowerMockito.whenNew(SearchServiceAgent.class).withAnyArguments() - .thenReturn(searchServiceAgent); + @Test + public void testProcess_success() throws Exception { + String genericVnfEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/generic-vnf-spike-event.json")), "UTF-8"); - policy = new SpikeAggregateGenericVnfProcessorStubbed(config); - FileInputStream event = new FileInputStream(new File("src/test/resources/spike_event.json")); - eventJson = IOUtils.toString(event, "UTF-8"); + policy.process( + getExchangeEvent(genericVnfEventJsonTemplate, "update-notification", "CREATE", "gvnf123")); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("generic-vnf/gvnf123"))); + + policy.process( + getExchangeEvent(genericVnfEventJsonTemplate, "update-notification", "DELETE", "gvnf123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("generic-vnf/gvnf123"))); + + } + /* + * Failure test cases - no searchable attribute for type + */ @Test - public void testProcess_success() throws Exception { - policy.process(getExchangeEvent("12345", "create", "generic-vnf")); - policy.process(getExchangeEvent("23456", "create", "generic-vnf")); - - assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/12345"))); - assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/23456"))); - - - policy.process(getExchangeEvent("23456", "delete", "generic-vnf")); - assertNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("23456"))); + public void testProcess_failure_unknownOxmEntityType() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/optical-router-spike-event.json")), + "UTF-8"); + + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "optronic123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("optical-router/optronic123"))); } + @Test - public void testProcess_fail() throws Exception { - policy.process(getExchangeEvent("666666", "create", "NotValid")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("NotValid/666666"))); - - policy.process(getExchangeEvent("", "create", "generic-vnf")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/"))); + public void testProcess_failure_missingMandatoryFieldsFromBodyObject() throws Exception { + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream( + new File("src/test/resources/pserver-missing-mandtory-field-spike-event.json")), + "UTF-8"); + + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } - - private Exchange getExchangeEvent(String key, String action, String type) { - Object obj = eventJson.replace("$KEY", key).replace("$ACTION", action).replace("$TYPE", type); + private Exchange getExchangeEvent(String payloadTemplate, String eventType, String operationType, + String entityKey) { + Object obj = payloadTemplate.replace("$EVENT_TYPE", eventType) + .replace("$OPERATION_TYPE", operationType).replace("$ENTITY_KEY", entityKey); + Exchange exchange = PowerMockito.mock(Exchange.class); Message inMessage = PowerMockito.mock(Message.class); Message outMessage = PowerMockito.mock(Message.class); - PowerMockito.when(exchange.getIn()).thenReturn(inMessage); + PowerMockito.when(exchange.getIn()).thenReturn(inMessage); PowerMockito.when(inMessage.getBody()).thenReturn(obj); PowerMockito.when(exchange.getOut()).thenReturn(outMessage); @@ -106,6 +118,4 @@ public class SpikeAggregateGenericVnfProcessorTest { } - - } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorStubbed.java index 202746c..81335e5 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorStubbed.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorStubbed.java @@ -25,30 +25,43 @@ import java.io.FileNotFoundException; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; public class SpikeAutosuggestProcessorStubbed extends SpikeAutosuggestIndexProcessor { - - - public SpikeAutosuggestProcessorStubbed(SpikeEventPolicyConfig config) throws FileNotFoundException { - super(config); - - } - - protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) { - //Stub out the actual call to Search Data service and instead store/update documents in memory - try { - switch (action.toLowerCase()) { - case "create": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "update": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "delete": - InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1 - break; - default: - break; - } - } catch (Exception ex) { - } - } + + private InMemorySearchDatastore searchDb; + + public SpikeAutosuggestProcessorStubbed(SpikeEventPolicyConfig config) + throws FileNotFoundException { + super(config); + } + + public InMemorySearchDatastore getSearchDb() { + return searchDb; + } + + public SpikeAutosuggestProcessorStubbed withSearchDb(InMemorySearchDatastore searchDb) { + this.searchDb = searchDb; + return this; + } + + protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, + String index) { + // Stub out the actual call to Search Data service and instead store/update documents in memory + try { + switch (action.toLowerCase()) { + case "create": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "update": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "delete": + searchDb.remove(eventEntity.getId()); // they are executed if variable == c1 + break; + default: + break; + } + } catch (Exception ex) { + } + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorTest.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorTest.java index 8ef5ab6..c49f17b 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorTest.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeAutosuggestProcessorTest.java @@ -34,66 +34,104 @@ import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.util.SearchServiceAgent; import org.powermock.api.mockito.PowerMockito; - - public class SpikeAutosuggestProcessorTest { - SpikeAutosuggestIndexProcessor policy; - String eventJson; + private SpikeEventPolicyConfig eventPolicyConfig; + private SpikeAutosuggestIndexProcessor policy; + private InMemorySearchDatastore searchDb; - @SuppressWarnings("unchecked") @Before public void init() throws Exception { - SpikeEventPolicyConfig config = PowerMockito.mock(SpikeEventPolicyConfig.class); - PowerMockito.when(config.getSearchKeystorePwd()).thenReturn("password"); - PowerMockito.when(config.getSourceDomain()).thenReturn("JUNIT"); - - - SearchServiceAgent searchServiceAgent = PowerMockito.mock(SearchServiceAgent.class); - PowerMockito.whenNew(SearchServiceAgent.class).withAnyArguments() - .thenReturn(searchServiceAgent); - - - policy = new SpikeAutosuggestProcessorStubbed(config); - FileInputStream event = new FileInputStream(new File("src/test/resources/spike_event.json")); - eventJson = IOUtils.toString(event, "UTF-8"); + + eventPolicyConfig = new SpikeEventPolicyConfig(); + eventPolicyConfig.setSearchKeystorePwd("password"); + eventPolicyConfig.setSourceDomain("JUNIT"); + + searchDb = new InMemorySearchDatastore(); + policy = new SpikeAutosuggestProcessorStubbed(eventPolicyConfig).withSearchDb(searchDb); } @Test public void testProcess_success() throws Exception { - policy.process(getExchangeEvent("77777", "create", "generic-vnf")); + + String genericVnfEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/generic-vnf-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(genericVnfEventJsonTemplate, "update-notification", "CREATE", "vserver123")); assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("junk and Running VNFs"))); + searchDb.get(NodeUtils.generateUniqueShaDigest("junk and Running VNFs"))); assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("junk VNFs"))); + searchDb.get(NodeUtils.generateUniqueShaDigest("junk VNFs"))); assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("Running VNFs"))); - + searchDb.get(NodeUtils.generateUniqueShaDigest("Running VNFs"))); } + + /* + * Failure test cases + * - no searchable attribute for type + */ + @Test - public void testProcess_fail() throws Exception { - policy.process(getExchangeEvent("666666", "create", "NotValid")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("NotValid/666666"))); + public void testProcess_failure_unknownOxmEntityType() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/optical-router-spike-event.json")), "UTF-8"); - policy.process(getExchangeEvent("", "create", "generic-vnf")); + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "optronic123")); + assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/"))); + searchDb.get(NodeUtils.generateUniqueShaDigest("optical-router/optronic123"))); + } + + @Test + public void testProcess_failure_missingMandatoryFieldsFromBodyObject() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/pserver-missing-mandtory-field-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + assertNull( + searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } + + @Test + public void testProcess_failure_missingMandatoryVertexProperties() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/pserver-missing-primary-key-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + assertNull( + searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); + } - private Exchange getExchangeEvent(String key, String action, String type) { - Object obj = eventJson.replace("$KEY", key).replace("$ACTION", action).replace("$TYPE", type); + @Test + public void testProcess_failure_noSuggestibleAttributesForEntityType() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/vserver-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "vserver123")); + + assertNull( + searchDb.get(NodeUtils.generateUniqueShaDigest("vserver/vserver123"))); + } + + private Exchange getExchangeEvent(String payloadTemplate, String eventType, String operationType, + String entityKey) { + Object obj = payloadTemplate.replace("$EVENT_TYPE", eventType) + .replace("$OPERATION_TYPE", operationType).replace("$ENTITY_KEY", entityKey); + Exchange exchange = PowerMockito.mock(Exchange.class); Message inMessage = PowerMockito.mock(Message.class); Message outMessage = PowerMockito.mock(Message.class); - PowerMockito.when(exchange.getIn()).thenReturn(inMessage); + PowerMockito.when(exchange.getIn()).thenReturn(inMessage); PowerMockito.when(inMessage.getBody()).thenReturn(obj); PowerMockito.when(exchange.getOut()).thenReturn(outMessage); @@ -105,5 +143,4 @@ public class SpikeAutosuggestProcessorTest { } - } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyStubbed.java index 17a76e8..e0356a9 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyStubbed.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyStubbed.java @@ -25,30 +25,43 @@ import java.io.FileNotFoundException; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; public class SpikeEntityEventPolicyStubbed extends SpikeEntityEventPolicy { - - - public SpikeEntityEventPolicyStubbed(SpikeEntityEventPolicyConfig config) throws FileNotFoundException { - super(config); - - } - - protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) { - //Stub out the actual call to Search Data service and instead store/update documents in memory - try { - switch (action.toLowerCase()) { - case "create": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "update": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "delete": - InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1 - break; - default: - break; - } - } catch (Exception ex) { - } - } + + private InMemorySearchDatastore searchDb; + + public SpikeEntityEventPolicyStubbed(SpikeEntityEventPolicyConfig config) + throws FileNotFoundException { + super(config); + } + + public SpikeEntityEventPolicyStubbed withSearchDb(InMemorySearchDatastore searchDb) { + this.searchDb = searchDb; + return this; + } + + public InMemorySearchDatastore getSearchDb() { + return searchDb; + } + + protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, + String index) { + // Stub out the actual call to Search Data service and instead store/update documents in memory + try { + switch (action.toLowerCase()) { + case "create": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "update": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "delete": + searchDb.remove(eventEntity.getId()); // they are executed if variable == c1 + break; + default: + break; + } + } catch (Exception ex) { + } + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyTest.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyTest.java index 69d3336..68edb74 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyTest.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicyTest.java @@ -20,8 +20,7 @@ */ package org.onap.aai.datarouter.policy; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyString; @@ -34,67 +33,83 @@ import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.util.SearchServiceAgent; import org.powermock.api.mockito.PowerMockito; - - public class SpikeEntityEventPolicyTest { - SpikeEntityEventPolicy policy; - String eventJson; - - @SuppressWarnings("unchecked") + private SpikeEntityEventPolicyConfig eventPolicyConfig; + private SpikeEntityEventPolicy policy; + private InMemorySearchDatastore searchDb; + + @Before public void init() throws Exception { - SpikeEntityEventPolicyConfig config = PowerMockito.mock(SpikeEntityEventPolicyConfig.class); - PowerMockito.when(config.getSearchKeystorePwd()).thenReturn("password"); - PowerMockito.when(config.getSourceDomain()).thenReturn("JUNIT"); - - - SearchServiceAgent searchServiceAgent = PowerMockito.mock(SearchServiceAgent.class); - PowerMockito.whenNew(SearchServiceAgent.class).withAnyArguments() - .thenReturn(searchServiceAgent); - + + eventPolicyConfig = new SpikeEntityEventPolicyConfig(); + eventPolicyConfig.setSearchKeystorePwd("password"); + eventPolicyConfig.setSourceDomain("JUNIT"); - policy = new SpikeEntityEventPolicyStubbed(config); - FileInputStream event = new FileInputStream(new File("src/test/resources/spike_event.json")); - eventJson = IOUtils.toString(event, "UTF-8"); + searchDb = new InMemorySearchDatastore(); + policy = new SpikeEntityEventPolicyStubbed(eventPolicyConfig).withSearchDb(searchDb); } @Test public void testProcess_success() throws Exception { - policy.process(getExchangeEvent("12345", "create", "generic-vnf")); - policy.process(getExchangeEvent("23456", "create", "generic-vnf")); + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/pserver-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/12345"))); - assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/23456"))); - - - policy.process(getExchangeEvent("23456", "delete", "generic-vnf")); - assertNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("23456"))); + searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } + @Test - public void testProcess_fail() throws Exception { - policy.process(getExchangeEvent("12345", "create", "NotValid")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("NotValid/12345"))); + public void testProcess_failure_unknownOxmEntityType() throws Exception { - policy.process(getExchangeEvent("", "create", "generic-vnf")); + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/optical-router-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "optronic123")); + assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/"))); + searchDb.get(NodeUtils.generateUniqueShaDigest("optical-router/optronic123"))); + } + + @Test + public void testProcess_failure_missingMandatoryFieldsFromBodyObject() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/pserver-missing-mandtory-field-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + assertNull( + searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } + + @Test + public void testProcess_failure_missingMandatoryVertexProperties() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/pserver-missing-primary-key-spike-event.json")), "UTF-8"); + + policy.process(getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + assertNull( + searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); + } - private Exchange getExchangeEvent(String key, String action, String type) { - Object obj = eventJson.replace("$KEY", key).replace("$ACTION", action).replace("$TYPE", type); + private Exchange getExchangeEvent(String payloadTemplate, String eventType, String operationType, + String entityKey) { + Object obj = payloadTemplate.replace("$EVENT_TYPE", eventType) + .replace("$OPERATION_TYPE", operationType).replace("$ENTITY_KEY", entityKey); + Exchange exchange = PowerMockito.mock(Exchange.class); Message inMessage = PowerMockito.mock(Message.class); Message outMessage = PowerMockito.mock(Message.class); - PowerMockito.when(exchange.getIn()).thenReturn(inMessage); + PowerMockito.when(exchange.getIn()).thenReturn(inMessage); PowerMockito.when(inMessage.getBody()).thenReturn(obj); PowerMockito.when(exchange.getOut()).thenReturn(outMessage); diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java index 100ff0a..5c82c4d 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorStubbed.java @@ -25,30 +25,44 @@ import java.io.FileNotFoundException; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; public class SpikeEntitySearchProcessorStubbed extends SpikeEntitySearchProcessor { - - - public SpikeEntitySearchProcessorStubbed(SpikeEventPolicyConfig config) throws FileNotFoundException { - super(config); - - } - - protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, String index) { - //Stub out the actual call to Search Data service and instead store/update documents in memory - try { - switch (action.toLowerCase()) { - case "create": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "update": - InMemorySearchDatastore.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if variable == c1 - break; - case "delete": - InMemorySearchDatastore.remove(eventEntity.getId()); // they are executed if variable == c1 - break; - default: - break; - } - } catch (Exception ex) { - } - } + + private InMemorySearchDatastore searchDb; + + public SpikeEntitySearchProcessorStubbed(SpikeEventPolicyConfig config) + throws FileNotFoundException { + super(config); + } + + public SpikeEntitySearchProcessorStubbed withSearchDb(InMemorySearchDatastore searchDb) { + this.searchDb = searchDb; + return this; + } + + + public InMemorySearchDatastore getSearchDb() { + return searchDb; + } + + protected void handleSearchServiceOperation(DocumentStoreDataEntity eventEntity, String action, + String index) { + // Stub out the actual call to Search Data service and instead store/update documents in memory + try { + switch (action.toLowerCase()) { + case "create": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "update": + searchDb.put(eventEntity.getId(), eventEntity.getAsJson()); // they are executed if + // variable == c1 + break; + case "delete": + searchDb.remove(eventEntity.getId()); // they are executed if variable == c1 + break; + default: + break; + } + } catch (Exception ex) { + } + } } diff --git a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorTest.java b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorTest.java index e6bf390..5b40c1a 100644 --- a/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorTest.java +++ b/src/test/java/org/onap/aai/datarouter/policy/SpikeEntitySearchProcessorTest.java @@ -34,104 +34,119 @@ import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.util.SearchServiceAgent; import org.powermock.api.mockito.PowerMockito; - - public class SpikeEntitySearchProcessorTest { - SpikeEntitySearchProcessor policy; - String eventJson; + private SpikeEntitySearchProcessor policy; + private String eventJson; + private InMemorySearchDatastore searchDb; - @SuppressWarnings("unchecked") @Before public void init() throws Exception { SpikeEventPolicyConfig config = PowerMockito.mock(SpikeEventPolicyConfig.class); PowerMockito.when(config.getSearchKeystorePwd()).thenReturn("password"); PowerMockito.when(config.getSourceDomain()).thenReturn("JUNIT"); + searchDb = new InMemorySearchDatastore(); + policy = new SpikeEntitySearchProcessorStubbed(config).withSearchDb(searchDb); + + } + + @Test + public void testProcess_success() throws Exception { + + String genericVnfEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/generic-vnf-spike-event.json")), "UTF-8"); - SearchServiceAgent searchServiceAgent = PowerMockito.mock(SearchServiceAgent.class); - PowerMockito.whenNew(SearchServiceAgent.class).withAnyArguments() - .thenReturn(searchServiceAgent); + policy.process( + getExchangeEvent(genericVnfEventJsonTemplate, "update-notification", "CREATE", "gvnf123")); + assertNotNull(searchDb.get(NodeUtils.generateUniqueShaDigest("generic-vnf/gvnf123"))); - policy = new SpikeEntitySearchProcessorStubbed(config); - FileInputStream event = new FileInputStream(new File("src/test/resources/spike_event.json")); - eventJson = IOUtils.toString(event, "UTF-8"); + policy.process( + getExchangeEvent(genericVnfEventJsonTemplate, "update-notification", "DELETE", "gvnf123")); + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("generic-vnf/gvnf123"))); + + } + /* + * Failure test cases - no searchable attribute for type + */ @Test - public void testProcess_success() throws Exception { - policy.process(getExchangeEvent("12345", "create", "generic-vnf")); - policy.process(getExchangeEvent("23456", "create", "generic-vnf")); + public void testProcess_failure_unknownOxmEntityType() throws Exception { - assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/12345"))); - assertNotNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/23456"))); + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/optical-router-spike-event.json")), + "UTF-8"); - - policy.process(getExchangeEvent("23456", "delete", "generic-vnf")); - assertNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/23456"))); - - policy.process(getExchangeEvent("333333", "", "generic-vnf")); - assertNull(InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/333333"))); + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "optronic123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("optical-router/optronic123"))); } + @Test - public void testProcess_fail() throws Exception { - policy.process(getExchangeEvent("xxxxx", "create", "NotValid")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("NotValid/xxxxx"))); - - policy.process(getExchangeEvent("", "create", "generic-vnf")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("generic-vnf/"))); - - policy.process(getExchangeEvent("yyyy", "create", "")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("/yyyy"))); - policy.process(getExchangeEvent("", "create", "")); - assertNull( - InMemorySearchDatastore.get(NodeUtils.generateUniqueShaDigest("/"))); + public void testProcess_failure_missingMandatoryFieldsFromBodyObject() throws Exception { + + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream( + new File("src/test/resources/pserver-missing-mandtory-field-spike-event.json")), + "UTF-8"); + + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } + @Test - public void testProcess_null() throws Exception { - policy.process(getExchangeEvent()); + public void testProcess_failure_missingMandatoryVertexProperties() throws Exception { + + String pserverEventJsonTemplate = + IOUtils.toString( + new FileInputStream( + new File("src/test/resources/pserver-missing-primary-key-spike-event.json")), + "UTF-8"); + + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "pserver123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("pserver/pserver123"))); } - - private Exchange getExchangeEvent(String key, String action, String type) { - Object obj = eventJson.replace("$KEY", key).replace("$ACTION", action).replace("$TYPE", type); - Exchange exchange = PowerMockito.mock(Exchange.class); - Message inMessage = PowerMockito.mock(Message.class); - Message outMessage = PowerMockito.mock(Message.class); - PowerMockito.when(exchange.getIn()).thenReturn(inMessage); - PowerMockito.when(inMessage.getBody()).thenReturn(obj); - PowerMockito.when(exchange.getOut()).thenReturn(outMessage); - PowerMockito.doNothing().when(outMessage).setBody(anyObject()); - PowerMockito.doNothing().when(outMessage).setHeader(anyString(), anyObject()); + @Test + public void testProcess_failure_noSuggestibleAttributesForEntityType() throws Exception { - return exchange; + String pserverEventJsonTemplate = IOUtils.toString( + new FileInputStream(new File("src/test/resources/vserver-spike-event.json")), "UTF-8"); + policy.process( + getExchangeEvent(pserverEventJsonTemplate, "update-notification", "CREATE", "vserver123")); + + assertNull(searchDb.get(NodeUtils.generateUniqueShaDigest("vserver/vserver123"))); } - - private Exchange getExchangeEvent() { - Object obj = ""; + + private Exchange getExchangeEvent(String payloadTemplate, String eventType, String operationType, + String entityKey) { + Object obj = payloadTemplate.replace("$EVENT_TYPE", eventType) + .replace("$OPERATION_TYPE", operationType).replace("$ENTITY_KEY", entityKey); + Exchange exchange = PowerMockito.mock(Exchange.class); Message inMessage = PowerMockito.mock(Message.class); Message outMessage = PowerMockito.mock(Message.class); - PowerMockito.when(exchange.getIn()).thenReturn(inMessage); + PowerMockito.when(exchange.getIn()).thenReturn(inMessage); PowerMockito.when(inMessage.getBody()).thenReturn(obj); PowerMockito.when(exchange.getOut()).thenReturn(outMessage); PowerMockito.doNothing().when(outMessage).setBody(anyObject()); PowerMockito.doNothing().when(outMessage).setHeader(anyString(), anyObject()); - + return exchange; } + } diff --git a/src/test/resources/generic-vnf-spike-event.json b/src/test/resources/generic-vnf-spike-event.json new file mode 100644 index 0000000..b31bd04 --- /dev/null +++ b/src/test/resources/generic-vnf-spike-event.json @@ -0,0 +1,31 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "vnf-id": "GenericVNFIdBpCNtULbEw9", + "in-maint": "false", + "heat-stack-id": "GenericVNFIdBpCNtULbEw1-12345-678-", + "prov-status": "junk", + "equipment-role": "ASBG", + "ipv4-oam-address": "5.6.7.8", + "vnf-name": "GenericVNFIdBpCNtULbEw9", + "vnf-type": "asbg", + "is-closed-loop-disabled": "false", + "orchestration-status": "Running", + "aai-node-type": "generic-vnf" + }, + "key": "$ENTITY_KEY", + "type": "generic-vnf", + "schema-version": "v13" + } + }, + "result": "SUCCESS" +} diff --git a/src/test/resources/optical-router-spike-event.json b/src/test/resources/optical-router-spike-event.json new file mode 100644 index 0000000..05efe48 --- /dev/null +++ b/src/test/resources/optical-router-spike-event.json @@ -0,0 +1,24 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "router-id": "optronicGatewayEast", + "brand": "optronix", + "version": "0.9.123b", + "bandwidth": "1Tbps" + }, + "key": "$ENTITY_KEY", + "type": "optical-router", + "schema-version": "v21" + } + }, + "result": "SUCCESS" +} diff --git a/src/test/resources/pserver-missing-mandtory-field-spike-event.json b/src/test/resources/pserver-missing-mandtory-field-spike-event.json new file mode 100644 index 0000000..c58bf7d --- /dev/null +++ b/src/test/resources/pserver-missing-mandtory-field-spike-event.json @@ -0,0 +1,28 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "ipv4-oam-address": "1.2.3.4", + "resource-version": "1477013499", + "purpose": "my-purpose", + "fqdn": "myhost.onap.net", + "in-maint": false, + "equip-model": "DL380p-nd", + "equip-vendor": "HP", + "equip-type": "server", + "hostname": "myhost", + "ptnii-equip-name": "e-name" + }, + "schema-version": "v13" + } + }, + "result": "SUCCESS" +} diff --git a/src/test/resources/pserver-missing-primary-key-spike-event.json b/src/test/resources/pserver-missing-primary-key-spike-event.json new file mode 100644 index 0000000..f1bd514 --- /dev/null +++ b/src/test/resources/pserver-missing-primary-key-spike-event.json @@ -0,0 +1,29 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "ipv4-oam-address": "1.2.3.4", + "resource-version": "1477013499", + "purpose": "my-purpose", + "fqdn": "myhost.onap.net", + "in-maint": false, + "equip-model": "DL380p-nd", + "equip-vendor": "HP", + "equip-type": "server", + "ptnii-equip-name": "e-name" + }, + "key": "$ENTITY_KEY", + "type": "pserver", + "schema-version": "v13" + } + }, + "result": "SUCCESS" +} diff --git a/src/test/resources/pserver-spike-event.json b/src/test/resources/pserver-spike-event.json new file mode 100644 index 0000000..f4b564c --- /dev/null +++ b/src/test/resources/pserver-spike-event.json @@ -0,0 +1,30 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "ipv4-oam-address": "1.2.3.4", + "resource-version": "1477013499", + "purpose": "my-purpose", + "fqdn": "myhost.onap.net", + "in-maint": false, + "equip-model": "DL380p-nd", + "equip-vendor": "HP", + "equip-type": "server", + "hostname": "myhost", + "ptnii-equip-name": "e-name" + }, + "key": "$ENTITY_KEY", + "type": "pserver", + "schema-version": "v13" + } + }, + "result": "SUCCESS" +} diff --git a/src/test/resources/vserver-spike-event.json b/src/test/resources/vserver-spike-event.json new file mode 100644 index 0000000..de94d41 --- /dev/null +++ b/src/test/resources/vserver-spike-event.json @@ -0,0 +1,31 @@ +{ + "header": { + "request-id": "c0a81fa7-5ef4-49cd-ab39-e42c53c9b9a4", + "timestamp": "20180309T121130Z", + "source-name": "SPIKE", + "event-type": "$EVENT_TYPE" + }, + "body": { + "timestamp": 1514927928167, + "operation": "$OPERATION_TYPE", + "vertex": { + "properties": { + "vnf-id": "logServer1", + "in-maint": "false", + "heat-stack-id": "vserver-12345-678-", + "prov-status": "junk", + "equipment-role": "ASBG", + "ipv4-oam-address": "5.6.7.8", + "vnf-name": "GenericVNFIdBpCNtULbEw9", + "vnf-type": "asbg", + "is-closed-loop-disabled": "false", + "orchestration-status": "Running", + "aai-node-type": "generic-vnf" + }, + "key": "$ENTITY_KEY", + "type": "vserver", + "schema-version": "v13" + } + }, + "result": "SUCCESS" +} -- 2.16.6 From f518411876d6830d83d051a915f0b21bdfdcb43e Mon Sep 17 00:00:00 2001 From: "Sanchez, Gabriel (gs882h)" Date: Mon, 18 Jun 2018 17:30:21 +0100 Subject: [PATCH 12/16] Add multi-oxm using schemaIngest library Use the schemaIngest library to have the capability to deal with multiple OXM files Issue-ID: AAI-1192 Change-Id: Icbebbf475bcf9fc3808bc79b9fa95085db46ab77 Signed-off-by: gabriel sanchez --- pom.xml | 50 +- src/main/bin/start.sh | 2 +- .../aai/datarouter/logging/DataRouterMsgs.java | 5 +- .../policy/AbstractSpikeEntityEventProcessor.java | 10 +- .../aai/datarouter/policy/EntityEventPolicy.java | 6 +- .../policy/SpikeAutosuggestIndexProcessor.java | 2 +- .../datarouter/policy/SpikeEntityEventPolicy.java | 6 +- .../aai/datarouter/schema/OxmConfigTranslator.java | 98 + .../onap/aai/datarouter/schema/OxmModelLoader.java | 101 + .../schema/SchemaIngestPropertiesReader.java | 88 + .../onap/aai/datarouter/util/OxmModelLoader.java | 134 - .../resources/logging/DataRouterMsgs.properties | 6 +- .../aai/datarouter/schema/OxmModelLoaderTest.java | 68 + .../oxm-reader/multiple-oxm/aai_oxm_a_v13.xml | 2987 +++++++++ .../oxm-reader/multiple-oxm/aai_oxm_b_v13.xml | 3811 +++++++++++ .../oxm-reader/multiple-oxm/aai_oxm_v11.xml | 6363 ++++++++++++++++++ .../oxm-reader/multiple-oxm/aai_oxm_v12.xml | 6770 ++++++++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml | 5438 ++++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml | 6363 ++++++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml | 6770 ++++++++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml | 6770 ++++++++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml | 4655 ++++++++++++++ src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml | 5330 +++++++++++++++ src/test/resources/schemaIngest.properties | 4 + 24 files changed, 55687 insertions(+), 150 deletions(-) create mode 100644 src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java create mode 100644 src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java create mode 100644 src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/OxmModelLoader.java create mode 100644 src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java create mode 100644 src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml create mode 100644 src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml create mode 100644 src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml create mode 100644 src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml create mode 100644 src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml create mode 100644 src/test/resources/schemaIngest.properties diff --git a/pom.xml b/pom.xml index 917a635..c66b855 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,7 @@ limitations under the License. false ${project.version} 1.2.3 + 16.0.1
@@ -167,6 +168,17 @@ limitations under the License. aai-schema 1.3.0-SNAPSHOT
+ + org.onap.aai.aai-common + aai-schema-ingest + 1.2.2 + + + com.google.guava + guava + + + org.onap.aai.router-core router-core @@ -208,7 +220,11 @@ limitations under the License. 1.1.0 - + + com.google.guava + guava + ${version.com.google.guava} + @@ -278,11 +294,43 @@ limitations under the License. **/* + + ${basedir}/config + true + + schema/** + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + prepare-package + + unpack + + + + + org.onap.aai.aai-common + aai-schema + 1.2.2 + jar + oxm/ + ${project.build.directory}/bundleconfig-local/etc + + + + + + com.spotify docker-maven-plugin diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh index a54059b..ced887a 100644 --- a/src/main/bin/start.sh +++ b/src/main/bin/start.sh @@ -29,7 +29,7 @@ keytool -importkeystore -noprompt -deststorepass $PASS -destkeypass $PASS -srcke ## import into cacerts sudo keytool -importkeystore -noprompt -deststorepass changeit -destkeypass changeit -destkeystore /$JAVA_HOME/jre/lib/security/cacerts -srckeystore $BASEDIR/config/auth/onap.p12 -srcstoretype PKCS12 -srcstorepass $PASS -alias tomcat - +PROPS="-DBASEDIR=$BASEDIR" PROPS="-DAJSC_HOME=$AJSC_HOME" PROPS="$PROPS -DAJSC_CONF_HOME=$AJSC_CONF_HOME" PROPS="$PROPS -Dlogging.config=$BASEDIR/bundleconfig/etc/logback.xml" diff --git a/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java b/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java index 93f4c54..521a7c3 100644 --- a/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java +++ b/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java @@ -194,7 +194,10 @@ public enum DataRouterMsgs implements LogMessageEnum { READING_JSON_SCHEMA_ERROR, /** Arguments: {0} = Error message */ - JSON_CONVERSION_ERROR; + JSON_CONVERSION_ERROR, + + /** Failed to load the schemaIngest.properties file */ + SCHEMA_INGEST_LOAD_ERROR; /** * Static initializer to ensure the resource bundles for this class are loaded... diff --git a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java index 6d04ed6..7a4884a 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java @@ -43,6 +43,7 @@ import org.json.JSONObject; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; +import org.onap.aai.datarouter.schema.OxmModelLoader; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SpikeEventEntity; @@ -51,7 +52,6 @@ import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; -import org.onap.aai.datarouter.util.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; import org.onap.aai.datarouter.util.Version; @@ -295,7 +295,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { } protected DynamicJAXBContext readOxm(Exchange exchange, String uebPayload) { - DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); + DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion); if (oxmJaxbContext == null) { logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", uebPayload); @@ -539,7 +539,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { private List getOxmAttributes(DynamicJAXBContext oxmJaxbContext, String oxmEntityType, String entityType, String fieldName) { - DynamicType entity = (DynamicType) oxmJaxbContext.getDynamicType(oxmEntityType); + DynamicType entity = oxmJaxbContext.getDynamicType(oxmEntityType); if (entity == null) { return null; } @@ -806,7 +806,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { meta.setSpikeEventVertex(spikeEventVertex); - DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); + DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion); if (oxmJaxbContext == null) { logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", @@ -834,7 +834,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { */ VersionedOxmEntities oxmEntities = - EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion)); + EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion.toLowerCase())); if (oxmEntities != null && !oxmEntities.getEntityTypeLookup().containsKey(entityType)) { logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "No matching OXM Descriptor for entity-type='" + entityType + "'", diff --git a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java index d54fbe7..c1a1f2e 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java @@ -52,7 +52,7 @@ import org.onap.aai.datarouter.util.CrossEntityReference; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.util.OxmModelLoader; +import org.onap.aai.datarouter.schema.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; import org.onap.aai.datarouter.util.SearchSuggestionPermutation; @@ -252,7 +252,7 @@ public class EntityEventPolicy implements Processor { return; } - DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); + DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion); if (oxmJaxbContext == null) { logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", @@ -390,7 +390,7 @@ public class EntityEventPolicy implements Processor { * Use the versioned OXM Entity class to get access to cross-entity reference helper collections */ VersionedOxmEntities oxmEntities = - EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion)); + EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion.toLowerCase())); /** * NOTES: diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java index c33e668..8b56f99 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java @@ -75,7 +75,7 @@ public class SpikeAutosuggestIndexProcessor extends AbstractSpikeEntityEventProc * Use the versioned OXM Entity class to get access to cross-entity reference helper collections */ VersionedOxmEntities oxmEntities = - EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion)); + EntityOxmReferenceHelper.getInstance().getVersionedOxmEntities(Version.valueOf(oxmVersion.toLowerCase())); if (oxmEntities != null) { Map rootDescriptor = diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java index caee8b4..8f0e426 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java @@ -50,7 +50,7 @@ import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; -import org.onap.aai.datarouter.util.OxmModelLoader; +import org.onap.aai.datarouter.schema.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; import org.onap.aai.restclient.client.Headers; @@ -291,7 +291,7 @@ public class SpikeEntityEventPolicy implements Processor { return; } - DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion.toLowerCase()); + DynamicJAXBContext oxmJaxbContext = loadOxmContext(oxmVersion); if (oxmJaxbContext == null) { logger.error(EntityEventPolicyMsgs.OXM_VERSION_NOT_SUPPORTED, oxmVersion); logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, "OXM version mismatch", eventPayload); @@ -526,7 +526,7 @@ public class SpikeEntityEventPolicy implements Processor { private List getOxmAttributes(DynamicJAXBContext oxmJaxbContext, String oxmEntityType, String entityType, String fieldName) { - DynamicType entity = (DynamicType) oxmJaxbContext.getDynamicType(oxmEntityType); + DynamicType entity = oxmJaxbContext.getDynamicType(oxmEntityType); if (entity == null) { return null; } diff --git a/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java b/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java new file mode 100644 index 0000000..ee2c5dc --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java @@ -0,0 +1,98 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.schema; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.PathMatcher; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; +import java.util.ServiceConfigurationError; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaLocationsBean; +import org.onap.aai.setup.Version; + +public class OxmConfigTranslator extends ConfigTranslator { + public OxmConfigTranslator(SchemaLocationsBean bean) { + super(bean); + } + + @Override + public Map> getNodeFiles() { + String nodeDirectory = bean.getNodeDirectory(); + if (nodeDirectory == null) { + throw new ServiceConfigurationError( + "Node(s) directory is empty in the schema location bean (" + bean.getSchemaConfigLocation() + ")"); + } + try { + return getVersionMap(Paths.get(nodeDirectory), "*_v*.xml"); + } catch (IOException e) { + throw new ServiceConfigurationError("Failed to read node(s) directory " + getPath(nodeDirectory), e); + } + } + + @Override + public Map> getEdgeFiles() { + String edgeDirectory = bean.getEdgeDirectory(); + if (edgeDirectory == null) { + throw new ServiceConfigurationError( + "Edge(s) directory is empty in the schema location bean (" + bean.getSchemaConfigLocation() + ")"); + } + try { + return getVersionMap(Paths.get(edgeDirectory), "*_v*.json"); + } catch (IOException e) { + throw new ServiceConfigurationError("Failed to read edge(s) directory " + getPath(edgeDirectory), e); + } + } + + private String getPath(String nodeDirectory) { + return Paths.get(nodeDirectory).toAbsolutePath().toString(); + } + + /** + * Creates a map containing each OXM Version and the matching OXM file path(s) + * + * @param folderPath the folder/directory containing the OXM files + * @param fileSuffix + * @return a new Map object (may be empty) + * @throws IOException if there is a problem reading the specified directory path + */ + private Map> getVersionMap(Path folderPath, String globPattern) throws IOException { + final PathMatcher filter = folderPath.getFileSystem().getPathMatcher("glob:**/" + globPattern); + try (final Stream stream = Files.list(folderPath)) { + return stream.filter(filter::matches).map(Path::toString).filter(p -> getVersionFromPath(p) != null) + .collect(Collectors.groupingBy(this::getVersionFromPath)); + } + } + + private Version getVersionFromPath(String pathName) { + String version = "V" + pathName.replaceAll("^.*\\/", "").replaceAll("\\D+", ""); + try { + return Version.valueOf(version); + } catch (IllegalArgumentException e) { + return null; + } + } +} diff --git a/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java b/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java new file mode 100644 index 0000000..93854d8 --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java @@ -0,0 +1,101 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.schema; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.concurrent.ConcurrentHashMap; +import javax.ws.rs.core.Response.Status; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.onap.aai.cl.eelf.LoggerFactory; +import org.onap.aai.datarouter.logging.DataRouterMsgs; +import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; +import org.onap.aai.nodes.NodeIngestor; +import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaLocationsBean; +import org.onap.aai.setup.Version; + +public class OxmModelLoader { + + private static Map versionContextMap = new ConcurrentHashMap<>(); + private static List oxmModelProcessorRegistry = new ArrayList<>(); + + private static final org.onap.aai.cl.api.Logger logger = + LoggerFactory.getInstance().getLogger(OxmModelLoader.class.getName()); + + private OxmModelLoader() { + throw new IllegalStateException("Utility class"); + } + + public static synchronized void loadModels() { + SchemaIngestPropertiesReader schemaIngestPropReader = new SchemaIngestPropertiesReader(); + SchemaLocationsBean schemaLocationsBean = new SchemaLocationsBean(); + schemaLocationsBean.setNodeDirectory(schemaIngestPropReader.getNodeDir()); + ConfigTranslator configTranslator = new OxmConfigTranslator(schemaLocationsBean); + NodeIngestor nodeIngestor = new NodeIngestor(configTranslator); + + for (Version oxmVersion : Version.values()) { + DynamicJAXBContext jaxbContext = nodeIngestor.getContextForVersion(oxmVersion); + if (jaxbContext != null) { + loadModel(oxmVersion.toString(), jaxbContext); + } + } + } + + public static DynamicJAXBContext getContextForVersion(String version) { + if (versionContextMap == null || versionContextMap.isEmpty()) { + loadModels(); + } else if (!versionContextMap.containsKey(version)) { + throw new NoSuchElementException(Status.NOT_FOUND.toString()); + } + return versionContextMap.get(version); + } + + public static synchronized void registerExternalOxmModelProcessors( + Collection processors) { + if (processors != null) { + for (ExternalOxmModelProcessor processor : processors) { + if (!oxmModelProcessorRegistry.contains(processor)) { + oxmModelProcessorRegistry.add(processor); + } + } + } + } + + public static Map getVersionContextMap() { + return versionContextMap; + } + + private static synchronized void loadModel(String oxmVersion, DynamicJAXBContext jaxbContext) { + versionContextMap.put(oxmVersion, jaxbContext); + if (oxmModelProcessorRegistry != null) { + for (ExternalOxmModelProcessor processor : oxmModelProcessorRegistry) { + processor.onOxmVersionChange(org.onap.aai.datarouter.util.Version.valueOf(oxmVersion.toLowerCase()), + jaxbContext); + } + } + logger.info(DataRouterMsgs.LOADED_OXM_FILE, oxmVersion); + } + +} diff --git a/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java b/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java new file mode 100644 index 0000000..76530ae --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java @@ -0,0 +1,88 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.schema; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Properties; +import org.onap.aai.cl.eelf.LoggerFactory; +import org.onap.aai.datarouter.logging.DataRouterMsgs; + +public class SchemaIngestPropertiesReader { + + private static final String SCHEMA_INGEST_PROPERTIES_FILE = "schemaIngest.properties"; + private static final String MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES = "Failed to load " + SCHEMA_INGEST_PROPERTIES_FILE; + + private static final String SCHEMA_INGEST_PROPERTIES_LOCATION = + System.getProperty("CONFIG_HOME") + "/" + SCHEMA_INGEST_PROPERTIES_FILE; + + private static org.onap.aai.cl.api.Logger logger = + LoggerFactory.getInstance().getLogger(SchemaIngestPropertiesReader.class.getName()); + + /** + * Gets the location of the OXM. + * + * @return the directory containing the OXM files + */ + public String getNodeDir() { + + Properties prop = new Properties(); + try { + prop = loadFromFile(SCHEMA_INGEST_PROPERTIES_LOCATION); + } catch (NoSuchFileException e) { + try { + prop = loadFromClasspath(SCHEMA_INGEST_PROPERTIES_FILE); + } catch (URISyntaxException | IOException ef) { + logger.error(DataRouterMsgs.SCHEMA_INGEST_LOAD_ERROR, ef.getMessage()); + throw new RuntimeException(MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES); + } + } catch (IOException ec) { + logger.error(DataRouterMsgs.SCHEMA_INGEST_LOAD_ERROR, ec.getMessage()); + throw new RuntimeException(MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES); + } + return prop.getProperty("nodeDir"); + } + + private Properties loadFromFile(String filename) throws IOException { + Path configLocation = Paths.get(filename); + try (InputStream stream = Files.newInputStream(configLocation)) { + return loadProperties(stream); + } + } + + private Properties loadFromClasspath(String resourceName) throws URISyntaxException, IOException { + Path path = Paths.get(ClassLoader.getSystemResource(resourceName).toURI()); + try (InputStream stream = Files.newInputStream(path)) { + return loadProperties(stream); + } + } + + private Properties loadProperties(InputStream stream) throws IOException { + Properties config = new Properties(); + config.load(stream); + return config; + } +} diff --git a/src/main/java/org/onap/aai/datarouter/util/OxmModelLoader.java b/src/main/java/org/onap/aai/datarouter/util/OxmModelLoader.java deleted file mode 100644 index 345bc48..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/OxmModelLoader.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Collection; -import java.util.NoSuchElementException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.ws.rs.core.Response.Status; -import javax.xml.bind.JAXBException; - -import org.eclipse.persistence.jaxb.JAXBContextProperties; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory; -import org.onap.aai.cl.eelf.LoggerFactory; -import org.onap.aai.datarouter.logging.DataRouterMsgs; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; - -public class OxmModelLoader { - - private static Map versionContextMap = new ConcurrentHashMap<>(); - private static List oxmModelProcessorRegistry = new ArrayList<>(); - static final Pattern p = Pattern.compile("aai_oxm_(.*).xml"); - - private static org.onap.aai.cl.api.Logger logger = LoggerFactory.getInstance() - .getLogger(OxmModelLoader.class.getName()); - - public static synchronized void loadModels() throws FileNotFoundException { - - ClassLoader cl = OxmModelLoader.class.getClassLoader(); - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cl); - Resource[] resources; - try { - resources = resolver.getResources("classpath*:/oxm/aai_oxm*.xml"); - } catch (IOException ex) { - logger.error(DataRouterMsgs.LOAD_OXM_ERROR, ex.getMessage()); - throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml"); - } - - if (resources.length == 0) { - logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "No OXM schema files found on classpath"); - throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml"); - } - - for (Resource resource : resources) { - Matcher matcher = p.matcher(resource.getFilename()); - - if (matcher.matches()) { - try { - OxmModelLoader.loadModel(matcher.group(1), resource.getFilename(),resource.getInputStream()); - } catch (Exception e) { - logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "Failed to load " + resource.getFilename() - + ": " + e.getMessage()); - } - } - } - - - } - - - private static synchronized void loadModel(String version,String resourceName,InputStream inputStream) throws JAXBException { - Map properties = new HashMap<>(); - properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, inputStream); - final DynamicJAXBContext jaxbContext = DynamicJAXBContextFactory - .createContextFromOXM(Thread.currentThread().getContextClassLoader(), properties); - versionContextMap.put(version, jaxbContext); - if ( oxmModelProcessorRegistry != null) { - for ( ExternalOxmModelProcessor processor : oxmModelProcessorRegistry ) { - processor.onOxmVersionChange(Version.valueOf(version), jaxbContext ); - } - } - logger.info(DataRouterMsgs.LOADED_OXM_FILE, resourceName); - } - - public static DynamicJAXBContext getContextForVersion(String version) throws NoSuchElementException, FileNotFoundException { - if (versionContextMap == null || versionContextMap.isEmpty()) { - loadModels(); - } else if (!versionContextMap.containsKey(version)) { - throw new NoSuchElementException(Status.NOT_FOUND.toString()); - - } - - return versionContextMap.get(version); - } - - public static Map getVersionContextMap() { - return versionContextMap; - } - - public static void setVersionContextMap(Map versionContextMap) { - OxmModelLoader.versionContextMap = versionContextMap; - } - - public static synchronized void registerExternalOxmModelProcessors(Collection processors) { - if(processors != null) { - for(ExternalOxmModelProcessor processor : processors) { - if(!oxmModelProcessorRegistry.contains(processor)) { - oxmModelProcessorRegistry.add(processor); - } - } - } - } - -} diff --git a/src/main/resources/logging/DataRouterMsgs.properties b/src/main/resources/logging/DataRouterMsgs.properties index fff262c..d922a7f 100644 --- a/src/main/resources/logging/DataRouterMsgs.properties +++ b/src/main/resources/logging/DataRouterMsgs.properties @@ -170,4 +170,8 @@ FAIL_TO_CREATE_UPDATE_DOC=\ Failed to create or update document in index {0}. Cause: {1} LOAD_OXM_ERROR=\ DR5000E|\ - Unable to load Oxm model: {0}\ + Unable to load Oxm model: {0}\ + +SCHEMA_INGEST_LOAD_ERROR=\ + DR5001E|\ + Unable to load schema ingest properties file due to : {0} diff --git a/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java b/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java new file mode 100644 index 0000000..a92d739 --- /dev/null +++ b/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java @@ -0,0 +1,68 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.schema; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.util.ArrayList; +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.internal.helper.DatabaseField; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.mappings.DatabaseMapping; +import org.junit.Test; +import org.onap.aai.datarouter.schema.OxmModelLoader; +import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; +import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; +import org.onap.aai.setup.Version; + +public class OxmModelLoaderTest { + + @Test + public void testLoadingMultipleOxmFiles() { + ArrayList externalOxmModelProcessors = new ArrayList(); + externalOxmModelProcessors.add(EntityOxmReferenceHelper.getInstance()); + OxmModelLoader.registerExternalOxmModelProcessors(externalOxmModelProcessors); + OxmModelLoader.loadModels(); + + DynamicJAXBContext jaxbContext = OxmModelLoader.getContextForVersion(Version.getLatest().toString()); + + DynamicType pserver = jaxbContext.getDynamicType("Pserver"); + DynamicType genericVnf = jaxbContext.getDynamicType("GenericVnf"); + + assertNotNull(pserver); + assertNotNull(genericVnf); + + DatabaseMapping mapping = pserver.getDescriptor().getMappings().firstElement(); + if (mapping.isAbstractDirectMapping()) { + DatabaseField f = mapping.getField(); + String keyName = f.getName().substring(0, f.getName().indexOf("/")); + assertTrue(keyName.equals("hostname")); + } + + mapping = genericVnf.getDescriptor().getMappings().firstElement(); + if (mapping.isAbstractDirectMapping()) { + DatabaseField f = mapping.getField(); + String keyName = f.getName().substring(0, f.getName().indexOf("/")); + assertTrue(keyName.equals("vnf-id")); + } + + } +} diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml new file mode 100644 index 0000000..334d32d --- /dev/null +++ b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_a_v13.xml @@ -0,0 +1,2987 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml new file mode 100644 index 0000000..368fcc7 --- /dev/null +++ b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_b_v13.xml @@ -0,0 +1,3811 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml new file mode 100644 index 0000000..90d023c --- /dev/null +++ b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v11.xml @@ -0,0 +1,6363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml new file mode 100644 index 0000000..d9fbcca --- /dev/null +++ b/src/test/resources/oxm-reader/multiple-oxm/aai_oxm_v12.xml @@ -0,0 +1,6770 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml new file mode 100644 index 0000000..51eaa34 --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v10.xml @@ -0,0 +1,5438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml new file mode 100644 index 0000000..90d023c --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v11.xml @@ -0,0 +1,6363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml new file mode 100644 index 0000000..d9fbcca --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v12.xml @@ -0,0 +1,6770 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml new file mode 100644 index 0000000..2dfc4f0 --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v13.xml @@ -0,0 +1,6770 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml new file mode 100644 index 0000000..d666b73 --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v8.xml @@ -0,0 +1,4655 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml b/src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml new file mode 100644 index 0000000..ecffb2f --- /dev/null +++ b/src/test/resources/oxm-reader/oxm/aai_oxm_v9.xml @@ -0,0 +1,5330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/schemaIngest.properties b/src/test/resources/schemaIngest.properties new file mode 100644 index 0000000..d56d2ef --- /dev/null +++ b/src/test/resources/schemaIngest.properties @@ -0,0 +1,4 @@ +# Properties for the SchemaLocationsBean +schemaConfig=NA +nodeDir=src/test/resources/oxm-reader/oxm/ +edgeDir= \ No newline at end of file -- 2.16.6 From aec897fe708e37b6a58f2aff04be5de14eabd403 Mon Sep 17 00:00:00 2001 From: renealr Date: Tue, 19 Jun 2018 10:50:41 -0400 Subject: [PATCH 13/16] add the gap event transformer add the gap event transformer and add stub data for test cases Issue-ID: AAI-1230 Change-Id: I95f6f050ca4d2d7ea3a288e05f69c6be66a9222b Signed-off-by: renealr --- src/main/bin/start.sh | 28 +----- .../aai/datarouter/policy/GapEventTransformer.java | 105 +++++++++++++++++++++ .../entity/SuggestionSearchEntityTest.java | 2 +- .../datarouter/policy/GapEventTransformerTest.java | 68 +++++++++++++ src/test/resources/gap_event.json | 50 ++++++++++ src/test/resources/gap_event_wrong.json | 50 ++++++++++ 6 files changed, 278 insertions(+), 25 deletions(-) create mode 100644 src/main/java/org/onap/aai/datarouter/policy/GapEventTransformer.java rename src/test/java/org/{openecomp => onap/aai}/datarouter/entity/SuggestionSearchEntityTest.java (99%) create mode 100644 src/test/java/org/onap/aai/datarouter/policy/GapEventTransformerTest.java create mode 100644 src/test/resources/gap_event.json create mode 100644 src/test/resources/gap_event_wrong.json diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh index ced887a..bb219b8 100644 --- a/src/main/bin/start.sh +++ b/src/main/bin/start.sh @@ -2,7 +2,7 @@ BASEDIR="/opt/app/data-router/" AJSC_HOME="$BASEDIR" -AJSC_CONF_HOME="$AJSC_HOME/bundleconfig/" + if [ -z "$CONFIG_HOME" ]; then echo "CONFIG_HOME must be set in order to start up process" @@ -12,35 +12,15 @@ fi if [ -z "$KEY_STORE_PASSWORD" ]; then echo "KEY_STORE_PASSWORD must be set in order to start up process" exit 1 -else - ## Extract java jar to DEOBFUSCATE the password. - CURR_D=`pwd` - cd $BASEDIR - jar xf data-router.jar - sudo java -cp ./BOOT-INF/lib/jetty-util-9.4.8.v20171121.jar org.eclipse.jetty.util.security.Password $KEY_STORE_PASSWORD > pass.txt 2>> pass.txt - PASS=`sed "2q;d" pass.txt` - sudo rm pass.txt - cd $CURR_D fi -## tomcat_keystore to p12 -keytool -importkeystore -noprompt -deststorepass $PASS -destkeypass $PASS -srckeystore $BASEDIR/config/auth/tomcat_keystore -destkeystore $BASEDIR/config/auth/onap.p12 -deststoretype PKCS12 -srcstorepass $PASS - -## import into cacerts -sudo keytool -importkeystore -noprompt -deststorepass changeit -destkeypass changeit -destkeystore /$JAVA_HOME/jre/lib/security/cacerts -srckeystore $BASEDIR/config/auth/onap.p12 -srcstoretype PKCS12 -srcstorepass $PASS -alias tomcat - -PROPS="-DBASEDIR=$BASEDIR" PROPS="-DAJSC_HOME=$AJSC_HOME" -PROPS="$PROPS -DAJSC_CONF_HOME=$AJSC_CONF_HOME" PROPS="$PROPS -Dlogging.config=$BASEDIR/bundleconfig/etc/logback.xml" -PROPS="$PROPS -DAJSC_SHARED_CONFIG=$AJSC_CONF_HOME" -PROPS="$PROPS -DAJSC_SERVICE_NAMESPACE=data-router" -PROPS="$PROPS -DAJSC_SERVICE_VERSION=v1" -PROPS="$PROPS -Dserver.port=9502" PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME" -JVM_MAX_HEAP=${MAX_HEAP:-1024} +PROPS="$PROPS -DKEY_STORE_PASSWORD=$KEY_STORE_PASSWORD" + -echo $CLASSPATH +JVM_MAX_HEAP=${MAX_HEAP:-1024} cd ${MICRO_HOME} jar uf0 $MICRO_HOME/data-router.jar BOOT-INF/lib/* diff --git a/src/main/java/org/onap/aai/datarouter/policy/GapEventTransformer.java b/src/main/java/org/onap/aai/datarouter/policy/GapEventTransformer.java new file mode 100644 index 0000000..6565fc2 --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/policy/GapEventTransformer.java @@ -0,0 +1,105 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.policy; + +import java.io.FileNotFoundException; + +import org.apache.camel.Exchange; +import org.json.JSONException; +import org.json.JSONObject; +import org.onap.aai.cl.api.Logger; +import org.onap.aai.cl.eelf.LoggerFactory; +import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; + + + +public class GapEventTransformer { + protected Logger logger; + protected static final String additionalInfo = "Response of GapEvent to transform"; + + protected enum ResponseType { + SUCCESS, PARTIAL_SUCCESS, FAILURE; + } + + public GapEventTransformer() throws FileNotFoundException { + LoggerFactory loggerFactoryInstance = LoggerFactory.getInstance(); + logger = loggerFactoryInstance.getLogger(AbstractSpikeEntityEventProcessor.class.getName()); + } + + + public void process(Exchange exchange) throws Exception { + + String payload = getExchangeBody(exchange); + JSONObject newPayload = transformToSpikePattern(payload); + exchange.getOut().setBody(newPayload.toString()); + + } + + protected JSONObject transformToSpikePattern(String payload) { + JSONObject payloadJson = new JSONObject(payload); + JSONObject payloadEntity = payloadJson.getJSONObject("entity"); + JSONObject payloadProperties = payloadEntity.getJSONObject("properties"); + String payloadId = payloadEntity.getString("id"); + String payloadType = payloadEntity.getString("type"); + + JSONObject newPayload = new JSONObject(); + newPayload.put("operation", "UPDATE"); + JSONObject newPayloadVertex = new JSONObject(); + newPayloadVertex.put("key", payloadId); + newPayloadVertex.put("type", payloadType); + newPayloadVertex.put("properties", payloadProperties); + newPayload.put("vertex", newPayloadVertex); + return newPayload; + } + + protected String getExchangeBody(Exchange exchange) { + String uebPayload = exchange.getIn().getBody().toString(); + if (uebPayload == null || !isJSONValid(uebPayload)) { + uebPayload = exchange.getIn().getBody(String.class); + if (uebPayload == null || !isJSONValid(uebPayload)) { + returnWithError(exchange, uebPayload, "Invalid Payload"); + return null; + } + } + return uebPayload; + } + + private boolean isJSONValid(String test) { + try { + new JSONObject(test); + } catch (JSONException ex) { + return false; + } + return true; + } + + protected void returnWithError(Exchange exchange, String payload, String errorMsg) { + logger.error(EntityEventPolicyMsgs.DISCARD_EVENT_NONVERBOSE, errorMsg); + logger.debug(EntityEventPolicyMsgs.DISCARD_EVENT_VERBOSE, errorMsg, payload); + setResponse(exchange, ResponseType.FAILURE, additionalInfo); + } + + protected void setResponse(Exchange exchange, ResponseType responseType, String additionalInfo) { + + exchange.getOut().setHeader("ResponseType", responseType.toString()); + exchange.getOut().setBody(additionalInfo); + } +} diff --git a/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java b/src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java similarity index 99% rename from src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java rename to src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java index 4d48e83..3c56dc8 100644 --- a/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java +++ b/src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.datarouter.entity; +package org.onap.aai.datarouter.entity; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/org/onap/aai/datarouter/policy/GapEventTransformerTest.java b/src/test/java/org/onap/aai/datarouter/policy/GapEventTransformerTest.java new file mode 100644 index 0000000..355756b --- /dev/null +++ b/src/test/java/org/onap/aai/datarouter/policy/GapEventTransformerTest.java @@ -0,0 +1,68 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * 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.datarouter.policy; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.FileInputStream; + +import org.apache.commons.io.IOUtils; +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; + + + +public class GapEventTransformerTest { + GapEventTransformer policy; + String eventJson; + String eventJson2; + + @SuppressWarnings("unchecked") + @Before + public void init() throws Exception { + policy = new GapEventTransformer(); + FileInputStream event = new FileInputStream(new File("src/test/resources/gap_event.json")); + eventJson = IOUtils.toString(event, "UTF-8"); + FileInputStream event2 = + new FileInputStream(new File("src/test/resources/gap_event_wrong.json")); + eventJson2 = IOUtils.toString(event2, "UTF-8"); + + } + + @Test + public void testTransform_success() throws Exception { + JSONObject newPayloadJson = policy.transformToSpikePattern(eventJson.toString()); + JSONObject payloadEntity = newPayloadJson.getJSONObject("vertex"); + assertTrue(newPayloadJson.has("vertex")); + assertTrue(newPayloadJson.has("operation")); + assertEquals(newPayloadJson.get("operation"), "UPDATE"); + + + } + + @Test(expected = Exception.class) + public void testTransform_badPayload_fail() throws Exception { + policy.transformToSpikePattern(eventJson2.toString()); + } + +} diff --git a/src/test/resources/gap_event.json b/src/test/resources/gap_event.json new file mode 100644 index 0000000..05e8fc3 --- /dev/null +++ b/src/test/resources/gap_event.json @@ -0,0 +1,50 @@ +{ + "event-header":{ + "entity-type":"pserver", + "top-entity-type":"pserver", + "entity-link":"/services/inventory/v11/pservers?properties=all", + "event-type":"${crud.event.type.api}", + "domain":"dev", + "topic-name":"CRUD-DATA-EXPORT-SDWAN", + "event-id":"7445ecab-40fc-46a9-a595-42d940488b02" + }, + "entity":{ + "in":[ + { + "id":"9387d038-1e4f-4a08-ac5e-97c09530bbd8", + "source":"services/inventory/v11/vserver/ad7c5ad8-142f-4cd1-b38a-11fd7d98239d", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v12/tosca.relationships.HostedOn/9387d038-1e4f-4a08-ac5e-97c09530bbd8" + } + ], + "id":"441d5a1e-a107-4fc3-b885-ccf683e3513b", + "type":"pserver", + "url":"services/inventory/v11/pserver/441d5a1e-a107-4fc3-b885-ccf683e3513b", + "properties":{ + "aai-last-mod-ts":"1522935511411", + "equip-type":"Rack Server", + "equip-vendor":"HP", + "serial-number":"S4MPLEDDD456D", + "pserver-id":"Pserver-AMT-8", + "aai-created-ts":"1522935511411", + "source-of-truth":"RO", + "number-of-cpus":10, + "aai-node-type":"pserver", + "hostname":"10_aaingenvnf-pserver-fw-8", + "equip-model":"PowerEdge R930", + "in-maint":false, + "resource-version":"64684545", + "disk-in-gigabytes":146, + "ram-in-megabytes":62914556, + "last-mod-source-of-truth":"RO" + }, + "out":[ + { + "id":"bfa7ec57-cfa6-4bda-b1dc-a11a192bacaa", + "type":"org.onap.relationships.inventory.LocatedIn", + "url":"services/inventory/relationships/v12/org.onap.relationships.inventory.LocatedIn/bfa7ec57-cfa6-4bda-b1dc-a11a192bacaa", + "target":"services/inventory/v11/complex/90564f64-d3c4-47f8-847d-553497f6b04a" + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/gap_event_wrong.json b/src/test/resources/gap_event_wrong.json new file mode 100644 index 0000000..bf4135f --- /dev/null +++ b/src/test/resources/gap_event_wrong.json @@ -0,0 +1,50 @@ +{ + "event-header":{ + "entity-type":"pserver", + "top-entity-type":"pserver", + "entity-link":"/services/inventory/v11/pservers?properties=all", + "event-type":"${crud.event.type.api}", + "domain":"dev", + "topic-name":"CRUD-DATA-EXPORT-SDWAN", + "event-id":"7445ecab-40fc-46a9-a595-42d940488b02" + }, + "entity2":{ + "in":[ + { + "id":"9387d038-1e4f-4a08-ac5e-97c09530bbd8", + "source":"services/inventory/v11/vserver/ad7c5ad8-142f-4cd1-b38a-11fd7d98239d", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v12/tosca.relationships.HostedOn/9387d038-1e4f-4a08-ac5e-97c09530bbd8" + } + ], + "id":"441d5a1e-a107-4fc3-b885-ccf683e3513b", + "type":"pserver", + "url":"services/inventory/v11/pserver/441d5a1e-a107-4fc3-b885-ccf683e3513b", + "properties":{ + "aai-last-mod-ts":"1522935511411", + "equip-type":"Rack Server", + "equip-vendor":"HP", + "serial-number":"S4MPLEDDD456D", + "pserver-id":"Pserver-AMT-8", + "aai-created-ts":"1522935511411", + "source-of-truth":"RO", + "number-of-cpus":10, + "aai-node-type":"pserver", + "hostname":"10_aaingenvnf-pserver-fw-8", + "equip-model":"PowerEdge R930", + "in-maint":false, + "resource-version":"64684545", + "disk-in-gigabytes":146, + "ram-in-megabytes":62914556, + "last-mod-source-of-truth":"RO" + }, + "out":[ + { + "id":"bfa7ec57-cfa6-4bda-b1dc-a11a192bacaa", + "type":"org.onap.relationships.inventory.LocatedIn", + "url":"services/inventory/relationships/v12/org.onap.relationships.inventory.LocatedIn/bfa7ec57-cfa6-4bda-b1dc-a11a192bacaa", + "target":"services/inventory/v11/complex/90564f64-d3c4-47f8-847d-553497f6b04a" + } + ] + } +} \ No newline at end of file -- 2.16.6 From 113837354d04e4f65b38a018228cdceca2127305 Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Thu, 21 Jun 2018 10:49:34 +0200 Subject: [PATCH 14/16] Remove performance problem. Change-Id: I15234aff50ca4946cf481fa3d32cb6fa56af60e5 Issue-ID: AAI-1233 Signed-off-by: Bogumil Zebek --- pom.xml | 6 ++++ .../policy/AbstractSpikeEntityEventProcessor.java | 8 +---- .../aai/datarouter/policy/EntityEventPolicy.java | 6 +--- .../datarouter/policy/OxmEntityTypeConverter.java | 42 ++++++++++++++++++++++ .../datarouter/policy/SpikeEntityEventPolicy.java | 6 +--- .../policy/OxmEntityTypeConverterTest.java | 41 +++++++++++++++++++++ 6 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 src/main/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverter.java create mode 100644 src/test/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverterTest.java diff --git a/pom.xml b/pom.xml index c66b855..e955c80 100644 --- a/pom.xml +++ b/pom.xml @@ -130,6 +130,12 @@ limitations under the License. test
+ + org.assertj + assertj-core + 3.10.0 + test + org.powermock powermock-api-mockito diff --git a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java index 7a4884a..ca8caf4 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java @@ -407,13 +407,7 @@ public abstract class AbstractSpikeEntityEventProcessor implements Processor { protected String getOxmEntityType(String entityType) { - - String[] entityTypeArr = entityType.split("-"); - String oxmEntityType = ""; - for (String entityWord : entityTypeArr) { - oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1); - } - return oxmEntityType; + return new OxmEntityTypeConverter().convert(entityType); } protected List getSearchableAttibutes(DynamicJAXBContext oxmJaxbContext, String oxmEntityType, diff --git a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java index c1a1f2e..ae5d0e6 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java @@ -314,11 +314,7 @@ public class EntityEventPolicy implements Processor { // Process for building AaiEventEntity object - String[] entityTypeArr = entityType.split("-"); - String oxmEntityType = ""; - for (String entityWord : entityTypeArr) { - oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1); - } + String oxmEntityType = new OxmEntityTypeConverter().convert(entityType); List searchableAttr = getOxmAttributes(uebPayload, oxmJaxbContext, oxmEntityType, entityType, "searchable"); diff --git a/src/main/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverter.java b/src/main/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverter.java new file mode 100644 index 0000000..d05ebc9 --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverter.java @@ -0,0 +1,42 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Nokia + * ================================================================================ + * 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.datarouter.policy; + +import org.apache.commons.lang.StringUtils; + +/** + * Created by Bogumil Zebek on 6/21/18. + */ +public class OxmEntityTypeConverter { + + private static final String DELIMITER = "-"; + + public String convert(String entityType) { + + String[] entityTypeArr = entityType.split(DELIMITER); + + StringBuilder oxmEntityType = new StringBuilder(); + for (String entityWord : entityTypeArr) { + oxmEntityType.append(StringUtils.capitalize(entityWord)); + } + return oxmEntityType.toString(); + } +} diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java index 8f0e426..67db407 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java @@ -338,11 +338,7 @@ public class SpikeEntityEventPolicy implements Processor { eventPayload); // Process for building SpikeEventEntity object - String[] entityTypeArr = entityType.split("-"); - String oxmEntityType = ""; - for (String entityWord : entityTypeArr) { - oxmEntityType += entityWord.substring(0, 1).toUpperCase() + entityWord.substring(1); - } + String oxmEntityType = new OxmEntityTypeConverter().convert(entityType); List searchableAttr = getOxmAttributes(oxmJaxbContext, oxmEntityType, entityType, "searchable"); diff --git a/src/test/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverterTest.java b/src/test/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverterTest.java new file mode 100644 index 0000000..12e23be --- /dev/null +++ b/src/test/java/org/onap/aai/datarouter/policy/OxmEntityTypeConverterTest.java @@ -0,0 +1,41 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Nokia + * ================================================================================ + * 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.datarouter.policy; + + +import org.assertj.core.api.Assertions; +import org.junit.Test; + +/** + * Created by Bogumil Zebek on 6/21/18. + */ +public class OxmEntityTypeConverterTest { + + private OxmEntityTypeConverter oxmEntityTypeConverter = new OxmEntityTypeConverter(); + + @Test + public void shouldConvertEntityTypeToOxmEntityType(){ + Assertions.assertThat(oxmEntityTypeConverter.convert("generic-vnf")).isEqualTo("GenericVnf"); + Assertions.assertThat(oxmEntityTypeConverter.convert("pserver")).isEqualTo("Pserver"); + Assertions.assertThat(oxmEntityTypeConverter.convert("optical-router")).isEqualTo("OpticalRouter"); + } + +} \ No newline at end of file -- 2.16.6 From 9939a1d4a4d390cfb89829ad253d94f8f4102ac5 Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Fri, 22 Jun 2018 08:56:43 +0200 Subject: [PATCH 15/16] Fix file stream closing Change-Id: Ie1417769a934fff51a1b8277e472a8f8c04b81eb Issue-ID: AAI-1234 Signed-off-by: Bogumil Zebek --- .../aai/datarouter/util/DataRouterProperties.java | 38 +++++++++++--------- .../aai/datarouter/util/SearchServiceAgent.java | 14 ++++---- .../datarouter/util/DataRouterPropertiesTest.java | 41 ++++++++++++++++++---- src/test/resources/data-router.properties | 2 ++ 4 files changed, 65 insertions(+), 30 deletions(-) create mode 100644 src/test/resources/data-router.properties diff --git a/src/main/java/org/onap/aai/datarouter/util/DataRouterProperties.java b/src/main/java/org/onap/aai/datarouter/util/DataRouterProperties.java index 2b17020..36e4a10 100644 --- a/src/main/java/org/onap/aai/datarouter/util/DataRouterProperties.java +++ b/src/main/java/org/onap/aai/datarouter/util/DataRouterProperties.java @@ -9,7 +9,7 @@ * 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 + * 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, @@ -24,31 +24,35 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.util.Properties; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DataRouterProperties { - private static final Logger logger = LoggerFactory.getLogger(DataRouterProperties.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DataRouterProperties.class); + + private static Properties properties; - private static Properties properties; + static { + File file = new File(DataRouterConstants.DR_CONFIG_FILE); + loadProperties(file); + } - static { - properties = new Properties(); - File file = new File(DataRouterConstants.DR_CONFIG_FILE); - try { - properties.load(new FileInputStream(file)); - } catch (FileNotFoundException e) { - logger.error("FileNotFoundException: ", e); - } catch (IOException e) { - logger.error("IOException: ", e); + static void loadProperties(File file) { + properties = new Properties(); + try (InputStream props = new FileInputStream(file)) { + properties.load(props); + } catch (FileNotFoundException e) { + LOGGER.error("FileNotFoundException: ", e); + } catch (IOException e) { + LOGGER.error("IOException: ", e); + } } - } - public static String get(String key) { - return properties.getProperty(key); - } + public static String get(String key) { + return properties.getProperty(key); + } } diff --git a/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java b/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java index 42861b4..bbdb4c8 100644 --- a/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java +++ b/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java @@ -320,8 +320,7 @@ public class SearchServiceAgent { * Removes a document from the Search Service. * * @param index - The index to create the document in. - * @param id - The identifier for the document. - * @param payload - The document contents. + * @param documentId - The identifier for the document. * @param headers - HTTP headers. */ public void deleteDocument(String index, String documentId, Map> headers) { @@ -340,12 +339,13 @@ public class SearchServiceAgent { */ protected String loadFileData(String filename) throws Exception { StringBuilder data = new StringBuilder(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader( - EntityEventPolicy.class.getClassLoader().getResourceAsStream("/" + filename), - StandardCharsets.UTF_8)); - String line; + try (InputStreamReader inputStreamReader = new InputStreamReader(EntityEventPolicy.class.getClassLoader() + .getResourceAsStream("/" + filename), StandardCharsets.UTF_8); BufferedReader in = new BufferedReader( + inputStreamReader) + ) { + + String line; while ((line = in.readLine()) != null) { data.append(line); } diff --git a/src/test/java/org/onap/aai/datarouter/util/DataRouterPropertiesTest.java b/src/test/java/org/onap/aai/datarouter/util/DataRouterPropertiesTest.java index 024a23d..51505a9 100644 --- a/src/test/java/org/onap/aai/datarouter/util/DataRouterPropertiesTest.java +++ b/src/test/java/org/onap/aai/datarouter/util/DataRouterPropertiesTest.java @@ -3,13 +3,13 @@ * org.onap.aai * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs + * Copyright © 2017-2018 Nokia * ================================================================================ * 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 + * 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, @@ -20,14 +20,43 @@ */ package org.onap.aai.datarouter.util; +import java.io.File; +import java.net.URISyntaxException; +import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.*; - +/** + * @author Bogumil Zebek + */ public class DataRouterPropertiesTest { @Test - public void testGet(){ - DataRouterProperties.get("key"); + public void shouldLoadDataRouterPropertiesProperlyWhenSpecifiedFileExists() throws URISyntaxException { + // given + ClassLoader classLoader = getClass().getClassLoader(); + + File file = new File( + classLoader.getResource("data-router.properties").getFile() + ); + + // when + DataRouterProperties.loadProperties(file); + + //then + Assert.assertEquals("value1", DataRouterProperties.get("key1")); + Assert.assertEquals("value2", DataRouterProperties.get("key2")); + Assert.assertNull(DataRouterProperties.get("nonExistingKey")); + } + + @Test + public void shouldCreateEmptyDataRouterPropertiesContainerWhenSpecifiedFileDoesNotExist() { + // given + File nonExistingFile = new File("nonExistingFile.properties"); + + // when + DataRouterProperties.loadProperties(nonExistingFile); + + // then + Assert.assertNull(DataRouterProperties.get("key")); } } \ No newline at end of file diff --git a/src/test/resources/data-router.properties b/src/test/resources/data-router.properties new file mode 100644 index 0000000..f995a3b --- /dev/null +++ b/src/test/resources/data-router.properties @@ -0,0 +1,2 @@ +key1=value1 +key2=value2 \ No newline at end of file -- 2.16.6 From 0f03ce7eea220df68d84a7f0f088a38ebb088039 Mon Sep 17 00:00:00 2001 From: Daniel Silverthorn Date: Wed, 27 Jun 2018 15:01:55 -0400 Subject: [PATCH 16/16] Move common code to router-core from DR Change-Id: I5c13ca2b4173db02c0678dfbc0b4a8b168a570f8 Issue-ID: AAI-1339 Signed-off-by: Daniel Silverthorn --- pom.xml | 32 +- .../aai/datarouter/entity/OxmEntityDescriptor.java | 122 ------- .../aai/datarouter/logging/DataRouterMsgs.java | 12 +- .../policy/AbstractSpikeEntityEventProcessor.java | 13 +- .../aai/datarouter/policy/EntityEventPolicy.java | 14 +- .../policy/SpikeAutosuggestIndexProcessor.java | 8 +- .../datarouter/policy/SpikeEntityEventPolicy.java | 8 +- .../aai/datarouter/schema/OxmConfigTranslator.java | 98 ------ .../onap/aai/datarouter/schema/OxmModelLoader.java | 101 ------ .../schema/SchemaIngestPropertiesReader.java | 88 ------ .../aai/datarouter/util/CrossEntityReference.java | 93 ------ .../datarouter/util/EntityOxmReferenceHelper.java | 58 ---- .../datarouter/util/ExternalOxmModelProcessor.java | 33 -- .../java/org/onap/aai/datarouter/util/Version.java | 25 -- .../aai/datarouter/util/VersionedOxmEntities.java | 349 --------------------- .../resources/logging/DataRouterMsgs.properties | 14 +- .../aai/datarouter/entity/AaiEventEntityTest.java | 30 +- .../aai/datarouter/schema/OxmModelLoaderTest.java | 68 ---- .../datarouter/util/CrossEntityReferenceTest.java | 49 --- 19 files changed, 42 insertions(+), 1173 deletions(-) delete mode 100644 src/main/java/org/onap/aai/datarouter/entity/OxmEntityDescriptor.java delete mode 100644 src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java delete mode 100644 src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java delete mode 100644 src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/CrossEntityReference.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/EntityOxmReferenceHelper.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/ExternalOxmModelProcessor.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/Version.java delete mode 100644 src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java delete mode 100644 src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java delete mode 100644 src/test/java/org/onap/aai/datarouter/util/CrossEntityReferenceTest.java diff --git a/pom.xml b/pom.xml index e955c80..7b0a651 100644 --- a/pom.xml +++ b/pom.xml @@ -169,22 +169,22 @@ limitations under the License. 3.1.200 provided - - org.onap.aai.aai-common - aai-schema - 1.3.0-SNAPSHOT - - - org.onap.aai.aai-common - aai-schema-ingest - 1.2.2 - - - com.google.guava - guava - - - + + + + + + + + + + + + + + + + org.onap.aai.router-core router-core diff --git a/src/main/java/org/onap/aai/datarouter/entity/OxmEntityDescriptor.java b/src/main/java/org/onap/aai/datarouter/entity/OxmEntityDescriptor.java deleted file mode 100644 index 30e55b7..0000000 --- a/src/main/java/org/onap/aai/datarouter/entity/OxmEntityDescriptor.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.entity; - -import java.util.List; - -import org.onap.aai.datarouter.util.CrossEntityReference; - - -public class OxmEntityDescriptor { - - private String entityName; - - private List primaryKeyAttributeName; - - private List searchableAttributes; - - private CrossEntityReference crossEntityReference; - - private List alias; - - private List suggestableAttributes; - - boolean isSuggestableEntity; - - public String getEntityName() { - return entityName; - } - - public void setEntityName(String entityName) { - this.entityName = entityName; - } - - public List getPrimaryKeyAttributeName() { - return primaryKeyAttributeName; - } - - public void setPrimaryKeyAttributeName(List primaryKeyAttributeName) { - this.primaryKeyAttributeName = primaryKeyAttributeName; - } - - public List getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public boolean hasSearchableAttributes() { - - if ( this.searchableAttributes == null) { - return false; - } - - if ( !this.searchableAttributes.isEmpty() ) { - return true; - } - - return false; - - } - - public CrossEntityReference getCrossEntityReference() { - return crossEntityReference; - } - - public void setCrossEntityReference(CrossEntityReference crossEntityReference) { - this.crossEntityReference = crossEntityReference; - } - - public List getAlias() { - return alias; - } - - public void setAlias(List alias) { - this.alias = alias; - } - - public List getSuggestableAttributes() { - return suggestableAttributes; - } - - public void setSuggestableAttributes(List suggestableAttributes) { - this.suggestableAttributes = suggestableAttributes; - } - - public boolean isSuggestableEntity() { - return isSuggestableEntity; - } - - public void setSuggestableEntity(boolean isSuggestableEntity) { - this.isSuggestableEntity = isSuggestableEntity; - } - - @Override - public String toString() { - return "OxmEntityDescriptor [entityName=" + entityName + ", primaryKeyAttributeName=" - + primaryKeyAttributeName + ", searchableAttributes=" + searchableAttributes - + ", crossEntityReference=" + crossEntityReference + ", alias=" + alias - + ", suggestableAttributes=" + suggestableAttributes + ", isSuggestableEntity=" - + isSuggestableEntity + "]"; - } -} diff --git a/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java b/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java index 521a7c3..2443993 100644 --- a/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java +++ b/src/main/java/org/onap/aai/datarouter/logging/DataRouterMsgs.java @@ -153,13 +153,6 @@ public enum DataRouterMsgs implements LogMessageEnum { INVALID_OXM_DIR, LOAD_OXM_ERROR, - /** - * Successfully loaded schema: {0} - * - *

Arguments: - * {0} = oxm filename - */ - LOADED_OXM_FILE, /** * Arguments: {0} = origin payload @@ -194,10 +187,7 @@ public enum DataRouterMsgs implements LogMessageEnum { READING_JSON_SCHEMA_ERROR, /** Arguments: {0} = Error message */ - JSON_CONVERSION_ERROR, - - /** Failed to load the schemaIngest.properties file */ - SCHEMA_INGEST_LOAD_ERROR; + JSON_CONVERSION_ERROR; /** * Static initializer to ensure the resource bundles for this class are loaded... diff --git a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java index ca8caf4..c642102 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/AbstractSpikeEntityEventProcessor.java @@ -33,7 +33,6 @@ import java.util.Map; import org.apache.camel.Exchange; import org.apache.camel.Processor; -import org.apache.http.conn.routing.RouteInfo.LayerType; import org.eclipse.persistence.dynamic.DynamicType; import org.eclipse.persistence.internal.helper.DatabaseField; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; @@ -43,19 +42,19 @@ import org.json.JSONObject; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; -import org.onap.aai.datarouter.schema.OxmModelLoader; +import org.onap.aai.schema.OxmModelLoader; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; -import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SpikeEventEntity; import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; -import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; -import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; -import org.onap.aai.datarouter.util.Version; -import org.onap.aai.datarouter.util.VersionedOxmEntities; +import org.onap.aai.entity.OxmEntityDescriptor; +import org.onap.aai.util.EntityOxmReferenceHelper; +import org.onap.aai.util.ExternalOxmModelProcessor; +import org.onap.aai.util.Version; +import org.onap.aai.util.VersionedOxmEntities; import org.onap.aai.restclient.client.Headers; import org.onap.aai.restclient.client.OperationResult; import org.onap.aai.restclient.rest.HttpUtil; diff --git a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java index ae5d0e6..6276abd 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/EntityEventPolicy.java @@ -43,21 +43,21 @@ import org.json.JSONObject; import org.onap.aai.datarouter.entity.AaiEventEntity; import org.onap.aai.datarouter.entity.AggregationEntity; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; -import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SuggestionSearchEntity; import org.onap.aai.datarouter.entity.TopographicalEntity; import org.onap.aai.datarouter.entity.UebEventHeader; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; -import org.onap.aai.datarouter.util.CrossEntityReference; -import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; -import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; import org.onap.aai.datarouter.util.NodeUtils; -import org.onap.aai.datarouter.schema.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; import org.onap.aai.datarouter.util.SearchSuggestionPermutation; -import org.onap.aai.datarouter.util.Version; -import org.onap.aai.datarouter.util.VersionedOxmEntities; +import org.onap.aai.entity.OxmEntityDescriptor; +import org.onap.aai.util.CrossEntityReference; +import org.onap.aai.util.EntityOxmReferenceHelper; +import org.onap.aai.util.ExternalOxmModelProcessor; +import org.onap.aai.schema.OxmModelLoader; +import org.onap.aai.util.Version; +import org.onap.aai.util.VersionedOxmEntities; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java index 8b56f99..b2f9202 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeAutosuggestIndexProcessor.java @@ -28,14 +28,14 @@ import java.util.List; import java.util.Map; import org.apache.camel.Exchange; -import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SpikeEventMeta; import org.onap.aai.datarouter.entity.SuggestionSearchEntity; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; -import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; import org.onap.aai.datarouter.util.SearchSuggestionPermutation; -import org.onap.aai.datarouter.util.Version; -import org.onap.aai.datarouter.util.VersionedOxmEntities; +import org.onap.aai.entity.OxmEntityDescriptor; +import org.onap.aai.util.EntityOxmReferenceHelper; +import org.onap.aai.util.Version; +import org.onap.aai.util.VersionedOxmEntities; import com.fasterxml.jackson.databind.JsonNode; diff --git a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java index 67db407..9826743 100644 --- a/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java +++ b/src/main/java/org/onap/aai/datarouter/policy/SpikeEntityEventPolicy.java @@ -44,15 +44,15 @@ import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; import org.onap.aai.datarouter.entity.DocumentStoreDataEntity; -import org.onap.aai.datarouter.entity.OxmEntityDescriptor; import org.onap.aai.datarouter.entity.SpikeEventEntity; import org.onap.aai.datarouter.entity.SpikeEventVertex; import org.onap.aai.datarouter.logging.EntityEventPolicyMsgs; -import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; -import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; -import org.onap.aai.datarouter.schema.OxmModelLoader; import org.onap.aai.datarouter.util.RouterServiceUtil; import org.onap.aai.datarouter.util.SearchServiceAgent; +import org.onap.aai.entity.OxmEntityDescriptor; +import org.onap.aai.util.EntityOxmReferenceHelper; +import org.onap.aai.util.ExternalOxmModelProcessor; +import org.onap.aai.schema.OxmModelLoader; import org.onap.aai.restclient.client.Headers; import org.onap.aai.restclient.client.OperationResult; import org.onap.aai.restclient.rest.HttpUtil; diff --git a/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java b/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java deleted file mode 100644 index ee2c5dc..0000000 --- a/src/main/java/org/onap/aai/datarouter/schema/OxmConfigTranslator.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.schema; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.PathMatcher; -import java.nio.file.Paths; -import java.util.List; -import java.util.Map; -import java.util.ServiceConfigurationError; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.onap.aai.setup.ConfigTranslator; -import org.onap.aai.setup.SchemaLocationsBean; -import org.onap.aai.setup.Version; - -public class OxmConfigTranslator extends ConfigTranslator { - public OxmConfigTranslator(SchemaLocationsBean bean) { - super(bean); - } - - @Override - public Map> getNodeFiles() { - String nodeDirectory = bean.getNodeDirectory(); - if (nodeDirectory == null) { - throw new ServiceConfigurationError( - "Node(s) directory is empty in the schema location bean (" + bean.getSchemaConfigLocation() + ")"); - } - try { - return getVersionMap(Paths.get(nodeDirectory), "*_v*.xml"); - } catch (IOException e) { - throw new ServiceConfigurationError("Failed to read node(s) directory " + getPath(nodeDirectory), e); - } - } - - @Override - public Map> getEdgeFiles() { - String edgeDirectory = bean.getEdgeDirectory(); - if (edgeDirectory == null) { - throw new ServiceConfigurationError( - "Edge(s) directory is empty in the schema location bean (" + bean.getSchemaConfigLocation() + ")"); - } - try { - return getVersionMap(Paths.get(edgeDirectory), "*_v*.json"); - } catch (IOException e) { - throw new ServiceConfigurationError("Failed to read edge(s) directory " + getPath(edgeDirectory), e); - } - } - - private String getPath(String nodeDirectory) { - return Paths.get(nodeDirectory).toAbsolutePath().toString(); - } - - /** - * Creates a map containing each OXM Version and the matching OXM file path(s) - * - * @param folderPath the folder/directory containing the OXM files - * @param fileSuffix - * @return a new Map object (may be empty) - * @throws IOException if there is a problem reading the specified directory path - */ - private Map> getVersionMap(Path folderPath, String globPattern) throws IOException { - final PathMatcher filter = folderPath.getFileSystem().getPathMatcher("glob:**/" + globPattern); - try (final Stream stream = Files.list(folderPath)) { - return stream.filter(filter::matches).map(Path::toString).filter(p -> getVersionFromPath(p) != null) - .collect(Collectors.groupingBy(this::getVersionFromPath)); - } - } - - private Version getVersionFromPath(String pathName) { - String version = "V" + pathName.replaceAll("^.*\\/", "").replaceAll("\\D+", ""); - try { - return Version.valueOf(version); - } catch (IllegalArgumentException e) { - return null; - } - } -} diff --git a/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java b/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java deleted file mode 100644 index 93854d8..0000000 --- a/src/main/java/org/onap/aai/datarouter/schema/OxmModelLoader.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.schema; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.Response.Status; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.onap.aai.cl.eelf.LoggerFactory; -import org.onap.aai.datarouter.logging.DataRouterMsgs; -import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; -import org.onap.aai.nodes.NodeIngestor; -import org.onap.aai.setup.ConfigTranslator; -import org.onap.aai.setup.SchemaLocationsBean; -import org.onap.aai.setup.Version; - -public class OxmModelLoader { - - private static Map versionContextMap = new ConcurrentHashMap<>(); - private static List oxmModelProcessorRegistry = new ArrayList<>(); - - private static final org.onap.aai.cl.api.Logger logger = - LoggerFactory.getInstance().getLogger(OxmModelLoader.class.getName()); - - private OxmModelLoader() { - throw new IllegalStateException("Utility class"); - } - - public static synchronized void loadModels() { - SchemaIngestPropertiesReader schemaIngestPropReader = new SchemaIngestPropertiesReader(); - SchemaLocationsBean schemaLocationsBean = new SchemaLocationsBean(); - schemaLocationsBean.setNodeDirectory(schemaIngestPropReader.getNodeDir()); - ConfigTranslator configTranslator = new OxmConfigTranslator(schemaLocationsBean); - NodeIngestor nodeIngestor = new NodeIngestor(configTranslator); - - for (Version oxmVersion : Version.values()) { - DynamicJAXBContext jaxbContext = nodeIngestor.getContextForVersion(oxmVersion); - if (jaxbContext != null) { - loadModel(oxmVersion.toString(), jaxbContext); - } - } - } - - public static DynamicJAXBContext getContextForVersion(String version) { - if (versionContextMap == null || versionContextMap.isEmpty()) { - loadModels(); - } else if (!versionContextMap.containsKey(version)) { - throw new NoSuchElementException(Status.NOT_FOUND.toString()); - } - return versionContextMap.get(version); - } - - public static synchronized void registerExternalOxmModelProcessors( - Collection processors) { - if (processors != null) { - for (ExternalOxmModelProcessor processor : processors) { - if (!oxmModelProcessorRegistry.contains(processor)) { - oxmModelProcessorRegistry.add(processor); - } - } - } - } - - public static Map getVersionContextMap() { - return versionContextMap; - } - - private static synchronized void loadModel(String oxmVersion, DynamicJAXBContext jaxbContext) { - versionContextMap.put(oxmVersion, jaxbContext); - if (oxmModelProcessorRegistry != null) { - for (ExternalOxmModelProcessor processor : oxmModelProcessorRegistry) { - processor.onOxmVersionChange(org.onap.aai.datarouter.util.Version.valueOf(oxmVersion.toLowerCase()), - jaxbContext); - } - } - logger.info(DataRouterMsgs.LOADED_OXM_FILE, oxmVersion); - } - -} diff --git a/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java b/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java deleted file mode 100644 index 76530ae..0000000 --- a/src/main/java/org/onap/aai/datarouter/schema/SchemaIngestPropertiesReader.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.schema; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.NoSuchFileException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Properties; -import org.onap.aai.cl.eelf.LoggerFactory; -import org.onap.aai.datarouter.logging.DataRouterMsgs; - -public class SchemaIngestPropertiesReader { - - private static final String SCHEMA_INGEST_PROPERTIES_FILE = "schemaIngest.properties"; - private static final String MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES = "Failed to load " + SCHEMA_INGEST_PROPERTIES_FILE; - - private static final String SCHEMA_INGEST_PROPERTIES_LOCATION = - System.getProperty("CONFIG_HOME") + "/" + SCHEMA_INGEST_PROPERTIES_FILE; - - private static org.onap.aai.cl.api.Logger logger = - LoggerFactory.getInstance().getLogger(SchemaIngestPropertiesReader.class.getName()); - - /** - * Gets the location of the OXM. - * - * @return the directory containing the OXM files - */ - public String getNodeDir() { - - Properties prop = new Properties(); - try { - prop = loadFromFile(SCHEMA_INGEST_PROPERTIES_LOCATION); - } catch (NoSuchFileException e) { - try { - prop = loadFromClasspath(SCHEMA_INGEST_PROPERTIES_FILE); - } catch (URISyntaxException | IOException ef) { - logger.error(DataRouterMsgs.SCHEMA_INGEST_LOAD_ERROR, ef.getMessage()); - throw new RuntimeException(MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES); - } - } catch (IOException ec) { - logger.error(DataRouterMsgs.SCHEMA_INGEST_LOAD_ERROR, ec.getMessage()); - throw new RuntimeException(MSG_FAILED_LOAD_SCHEMA_INGEST_PROPERTIES); - } - return prop.getProperty("nodeDir"); - } - - private Properties loadFromFile(String filename) throws IOException { - Path configLocation = Paths.get(filename); - try (InputStream stream = Files.newInputStream(configLocation)) { - return loadProperties(stream); - } - } - - private Properties loadFromClasspath(String resourceName) throws URISyntaxException, IOException { - Path path = Paths.get(ClassLoader.getSystemResource(resourceName).toURI()); - try (InputStream stream = Files.newInputStream(path)) { - return loadProperties(stream); - } - } - - private Properties loadProperties(InputStream stream) throws IOException { - Properties config = new Properties(); - config.load(stream); - return config; - } -} diff --git a/src/main/java/org/onap/aai/datarouter/util/CrossEntityReference.java b/src/main/java/org/onap/aai/datarouter/util/CrossEntityReference.java deleted file mode 100644 index 47d6105..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/CrossEntityReference.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import java.util.ArrayList; -import java.util.List; - -/** - * Processing and entity wrapper for property transposition logic and UEB processing - * - * @author DAVEA - */ -public class CrossEntityReference { - - private String targetEntityType; - - private List attributeNames; - - public CrossEntityReference() { - this.targetEntityType = null; - this.attributeNames = new ArrayList<>(); - } - - public String getTargetEntityType() { - return targetEntityType; - } - - public void setTargetEntityType(String targetEntityType) { - this.targetEntityType = targetEntityType; - } - - public List getAttributeNames() { - return attributeNames; - } - - public void setAttributeNames(List attributeNames) { - this.attributeNames = attributeNames; - } - - public void addAttributeName(String attributeName) { - if (!this.attributeNames.contains(attributeName)) { - this.attributeNames.add(attributeName); - } - } - - public void initialize(String crossEntityReferenceValueFromModel) { - - if (crossEntityReferenceValueFromModel == null - || crossEntityReferenceValueFromModel.length() == 0) { - // or throw an exception due to failure to initialize - return; - } - - String[] tokens = crossEntityReferenceValueFromModel.split(","); - - if (tokens.length >= 2) { - this.targetEntityType = tokens[0]; - - for (int x = 1; x < tokens.length; x++) { - this.attributeNames.add(tokens[x]); - } - } else { - // throw a CrossEntityReferenceInitializationException?? - } - - } - - @Override - public String toString() { - return "CrossEntityReference [" - + (targetEntityType != null ? "entityType=" + targetEntityType + ", " : "") - + (attributeNames != null ? "attributeNames=" + attributeNames : "") + "]"; - } - -} diff --git a/src/main/java/org/onap/aai/datarouter/util/EntityOxmReferenceHelper.java b/src/main/java/org/onap/aai/datarouter/util/EntityOxmReferenceHelper.java deleted file mode 100644 index 3f05a92..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/EntityOxmReferenceHelper.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import java.util.HashMap; - -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; - -public class EntityOxmReferenceHelper implements ExternalOxmModelProcessor { - - private static EntityOxmReferenceHelper _instance = null; - - private HashMap versionedModels; - - protected EntityOxmReferenceHelper() { - this.versionedModels = new HashMap<>(); - } - - public static EntityOxmReferenceHelper getInstance() { - if ( _instance == null ) { - _instance = new EntityOxmReferenceHelper(); - } - - return _instance; - } - - - @Override - public void onOxmVersionChange(Version version, DynamicJAXBContext context) { - VersionedOxmEntities oxmEntities = new VersionedOxmEntities(); - oxmEntities.initialize(context); - this.versionedModels.put(version, oxmEntities); - - } - - public VersionedOxmEntities getVersionedOxmEntities(Version version){ - return this.versionedModels.get(version); - } - -} diff --git a/src/main/java/org/onap/aai/datarouter/util/ExternalOxmModelProcessor.java b/src/main/java/org/onap/aai/datarouter/util/ExternalOxmModelProcessor.java deleted file mode 100644 index 9406d30..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/ExternalOxmModelProcessor.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; - -/** - * Exposes a registration and processing contract so that any load/change of an oxm version will - * inform registered model processors. - * - * @author davea - */ -public interface ExternalOxmModelProcessor { - public void onOxmVersionChange(Version version, DynamicJAXBContext context); -} diff --git a/src/main/java/org/onap/aai/datarouter/util/Version.java b/src/main/java/org/onap/aai/datarouter/util/Version.java deleted file mode 100644 index 62418ae..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/Version.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -public enum Version { - v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20; -} \ No newline at end of file diff --git a/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java b/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java deleted file mode 100644 index fc34437..0000000 --- a/src/main/java/org/onap/aai/datarouter/util/VersionedOxmEntities.java +++ /dev/null @@ -1,349 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import org.eclipse.persistence.dynamic.DynamicType; -import org.eclipse.persistence.internal.helper.DatabaseField; -import org.eclipse.persistence.internal.oxm.XPathFragment; -import org.eclipse.persistence.internal.oxm.mappings.Descriptor; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.eclipse.persistence.mappings.DatabaseMapping; -import org.eclipse.persistence.oxm.XMLField; -import org.onap.aai.datarouter.entity.OxmEntityDescriptor; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -/** - * Builds up a representation of the versioned entities in a way that they can be cross referenced - * in a data-driven way - * - * @author DAVEA - */ -public class VersionedOxmEntities { - - private static final String REST_ROOT_ENTITY = "inventory"; - - private HashMap crossEntityReferenceContainerLookup = new HashMap<>(); - private HashMap crossEntityReferenceLookup = new HashMap<>(); - private Map entityTypeLookup = new LinkedHashMap<>(); - private Map searchableEntityDescriptors = new HashMap<>(); - private Map suggestableEntityDescriptors = new HashMap<>(); - private Map entityAliasDescriptors = new HashMap<>(); - - - public void initialize(DynamicJAXBContext context) { - parseOxmContext(context); - buildCrossEntityReferenceCollections(REST_ROOT_ENTITY, new HashSet()); - populateSearchableDescriptors(context); - } - - /** - * The big goal for these methods is to make the processing as generic and model driven as possible. - * There are only two exceptions to this rule, at the moment. I needed to hard-coded the top level REST data - * model entity type, which is "inventory" for now. And as this class is heavily focused and coupled towards - * building a version specific set of lookup structures for the "crossEntityReference" model attribute, it possesses - * knowledge of that attribute whether it exists or not in the DynamicJAXBContext we are currently analyzing. - *

- * This method will build two collections: - *

- * 1) A list of entity types that can have nested entities containing cross entity reference definitions. - * The purpose of this collection is a fail-fast test when processing UEB events so we can quickly determine if - * it is necessary to deeply parse the event looking for cross entity reference attributes which not exist. - *

- * For example, looking at a service-instance <=> inventory path: - *

- * inventory (true) - * -> business (true) - * -> customers (true) - * -> customer (true) - * -> service-subscriptions (true) - * -> service-subscription (CER defined here in the model) (true) - * -> service-instances (false) - * -> service-instance (false) - *

- * Because service-subscription contains a model definition of CER, in the first collection all the types in the - * tree will indicate that it possesses one or more contained entity types with a cross-entity-reference definition. - *

- * 2) A lookup for { entityType => CrossEntityReference } so we can quickly access the model definition of a CER - * for a specific entity type when we begin extracting parent attributes for transposition into nested child entity - * types. - * - * @param entityType - * @param checked - * @return - */ - protected boolean buildCrossEntityReferenceCollections(String entityType, HashSet checked) { - - /* - * To short-circuit infinite loops, make sure this entityType hasn't - * already been checked - */ - - if (checked.contains(entityType)) { - return false; - } else { - checked.add(entityType); - } - - DynamicType parentType = entityTypeLookup.get(entityType); - DynamicType childType; - boolean returnValue = false; - - if (parentType == null) { - return returnValue; - } - - /* - * Check if current descriptor contains the cross-entity-reference - * attribute. If it does not walk the entity model looking for nested - * entity types that may contain the reference. - */ - - Map properties = parentType.getDescriptor().getProperties(); - if (properties != null) { - for (Map.Entry entry : properties.entrySet()) { - if ("crossEntityReference".equalsIgnoreCase(entry.getKey())) { - returnValue = true; - CrossEntityReference cer = new CrossEntityReference(); - cer.initialize(entry.getValue()); - crossEntityReferenceLookup.put(entityType, cer); - //System.out.println("entityType = " + entityType + " contains a CER instance = " + returnValue); - // return true; - } - } - } - - Vector fields = parentType.getDescriptor().getAllFields(); - - if (fields != null) { - - XMLField xmlField; - for (DatabaseField f : fields) { - - if (f instanceof XMLField) { - xmlField = (XMLField) f; - XPathFragment xpathFragment = xmlField.getXPathFragment(); - String entityShortName = xpathFragment.getLocalName(); - - childType = entityTypeLookup.get(entityShortName); - - if (childType != null) { - - if (!checked.contains(entityShortName)) { - - if (buildCrossEntityReferenceCollections(entityShortName, checked)) { - returnValue = true; - } - - } - - checked.add(entityShortName); - - } - - } - - } - - } - - crossEntityReferenceContainerLookup.put(entityType, Boolean.valueOf(returnValue)); - return returnValue; - } - - private void populateSearchableDescriptors(DynamicJAXBContext oxmContext) { - List descriptorsList = oxmContext.getXMLContext().getDescriptors(); - OxmEntityDescriptor newOxmEntity; - - for (Descriptor desc : descriptorsList) { - - DynamicType entity = (DynamicType) oxmContext.getDynamicType(desc.getAlias()); - - //LinkedHashMap oxmProperties = new LinkedHashMap(); - String primaryKeyAttributeNames = null; - - //Not all fields have key attributes - if (desc.getPrimaryKeyFields() != null) { - primaryKeyAttributeNames = desc.getPrimaryKeyFields() - .toString().replaceAll("/text\\(\\)", "").replaceAll("\\[", "").replaceAll("\\]", ""); - } - - String entityName = desc.getDefaultRootElement(); - - Map properties = entity.getDescriptor().getProperties(); - if (properties != null) { - for (Map.Entry entry : properties.entrySet()) { - if ("searchable".equalsIgnoreCase(entry.getKey())) { - - /* - * we can do all the work here, we don't have a create additional collections for - * subsequent passes - */ - newOxmEntity = new OxmEntityDescriptor(); - newOxmEntity.setEntityName(entityName); - newOxmEntity - .setPrimaryKeyAttributeName(Arrays.asList(primaryKeyAttributeNames.split(","))); - newOxmEntity.setSearchableAttributes(Arrays.asList(entry.getValue().split(","))); - searchableEntityDescriptors.put(entityName, newOxmEntity); - } else if ("containsSuggestibleProps".equalsIgnoreCase(entry.getKey())) { - newOxmEntity = new OxmEntityDescriptor(); - newOxmEntity.setEntityName(entityName); - newOxmEntity.setSuggestableEntity(true); - Vector descriptorMaps = entity.getDescriptor().getMappings(); - List listOfSuggestableAttributes = new ArrayList<>(); - - for (DatabaseMapping descMap : descriptorMaps) { - if (descMap.isAbstractDirectMapping()) { - - if (descMap.getProperties().get("suggestibleOnSearch") != null) { - String suggestableOnSearchString = String.valueOf( - descMap.getProperties().get("suggestibleOnSearch")); - - boolean isSuggestibleOnSearch = Boolean.valueOf(suggestableOnSearchString); - - if (isSuggestibleOnSearch) { - /* Grab attribute types for suggestion */ - String attributeName = descMap.getField().getName() - .replaceAll("/text\\(\\)", ""); - listOfSuggestableAttributes.add(attributeName); - } - } - } - } - newOxmEntity.setSuggestableAttributes(listOfSuggestableAttributes); - suggestableEntityDescriptors.put(entityName, newOxmEntity); - } else if ("suggestionAliases".equalsIgnoreCase(entry.getKey())) { - newOxmEntity = new OxmEntityDescriptor(); - newOxmEntity.setEntityName(entityName); - newOxmEntity.setAlias(Arrays.asList(entry.getValue().split(","))); - entityAliasDescriptors.put(entityName, newOxmEntity); - } - } - } - - } - - } - - public Map getSearchableEntityDescriptors() { - return searchableEntityDescriptors; - } - - public OxmEntityDescriptor getSearchableEntityDescriptor(String entityType) { - return searchableEntityDescriptors.get(entityType); - } - - - public HashMap getCrossEntityReferenceContainers() { - return crossEntityReferenceContainerLookup; - } - - public HashMap getCrossEntityReferences() { - return crossEntityReferenceLookup; - } - - - private void parseOxmContext(DynamicJAXBContext oxmContext) { - List descriptorsList = oxmContext.getXMLContext().getDescriptors(); - - for (Descriptor desc : descriptorsList) { - - DynamicType entity = (DynamicType) oxmContext.getDynamicType(desc.getAlias()); - - String entityName = desc.getDefaultRootElement(); - - entityTypeLookup.put(entityName, entity); - - } - - } - - public boolean entityModelContainsCrossEntityReference(String containerEntityType) { - Boolean v = crossEntityReferenceContainerLookup.get(containerEntityType); - - if (v == null) { - return false; - } - - return v; - } - - public boolean entityContainsCrossEntityReference(String entityType) { - return crossEntityReferenceLookup.get(entityType) != null; - } - - public CrossEntityReference getCrossEntityReference(String entityType) { - return crossEntityReferenceLookup.get(entityType); - } - - public Map getSuggestableEntityDescriptors() { - return suggestableEntityDescriptors; - } - - public void setSuggestableEntityDescriptors( - Map suggestableEntityDescriptors) { - this.suggestableEntityDescriptors = suggestableEntityDescriptors; - } - - public Map getEntityAliasDescriptors() { - return entityAliasDescriptors; - } - - public void setEntityAliasDescriptors(Map entityAliasDescriptors) { - this.entityAliasDescriptors = entityAliasDescriptors; - } - - public void extractEntities(String entityType, DynamicJAXBContext context, Collection entities) { - - - } - - public String dumpCrossEntityReferenceContainers() { - - Set keys = crossEntityReferenceContainerLookup.keySet(); - StringBuilder sb = new StringBuilder(128); - - for (String key : keys) { - - if (crossEntityReferenceContainerLookup.get(key)) { - sb.append("\n").append("Entity-Type = '" + key + "' contains a Cross-Entity-Reference."); - } - } - - - return sb.toString(); - - } - - public Map getEntityTypeLookup() { - return entityTypeLookup; - } - -} diff --git a/src/main/resources/logging/DataRouterMsgs.properties b/src/main/resources/logging/DataRouterMsgs.properties index d922a7f..3194f5e 100644 --- a/src/main/resources/logging/DataRouterMsgs.properties +++ b/src/main/resources/logging/DataRouterMsgs.properties @@ -95,11 +95,7 @@ ROUTING_RESPONSE=\ OP_TIME=\ DR0013I|\ - {0} took {1} ms. - -LOADED_OXM_FILE=\ - DR0014I|\ - Successfully loaded schema: {0} + {0} took {1} ms. STARTUP_FAILURE=\ DR2001E|\ @@ -115,11 +111,11 @@ QUERY_ROUTING_ERR=\ LOAD_PROPERTIES_FAILURE=\ DR3001E|\ - File {0} cannot be loaded into the map. + File {0} cannot be loaded into the map. FILE_MON_BLOCK_ERR=\ DR3002E|\ - Error in the file monitor block. + Error in the file monitor block. CREATE_PROPERTY_MAP_ERR=\ DR3003E|\ @@ -171,7 +167,3 @@ FAIL_TO_CREATE_UPDATE_DOC=\ LOAD_OXM_ERROR=\ DR5000E|\ Unable to load Oxm model: {0}\ - -SCHEMA_INGEST_LOAD_ERROR=\ - DR5001E|\ - Unable to load schema ingest properties file due to : {0} diff --git a/src/test/java/org/onap/aai/datarouter/entity/AaiEventEntityTest.java b/src/test/java/org/onap/aai/datarouter/entity/AaiEventEntityTest.java index 665b8f9..1f71dcd 100644 --- a/src/test/java/org/onap/aai/datarouter/entity/AaiEventEntityTest.java +++ b/src/test/java/org/onap/aai/datarouter/entity/AaiEventEntityTest.java @@ -22,7 +22,7 @@ package org.onap.aai.datarouter.entity; import org.junit.Assert; import org.junit.Test; -import org.onap.aai.datarouter.util.CrossEntityReference; +import org.onap.aai.util.CrossEntityReference; import java.io.IOException; import java.security.NoSuchAlgorithmException; @@ -95,34 +95,6 @@ public class AaiEventEntityTest { Assert.assertNotNull(entity.toString()); } - @Test - public void testOxmEntityDescriptor(){ - OxmEntityDescriptor descriptor = new OxmEntityDescriptor(); - descriptor.setEntityName("entity-1"); - Assert.assertEquals(descriptor.getEntityName(), "entity-1"); - - descriptor.setPrimaryKeyAttributeName(new ArrayList()); - Assert.assertTrue(descriptor.getPrimaryKeyAttributeName().size()==0); - - Assert.assertFalse(descriptor.hasSearchableAttributes()); - - List searchableAttr = new ArrayList(); - searchableAttr.add("search"); - descriptor.setSearchableAttributes(searchableAttr); - Assert.assertTrue(descriptor.getSearchableAttributes().size()==1); - - Assert.assertTrue(descriptor.hasSearchableAttributes()); - - CrossEntityReference ref = new CrossEntityReference(); - descriptor.setCrossEntityReference(ref); - Assert.assertEquals(descriptor.getCrossEntityReference(), ref); - - descriptor.setSuggestableEntity(true); - Assert.assertTrue(descriptor.isSuggestableEntity()); - - Assert.assertNotNull(descriptor.toString()); - } - @Test public void testPolicyResponse(){ PolicyResponse response = new PolicyResponse(PolicyResponse.ResponseType.SUCCESS, "response-data"); diff --git a/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java b/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java deleted file mode 100644 index a92d739..0000000 --- a/src/test/java/org/onap/aai/datarouter/schema/OxmModelLoaderTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.schema; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import java.util.ArrayList; -import org.eclipse.persistence.dynamic.DynamicType; -import org.eclipse.persistence.internal.helper.DatabaseField; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.eclipse.persistence.mappings.DatabaseMapping; -import org.junit.Test; -import org.onap.aai.datarouter.schema.OxmModelLoader; -import org.onap.aai.datarouter.util.EntityOxmReferenceHelper; -import org.onap.aai.datarouter.util.ExternalOxmModelProcessor; -import org.onap.aai.setup.Version; - -public class OxmModelLoaderTest { - - @Test - public void testLoadingMultipleOxmFiles() { - ArrayList externalOxmModelProcessors = new ArrayList(); - externalOxmModelProcessors.add(EntityOxmReferenceHelper.getInstance()); - OxmModelLoader.registerExternalOxmModelProcessors(externalOxmModelProcessors); - OxmModelLoader.loadModels(); - - DynamicJAXBContext jaxbContext = OxmModelLoader.getContextForVersion(Version.getLatest().toString()); - - DynamicType pserver = jaxbContext.getDynamicType("Pserver"); - DynamicType genericVnf = jaxbContext.getDynamicType("GenericVnf"); - - assertNotNull(pserver); - assertNotNull(genericVnf); - - DatabaseMapping mapping = pserver.getDescriptor().getMappings().firstElement(); - if (mapping.isAbstractDirectMapping()) { - DatabaseField f = mapping.getField(); - String keyName = f.getName().substring(0, f.getName().indexOf("/")); - assertTrue(keyName.equals("hostname")); - } - - mapping = genericVnf.getDescriptor().getMappings().firstElement(); - if (mapping.isAbstractDirectMapping()) { - DatabaseField f = mapping.getField(); - String keyName = f.getName().substring(0, f.getName().indexOf("/")); - assertTrue(keyName.equals("vnf-id")); - } - - } -} diff --git a/src/test/java/org/onap/aai/datarouter/util/CrossEntityReferenceTest.java b/src/test/java/org/onap/aai/datarouter/util/CrossEntityReferenceTest.java deleted file mode 100644 index 3e0593f..0000000 --- a/src/test/java/org/onap/aai/datarouter/util/CrossEntityReferenceTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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.datarouter.util; - -import org.junit.Assert; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.*; - -public class CrossEntityReferenceTest { - - @Test - public void testCrossEntityReference() { - - CrossEntityReference reference = new CrossEntityReference(); - - reference.setTargetEntityType("entity-type"); - Assert.assertEquals(reference.getTargetEntityType(),"entity-type"); - - reference.setAttributeNames(new ArrayList()); - Assert.assertTrue(reference.getAttributeNames().size()==0); - - reference.addAttributeName("attribute"); - Assert.assertEquals(reference.getAttributeNames().get(0),"attribute"); - } - - -} \ No newline at end of file -- 2.16.6