diff options
Diffstat (limited to 'src/test/resources')
8 files changed, 294 insertions, 0 deletions
diff --git a/src/test/resources/data-dictionary/rule-data-dictionary.properties b/src/test/resources/data-dictionary/rule-data-dictionary.properties new file mode 100644 index 0000000..35403e4 --- /dev/null +++ b/src/test/resources/data-dictionary/rule-data-dictionary.properties @@ -0,0 +1,24 @@ +# ============LICENSE_START=================================================== +# Copyright (c) 2018-2019 European Software Marketing Ltd. +# ============================================================================ +# 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===================================================== + +rule.datadictionary.hostport=localhost:8080 +rule.datadictionary.connect.timeout=1000 +rule.datadictionary.read.timeout=1000 + +# basic authentication: base64 encoding of username:password +rule.datadictionary.credentials= + +rule.datadictionary.uri=/commonModelElements/instance~nfValuesCatalog~1.0/validateInstance diff --git a/src/test/resources/data-dictionary/rule-indexing.properties b/src/test/resources/data-dictionary/rule-indexing.properties new file mode 100644 index 0000000..0139a8b --- /dev/null +++ b/src/test/resources/data-dictionary/rule-indexing.properties @@ -0,0 +1,20 @@ +# ============LICENSE_START=================================================== +# Copyright (c) 2018-2019 European Software Marketing Ltd. +# ============================================================================ +# 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===================================================== + +rule.indexing.events=POA-EVENT +rule.indexing.exclude.oxm.validation=POA-EVENT +rule.indexing.key.attributes=$.poa-event.modelVersionId,$.poa-event.modelInvariantId +rule.indexing.default.key=default-rules diff --git a/src/test/resources/data-dictionary/rules/poa-event/default-rules.groovy b/src/test/resources/data-dictionary/rules/poa-event/default-rules.groovy new file mode 100644 index 0000000..574c3a2 --- /dev/null +++ b/src/test/resources/data-dictionary/rules/poa-event/default-rules.groovy @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ============================================================================ + * 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===================================================== + */ + +entity { + name 'POA-EVENT' + indexing { indices 'default-rules' } + validation { + useRule { + name 'Data-Dictionary validate VF type' + attributes 'vnfList[*].vfModuleList[*].networkList[*].type' + } + } +} + +rule { + name 'Data-Dictionary validate VF type' + category 'INVALID_VALUE' + description 'Validate all VF type values against data-dictionary' + errorText 'VF type [{0}] failed data-dictionary validation: {1}' + severity 'ERROR' + attributes 'typeList' + validate ''' + List<String> details = new ArrayList<>() + typeList.each { + def result = org.onap.aai.validation.ruledriven.rule.builtin.DataDictionary.validate("instance", "vfModuleNetworkType", "type", "$it") + if (!result.isEmpty()) { + details.add("$it") + details.add("$result") + } + } + return new Tuple2(details.isEmpty(), details) + ''' +} diff --git a/src/test/resources/data-dictionary/schemaIngest.properties b/src/test/resources/data-dictionary/schemaIngest.properties new file mode 100644 index 0000000..8df810a --- /dev/null +++ b/src/test/resources/data-dictionary/schemaIngest.properties @@ -0,0 +1,48 @@ +# ============LICENSE_START=================================================== +# Copyright (c) 2018-2019 European Software Marketing Ltd. +# ============================================================================ +# 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===================================================== + +# Properties for the org.onap.aai.setup.SchemaLocationsBean +# Schema related attributes for the oxm and edges +# Any additional schema related attributes should start with prefix schema +schema.configuration.location=N/A +schema.nodes.location=src/test/resources/oxm-reader/single/oxm +schema.edges.location=src/test/resources/oxm-reader/single/dbedgerules + +# Schema Version Related Attributes + +# Lists all of the versions in the schema +schema.version.list=v8,v9,v10 +# Specifies from which version should the depth parameter to default to zero +schema.version.depth.start=v9 +# Specifies from which version should the related link be displayed in response payload +schema.version.related.link.start=v10 +# Specifies from which version should the client see only the uri excluding host info +# Before this version server base will also be included +schema.version.app.root.start=v10 +# Specifies from which version should the namespace be changed +schema.version.namespace.change.start=v10 +# Specifies from which version should the client start seeing the edge label in payload +schema.version.edge.label.start=v10 +# Specifies the version that the application should default to +schema.version.api.default=v9 + +schema.service.base.url=https://localhost:8452/aai/schema-service/v1/ +schema.service.nodes.endpoint=nodes?version= +schema.service.edges.endpoint=edgerules?version= +schema.service.versions.endpoint=versions + +schema.service.ssl.key-store=src/integration-test/resources/authentication/aai-client-cert.p12 +schema.service.ssl.trust-store=src/integration-test/resources/authentication/tomcat_keystore diff --git a/src/test/resources/data-dictionary/test-data-dictionary-beans.xml b/src/test/resources/data-dictionary/test-data-dictionary-beans.xml new file mode 100644 index 0000000..78a92f1 --- /dev/null +++ b/src/test/resources/data-dictionary/test-data-dictionary-beans.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" /> + + <import resource="../oxm-reader/oxm-reader-beans.xml" /> + + <context:property-placeholder + location=" + classpath:event-reader.properties, + classpath:aai-environment.properties, + classpath:data-dictionary/validation-service.properties, + classpath:data-dictionary/validation-service-auth.properties, + classpath:data-dictionary/schemaIngest.properties, + classpath:data-dictionary/rule-indexing.properties" + ignore-unresolvable="true" /> + + <util:properties id="dataDictionaryProperties" location="classpath:data-dictionary/rule-data-dictionary.properties" /> + + <!-- CONFIG BEANS --> + <bean id="eventReaderConfig" class="org.onap.aai.validation.config.EventReaderConfig" /> + + <!-- READER BEANS --> + <bean id="jsonReader" class="org.onap.aai.validation.reader.JsonReader" /> + + <bean id="eventReader" class="org.onap.aai.validation.reader.EventReader"> + <constructor-arg ref="eventReaderConfig" /> + <constructor-arg ref="jsonReader" /> + <constructor-arg ref="oxmReader" /> + </bean> + + <bean id="rulesConfigurationPath" class="java.nio.file.Paths" factory-method="get"> + <constructor-arg value="src/test/resources/data-dictionary/rules/" /> + <constructor-arg> + <array /> + </constructor-arg> + </bean> + + <bean id="ruleIndexingConfig" class="org.onap.aai.validation.config.RuleIndexingConfig"> + <property name="indexedEvents" value="#{'${rule.indexing.events}'.split(',')}" /> + <property name="excludedOxmValidationEvents" value="#{'${rule.indexing.exclude.oxm.validation}'.split(',')}" /> + <property name="indexAttributes" value="#{'${rule.indexing.key.attributes}'.split(',')}" /> + <property name="defaultIndexKey" value="${rule.indexing.default.key}" /> + </bean> + + <bean id="ruleDrivenValidator" class="org.onap.aai.validation.ruledriven.RuleDrivenValidator"> + <constructor-arg ref="rulesConfigurationPath" /> + <constructor-arg ref="oxmReader" /> + <constructor-arg ref="eventReader" /> + <constructor-arg ref="ruleIndexingConfig" /> + </bean> + + <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="staticMethod" value="org.onap.aai.validation.ruledriven.rule.builtin.DataDictionary.setProperties" /> + <property name="arguments"> + <list> + <ref bean="dataDictionaryProperties" /> + </list> + </property> + </bean> + +</beans> diff --git a/src/test/resources/data-dictionary/test_events/test-create-event.json b/src/test/resources/data-dictionary/test_events/test-create-event.json new file mode 100644 index 0000000..3693c99 --- /dev/null +++ b/src/test/resources/data-dictionary/test_events/test-create-event.json @@ -0,0 +1,39 @@ +{ + "cambria.partition": "AAI", + "event-header": { + "id": "test", + "timestamp": "20190213-16:27:37:353", + "domain": "test", + "event-type": "POA-EVENT", + "action": "CREATE", + "entity-type": "poa-entity", + "top-entity-type": "poa-entity", + "entity-link": "" + }, + "entity": { + "poa-event": { + "modelVersionId": "model-version-id", + "modelInvariantId": "model-invariant-id" + }, + "vnfList": [ + { + "vfModuleList": [ + { + "networkList": [ + { + "type": "test1" + } + ] + }, + { + "networkList": [ + { + "type": "test2" + } + ] + } + ] + } + ] + } +} diff --git a/src/test/resources/data-dictionary/validation-service-auth.properties b/src/test/resources/data-dictionary/validation-service-auth.properties new file mode 100644 index 0000000..e729536 --- /dev/null +++ b/src/test/resources/data-dictionary/validation-service-auth.properties @@ -0,0 +1,18 @@ +# ============LICENSE_START=================================================== +# Copyright (c) 2018-2019 European Software Marketing Ltd. +# ============================================================================ +# 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===================================================== + +auth.policy.file=auth/auth_policy.json +auth.authentication.disable=false
\ No newline at end of file diff --git a/src/test/resources/data-dictionary/validation-service.properties b/src/test/resources/data-dictionary/validation-service.properties new file mode 100644 index 0000000..105953a --- /dev/null +++ b/src/test/resources/data-dictionary/validation-service.properties @@ -0,0 +1,28 @@ +# ============LICENSE_START=================================================== +# Copyright (c) 2018-2019 European Software Marketing Ltd. +# ============================================================================ +# 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===================================================== + +topic.publish.enable=true +topic.publish.retries=3 +topic.consume.enable=true +topic.consume.polling.interval.seconds=7 + +event.domain=onap +event.action.exclude=DELETE +event.type.rule=poa-event +event.type.model=NOT_APPLICABLE +event.type.end=END-EVENT + +model.cache.expirySeconds=3 |