From aec897fe708e37b6a58f2aff04be5de14eabd403 Mon Sep 17 00:00:00 2001 From: renealr Date: Tue, 19 Jun 2018 10:50:41 -0400 Subject: 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 | 155 +++++++++++++++++++++ .../datarouter/policy/GapEventTransformerTest.java | 68 +++++++++ .../entity/SuggestionSearchEntityTest.java | 155 --------------------- src/test/resources/gap_event.json | 50 +++++++ src/test/resources/gap_event_wrong.json | 50 +++++++ 7 files changed, 432 insertions(+), 179 deletions(-) create mode 100644 src/main/java/org/onap/aai/datarouter/policy/GapEventTransformer.java create mode 100644 src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java create mode 100644 src/test/java/org/onap/aai/datarouter/policy/GapEventTransformerTest.java delete mode 100644 src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java create mode 100644 src/test/resources/gap_event.json create mode 100644 src/test/resources/gap_event_wrong.json (limited to 'src') 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/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java b/src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java new file mode 100644 index 0000000..3c56dc8 --- /dev/null +++ b/src/test/java/org/onap/aai/datarouter/entity/SuggestionSearchEntityTest.java @@ -0,0 +1,155 @@ +/** + * ============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 static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Scanner; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.aai.datarouter.entity.SuggestionSearchEntity; +import org.onap.aai.datarouter.search.filters.config.UiFiltersSchemaUtility; + +public class SuggestionSearchEntityTest { + private static SuggestionSearchEntity suggestionSearchEntity; + + @Before + public void setUpBeforeTest() { + UiFiltersSchemaUtility filtersSchemaUtility = Mockito.mock(UiFiltersSchemaUtility.class); + Mockito.when(filtersSchemaUtility.loadUiFiltersConfig()).thenReturn(null); + + suggestionSearchEntity = new SuggestionSearchEntity(); + suggestionSearchEntity.setFiltersSchemaUtility(filtersSchemaUtility); + suggestionSearchEntity.setEntityType("generic-vnf"); + suggestionSearchEntity.setEntityTypeAliases(Arrays.asList("VNFs")); + } + + /** + * Read in the contents of the given file (can include sub-path) in test/resources folder + * + * @param filePath The file name or path (relative to test/resources) to read from + * @return The contents of the file as a String + */ + public String getResourceFileContents(String filePath) { + StringBuilder result = new StringBuilder(""); + + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource(filePath).getFile()); + + try (Scanner scanner = new Scanner(file)) { + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + result.append(line).append("\n"); + } + + scanner.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + + return result.toString(); + } + + @Test + public void testGetAsJson_multipleFilterAttributableStatusesIncluded() throws IOException { + String expectedOutput = + getResourceFileContents("uifilters/testGetAsJson_multipleFilterAttributableStatusesIncluded_expectedValue.json"); + + List suggestionInputPermutations = Arrays.asList( + "provStatus1 orchestrationStatus1 generic-vnf", + "provStatus1 generic-vnf orchestrationStatus1", + "orchestrationStatus1 generic-vnf provStatus1", + "orchestrationStatus1 provStatus1 generic-vnf", + "generic-vnf provStatus1 orchestrationStatus1", + "generic-vnf orchestrationStatus1 provStatus1"); + + MapinputOutputData = new HashMap<>(); + inputOutputData.put("prov-status", "provStatus1"); + inputOutputData.put("orchestration-status", "orchestrationStatus1"); + + // Build UI filters JSON string + JSONObject payloadFilter1 = new JSONObject(); + payloadFilter1.put("filterId", "1"); + payloadFilter1.put("filterValue", "orchestrationStatus1"); + + JSONObject payloadFilter2 = new JSONObject(); + payloadFilter2.put("filterId", "2"); + payloadFilter2.put("filterValue", "provStatus1"); + + JSONArray payloadFilters = new JSONArray(); + payloadFilters.put(payloadFilter2); + payloadFilters.put(payloadFilter1); + + JSONObject filterPayload = new JSONObject(); + filterPayload.put("filterList", payloadFilters); + + suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations); + suggestionSearchEntity.setInputOutputData(inputOutputData); + suggestionSearchEntity.setFilterPayload(filterPayload); + + String actualOutput = suggestionSearchEntity.getAsJson(); + + assertEquals(expectedOutput.trim(), actualOutput.trim()); + } + + @Test + public void testGetAsJson_singleFilterAttributableStatusIncluded() throws IOException { + String expectedOutput = + getResourceFileContents("uifilters/testGetAsJson_singleFilterAttributableStatusIncluded_expectedValue.json"); + + List suggestionInputPermutations = Arrays.asList( + "provStatus1 generic-vnf", + "generic-vnf provStatus1"); + + MapinputOutputData = new HashMap<>(); + inputOutputData.put("prov-status", "provStatus1"); + + // Build UI filters JSON string + JSONObject payloadFilter1 = new JSONObject(); + payloadFilter1.put("filterId", "2"); + payloadFilter1.put("filterValue", "provStatus1"); + + JSONArray payloadFilters = new JSONArray(); + payloadFilters.put(payloadFilter1); + + JSONObject filterPayload = new JSONObject(); + filterPayload.put("filterList", payloadFilters); + + suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations); + suggestionSearchEntity.setInputOutputData(inputOutputData); + suggestionSearchEntity.setFilterPayload(filterPayload); + + String actualOutput = suggestionSearchEntity.getAsJson(); + + assertEquals(expectedOutput.trim(), actualOutput.trim()); + } +} 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/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java b/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java deleted file mode 100644 index 4d48e83..0000000 --- a/src/test/java/org/openecomp/datarouter/entity/SuggestionSearchEntityTest.java +++ /dev/null @@ -1,155 +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.openecomp.datarouter.entity; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.onap.aai.datarouter.entity.SuggestionSearchEntity; -import org.onap.aai.datarouter.search.filters.config.UiFiltersSchemaUtility; - -public class SuggestionSearchEntityTest { - private static SuggestionSearchEntity suggestionSearchEntity; - - @Before - public void setUpBeforeTest() { - UiFiltersSchemaUtility filtersSchemaUtility = Mockito.mock(UiFiltersSchemaUtility.class); - Mockito.when(filtersSchemaUtility.loadUiFiltersConfig()).thenReturn(null); - - suggestionSearchEntity = new SuggestionSearchEntity(); - suggestionSearchEntity.setFiltersSchemaUtility(filtersSchemaUtility); - suggestionSearchEntity.setEntityType("generic-vnf"); - suggestionSearchEntity.setEntityTypeAliases(Arrays.asList("VNFs")); - } - - /** - * Read in the contents of the given file (can include sub-path) in test/resources folder - * - * @param filePath The file name or path (relative to test/resources) to read from - * @return The contents of the file as a String - */ - public String getResourceFileContents(String filePath) { - StringBuilder result = new StringBuilder(""); - - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource(filePath).getFile()); - - try (Scanner scanner = new Scanner(file)) { - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - result.append(line).append("\n"); - } - - scanner.close(); - - } catch (IOException e) { - e.printStackTrace(); - } - - return result.toString(); - } - - @Test - public void testGetAsJson_multipleFilterAttributableStatusesIncluded() throws IOException { - String expectedOutput = - getResourceFileContents("uifilters/testGetAsJson_multipleFilterAttributableStatusesIncluded_expectedValue.json"); - - List suggestionInputPermutations = Arrays.asList( - "provStatus1 orchestrationStatus1 generic-vnf", - "provStatus1 generic-vnf orchestrationStatus1", - "orchestrationStatus1 generic-vnf provStatus1", - "orchestrationStatus1 provStatus1 generic-vnf", - "generic-vnf provStatus1 orchestrationStatus1", - "generic-vnf orchestrationStatus1 provStatus1"); - - MapinputOutputData = new HashMap<>(); - inputOutputData.put("prov-status", "provStatus1"); - inputOutputData.put("orchestration-status", "orchestrationStatus1"); - - // Build UI filters JSON string - JSONObject payloadFilter1 = new JSONObject(); - payloadFilter1.put("filterId", "1"); - payloadFilter1.put("filterValue", "orchestrationStatus1"); - - JSONObject payloadFilter2 = new JSONObject(); - payloadFilter2.put("filterId", "2"); - payloadFilter2.put("filterValue", "provStatus1"); - - JSONArray payloadFilters = new JSONArray(); - payloadFilters.put(payloadFilter2); - payloadFilters.put(payloadFilter1); - - JSONObject filterPayload = new JSONObject(); - filterPayload.put("filterList", payloadFilters); - - suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations); - suggestionSearchEntity.setInputOutputData(inputOutputData); - suggestionSearchEntity.setFilterPayload(filterPayload); - - String actualOutput = suggestionSearchEntity.getAsJson(); - - assertEquals(expectedOutput.trim(), actualOutput.trim()); - } - - @Test - public void testGetAsJson_singleFilterAttributableStatusIncluded() throws IOException { - String expectedOutput = - getResourceFileContents("uifilters/testGetAsJson_singleFilterAttributableStatusIncluded_expectedValue.json"); - - List suggestionInputPermutations = Arrays.asList( - "provStatus1 generic-vnf", - "generic-vnf provStatus1"); - - MapinputOutputData = new HashMap<>(); - inputOutputData.put("prov-status", "provStatus1"); - - // Build UI filters JSON string - JSONObject payloadFilter1 = new JSONObject(); - payloadFilter1.put("filterId", "2"); - payloadFilter1.put("filterValue", "provStatus1"); - - JSONArray payloadFilters = new JSONArray(); - payloadFilters.put(payloadFilter1); - - JSONObject filterPayload = new JSONObject(); - filterPayload.put("filterList", payloadFilters); - - suggestionSearchEntity.setSuggestionInputPermutations(suggestionInputPermutations); - suggestionSearchEntity.setInputOutputData(inputOutputData); - suggestionSearchEntity.setFilterPayload(filterPayload); - - String actualOutput = suggestionSearchEntity.getAsJson(); - - assertEquals(expectedOutput.trim(), actualOutput.trim()); - } -} 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 -- cgit 1.2.3-korg