summaryrefslogtreecommitdiffstats
path: root/javatoscachecker/checker/src
diff options
context:
space:
mode:
authorSerban Jora <jora@research.att.com>2017-10-02 13:20:50 -0400
committerSerban Jora <jora@research.att.com>2017-10-02 14:33:47 -0400
commitcba3b4f6a26aee3009a56b899a1cb9f093aba805 (patch)
tree063d570fb8f3390ced12a4ed10efc4388d68d392 /javatoscachecker/checker/src
parent53065490134870ead778bff590cfd9e43ddd9f77 (diff)
Add unit testing
JUnit based testing added to the checker lib and service, work in progress. Includes grammar correction. Change-Id: I8fa950f89faba24e7b45ef41cbc0402362b3f394 Issue-Id: MODELING-26 Signed-off-by: Serban Jora <jora@research.att.com>
Diffstat (limited to 'javatoscachecker/checker/src')
-rw-r--r--javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Checker.java2
-rw-r--r--javatoscachecker/checker/src/main/resources/tosca/tosca_simple_yaml_1_1.grammar7
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Annotations.java49
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/CheckerTest.java133
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/ModelTest.java186
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Tools.java104
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssert.java102
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssertions.java30
-rw-r--r--javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerBuildAssert.java38
-rw-r--r--javatoscachecker/checker/src/test/resources/config/annotations.yaml11
-rw-r--r--javatoscachecker/checker/src/test/resources/config/tosca_simple_yaml_1_1_extended.grammar1656
-rw-r--r--javatoscachecker/checker/src/test/resources/models/full.yaml107
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml11
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml25
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml26
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml33
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml18
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml30
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml26
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml29
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml33
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml33
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml30
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml49
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml45
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml114
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml25
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml27
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml39
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml45
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml42
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml26
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml44
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml10
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml29
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml24
-rw-r--r--javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml24
42 files changed, 3392 insertions, 5 deletions
diff --git a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Checker.java b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Checker.java
index 4218b85..358dc2b 100644
--- a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Checker.java
+++ b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Checker.java
@@ -3651,7 +3651,7 @@ System.out.println(" **** unassigned -> " + unassignedEntry.getKey() + " : " + u
private String defaultImportsPath = null;
private List<String> grammars = new LinkedList<String>();
- protected CheckerConfiguration() {
+ public CheckerConfiguration() {
withGrammars(Checker.grammarFiles);
}
diff --git a/javatoscachecker/checker/src/main/resources/tosca/tosca_simple_yaml_1_1.grammar b/javatoscachecker/checker/src/main/resources/tosca/tosca_simple_yaml_1_1.grammar
index 39b11d9..abd6c39 100644
--- a/javatoscachecker/checker/src/main/resources/tosca/tosca_simple_yaml_1_1.grammar
+++ b/javatoscachecker/checker/src/main/resources/tosca/tosca_simple_yaml_1_1.grammar
@@ -643,10 +643,9 @@ _workflow_step_definition: &workflow_step_definition
type: str
filter:
desc: "Filter is a map of attribute name, list of constraint clause that allows to provide a filtering logic"
- type: map
- mapping:
- =:
- *constraints_sequence
+ type: seq
+ sequence:
+ - *constraints_sequence
activities:
desc: "The list of sequential activities to be performed in this step"
type: seq
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Annotations.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Annotations.java
new file mode 100644
index 0000000..807f432
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Annotations.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.onap.tosca.checker.Checker;
+import org.onap.tosca.checker.annotations.Checks;
+
+
+@Checks
+public class Annotations {
+
+ private Map<String,List> annons = new HashMap<String, List>();
+
+ @Checks(path="/topology_template/node_templates")
+ public void check_node_templates_annotations(Map theTemplates, Checker.CheckContext theContext) {
+
+ for (Iterator<Map.Entry<String,Map>> i = theTemplates.entrySet().iterator(); i.hasNext(); ) {
+ Map.Entry<String,Map> e = i.next();
+ List nodeAnnons = (List)e.getValue().get("annotations");
+ if (nodeAnnons != null)
+ this.annons.put(e.getKey(), nodeAnnons);
+ }
+ }
+
+ public boolean hasAnnotation(String thePath, String theValue) {
+
+ List nodeAnnotations = annons.get(thePath);
+ if (nodeAnnotations == null)
+ return false;
+
+ return nodeAnnotations.contains(theValue);
+ }
+
+}
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/CheckerTest.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/CheckerTest.java
new file mode 100644
index 0000000..6bde63c
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/CheckerTest.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.*;
+
+import static org.onap.tosca.checker.test.assertions.CheckerAssertions.*;
+
+import org.onap.tosca.checker.Checker;
+import org.onap.tosca.checker.Target;
+
+/**
+ * Basic tests of Checker
+ */
+public class CheckerTest {
+
+
+
+ @Test
+ public void testCreateChecker() {
+ assertThatCode(() -> {
+ new Checker();
+ }).doesNotThrowAnyException();
+ }
+
+
+ @Test
+ public void testCreateCheckerWithEmptyConfiguraton() {
+ assertThatCode(() -> {
+ new Checker(new Checker.CheckerConfiguration());
+ }).doesNotThrowAnyException();
+ }
+
+ @Test
+ public void testCreateCheckerWithConfiguratonWithGrammar() {
+ assertThatCode(() -> {
+ new Checker(new Checker.CheckerConfiguration()
+ .withGrammars("config/tosca_simple_yaml_1_1_extended.grammar"));
+ }).doesNotThrowAnyException();
+ }
+
+ @Test
+ public void testCreateCheckerWithConfiguratonWithPaths() {
+ assertThatCode(() -> {
+ new Checker(new Checker.CheckerConfiguration()
+ .withDefaultImportsPath("config/"));
+ }).doesNotThrowAnyException();
+ }
+
+ /*
+ * this is the positive test
+ */
+ @Test
+ public void testCheckGrammarExtension() {
+
+ assertThat(new Checker.CheckerConfiguration()
+ .withGrammars("config/tosca_simple_yaml_1_1_extended.grammar"))
+ .builds()
+ .checks(Tools.getTarget("config/annotations.yaml"))
+ .withNoErrors();
+ }
+
+ /** test that provided extensions get called at every relevant processing stage */
+ @Test
+ public void testCheckExtension() {
+
+ assertThat(new Checker.CheckerConfiguration()
+ .withGrammars("config/tosca_simple_yaml_1_1_extended.grammar"))
+ .builds()
+ .checks(Tools.getTarget("config/annotations.yaml"))
+ .withNoErrors()
+ .withTruePredicate(checker -> checker.getHandler(Annotations.class).hasAnnotation("test", "this"));
+ }
+
+
+ @Test
+ public void testCheckDataTypes() {
+ testCheckInputFiles("spec/data_types");
+ }
+
+ @Test
+ public void testCheckCapabilityTypes() {
+ testCheckInputFiles("spec/capability_types");
+ }
+
+ @Test
+ public void testCheckNodeTypes() {
+ testCheckInputFiles("spec/node_types");
+ }
+
+ @Test
+ public void testCheckTopologyTemplate() {
+ testCheckInputFiles("spec/topology_template");
+ }
+
+ @Test
+ public void testCheckExamples() {
+ testCheckInputFiles("spec/examples");
+ }
+
+ private void testCheckInputFiles(final String theLocation) {
+
+ //creates a checker for each test file, is that really necessary?
+ for (String filename: Tools.getResourceFiles(theLocation)) {
+ assertThat()
+ .builds()
+ .checks(Tools.getTarget(theLocation + "/" + filename))
+ .withExpectedOutcome();
+ }
+ }
+
+}
+
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/ModelTest.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/ModelTest.java
new file mode 100644
index 0000000..d6b3d8b
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/ModelTest.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.FixMethodOrder;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.Map;
+
+import org.onap.tosca.checker.Target;
+import org.onap.tosca.checker.Checker;
+import org.onap.tosca.checker.model.*;
+
+/*
+ * This is purely a navigational model, no processing, so we test that the data we expect can be found
+ */
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ModelTest {
+
+ static Target target;
+ static ServiceTemplate template;
+
+ @BeforeClass
+ public static void initialize() throws Exception {
+
+ Checker checker = new Checker();
+ checker.check(Tools.getTarget("models/full.yaml"));
+
+ for (Target t: checker.catalog().targets()) {
+ if (!t.getReport().isEmpty())
+ System.out.println("Model checker issues:\n" + t.getReport());
+ }
+
+ target = checker.catalog().targets().iterator().next();
+ template = Models.service_template(target);
+ }
+
+ @Test
+ public void testServiceTemplate() {
+
+ assertTrue("full service template".equals(template.description()));
+ }
+
+ @Test
+ public void testServiceTemplateMetadata() {
+
+ assertTrue(template.metadata() == null);
+ }
+
+ @Test
+ public void testServiceTemplateDataTypes() {
+
+ assertTrue(template.data_types() != null);
+
+ for (Map.Entry<String, DataType> type: template.data_types().entrySet()) {
+ assertTrue(type.getKey().startsWith("data_type_"));
+
+ Properties props = type.getValue().properties();
+ assertTrue(props != null);
+
+ for (Map.Entry<String, Property> prop: props.entrySet()) {
+ assertTrue(prop.getKey().startsWith("data_field_"));
+ }
+ }
+ }
+
+ @Test
+ public void testServiceTemplateCapabilityTypes() {
+
+ assertTrue(template.capability_types() != null);
+ for (Map.Entry<String, CapabilityType> type: template.capability_types().entrySet()) {
+ assertTrue(type.getKey().matches("capability_type_[0-9]"));
+
+ Properties props = type.getValue().properties();
+ assertTrue(props != null);
+
+ for (Map.Entry<String, Property> prop: props.entrySet()) {
+ assertTrue(prop.getKey().matches("capability_type_[0-9]_property_[0-9]"));
+ }
+ }
+ }
+
+ @Test
+ public void testServiceTemplateInterfaceTypes() {
+
+ assertTrue(template.interface_types() != null);
+ for (Map.Entry<String, InterfaceType> type: template.interface_types().entrySet()) {
+ assertTrue(type.getKey().matches("interface_type_[0-9]"));
+
+ Operations ops = type.getValue().operations();
+ assertTrue(ops != null);
+
+ for (Map.Entry<String, Operation> op: ops.entrySet()) {
+ assertTrue(op.getKey().matches("interface_type_[0-9]_op_[0-9]"));
+ }
+ }
+ }
+
+ @Test
+ public void testServiceTemplateRelationshipTypes() {
+
+ assertTrue(template.relationship_types() != null);
+ for (Map.Entry<String, RelationshipType> type: template.relationship_types().entrySet()) {
+ assertTrue(type.getKey().matches("relationship_type_[0-9]"));
+
+ TypeInterfaces infs = type.getValue().interfaces();
+ assertTrue(infs != null);
+
+ for (Map.Entry<String, TypeInterface> inf: infs.entrySet()) {
+ assertTrue(inf.getKey().matches("relationship_type_[0-9]_interface_[0-9]"));
+ }
+ }
+ }
+
+ @Test
+ public void testServiceTemplateNodeTypes() {
+
+ assertTrue(template.node_types() != null);
+ for (Map.Entry<String, NodeType> type: template.node_types().entrySet()) {
+ assertTrue(type.getKey().matches("node_type_[0-9]"));
+
+ Capabilities caps = type.getValue().capabilities();
+ assertTrue(caps != null);
+
+ for (Map.Entry<String, Capability> cap: caps.entrySet()) {
+ assertTrue(cap.getKey().matches("node_type_[0-9]_capability_[0-9]"));
+ }
+ }
+ }
+
+ @Test
+ public void testServiceTemplateGroupTypes() {
+
+ assertTrue(template.group_types() == null);
+ }
+
+ @Test
+ public void testServiceTemplateTopologyTemplate() {
+
+ assertTrue(template.topology_template() != null);
+ }
+
+ @Test
+ public void testTopologyTemplateNodeTemplates() {
+
+ assertTrue(template.topology_template().node_templates() != null);
+
+ for (Map.Entry<String, NodeTemplate> node: template.topology_template().node_templates().entrySet()) {
+ assertTrue(node.getKey().matches("node_[0-9]"));
+
+ PropertiesAssignments props = node.getValue().properties();
+ assertTrue(props != null);
+
+ for (Map.Entry<String, Object> prop: props.entrySet()) {
+ assertTrue(prop.getKey().matches("node_type_[0-9]_property_[0-9]"));
+ }
+ }
+ }
+
+ @Test
+ public void testTopologyTemplateRelationshipTemplates() {
+
+ assertTrue(template.topology_template().relationship_templates() != null);
+ }
+
+}
+
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Tools.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Tools.java
new file mode 100644
index 0000000..20bc334
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/Tools.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.onap.tosca.checker.Target;
+
+
+
+/**
+ * Credit for getResourceFiles goes to
+ * https://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory
+ *
+ * The spring framework contains classpath URL handler but I wanted to avoid bring all that in here.
+ */
+public class Tools {
+
+ public static List<String> getResourceFiles(String thePath) {
+ List<String> filenames = new ArrayList<>();
+
+ try {
+ InputStream in = getResourceAsStream(thePath);
+ BufferedReader br = new BufferedReader(new InputStreamReader(in));
+
+ try {
+ String resource;
+
+ while( (resource = br.readLine()) != null ) {
+ filenames.add( resource );
+ }
+ }
+ finally {
+ try { br.close(); } catch (IOException iox) {}
+ }
+ }
+ catch (IOException iox) {
+ throw new UncheckedIOException(iox);
+ }
+
+ return filenames;
+ }
+
+ private static InputStream getResourceAsStream(String theResource) {
+ final InputStream in
+ = getContextClassLoader().getResourceAsStream(theResource);
+
+ return in == null ? in.getClass().getResourceAsStream(theResource) : in;
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ public static Target getTarget(String theClassPath) {
+ try {
+ return new ClasspathTarget(theClassPath);
+ }
+ catch(URISyntaxException urix) {
+ throw new RuntimeException(urix);
+ }
+ }
+
+ /**
+ * Simpler than handling classpath URIs
+ */
+ public static class ClasspathTarget extends Target {
+
+ public ClasspathTarget(String theLocation) throws URISyntaxException {
+ super(theLocation, new URI("classpath:" + theLocation));
+ }
+
+ @Override
+ public Reader open() throws IOException {
+
+ return new BufferedReader(
+ new InputStreamReader(
+ getResourceAsStream(getName())));
+ }
+ }
+
+
+}
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssert.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssert.java
new file mode 100644
index 0000000..c973c08
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssert.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test.assertions;
+
+import java.util.Map;
+
+import java.util.function.Predicate;
+
+import org.assertj.core.api.AbstractAssert;
+import static org.assertj.core.api.Assertions.*;
+
+import org.onap.tosca.checker.Checker;
+import org.onap.tosca.checker.Target;
+import org.onap.tosca.checker.Report;
+import org.onap.tosca.checker.Catalog;
+
+/**
+ */
+public class CheckerAssert extends AbstractAssert<CheckerAssert, Checker> {
+
+ protected CheckerAssert(Checker theActualChecker) {
+ super(theActualChecker, CheckerAssert.class);
+ }
+
+ public CheckerAssert checks(String theTarget) {
+ assertThatCode(() -> {
+ this.actual.check(theTarget);
+ }).doesNotThrowAnyException();
+
+ return this;
+ }
+
+ public CheckerAssert checks(Target theTarget) {
+ assertThatCode(() -> {
+ this.actual.check(theTarget);
+ }).doesNotThrowAnyException();
+
+ return this;
+ }
+
+ public CheckerAssert withNoErrors() {
+ Catalog cat = this.actual.catalog();
+ for (Target t: cat.targets()) {
+ assertThat(t.getReport().isEmpty())
+ .as("No errors were expected for " + t + "\n" + t.getReport())
+ .isTrue();
+ }
+
+ return this;
+ }
+
+ public CheckerAssert withExpectedOutcome() {
+ Catalog cat = this.actual.catalog();
+ for (Target t: cat.targets()) {
+
+ //no content means that parsing might have failed ..
+ Map content = (Map)t.getTarget();
+ assertThat(content != null)
+ .as("Parsing failed for " + t + "\n" + t.getReport())
+ .isTrue();
+
+ String outcome = "success";
+ Map metadata = (Map)content.get("metadata");
+ //assertThat(metadata != null)
+ // .as("No metadata was defined in " + t)
+ // .isTrue();
+ if (metadata != null) {
+ outcome = (String)metadata.get("outcome");
+ }
+ //assertThat(outcome != null)
+ // .as("No expected outcome was defined in " + t)
+ // .isTrue();
+
+ if ("fail".equals(outcome))
+ assertThat(t.getReport().isEmpty())
+ .as("Checking was expected to fail but succeeded for " + t)
+ .isFalse(); //should go further and make sure teh expected error was generated
+ else if ("success".equals(outcome))
+ assertThat(t.getReport().isEmpty())
+ .as("Checking was expected to succeed but failed for " + t + "\n" + t.getReport())
+ .isTrue(); //should go further and make sure teh expected error was generated
+ }
+
+ return this;
+ }
+
+ public CheckerAssert withTruePredicate(Predicate<Checker> thePredicate) {
+ assertThat(thePredicate.test(this.actual))
+ .isTrue();
+ return this;
+ }
+}
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssertions.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssertions.java
new file mode 100644
index 0000000..1478512
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerAssertions.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test.assertions;
+
+import org.onap.tosca.checker.Checker;
+
+
+/** */
+public class CheckerAssertions {
+
+ public static CheckerBuildAssert assertThat() {
+ return new CheckerBuildAssert(null);
+ }
+
+ public static CheckerBuildAssert assertThat(Checker.CheckerConfiguration theConfig) {
+ return new CheckerBuildAssert(theConfig);
+ }
+
+}
+
diff --git a/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerBuildAssert.java b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerBuildAssert.java
new file mode 100644
index 0000000..483ba85
--- /dev/null
+++ b/javatoscachecker/checker/src/test/java/org/onap/tosca/checker/test/assertions/CheckerBuildAssert.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017 <AT&T>. All rights reserved.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
+ * the specific language governing permissions and limitations under the License.
+ */
+package org.onap.tosca.checker.test.assertions;
+
+import org.assertj.core.api.AbstractAssert;
+
+import org.onap.tosca.checker.Checker;
+import org.onap.tosca.checker.CheckerException;
+
+/**
+ */
+public class CheckerBuildAssert extends AbstractAssert<CheckerBuildAssert, Checker.CheckerConfiguration> {
+
+ protected CheckerBuildAssert(Checker.CheckerConfiguration theConfig) {
+ super(theConfig, CheckerBuildAssert.class);
+ }
+
+ public CheckerAssert builds() {
+ try {
+ return new CheckerAssert(this.actual == null ? new Checker() : new Checker(this.actual));
+ }
+ catch (CheckerException cx) {
+ failWithMessage("Failed to build checker with given configuration: %s", cx.getMessage());
+ return null; //we should not make it here
+ }
+ }
+
+}
diff --git a/javatoscachecker/checker/src/test/resources/config/annotations.yaml b/javatoscachecker/checker/src/test/resources/config/annotations.yaml
new file mode 100644
index 0000000..2102a22
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/config/annotations.yaml
@@ -0,0 +1,11 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_x
+description: test extension
+
+topology_template:
+
+ node_templates:
+
+ test:
+ type: tosca.nodes.Compute
+ annotations: ["this", "that"]
+
diff --git a/javatoscachecker/checker/src/test/resources/config/tosca_simple_yaml_1_1_extended.grammar b/javatoscachecker/checker/src/test/resources/config/tosca_simple_yaml_1_1_extended.grammar
new file mode 100644
index 0000000..f204384
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/config/tosca_simple_yaml_1_1_extended.grammar
@@ -0,0 +1,1656 @@
+#
+# This is an example of an extension added to the standard 1.1 grammar
+# We add the keyword annotations (as a list) to node templates (as an example).
+# look in the node_template_definition rule
+#
+
+_status_values: &status_values
+ enum:
+ - supported
+ - unsupported
+ - experimental
+ - deprecated
+
+#I do not know that the lists and maps qualify as 'primitive' ..
+_primitive_types: &primitive_types
+ enum: [string,integer,float,boolean,timestamp,list,map,version,range,scalar-unit.size,scalar_unit.frequency,scalar_unit.time]
+
+#needs custom validation as we have to make sure there are 2 elements and allow for the
+#UNBOUNDED keyword as second element
+_range_definition: &range_definition
+ desc: "Section used to declare additional metadata information"
+ required: no
+ type: seq
+ size: 2
+ name: range_definition
+ sequence:
+ - type: scalar
+
+_version_definition: &version_definition
+ desc: "An optional TOSCA version number"
+ required: no
+ type: str
+ name: version_definition
+# pattern: <major_version>.<minor_version>[.<fix_version>[.<qualifier>[-<build_version] ] ]
+
+#common metadata defintion syntax
+_metadata_definition: &metadata_definition
+ desc: "Section used to declare additional metadata information"
+ required: no
+ type: map
+ mapping:
+ =:
+ type: str
+
+#see A.5.2
+#this is where the need of verifying the size of a collection (sequence/map) came from
+#this is specified as a sequence where each entry is a map with one entry??
+_constraints_sequence: &constraints_sequence
+ name: constraints_sequence
+ short: 0
+ type: seq
+ sequence:
+ - type: map
+# length: 1
+ mapping:
+ equal:
+ desc: "Constrains a property or parameter to a value equal to the value declared."
+ type: any
+ required: no
+ greater_than:
+ desc: "Constrains a property or parameter to a value greater than the value declared"
+ type: scalar
+ required: no
+ greater_or_equal:
+ desc: "Constrains a property or parameter to a value greater than or equal to the value declared."
+ type: scalar
+ required: no
+ less_than:
+ desc: "Constrains a property or parameter to a value less than the value declared"
+ type: scalar
+ required: no
+ less_or_equal:
+ desc: "Constrains a property or parameter to a value less than or equal to the value declared."
+ type: scalar
+ required: no
+ in_range:
+ desc: "Constrains a property or parameter to a value in range of (inclusive) the two values declared."
+ type: seq
+# length: 2
+ sequence:
+ - type: scalar
+ required: no
+ valid_values:
+ desc: "Constrains a property or parameter to a value that is in the list of declared values"
+ type: seq
+ sequence:
+ - type: scalar
+ required: no
+ length:
+ desc: "Constrains the property or parameter to a value of a given length."
+ type: int
+ required: no
+ min_length:
+ desc: "Constrains the property or parameter to a value to a minimum length"
+ type: scalar
+ required: no
+ max_length:
+ desc: "Constrains the property or parameter to a value to a maximum length"
+ type: scalar
+ required: no
+ pattern:
+ desc: "Constrains the property or parameter to a value that is allowed by the provided regular expression."
+ type: str
+ required: no
+
+# section A.5.3 property_filter_definition
+# it is a constraints sequence that gets attached to a property ..
+_property_filter_definition: &property_filter_definition
+ name: property_filter_definition
+ type: map
+ mapping:
+ =:
+ *constraints_sequence
+
+#section A.5.4 node_filter_definition
+_node_filter_definition: &node_filter_definition
+ type: map
+ name: node_filter_definition
+ mapping:
+ properties:
+ desc: "property names to constraints to be applied to those properties"
+ required: no
+ type: seq
+ sequence:
+ - *property_filter_definition
+# - type: map
+# mapping:
+# =:
+# *constraints_sequence
+ capabilities:
+ desc: ""
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ name: node_filter_capabilities_sequence
+ desc: "the key is a capability name or type"
+ mapping:
+ =:
+ name: node_filter_capabilities_entry
+ type: map
+ mapping:
+ properties:
+ desc: "the capability properties and their constraints"
+ name: node_filter_capabilities_properties
+ type: seq
+ sequence:
+ - type: map
+ name: node_filter_capabilities_property
+ mapping:
+ =: *constraints_sequence
+
+#used in property and attribute definitions
+_entry_schema_definition: &entry_schema_definition
+ desc: "The optional key that is used to declare the name of the Datatype definition for entries of set types such as the TOSCA list or map"
+ name: entry_schema_definition
+ required: no
+ type: map
+ short: type
+ mapping:
+ "type":
+ desc: "collection element type"
+ required: yes
+ type: str
+ description:
+ required: no
+ type: str
+ constraints:
+ *constraints_sequence
+
+# see section 3.5.6
+# it is strange that an artifact type defined a set of properties but here there is no place for their assignments ..
+_artifact_definition: &artifact_definition
+ type: map
+ name: artifact_definition
+ short: implementation # assumes type can be inferred ..
+ mapping:
+ "type":
+ desc: "The required artifact type for the artifact definition"
+ required: yes
+ type: str
+ description:
+ desc: "The optional description for the artifact definition"
+ required: no
+ type: str
+ file:
+ desc: "The optional URI string (relative or absolute) which can be used to locate the artifacts file."
+ required: no
+ type: str
+ repository:
+ desc: "The optional name of the repository definition which contains the location of the external repository that contains the artifact"
+ required: no
+ type: str
+ deploy_path:
+ desc: "The file path the associated file would be deployed into within the target nodes container."
+ required: no
+ type: str
+
+# see section 3.5.5
+_repository_definition: &repository_definition
+ type: map
+ name: repository_definition
+ short: url
+ mapping:
+ description:
+ desc: "The optional description for the repository."
+ required: no
+ type: str
+ url:
+ desc: "The required URL or network address used to access the repository"
+ required: yes
+ type: str
+ credential:
+ #this is the specification of the data type tosca.datatypes.Credential
+ desc: "The optional Credential used to authorize access to the repository"
+ required: no
+ type: map
+ mapping:
+ protocol:
+ required: no
+ type: str
+ token_type:
+ required: no
+ type: str
+ #default: password
+ token:
+ required: no
+ type: str
+ keys:
+ required: no
+ type: map
+ mapping:
+ =:
+ type: str
+ user:
+ required: no
+ type: str
+
+#see section 3.5.7
+_import_definition: &import_definition
+ type: map
+ name: import_definition
+ short: file
+ mapping:
+ file:
+ desc: "file URI"
+ required: yes
+ type: str
+ repository:
+ desc: "symbolic name of the repository definition where the imported file can be found"
+ required: no
+ type: str
+ namespace_uri:
+ desc: "namespace URI to that will be applied to type definitions found within the imported file"
+ required: no
+ type: str
+ namespace_prefix:
+ desc: "optional namespace prefix (alias) that will be used to indicate the namespace_uri when forming a qualified name (i.e., qname) when referencing type definitions from the imported"
+ required: no
+ type: str
+
+#see section 3.5.8
+_property_definition: &property_definition
+ type: map
+ name: property_definition
+ mapping:
+ "type":
+ type: str
+ required: yes
+#not as easy, it can be an user defined data type
+# <<: *primitive_types
+ description:
+ type: str
+ required: no
+ constraints:
+ desc: "The optional list of sequenced constraint clauses for the Data Type."
+ required: no
+ <<: *constraints_sequence
+ default:
+ type: any
+ required: no
+ "required":
+ type: bool
+ required: no
+ status:
+ type: str
+ required: no
+ <<: *status_values
+ entry_schema:
+ <<: *entry_schema_definition
+# desc: "used to declare the name of the Datatype definition for entries of set types such as the TOSCA list or map."
+# type: str
+# required: no
+
+
+#see 3.5.10
+_attribute_definition: &attribute_definition
+ type: map
+ name: attribute_definition
+ mapping:
+ "type":
+ type: str
+ required: yes
+# <<: *primitive_types
+ description:
+ type: str
+ required: no
+ default:
+ type: any
+ required: no
+ status:
+ desc: "The optional status of the attribute relative to the specification or implementation"
+ type: str
+ required: no
+ <<: *status_values
+ entry_schema:
+ <<: *entry_schema_definition
+# desc: "Used to declare the name of the Datatype definition for entries of set types such as the TOSCA list or map"
+# type: str
+# required: no
+
+#see section 3.5.11
+#here again, we must support the short form which is the most common
+_attribute_assignment_definition: &attribute_assignment_definition
+ type: map
+ name: attribute_assignment_definition
+ mapping:
+ description:
+ desc: "The optional description of the attribute."
+ required: no
+ type: str
+ value:
+#actually 'value | value_expression'
+ desc: "represent the type-compatible value to assign to the named attribute. Attribute values may be provided as the result from the evaluation of an expression or a function"
+ required: yes
+ type: any
+
+
+#see 3.5.12
+_parameter_definition: &parameter_definition
+ type: map
+ name: parameter_definition
+ mapping:
+ "type":
+ type: str
+ required: no
+#not as easy, it can be an user defined data type
+# <<: *primitive_types
+ description:
+ type: str
+ required: no
+ constraints:
+ desc: "The optional list of sequenced constraint clauses for the Data Type."
+ required: no
+ <<: *constraints_sequence
+ default:
+ type: any
+ required: no
+ "required":
+ type: bool
+ required: no
+ status:
+ type: str
+ required: no
+ <<: *status_values
+ value:
+ desc: "represent the type-compatible value to assign to the named parameter. Parameter values may be provided as the result from the evaluation of an expression or a function"
+ required: yes
+ type: any
+ entry_schema:
+ <<: *entry_schema_definition
+
+
+
+
+# see spec section 3.5.13
+
+# see spec section 3.5.13.2: variant to be used in node or relationship type definitions
+_type_operation_definition: &type_operation_definition
+ type: map
+ name: type_operation_definition
+ short: implementation
+ mapping:
+ description:
+ desc: "The optional description string for the associated named operation."
+ required: no
+ type: str
+ implementation:
+ desc: "The optional implementation artifact name (e.g., a script file name within a TOSCA CSAR file)"
+ required: no
+ type: str
+ inputs:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: "a property value or an expression providing a input value"
+ name: property_assignment
+ type: any
+
+# from 3.5.13.2.3
+_template_operation_definition: &template_operation_definition
+ type: map
+ name: template_operation_definition
+ short: implementation
+ mapping:
+ description:
+ desc: "The optional description string for the associated named operation."
+ required: no
+ type: str
+ implementation:
+ desc: "The optional implementation artifact name (e.g., a script file name within a TOSCA CSAR file)"
+ name: template_operation_implementation_definition
+ required: no
+ short: primary
+ type: map
+ mapping:
+ primary:
+ desc: "The optional implementation artifact name (e.g., the primary script file name within a TOSCA CSAR file). "
+ required: no
+ type: str
+ dependencies:
+ desc: "The optional list of one or more dependent or secondary implementation artifact name which are referenced by the primary implementation artifact (e.g., a library the script installs or a secondary script)"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ inputs:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: "a property value or an expression providing a input value"
+ name: property_assignment
+ type: any
+
+
+# see section 3.5.14, specifically 3.5.14.2.1 : definition to be used in node or relationship type definition
+_type_interface_definition: &type_interface_definition
+ type: map
+ name: type_interface_definition
+ mapping:
+ "type":
+ desc: "represents the required name of the Interface Type for the interface definition"
+ required: yes
+ type: str
+ inputs:
+ desc: "The optional list of input property definitions available to all defined operations"
+ type: map
+ mapping:
+ =:
+ *property_definition
+ =:
+ *type_operation_definition
+
+# see section 3.5.14.2.2, extended notation to be used in node or relationship template definitions
+_template_interface_definition: &template_interface_definition
+ type: map
+ name: template_interface_definition
+ mapping:
+ inputs:
+ desc: "The optional list of input property definitions available to all defined operations"
+ type: map
+ mapping:
+ =:
+ desc: "a property value or an expression providing a property value"
+ name: property_assignment
+ type: any
+ =:
+ *template_operation_definition
+
+# see section 3.5.15
+_event_filter_definition: &event_filter_definition
+ type: map
+ name: event_filter_definition
+ mapping:
+ node:
+ desc: "The required name of the node type or template that contains either the attribute to be monitored or contains the requirement that references the node that contains the attribute to be monitored"
+ required: yes
+ type: str
+ requirement:
+ desc: "The optional name of the requirement within the filter’s node that can be used to locate a referenced node that contains an attribute to monitor."
+ required: no
+ type: str
+ capability:
+ desc: "The optional name of a capability within the filter’s node or within the node referenced by its requirement that contains the attribute to monitor."
+ required: no
+ type: str
+
+# see section 3.5.16
+# to be revised, based on working version
+_trigger_definition: &trigger_definition
+ type: map
+ name: trigger_definition
+ mapping:
+ description:
+ desc: ""
+ required: no
+ type: str
+ event_type:
+ desc: "The required name of the event type that activates the trigger’s action."
+ required: yes
+ short: type
+ type: map
+ mapping:
+ type:
+ required: yes
+ type: str
+ schedule:
+ desc: ""
+ required: no
+ type: str
+ target_filter:
+ desc: ""
+ required: no
+ <<: *event_filter_definition
+#the section made up of condition/constraint/period/evaluations/method has a mistmatching example in the spec doc ..
+ condition:
+ desc: ""
+ required: no
+ <<: *constraints_sequence
+ constraint:
+ desc: ""
+ required: no
+ <<: *constraints_sequence
+ period:
+ desc: "The optional period to use to evaluate for the condition"
+ required: no
+ type: int
+ evaluations:
+ desc: ""
+ required: no
+ type: int
+ method:
+ desc: "The optional statistical method name to use to perform the evaluation of the condition"
+ required: no
+ type: str
+ action:
+ desc: "The if of the workflow to be invoked when the event is triggered and the condition is met (i.e, evaluates to true) OR the required operation to invoke when the event is triggered and the condition is met (i.e., evaluates to true)."
+ required: yes
+ type: str # or operation definition?
+
+
+# see section 3.5.17
+# to be revised, based on working version
+# example on 3.5.17.4 shows this as a sequence of maps
+# the map must a length/size of 1: none of the entries is required bjut one must be present (mutually exclusive)
+_workflow_activity_definition: &workflow_activity_definition
+ type: map
+ short: call_operation
+ name: workflow_activity_definition
+# size: 1
+ mapping:
+ delegate:
+ desc: ""
+ required: no
+ type: str
+ set_state:
+ desc: ""
+ required: no
+ type: str
+ call_operation:
+ desc: ""
+ required: no
+ type: str
+ inline:
+ desc: ""
+ required: no
+ type: str
+
+
+# see section 3.5.18
+# to be revised, based on working version
+_workflow_assertion_definition: &workflow_assertion_definition
+ name: workflow_assertion_definition
+ type: map
+ mapping:
+ =:
+ *constraints_sequence
+
+
+# see section 3.5.19
+# to be revised, based on working version
+# it employs a recursive definition which yaml allows but the parsers we've tried complain about, i.e the pattern
+# foo: &foo
+# bar: *foo
+# is theoretically allowed in YAML
+# we have enabled recursive defintions in kwalify through reference rules.
+# the spec is 'vague': it assumes a logical 'AND' between the entries of the top sequence of the rule
+_workflow_condition_clause_definition: &workflow_condition_clause_definition
+ name: workflow_condition_clause_definition
+ type: seq
+ sequence: &workflow_condition_clause_entry
+ - type: map
+ name: workflow_condition_clause_entry
+ mapping:
+ assert:
+ type: seq
+ sequence:
+ - *workflow_assertion_definition
+ and:
+ type: ref
+ rule: workflow_condition_clause_definition
+ # recursive definition ! yaml parser cannot deal with it
+ # <<: *workflow_condition_clause_definition
+
+ or:
+ type: ref
+ rule: workflow_condition_clause_definition
+ # recursive definition ! yaml parser cannot deal with it
+ # <<: *workflow_condition_clause_definition
+
+# see section 3.5.20
+# to be revised, based on working version
+# here too, not clear if this a map or a sequence .. there is no example
+_workflow_precondition_definition: &workflow_precondition_definition
+ name: workflow_precondition_definition
+ type: map
+ mapping:
+ target:
+ required: yes
+ type: str
+ target_relationship:
+ required: no
+ type: str
+ condition:
+ desc: "list of condition clause definition .. !@#$%"
+ <<: *workflow_condition_clause_definition
+
+
+# see section 3.5.21
+# to be revised, based on working version
+_workflow_step_definition: &workflow_step_definition
+ name: workflow_step_definition
+ desc: "A workflow step allows to define one or multiple sequenced activities in a workflow and how they are connected to other steps in the workflow. They are the building blocks of a declarative workflow."
+ type: map
+ mapping:
+ target:
+ required: yes
+ type: str
+ desc: "The target of the step (this can be a node template name, a group name)"
+ target_relationship:
+ required: no
+ type: str
+ operation_host:
+ required: no
+ type: str
+ filter:
+ desc: "Filter is a map of attribute name, list of constraint clause that allows to provide a filtering logic"
+ type: map
+ mapping:
+ =:
+ *constraints_sequence
+ activities:
+ desc: "The list of sequential activities to be performed in this step"
+ type: seq
+ sequence:
+ - *workflow_activity_definition
+ on_success:
+ desc: "The optional list of step names to be performed after this one has been completed with success (all activities has been correctly processed)."
+ type: seq
+ sequence:
+ - type: str
+ on_failure:
+ desc: "The optional list of step names to be called after this one in case one of the step activity failed."
+ type: seq
+ sequence:
+ - type: str
+
+
+
+
+# 3.6 section: type specific definitions
+
+# see section 3.6.2
+_capability_definition: &capability_definition
+ type: map
+ name: capability_definition
+ short: type
+ mapping:
+ "type":
+ desc: "The required name of the Capability Type the capability definition is based upon"
+ required: yes
+ type: str
+ description:
+ desc: "The optional description of the Capability definition"
+ required: no
+ type: str
+ properties:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ attributes:
+ desc: "An optional list of property definitions for the Capability definition"
+ required: no
+ type: map
+ mapping:
+ =:
+ *attribute_definition
+ valid_source_types:
+ desc: ""
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ occurrences:
+ desc: "The optional minimum and maximum occurrences for the capability."
+ required: no
+ <<: *range_definition
+
+
+
+
+# see section 3.6.3
+#
+_requirement_definition: &requirement_definition
+ type: map
+ name: requirement_definition
+ short: capability #as per A.6.2.2.1
+ mapping:
+ capability:
+ desc: "The required reserved keyname used that can be used to provide the name of a valid Capability Type that can fulfil the requirement"
+ required: yes
+ type: str
+ node:
+ desc: "The optional reserved keyname used to provide the name of a valid Node Type that contains the capability definition that can be used to fulfil the requirement. "
+ required: no
+ type: str
+ relationship:
+# and from section A.6.2.1, this one is an oddball
+ desc: "The optional reserved keyname used to provide the name of a valid Relationship Type to construct when fulfilling the requirement."
+ required: no
+ name: requirement_relationship_definition
+ short: type
+ type: map
+ mapping:
+ type:
+ desc: "The optional reserved keyname used to provide the name of the Relationship Type for the requirement definitions relationship keyname.
+"
+ required: yes
+ type: str
+ interfaces:
+ #not clear which interface definition is to be used here
+ desc: "allows augmentation (additional properties and operations) of the interfaces defined by the relationship type indicated above"
+ required: no
+ type: map
+ mapping:
+ =:
+ *type_interface_definition
+ occurrences:
+ desc: "The optional minimum and maximum occurrences for the requirement."
+ required: no
+ <<: *range_definition
+
+# see section 3.6.4
+_artifact_type_definition: &artifact_type_definition
+ type: map
+ name: artifact_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent Artifact Type name the Artifact Type derives from"
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ description:
+ desc: "An optional description for the Artifact Type."
+ required: no
+ type: str
+ mime_type:
+ desc: "The required mime type property for the Artifact Type."
+ required: no
+ type: str
+ file_ext:
+ desc: "The required file extension property for the Artifact Type"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ properties:
+ desc: "An optional list of property definitions for the Artifact Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+
+#see spec section #3.6.5
+_interface_type_definition: &interface_type_definition
+ type: map
+ name: interface_type_definition
+ mapping:
+ derived_from:
+ desc: "The name of the Interface Type this Interface Type definition derives from"
+ required: no
+ type: str
+ description:
+ desc: "The optional description for the Interface Type."
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ inputs:
+ desc: "The optional list of input property definitions available to all defined operations"
+ type: map
+ mapping:
+ =:
+ type: str
+ desc: "property_name to property_value(_expression) mapping"
+ =:
+ *type_operation_definition
+
+#see spec section #3.6.6
+_data_type_definition: &data_type_definition
+ type: map
+ name: data_type_definition
+ mapping:
+ derived_from:
+ desc: "The optional key used when a datatype is derived from an existing TOSCA Data Type."
+ required: no
+ type: str
+ description:
+ desc: "The optional description for the Data Type."
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ constraints:
+ desc: "The optional list of sequenced constraint clauses for the Data Type."
+ <<: *constraints_sequence
+ properties:
+ desc: "The optional list property definitions that comprise the schema for a complex Data Type in TOSCA"
+ type: map
+ mapping:
+ =:
+ *property_definition
+
+# see section 3.6.7
+_capability_type_definition: &capability_type_definition
+ type: map
+ name: capability_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent capability type name this new Capability Type derives from."
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ description:
+ desc: "An optional description for the Capability Type"
+ required: no
+ type: str
+ properties:
+ desc: "An optional list of property definitions for the Capability Type."
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ attributes:
+ desc: "An optional list of attribute definitions for the Capability Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *attribute_definition
+ valid_source_types:
+ desc: "An optional list of one or more valid names of Node Types that are supported as valid sources of any relationship established to the declared Capability Type"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+
+# section A.6.7 requirement definition: TOSCA YAML profile relies on capability types to
+# define requirements
+
+# see section #3.6.10
+_relationship_type_definition: &relationship_type_definition
+ type: map
+ name: relationship_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent Relationship Type name the Relationship Type derives from"
+ required: no
+ type: str
+ description:
+ desc: "An optional description for the Relationship Type."
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "An optional list of property definitions for the Relationship Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ attributes:
+ desc: "An optional list of attribute definitions for the Relationship Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *attribute_definition
+ interfaces:
+ desc: "An optional list of interface definitions interfaces supported by the Relationship Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *type_interface_definition
+ valid_target_types:
+ desc: "An optional list of one or more names of Capability Types that are valid targets for this relationship. "
+ required: no
+ type: seq
+ sequence:
+ - type: str
+
+#see section 3.6.11
+_group_type_definition: &group_type_definition
+ type: map
+ name: group_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent Group Type name this new Group Type derives from"
+ required: no
+ type: str
+ description:
+ desc: "An optional description for the Group Type"
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "An optional list of property definitions for the Group Type."
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ members:
+ desc: "An optional list of one or more names of Node Types that are valid
+(allowed) as members of the Group Type."
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ interfaces:
+ desc: "An optional list of interface definitions supported by the Group Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *type_interface_definition
+ requirements:
+ desc: "An optional sequenced list of requirement definitions for the Group Type."
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ =:
+ *requirement_definition
+ capabilities:
+ desc: "An optional list of capability definitions for the Group Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *capability_definition
+
+
+
+#see section 3.6.12
+_policy_type_definition: &policy_type_definition
+ type: map
+ name: policy_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent Policy Type name this new Policy Type derives from"
+ required: no
+ type: str
+ description:
+ desc: "An optional description for the Policy Type"
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "An optional list of property definitions for the Policy Type."
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ targets:
+ desc: "An optional list of valid Node Types or Group Types the Policy Type
+can be applied to"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ triggers:
+ desc: "List of trigger defintions"
+ required: no
+ type: seq
+ sequence:
+ - *trigger_definition
+
+
+# see section #3.6.9
+_node_type_definition: &node_type_definition
+ type: map
+ name: node_type_definition
+ mapping:
+ derived_from:
+ desc: "An optional parent Node Type name this new Node Type derives from"
+ required: no
+ type: str
+ description:
+ desc: "An optional description for the Node Type"
+ required: no
+ type: str
+ version:
+ <<: *version_definition
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "An optional list of property definitions for the Node Type."
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ attributes:
+ desc: "An optional list of attribute definitions for the Node Type.
+"
+ required: no
+ type: map
+ mapping:
+ =:
+ *attribute_definition
+ requirements:
+ desc: "An optional sequenced list of requirement definitions for the Node Type.
+"
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ =:
+ *requirement_definition
+ capabilities:
+ desc: "An optional list of capability definitions for the Node Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *capability_definition
+ interfaces:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ *type_interface_definition
+ artifacts:
+ desc: "An optional list of named artifact definitions for the Node Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *artifact_definition
+
+# 3.7 Template specific definitions
+
+# see section 3.7.1
+_capability_assignment_definition: &capability_assignment_definition
+ type: map
+ name: capability_assignment_definition
+ mapping:
+ properties:
+ # list of property assignments
+ desc: "An optional list of property definitions for the Capability definition"
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: "a property value or an expression providing a property value"
+ name: property_assignment
+ type: any
+ attributes:
+ # list of attribute assignments
+ desc: "An optional list of attribute definitions for the Capability definition"
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: ""
+ name: attribute_assignment
+ type: any
+
+# see section 3.7.2
+_requirement_assignment_definition: &requirement_assignment_definition
+ type: map
+ name: requirement_assignment_definition
+ short: node
+ mapping:
+ capability:
+ desc: " used to provide the name of either a: Capability definition within a target node template that can fulfill the requirement or Capability Type that the provider will use to select a type-compatible target node template to fulfill the requirement at runtime."
+ required: no
+ type: str
+ node:
+#why is this a reference to a node type and not to a node template??
+ desc: "used to identify the target node of a relationship: Node Template name that can fulfil the target node requirement or Node Type name that the provider will use to select a type-compatible node template to fulfil the requirement at runtime"
+ required: no
+ type: str
+ relationship:
+ desc: ""
+ required: no
+#fins a better name name: relationship_definition
+ type: map
+ short: type
+ mapping:
+ "type":
+ desc: "The optional reserved keyname used to provide the name of the Relationship Type for the requirement assignments relationship keyname"
+ required: no
+ type: str
+ properties:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: "a property value or an expression providing a property value"
+ name: property_assignment
+ type: any
+ interfaces:
+ desc: "from A.5.12.2.2, right?"
+ required: no
+ type: map
+ mapping:
+ =:
+ *template_interface_definition
+ node_filter:
+ desc: "The optional filter definition that TOSCA orchestrators or providers would use to select a type-compatible target node that can fulfill the associated abstract requirement at runtime."
+ required: no
+ <<: *node_filter_definition
+
+# see section 3.7.3
+_node_template_definition: &node_template_definition
+ type: map
+ name: node_template_definition
+ mapping:
+ "type":
+ desc: "The required name of the Node Type the Node Template is based upon"
+ required: yes
+ type: str
+ description:
+ desc: "An optional description for the Node Template"
+ required: no
+ type: str
+ metadata:
+ <<: *metadata_definition
+ directives:
+ desc: "An optional list of directive values to provide processing instructions to orchestrators and tooling."
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ annotations:
+ desc: "Sample extension"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ properties:
+#custom check needs to be added: the value or expression providing the property value
+#needs to be compatible with the property definition
+ desc: "An optional list of property value assignments for the Node Template."
+ required: no
+ type: map
+ mapping:
+ =:
+ type: any
+ name: property_assignment
+ desc: "a property value or an expression providing a property value"
+ attributes:
+ desc: "An optional list of attribute value assignments for the Node Template"
+ required: no
+ type: map
+ mapping:
+ =:
+ *attribute_assignment_definition
+ requirements:
+ desc: "An optional sequenced list of requirement assignments for the Node Template."
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ =:
+ *requirement_assignment_definition
+ capabilities:
+ desc: "An optional list of capability assignments for the Node Template."
+ required: no
+ type: map
+ mapping:
+ =:
+ *capability_assignment_definition
+ interfaces:
+ desc: "An optional list of named interface definitions for the Node Template"
+ required: no
+ type: map
+ mapping:
+ =:
+ *template_interface_definition
+ artifacts:
+ desc: "An optional list of named artifact definitions for the Node Template.
+"
+ required: no
+ type: map
+ mapping:
+ =:
+ *artifact_definition
+ node_filter:
+ desc: "The optional filter definition that TOSCA orchestrators would use to select the correct target node. This keyname is only valid if the directive has the value of 'selectable' set."
+ required: no
+ <<: *node_filter_definition
+ copy:
+ desc: "The optional (symbolic) name of another node template to copy into (all keynames and values) and use as a basis for this node template."
+ required: no
+ type: str
+
+# see section 3.7.4
+_relationship_template_definition: &relationship_template_definition
+ type: map
+ name: relationship_template_definition
+ mapping:
+ "type":
+ desc: "The required name of the Relationship Type the Relationship Template is based upon"
+ required: yes
+ type: str
+ description:
+ desc: "An optional description for the Relationship Template"
+ required: no
+ type: str
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "An optional list of property assignments for the Relationship Template."
+ required: no
+ name: properties_assignment_validation
+ type: map
+ mapping:
+ =:
+ type: any
+#scalar
+ desc: "an expression providing a property value"
+ attributes:
+ desc: "An optional list of attribute value assignments for the Relationship Template"
+ required: no
+ name: attributes_assignment_validation
+ type: map
+ mapping:
+ =:
+ type: scalar
+ desc: "an expression providing an attribute value"
+ interfaces:
+ desc: "An optional list of named interface definitions for the Relationship Template ('augmentation' is allowed here)"
+ required: no
+ type: map
+ mapping:
+ =:
+ *template_interface_definition
+ copy:
+ desc: "The optional (symbolic) name of another relationship template to copy into (all keynames and values) and use as a basis for this relationship template."
+ required: no
+ type: str
+
+
+# see section 3.7.5
+_group_definition: &group_definition
+ type: map
+ name: group_definition
+ mapping:
+ "type":
+ desc: "The required name of the group type the group definition is based upon"
+ required: yes
+ type: str
+ description:
+ desc: "The optional description for the group definition"
+ required: no
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: " represents the optional list of property assignments for the group definition that provide values for properties defined in its declared Group Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ type: any
+ name: property_assignment
+ members:
+ desc: "contains the required list of one or more node template names (within the same topology template) that are members of this logical group"
+ required: yes
+ type: seq
+ sequence:
+ - type: str
+ interfaces:
+ desc: "represents the optional list of interface definitions for the group definition that augment those provided by its declared Group Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ *template_interface_definition
+
+# see section 3.7.6
+_policy_template_definition: &policy_template_definition
+ type: map
+ name: policy_definition
+ mapping:
+ "type":
+ desc: "The required name of the policy type the policy definition is based upon"
+ required: yes
+ type: str
+ description:
+ desc: "The optional description for the policy definition"
+ required: no
+ metadata:
+ <<: *metadata_definition
+ properties:
+ desc: "represents the optional list of property assignments for the policy definition that provide values for properties defined in its declared Policy Type"
+ required: no
+ type: map
+ mapping:
+ =:
+ type: any
+ name: property_assignment
+ targets:
+ desc: "represents the optional list of names of node templates or groups that the policy is to applied to"
+ required: no
+ type: seq
+ sequence:
+ - type: str
+ triggers:
+ desc: "List of trigger definitions"
+ required: no
+ type: seq
+ sequence:
+ - *trigger_definition
+
+#see section 3.7.7, obviously incomplete spec
+_workflow_definition: &workflow_definition
+ type: map
+ name: workflow_definition
+ mapping:
+ description:
+ desc: "The optional description for the workflow definition"
+ required: no
+ metadata:
+ <<: *metadata_definition
+ inputs:
+ desc: "optional list of input parameter definitions"
+ required: no
+ type: map
+ mapping:
+ =:
+ *property_definition
+ preconditions:
+ desc: "List of preconditions to be validated before the workflow can be processed."
+ required: no
+ type: seq
+ sequence:
+ - *workflow_precondition_definition
+ steps:
+ desc: ""
+ required: no
+ type: map
+ mapping:
+ =:
+ *workflow_step_definition
+
+
+# see section 3.8 Topology Template definition: defines the topology template of a cloud application.
+# described as a a reusable grammar as it can be a part of a service template definition
+_topology_template_definition: &topology_template_definition
+ type: map
+ name: topology_template_definition
+ mapping:
+ description:
+ desc: "a description of the topology template"
+ required: no
+ type: str
+ inputs:
+ desc: "definition of input parameters for the topology template"
+ name: inputs
+ required: no
+ type: map
+ mapping:
+ =:
+ *parameter_definition
+ node_templates:
+ desc: "definition of the node templates of the topology"
+ name: node_templates
+ required: no
+ type: map
+ mapping:
+ =:
+ *node_template_definition
+ relationship_templates:
+ desc: "definition of the relationship templates of the topology"
+ required: no
+ name: relationship_templates
+ type: map
+ mapping:
+ =:
+ *relationship_template_definition
+ outputs:
+ desc: "definition of output parameters for the topology template"
+ name: outputs
+ required: no
+ type: map
+ mapping:
+ =:
+ *parameter_definition
+ groups:
+ desc: "An optional list of Group definitions whose members are node templates defined within this same Topology Template"
+ name: groups
+ required: no
+ type: map
+ mapping:
+ =:
+ *group_definition
+ policies:
+ # see 8.2.3, initially the list is not described as sequenced but then the grammar shows it as such !?
+ desc: "An optional sequenced?? list of Policy definitions for the Topology Template."
+ name: policies
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ =:
+ *policy_template_definition
+ workflows:
+ desc: "optional map of imperative workflow definition for the Topology Template"
+ name: workflows
+ required: no
+ type: map
+ mapping:
+ =:
+ *workflow_definition
+ substitution_mappings:
+# one possible short-coming that is visible here is that the definition of the capability
+# and requirements mappings are given in the spec only with the short/inline version of a
+# YAML list/sequence, which cannot be enforced here ..
+ desc: " a description of the topology template"
+ name: substitution_mappings
+ required: no
+ type: map
+ mapping:
+ node_type:
+ desc: "node type name"
+ required: yes
+ type: str
+ capabilities:
+ desc: "map_of_capability_mappings_to_expose"
+ type: map
+ mapping:
+ =:
+ type: seq
+ sequence:
+ - type: str
+ requirements:
+ desc: "map_of_requirement_mapping_to_expose"
+ type: map
+ mapping:
+ =:
+ type: seq
+ sequence:
+ - type: str
+
+
+# see A.9 Service Template definition: A TOSCA Service Template (YAML) document contains
+# element definitions of building blocks for cloud application, or complete models of cloud applications.
+
+type: map
+name: service_template_definition
+mapping:
+ tosca_definitions_version:
+ desc: "Required TOSCA Definitions version string"
+ required: yes
+ type: str
+ enum: [tosca_simple_yaml_1_1_x]
+
+ tosca_default_namespace:
+ desc: "Optional. default namespace (for type schema)"
+ required: no
+ type: str
+
+ metadata:
+ desc: "Optional metadata keyname: value pairs"
+ name: metadata
+ required: no
+ type: map
+ mapping:
+ template_name:
+ desc: "Optional name of this service template"
+ required: no
+ type: str
+ template_author:
+ desc: "Optional author of this service template"
+ required: no
+ type: str
+ template_version:
+ desc: "Optional version of this service template"
+ required: no
+ type: str
+ =:
+ desc: "User defined entry"
+ required: no
+ type: str
+
+#to add, the spec says: "Optional list of domain or profile specific metadata keynames"
+
+ description:
+ desc: "Optional description of the definitions inside the file"
+ required: no
+ type: str
+
+ imports:
+ desc: "ordered list of import statements for importing other definitions files"
+ name: imports
+ required: no
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ =:
+ *import_definition
+
+ dsl_definitions:
+ desc: "list of YAML alias anchors (or macros)"
+ name: dsl_definitions
+ required: no
+ type: map
+ mapping:
+ =:
+ desc: "some piece of valid yaml that makes the anchor/alias definition"
+ type: any
+ required: no
+
+ repositories:
+ desc: "list of external repository definitions which host TOSCA artifacts"
+ name: repositories
+ required: no
+ type: map
+ mapping:
+ =:
+ *repository_definition
+
+ data_types:
+ desc: "list of TOSCA datatype definitions"
+ name: data_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *data_type_definition
+
+ node_types:
+ desc: "list of node type definitions"
+ name: node_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *node_type_definition
+
+ capability_types:
+ desc: "list of capability type definitions"
+ name: capability_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *capability_type_definition
+
+ relationship_types:
+ desc: "list of relationship type definitions"
+ name: relationship_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *relationship_type_definition
+
+ artifact_types:
+ desc: "list of artifact type definitions"
+ name: artifact_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *artifact_type_definition
+
+ interface_types:
+ desc: "list of interface type definitions"
+ name: interface_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *interface_type_definition
+
+ group_types:
+ desc: "list of group type definitions"
+ name: group_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *group_type_definition
+
+ policy_types:
+ desc: "list of policy type definitions"
+ name: policy_types
+ required: no
+ type: map
+ mapping:
+ =:
+ *policy_type_definition
+
+ topology_template:
+ desc: "topology template definition of the cloud application or service"
+ required: no
+ <<: *topology_template_definition
diff --git a/javatoscachecker/checker/src/test/resources/models/full.yaml b/javatoscachecker/checker/src/test/resources/models/full.yaml
new file mode 100644
index 0000000..85f69b4
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/models/full.yaml
@@ -0,0 +1,107 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: full service template
+
+data_types:
+
+ data_type_1:
+ derived_from: tosca.datatypes.Root
+ properties:
+ data_field_11:
+ type: string
+ data_field_12:
+ type: integer
+
+ data_type_2:
+ derived_from: data_type_1
+ properties:
+ data_field_21:
+ type: string
+
+capability_types:
+
+ capability_type_1:
+ derived_from: tosca.capabilities.Root
+ properties:
+ capability_type_1_property_1:
+ type: string
+
+ capability_type_2:
+ derived_from: tosca.capabilities.Root
+ properties:
+ capability_type_2_property_1:
+ type: string
+
+node_types:
+
+ node_type_1:
+ properties:
+ node_type_1_property_1:
+ type: data_type_1
+ capabilities:
+ node_type_1_capability_1:
+ type: capability_type_1
+ requirements:
+ - node_type_1_requirement_2:
+ capability: capability_type_2
+# relationship:
+
+ node_type_2:
+ properties:
+ node_type_2_property_1:
+ type: data_type_2
+ capabilities:
+ node_type_2_capability_2:
+ type: capability_type_2
+
+interface_types:
+
+ interface_type_1:
+ derived_from: tosca.interfaces.Root
+ description: test interface type
+# inputs:
+# interface_type_1_input_1:
+# type: string
+ interface_type_1_op_1:
+ description: test interface operation
+
+relationship_types:
+
+ relationship_type_1:
+ derived_from: tosca.relationships.ConnectsTo
+ description: test relationship type
+ interfaces:
+ relationship_type_1_interface_1:
+ type: interface_type_1
+
+topology_template:
+
+ node_templates:
+
+ node_1:
+ type: node_type_1
+ properties:
+ node_type_1_property_1: { data_field_11: "11", data_field_12: 12 }
+ requirements:
+ - node_type_1_requirement_2:
+ node_filter:
+ capabilities:
+ - two:
+ properties:
+ - capability_type_2_property_1: { equal: "value2" }
+
+ node_2:
+ type: node_type_2
+ properties:
+ node_type_2_property_1: { data_field_11: "11", data_field_12: 12, data_field_21: "21" }
+ capabilities:
+ node_type_2_capability_2:
+ properties:
+ capability_type_2_property_1: value_2
+
+ relationship_templates:
+
+ relationship_1:
+ type: relationship_type_1
+# interfaces:
+# relationship_type_1_interface_1:
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml b/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml
new file mode 100644
index 0000000..6a6a036
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml
@@ -0,0 +1,11 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: basic capability type
+
+metadata:
+ outcome: "success"
+
+capability_types:
+ org.onap.tosca.checker.capability.ElectricalSupply:
+ description: expresses the capability of a given environment ot host electric appliances
+ version: "1.0"
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml
new file mode 100644
index 0000000..c5f9abe
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml
@@ -0,0 +1,25 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml
new file mode 100644
index 0000000..7b39309
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ default: 1
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ default: VA
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml
new file mode 100644
index 0000000..550a8b1
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ default: negative
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml
new file mode 100644
index 0000000..6eb4db2
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ default: "XX"
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml
new file mode 100644
index 0000000..2fdd4c4
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml
@@ -0,0 +1,26 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: strong
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml
new file mode 100644
index 0000000..8546430
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: maybe
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ default: 1
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml
new file mode 100644
index 0000000..04d6a36
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml
@@ -0,0 +1,33 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
+ org.onap.tosca.SomeOtherDataType:
+ properties:
+ teamName:
+ type: string
+ required: true
+ players:
+ type: list
+ entry_schema: org.onap.tosca.checker.SomeDataType
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml
new file mode 100644
index 0000000..89ad5e4
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml
@@ -0,0 +1,18 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+
+ org.onap.tosca.checker.SomeDataType:
+ lastName:
+ type: string
+ required: true
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml
new file mode 100644
index 0000000..deefb94
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml
@@ -0,0 +1,30 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ nicknames:
+ type: list
+ required: false
+ entry_schema:
+ type: string
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml
new file mode 100644
index 0000000..a2cc7c4
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml
@@ -0,0 +1,26 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ derived_from: tosca.datatypes.Root
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml
new file mode 100644
index 0000000..de72e7d
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml
@@ -0,0 +1,29 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeBaseDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+
+ org.onap.tosca.checker.SomeDataType:
+ derived_from: org.onap.tosca.checker.SomeBaseDataType
+ properties:
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml
new file mode 100644
index 0000000..6364a9b
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml
@@ -0,0 +1,33 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: redefines the type of a property
+
+metadata:
+ outcome: "fail"
+
+data_types:
+ org.onap.tosca.checker.SomeBaseDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+
+ org.onap.tosca.checker.SomeDataType:
+ derived_from: org.onap.tosca.checker.SomeBaseDataType
+ properties:
+ firstName:
+ type: integer
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml
new file mode 100644
index 0000000..8726012
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml
@@ -0,0 +1,33 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: redefines the required flag of a property
+
+metadata:
+ outcome: "success"
+
+data_types:
+ org.onap.tosca.checker.SomeBaseDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+
+ org.onap.tosca.checker.SomeDataType:
+ derived_from: org.onap.tosca.checker.SomeBaseDataType
+ properties:
+ firstName:
+ type: string
+ required: false
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml
new file mode 100644
index 0000000..d53cd1b
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml
@@ -0,0 +1,30 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ nicknames:
+ type: list
+ entry_schema:
+ type: strong
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml
new file mode 100644
index 0000000..483dd70
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "fail"
+ error: ""
+
+data_types:
+ org.onap.tosca.checker.SomeDataType:
+ derived_from: tosca.datatypes.Rooter
+ properties:
+ firstName:
+ type: string
+ required: true
+ lastName:
+ type: string
+ required: true
+ streetNo:
+ type: integer
+ required: true
+ streetName:
+ type: string
+ required: true
+ state:
+ type: string
+ constraints:
+ - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml
new file mode 100644
index 0000000..e79c827
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml
@@ -0,0 +1,49 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >
+ TOSCA simple profile with 1 server bound to a new network
+
+metadata:
+ outcome: "success"
+
+imports:
+ - network: tosca/tosca-network-types.yaml
+
+topology_template:
+
+ inputs:
+ network_name:
+ type: string
+ description: Network name
+
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network:
+ type: tosca.nodes.network.Network
+ properties:
+ network_name: { get_input: network_name }
+ ip_version: 4
+ cidr: '192.168.0.0/24'
+ start_ip: '192.168.0.50'
+ end_ip: '192.168.0.200'
+ gateway_ip: '192.168.0.1'
+
+ my_port:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding: my_server
+ - link: my_network
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml
new file mode 100644
index 0000000..cbc2b24
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml
@@ -0,0 +1,45 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >
+ TOSCA simple profile with 1 server bound to an existing network
+
+metadata:
+ outcome: "success"
+
+imports:
+ - network: tosca/tosca-network-types.yaml
+
+topology_template:
+ inputs:
+ network_name:
+ type: string
+ description: Network name
+
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: 1
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: Linux
+ distribution: CirrOS
+ version: 0.3.2
+
+ my_network:
+ type: tosca.nodes.network.Network
+ properties:
+ network_name: { get_input: network_name }
+
+ my_port:
+ type: tosca.nodes.network.Port
+ requirements:
+ - binding:
+ node: my_server
+ - link:
+ node: my_network
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml
new file mode 100644
index 0000000..0efd978
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml
@@ -0,0 +1,114 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >
+ TOSCA simple profile with WordPress, a web server, a MySQL DBMS hosting the application’s database content on the same server. Does not have input defaults or constraints.
+
+# well, whomever wrote this example .. there are references to non-existent template and interface inputs.
+metadata:
+ outcome: "fail"
+
+imports:
+ - network: tosca/tosca-network-types.yaml
+ - examples: tosca/tosca-examples-types.yaml
+
+topology_template:
+ inputs:
+ cpus:
+ type: integer
+ description: Number of CPUs for the server.
+ db_name:
+ type: string
+ description: The name of the database.
+ db_user:
+ type: string
+ description: The username of the DB user.
+ db_pwd:
+ type: string
+ description: The WordPress database admin account password.
+ db_root_pwd:
+ type: string
+ description: Root password for MySQL.
+ db_port:
+ type: tosca.datatypes.network.PortDef
+ description: Port for the MySQL database
+
+ node_templates:
+ wordpress:
+ type: tosca.nodes.WebApplication.WordPress
+ properties:
+ context_root: { get_input: context_root }
+ requirements:
+ - host: webserver
+ - database_endpoint: mysql_database
+ interfaces:
+ Standard:
+ create: wordpress_install.sh
+ configure:
+ implementation: wordpress_configure.sh
+ inputs:
+ wp_db_name: { get_property: [ mysql_database, name ] }
+ wp_db_user: { get_property: [ mysql_database, user ] }
+ wp_db_password: { get_property: [ mysql_database, password ] }
+ # In my own template, find requirement/capability, find port property
+ wp_db_port: { get_property: [ SELF, database_endpoint, port ] }
+
+ mysql_database:
+ type: tosca.nodes.Database
+ properties:
+ name: { get_input: db_name }
+ user: { get_input: db_user }
+ password: { get_input: db_pwd }
+ port: { get_input: db_port }
+ capabilities:
+ database_endpoint:
+ properties:
+ port: { get_input: db_port }
+ requirements:
+ - host: mysql_dbms
+ interfaces:
+ Standard:
+ configure: mysql_database_configure.sh
+
+ mysql_dbms:
+ type: tosca.nodes.DBMS
+ properties:
+ root_password: { get_input: db_root_pwd }
+ port: { get_input: db_port }
+ requirements:
+ - host: server
+ interfaces:
+ Standard:
+ inputs:
+ db_root_password: { get_property: [ mysql_dbms, root_password ] }
+ create: mysql_dbms_install.sh
+ start: mysql_dbms_start.sh
+ configure: mysql_dbms_configure.sh
+
+ webserver:
+ type: tosca.nodes.WebServer
+ requirements:
+ - host: server
+ interfaces:
+ Standard:
+ create: webserver_install.sh
+ start: webserver_start.sh
+
+ server:
+ type: tosca.nodes.Compute
+ capabilities:
+ host:
+ properties:
+ disk_size: 10 GB
+ num_cpus: { get_input: cpus }
+ mem_size: 4096 MB
+ os:
+ properties:
+ architecture: x86_64
+ type: linux
+ distribution: fedora
+ version: 17.0
+
+ outputs:
+ website_url:
+ description: URL for Wordpress wiki.
+ value: { get_attribute: [server, public_address] }
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml
new file mode 100644
index 0000000..e8d5538
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml
@@ -0,0 +1,25 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: Template for deploying a single server with predefined properties.
+
+metadata:
+ outcome: "success"
+
+topology_template:
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ capabilities:
+ # Host container properties
+ host:
+ properties:
+ num_cpus: 1
+ disk_size: 10 GB
+ mem_size: 4096 MB
+ # Guest Operating System properties
+ os:
+ properties:
+ # host Operating System image properties
+ architecture: x86_64
+ type: linux
+ distribution: rhel
+ version: 6.5
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml
new file mode 100644
index 0000000..65f0aea
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: expected to fail as this redeclares a common type (and the checker provides them by default)
+
+metadata:
+ outcome: "fail"
+
+data_types:
+
+ tosca.datatypes.Credential:
+ derived_from: tosca.datatypes.Root
+ properties:
+ protocol:
+ type: string
+ required: false
+ token_type:
+ type: string
+ default: password
+ token:
+ type: string
+ keys:
+ type: map
+ required: false
+ entry_schema:
+ type: string
+ user:
+ type: string
+ required: false
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml
new file mode 100644
index 0000000..7e6e375
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml
@@ -0,0 +1,39 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+#it fails because DBMS node type has no Backup interface defined
+
+metadata:
+ outcome: "fail"
+
+imports:
+ - examples: tosca/tosca-examples-types.yaml
+
+topology_template:
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ mysql:
+ type: tosca.nodes.DBMS.MySQL
+ requirements:
+ - host: my_server
+ interfaces:
+ tosca.interfaces.nodes.custom.Backup:
+ backup: backup.sh
+ workflows:
+ backup:
+ description: Performs a snapshot of the MySQL data.
+ preconditions:
+ - target: my_server
+ condition:
+ - assert:
+ - state: [{equal: available}]
+ - target: mysql
+ condition:
+ - assert:
+ - state: [{valid_values: [started, available]}]
+ - my_attribute: [{equal: ready }]
+ steps:
+ my_step:
+ target: mysql
+ activities:
+ - call_operation: tosca.interfaces.nodes.custom.Backup.backup
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml
new file mode 100644
index 0000000..d86177a
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml
@@ -0,0 +1,45 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+metadata:
+ outcome: "fail"
+
+imports:
+ - examples: tosca/tosca-examples-types.yaml
+
+topology_template:
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ db:
+ type: tosca.nodes.DBMS.MySQL
+ requirements:
+ - host: my_server
+ interfaces:
+ Standard:
+ stop: stop.sh
+
+ workflows:
+ backup:
+ description: Performs a snapshot of the MySQL data.
+ preconditions:
+ - target: my_server
+ condition:
+ - assert:
+ - state: [{equal: available}]
+ - target: my_server
+ condition:
+ - assert:
+ - state: [{valid_values: [started, available]}]
+ - my_attribute: [{equal: ready }]
+ steps:
+ backup_step:
+ target: db
+ filter: # filter is a list of clauses. Matching between clauses is and.
+ - or: # only one of sub-clauses must be true.
+ - assert:
+ - foo: [{equals: true}]
+ - assert:
+ - bar: [{greater_than: 2}, {less_than: 20}]
+ activities:
+ - call_operation: tosca.interfaces.node.lifecycle.Standard.stop
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml
new file mode 100644
index 0000000..b26f53a
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml
@@ -0,0 +1,42 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+imports:
+ - examples: tosca/tosca-examples-types.yaml
+
+topology_template:
+ node_templates:
+ my_server:
+ type: tosca.nodes.Compute
+ db:
+ type: tosca.nodes.DBMS.MySQL
+ requirements:
+ - host: my_server
+ interfaces:
+ Standard:
+ stop: stop.sh
+
+ workflows:
+ backup:
+ description: Performs a snapshot of the MySQL data.
+ preconditions:
+ - target: my_server
+ condition:
+ - assert:
+ - state: [{equal: available}]
+ - target: my_server
+ condition:
+ - assert:
+ - state: [{valid_values: [started, available]}]
+ - my_attribute: [{equal: ready }]
+ steps:
+ backup_step:
+ target: db
+ filter: # filter is a list of clauses. Matching between clauses is and.
+ - or: # only one of sub-clauses must be true.
+ - assert:
+ - foo: [{equals: true}]
+ - assert:
+ - bar: [{greater_than: 2}, {less_than: 20}]
+ activities:
+ - call_operation: Standard.stop
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml
new file mode 100644
index 0000000..0600a12
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml
@@ -0,0 +1,26 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+node_types:
+ org.onap.tosca.checker.Appliance:
+ properties:
+ brand:
+ type: string
+ required: true
+ color:
+ type: string
+ required: true
+ warrantyDuration:
+ type: string
+ required: true
+ price:
+ type: float
+ required: true
+ power_type:
+ type: string
+ default: "electric"
+ constraints:
+ - valid_values: ["electric", "gas"]
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml
new file mode 100644
index 0000000..b095297
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml
@@ -0,0 +1,44 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+
+metadata:
+ outcome: "success"
+
+node_types:
+ org.onap.tosca.checker.Appliance:
+ properties:
+ brand:
+ type: string
+ required: true
+ color:
+ type: string
+ required: true
+ warrantyDuration:
+ type: string
+ required: true
+ price:
+ type: float
+ required: true
+ power_type:
+ type: string
+ default: "electric"
+ constraints:
+ - valid_values: ["electric", "gas"]
+
+ org.onap.tosca.checker.Dishwasher:
+ derived_from: org.onap.tosca.checker.Appliance
+ properties:
+ waterFiltration:
+ type: boolean
+ required: false
+ default: false
+ numberOfCycles:
+ type: integer
+ required: false
+ rackMaterial:
+ type: string
+ required: true
+ energyStar:
+ type: boolean
+ required: true
+
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml
new file mode 100644
index 0000000..d71d466
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml
@@ -0,0 +1,10 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: reference to non-existing super type
+
+metadata:
+ outcome: "fail"
+
+node_types:
+ org.onap.tosca.checker.Appliance:
+ derived_from: org.onap.tosca.checker.Object
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml
new file mode 100644
index 0000000..752a973
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml
@@ -0,0 +1,29 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: defines a property of a user defined data type
+
+metadata:
+ outcome: "success"
+
+imports:
+ - basic: "spec/node_types/node_type_basic.yaml"
+
+data_types:
+ org.onap.tosca.checker.SmartHouseSupport:
+ properties:
+ alexaSupport:
+ type: boolean
+ default: false
+ homekitSuppport:
+ type: boolean
+ default: false
+ googlehomeSupport:
+ type: boolean
+ default: false
+
+node_types:
+ org.onap.tosca.checker.SmartAppliance:
+ derived_from: org.onap.tosca.checker.Appliance
+ properties:
+ environmentSupport:
+ type: org.onap.tosca.checker.SmartHouseSupport
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml
new file mode 100644
index 0000000..66ff83d
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml
@@ -0,0 +1,24 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: test basic property value assignment
+
+metadata:
+ outcome: "success"
+
+imports:
+ - appliances: spec/node_types/node_type_with_hierarchy.yaml
+
+topology_template:
+
+ node_templates:
+ dishwasher:
+ type: org.onap.tosca.checker.Dishwasher
+ properties:
+ brand: Samsung
+ color: white
+ warrantyDuration: 1 year
+ price: 550
+ numberOfCycles: 6
+ rackMaterial: stainless
+ energyStar: false
+
+
diff --git a/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml
new file mode 100644
index 0000000..bb418a7
--- /dev/null
+++ b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml
@@ -0,0 +1,24 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+description: test invalid property value assignment (numberOfCycles expects an integer)
+
+metadata:
+ outcome: "fail"
+
+imports:
+ - appliances: spec/node_types/node_type_with_hierarchy.yaml
+
+topology_template:
+
+ node_templates:
+ dishwasher:
+ type: org.onap.tosca.checker.Dishwasher
+ properties:
+ brand: Samsung
+ color: white
+ warrantyDuration: 1 year
+ price: 550
+ numberOfCycles: unknown
+ rackMaterial: stainless
+ energyStar: false
+
+