aboutsummaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src/test/resources
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2020-11-18 16:40:39 -0600
committerjhh <jorge.hernandez-herrero@att.com>2020-11-18 17:08:33 -0600
commitf01256145bd9abb97cb9fba3019dcaccaeeca509 (patch)
tree47315582744c0b028320f6e3bde87c4cc439f49c /feature-lifecycle/src/test/resources
parent6a429b8504cdd38cadb3ce9bb532d08cc5115da9 (diff)
verify schema validation for any policy type
Issue-ID: POLICY-2880 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I0cc6e8967d42d347415857dc77976f2b8ab86516 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'feature-lifecycle/src/test/resources')
-rw-r--r--feature-lifecycle/src/test/resources/lifecycle.kmodule8
-rw-r--r--feature-lifecycle/src/test/resources/schemas/onap.policies.typeA-1.0.0.schema.json106
-rw-r--r--feature-lifecycle/src/test/resources/tosca-policy-other-unvalidated.json (renamed from feature-lifecycle/src/test/resources/tosca-policy-other.json)6
-rw-r--r--feature-lifecycle/src/test/resources/tosca-policy-other-validated.json22
-rw-r--r--feature-lifecycle/src/test/resources/tosca-policy-other-validation-error.json21
5 files changed, 157 insertions, 6 deletions
diff --git a/feature-lifecycle/src/test/resources/lifecycle.kmodule b/feature-lifecycle/src/test/resources/lifecycle.kmodule
index 529730bd..56ca0923 100644
--- a/feature-lifecycle/src/test/resources/lifecycle.kmodule
+++ b/feature-lifecycle/src/test/resources/lifecycle.kmodule
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
feature-controller-logging
================================================================================
- Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,8 +20,10 @@
-->
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
- <kbase name="onap.policies.controlloop.operational.common.Drools" default="false" equalsBehavior="equality"/>
+ <kbase name="onap.policies.typeA" default="false" equalsBehavior="equality"/>
+ <kbase name="onap.policies.controlloop.operational.common.Drools"
+ includes="onap.policies.typeA" default="false" equalsBehavior="equality"/>
<kbase name="onap.policies.type1.type2" includes="onap.policies.controlloop.operational.common.Drools">
<ksession name="junits" />
</kbase>
-</kmodule>
+</kmodule> \ No newline at end of file
diff --git a/feature-lifecycle/src/test/resources/schemas/onap.policies.typeA-1.0.0.schema.json b/feature-lifecycle/src/test/resources/schemas/onap.policies.typeA-1.0.0.schema.json
new file mode 100644
index 00000000..91712460
--- /dev/null
+++ b/feature-lifecycle/src/test/resources/schemas/onap.policies.typeA-1.0.0.schema.json
@@ -0,0 +1,106 @@
+{
+ "definitions": {},
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://www.onap.org/policy/models/schemas/onap.policies.typeA.schema.json",
+ "type": "object",
+ "title": "The Root Schema",
+ "required": [
+ "type",
+ "type_version",
+ "version",
+ "metadata",
+ "properties"
+ ],
+ "properties": {
+ "type": {
+ "$id": "#/properties/type",
+ "type": "string",
+ "title": "Policy Type",
+ "default": "onap.policies.typeA",
+ "examples": [
+ "onap.policies.typeA"
+ ],
+ "pattern": "^(.+)$"
+ },
+ "type_version": {
+ "$id": "#/properties/type_version",
+ "type": "string",
+ "title": "Policy Type Version",
+ "default": "1.0.0",
+ "examples": [
+ "1.0.0"
+ ],
+ "pattern": "^(.+)$"
+ },
+ "name": {
+ "$id": "#/properties/name",
+ "type": "string",
+ "title": "Policy Name",
+ "default": "",
+ "examples": [
+ "example"
+ ],
+ "pattern": "^(.*)$"
+ },
+ "version": {
+ "$id": "#/properties/version",
+ "type": "string",
+ "title": "Policy Version",
+ "default": "1.0.0",
+ "examples": [
+ "1.0.0"
+ ],
+ "pattern": "^(.+)$"
+ },
+ "metadata": {
+ "$id": "#/properties/metadata",
+ "type": "object",
+ "title": "Metadata",
+ "required": [
+ "policy-id"
+ ],
+ "properties": {
+ "policy-id": {
+ "$id": "#/properties/metadata/properties/policy-id",
+ "type": "string",
+ "title": "Policy ID",
+ "examples": [
+ "operational.restart"
+ ],
+ "pattern": "^(.+)$"
+ }
+ }
+ },
+ "properties": {
+ "$id": "#/properties/properties",
+ "type": "object",
+ "title": "Properties",
+ "required": [
+ "fieldA",
+ "fieldB"
+ ],
+ "properties": {
+ "fieldA": {
+ "$id": "#/properties/properties/properties/fieldA",
+ "type": "string",
+ "title": "Field A",
+ "examples": [
+ "FieldA"
+ ],
+ "pattern": "^(.+)$"
+ },
+ "fieldB": {
+ "$id": "#/properties/properties/properties/fieldB",
+ "type": "integer",
+ "title": "Timeout in seconds",
+ "minimum": 1,
+ "maximum": 5,
+ "default": 1,
+ "examples": [
+ 3
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/feature-lifecycle/src/test/resources/tosca-policy-other.json b/feature-lifecycle/src/test/resources/tosca-policy-other-unvalidated.json
index 33aed19b..64a59b2a 100644
--- a/feature-lifecycle/src/test/resources/tosca-policy-other.json
+++ b/feature-lifecycle/src/test/resources/tosca-policy-other-unvalidated.json
@@ -3,13 +3,13 @@
"topology_template": {
"policies": [
{
- "other": {
+ "other-unvalidated": {
"type": "onap.policies.type1.type2",
"type_version": "1.0.0",
- "name": "other",
+ "name": "other-unvalidated",
"version": "1.0.0",
"metadata": {
- "policy-id": "other"
+ "policy-id": "other-unvalidated"
},
"properties": {
"field1": "abc",
diff --git a/feature-lifecycle/src/test/resources/tosca-policy-other-validated.json b/feature-lifecycle/src/test/resources/tosca-policy-other-validated.json
new file mode 100644
index 00000000..e79435c6
--- /dev/null
+++ b/feature-lifecycle/src/test/resources/tosca-policy-other-validated.json
@@ -0,0 +1,22 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "other-validated": {
+ "type": "onap.policies.typeA",
+ "type_version": "1.0.0",
+ "name": "other-validated",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "other-validated"
+ },
+ "properties": {
+ "fieldA": "abc",
+ "fieldB": 2
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/feature-lifecycle/src/test/resources/tosca-policy-other-validation-error.json b/feature-lifecycle/src/test/resources/tosca-policy-other-validation-error.json
new file mode 100644
index 00000000..f7af04bb
--- /dev/null
+++ b/feature-lifecycle/src/test/resources/tosca-policy-other-validation-error.json
@@ -0,0 +1,21 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "other-validation-error": {
+ "type": "onap.policies.typeA",
+ "type_version": "1.0.0",
+ "name": "other-validation-error",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "other-validation-error"
+ },
+ "properties": {
+ "fieldA": "abc"
+ }
+ }
+ }
+ ]
+ }
+}