From 6472ad24f759b8530a12200f5e0c2c46a298a4a5 Mon Sep 17 00:00:00 2001
From: aai <aai@kereval.com>
Date: Fri, 7 Jan 2022 18:17:54 +0100
Subject: [PATCH] Add GOC Annotations Module, and add missing ITs/UTs then
 apply @Covers on them

---
 archetype/generated-validator/pom.xml         |   8 +
 .../gazelle/goc/ValidatorInstantiator.java    |   4 +-
 .../goc-tests/goc-annotations/pom.xml         | 167 ++++++++++++++++++
 .../definitions/annotations/Covers.java       |  19 ++
 .../definitions/annotations/TestType.java     |  20 +++
 .../models/AnnotatedTestMethod.java           | 101 +++++++++++
 .../processors/CoverageProcessor.java         |  50 ++++++
 .../processors/MethodTestIdentifier.java      |  24 +++
 .../processors/ReportGenerator.java           |  47 +++++
 .../goctests/definitions/utils/CSVUtils.java  |  54 ++++++
 .../utils/CoverageProcessorUtil.java          |  54 ++++++
 hl7templates/goc-tests/pom.xml                |  46 +++++
 hl7templates/gocmodel-jar/pom.xml             |   5 +
 .../hl7templates-generator-jar/.gitignore     |   1 +
 .../RDprocessors/test/ItemsProcessorIT.java   |  54 ++++++
 .../test/MultiplicityProcessorsIT.java        | 132 ++++++++++++++
 .../test/VocabularyProcessorsIT.java          | 103 +++++++++++
 .../assertions/test/XPATHValidationIT.java    |   2 +
 .../choice/test/AssertionChoicesIT.java       |   3 +-
 .../ContainMaximumMultiplicityAnalyzerIT.java |   3 +
 .../ContainMinimumMultiplicityAnalyzerIT.java |   3 +
 ...toryIT.java => RDMandatoryAnalyzerIT.java} |  31 +++-
 ...a => RDMaximumMultiplicityAnalyzerIT.java} |  21 ++-
 .../test/RDMinimumMultiplicityAnalyzerIT.java |  27 ++-
 .../resources/decor_custodian_optional.xml    |  39 ++++
 .../src/test/resources/decor_obs_conf_C.xml   |  59 +++++++
 .../src/test/resources/decor_obs_conf_M.xml   |  59 +++++++
 .../src/test/resources/decor_obs_conf_O.xml   |  59 +++++++
 .../src/test/resources/decor_obs_conf_R.xml   |  59 +++++++
 .../test/resources/processors/decor_item.xml  |  31 ++++
 .../processors/decor_multiplicity_0_2_R.xml   |  59 +++++++
 .../processors/decor_multiplicity_0_n_R.xml   |  59 +++++++
 .../processors/decor_multiplicity_1_n_R.xml   |  59 +++++++
 .../processors/decor_multiplicity_NP.xml      |  59 +++++++
 .../resources/processors/decor_vocab_VS.xml   |  31 ++++
 .../processors/decor_vocab_VS_dynamic.xml     |  31 ++++
 .../processors/decor_vocab_fixdedVal.xml      |  31 ++++
 pom.xml                                       |  24 ++-
 38 files changed, 1625 insertions(+), 13 deletions(-)
 create mode 100644 hl7templates/goc-tests/goc-annotations/pom.xml
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/Covers.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/TestType.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/models/AnnotatedTestMethod.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/CoverageProcessor.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/MethodTestIdentifier.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/ReportGenerator.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CSVUtils.java
 create mode 100644 hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CoverageProcessorUtil.java
 create mode 100644 hl7templates/goc-tests/pom.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/ItemsProcessorIT.java
 create mode 100644 hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/MultiplicityProcessorsIT.java
 create mode 100644 hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/VocabularyProcessorsIT.java
 rename hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/{RDMandatoryIT.java => RDMandatoryAnalyzerIT.java} (61%)
 rename hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/{RDMaximumMultiplicityIT.java => RDMaximumMultiplicityAnalyzerIT.java} (75%)
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/decor_custodian_optional.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_C.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_M.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_O.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_R.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_item.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_2_R.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_n_R.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_1_n_R.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_NP.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS_dynamic.xml
 create mode 100644 hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_fixdedVal.xml

diff --git a/archetype/generated-validator/pom.xml b/archetype/generated-validator/pom.xml
index e919359..ed6c5b6 100644
--- a/archetype/generated-validator/pom.xml
+++ b/archetype/generated-validator/pom.xml
@@ -42,4 +42,12 @@
             </plugin>
         </plugins>
     </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>net.ihe.gazelle.goctests</groupId>
+            <artifactId>goc-annotations</artifactId>
+            <version>3.0.4-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/archetype/generated-validator/validator-archetype-instantiator/src/main/java/net/ihe/gazelle/goc/ValidatorInstantiator.java b/archetype/generated-validator/validator-archetype-instantiator/src/main/java/net/ihe/gazelle/goc/ValidatorInstantiator.java
index 0c10a73..b2ed43f 100644
--- a/archetype/generated-validator/validator-archetype-instantiator/src/main/java/net/ihe/gazelle/goc/ValidatorInstantiator.java
+++ b/archetype/generated-validator/validator-archetype-instantiator/src/main/java/net/ihe/gazelle/goc/ValidatorInstantiator.java
@@ -20,10 +20,12 @@ public class ValidatorInstantiator {
         if(javaHome != null && !javaHome.isEmpty()){
             javaEnv = "env $JAVA_HOME=\""+javaHome+"\" ";
         }
+        String version = getVersion();
+        version = version==null?gocVersion:version;
         return CD_COMMAND + workspacePath + "\"\n" + javaEnv + mvnExecPath + " org.apache.maven.plugins:maven-archetype-plugin:2.3:generate -B " +
                 "-DarchetypeGroupId=net.ihe.gazelle.goc " +
                 "-DarchetypeArtifactId=validator-archetype " +
-                "-DarchetypeVersion=" + getVersion() + " " +
+                "-DarchetypeVersion=" + version + " " +
                 "-DprojectName=" + projectName + " " +
                 "-DgroupId=net.ihe.gazelle.goc " +
                 "-DartifactId=" + projectName + "-validator-jar " +
diff --git a/hl7templates/goc-tests/goc-annotations/pom.xml b/hl7templates/goc-tests/goc-annotations/pom.xml
new file mode 100644
index 0000000..108c69f
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/pom.xml
@@ -0,0 +1,167 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <artifactId>goc-tests</artifactId>
+        <groupId>net.ihe.gazelle</groupId>
+        <version>3.0.4-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>net.ihe.gazelle.goctests</groupId>
+    <artifactId>goc-annotations</artifactId>
+    <name>GOC Annotations</name>
+    <version>3.0.4-SNAPSHOT</version>
+
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.20</version>
+                <configuration>
+                    <argLine>-Dfile.encoding=UTF-8</argLine>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.maven.surefire</groupId>
+                        <artifactId>surefire-junit47</artifactId>
+                        <version>2.20</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+
+
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.17</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <argLine>-DHL7TEMP_RESOURCES_PATH="/tmp/GOCResources/hl7templates-resources"</argLine>
+                </configuration>
+            </plugin>
+
+            <plugin>
+
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.8.1</version>
+                <configuration>
+                    <source>11</source>
+                    <target>11</target>
+                    <annotationProcessors>
+                        <annotationProcessor>
+                            net.ihe.gazelle.goctests.definitions.processors.CoverageProcessor
+                        </annotationProcessor>
+                    </annotationProcessors>
+                </configuration>
+                <executions> <!-- exclude src from annotation processing -->
+                    <execution>
+                        <id>default-compile</id>
+                        <goals>
+                            <goal>compile</goal>
+                            <goal>testCompile</goal>
+                        </goals>
+                        <configuration>
+                            <proc>none</proc>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.17</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.4</version>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>gazelle-plugins</artifactId>
+                <version>1.60</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <version>2.9</version>
+            </plugin>
+        </plugins>
+    </reporting>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.7.30</version>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>apache-log4j-extras</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.10</version>
+            <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+            <groupId>apache-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.3</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sf.trove4j</groupId>
+            <artifactId>trove4j</artifactId>
+            <version>3.0.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.auto.service</groupId>
+            <artifactId>auto-service</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+
+
+
+    </dependencies>
+</project>
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/Covers.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/Covers.java
new file mode 100644
index 0000000..7ff55fa
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/Covers.java
@@ -0,0 +1,19 @@
+package net.ihe.gazelle.goctests.definitions.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Covers {
+
+    String[] requirements();
+
+    TestType testType() default TestType.UNIT_TEST;
+
+    String comment() default "";
+
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/TestType.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/TestType.java
new file mode 100644
index 0000000..7a0448b
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/annotations/TestType.java
@@ -0,0 +1,20 @@
+package net.ihe.gazelle.goctests.definitions.annotations;
+
+public enum TestType {
+
+    SYSTEM_TEST("system-test"),
+    UNIT_TEST("unit-test"),
+    INTEGRATION_TEST("integration-test");
+
+    private String value;
+
+    private TestType(String value){
+        this.value = value;
+    }
+
+    public String getValue(){
+        return value;
+    }
+
+
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/models/AnnotatedTestMethod.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/models/AnnotatedTestMethod.java
new file mode 100644
index 0000000..4e56eed
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/models/AnnotatedTestMethod.java
@@ -0,0 +1,101 @@
+package net.ihe.gazelle.goctests.definitions.models;
+
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
+
+import java.util.Arrays;
+
+public class AnnotatedTestMethod {
+
+    private String methodName;
+
+    private String[] requirements;
+
+    private TestType testType;
+
+    private String packageName;
+
+    private String className;
+
+    private String comment;
+
+    public AnnotatedTestMethod() {
+    }
+
+    public AnnotatedTestMethod(String methodName) {
+        this.methodName = methodName;
+    }
+
+    public String getMethodName() {
+        return methodName;
+    }
+
+    public AnnotatedTestMethod(String methodName, String[] requirements, TestType testType, String packageName, String className) {
+        this(methodName, requirements, testType, packageName, className, "");
+
+    }
+
+    public AnnotatedTestMethod(String methodName, String[] requirements, TestType testType, String packageName, String className, String comment) {
+        this.methodName = methodName;
+        this.requirements = requirements;
+        this.testType = testType;
+        this.packageName = packageName;
+        this.className = className;
+        this.comment = comment;
+    }
+
+    public void setMethodName(String methodName) {
+        this.methodName = methodName;
+    }
+
+    public String[] getRequirements() {
+        return requirements;
+    }
+
+    public void setRequirements(String[] requirements) {
+        this.requirements = requirements;
+    }
+
+    public TestType getTestType() {
+        return testType;
+    }
+
+    public void setTestType(TestType testType) {
+        this.testType = testType;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    @Override
+    public String toString() {
+        return "AnnotatedTestMethod{" +
+                "methodName='" + methodName + '\'' +
+                ", requirements=" + Arrays.toString(requirements) +
+                ", testType=" + testType +
+                ", packageName='" + packageName + '\'' +
+                ", className='" + className + '\'' +
+                ", comment='" + comment + '\'' +
+                '}';
+    }
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/CoverageProcessor.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/CoverageProcessor.java
new file mode 100644
index 0000000..90b0392
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/CoverageProcessor.java
@@ -0,0 +1,50 @@
+package net.ihe.gazelle.goctests.definitions.processors;
+
+import com.google.auto.service.AutoService;
+import net.ihe.gazelle.goctests.definitions.models.AnnotatedTestMethod;
+import net.ihe.gazelle.goctests.definitions.utils.CoverageProcessorUtil;
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+@SupportedAnnotationTypes("net.ihe.gazelle.goctests.*")
+@SupportedSourceVersion(SourceVersion.RELEASE_11)
+@AutoService(Processor.class)
+public class CoverageProcessor extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+
+        System.out.println("Start coverage processing");
+
+        for(TypeElement annotation : annotations){
+
+            Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(annotation);
+            Map<Boolean, List<Element>> annotatedMethods = annotatedElements.stream()
+                    .collect(Collectors.partitioningBy(element ->
+                            (CoverageProcessorUtil.isElementIdentifierValide(element))));
+
+            //Generate the report
+            List<AnnotatedTestMethod> validMethods = CoverageProcessorUtil.getAnnotatedTestMethods(annotatedMethods.get(true));
+            ReportGenerator reportGenerator = new ReportGenerator(validMethods, annotatedMethods.get(false));
+            try {
+                reportGenerator.generateReport();
+            } catch (IOException e) {
+                System.err.println("The following error has occured: "+e.getMessage());
+                System.err.println("Coverage report not generated");
+            }
+
+        }
+
+        return false;
+    }
+
+
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/MethodTestIdentifier.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/MethodTestIdentifier.java
new file mode 100644
index 0000000..e738cd1
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/MethodTestIdentifier.java
@@ -0,0 +1,24 @@
+package net.ihe.gazelle.goctests.definitions.processors;
+
+/**
+ * Allowed prefixes and suffixes for test methods, to be recognized by the test-coverage processing
+ */
+
+public enum MethodTestIdentifier {
+
+    test("test"),
+    Test("Test"),
+    it("it"),
+    It("It"),
+    IT("IT");
+
+    private String value;
+
+    private MethodTestIdentifier(String value){
+        this.value = value;
+    }
+
+    public String getValue(){
+        return value;
+    }
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/ReportGenerator.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/ReportGenerator.java
new file mode 100644
index 0000000..c6e87a8
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/processors/ReportGenerator.java
@@ -0,0 +1,47 @@
+package net.ihe.gazelle.goctests.definitions.processors;
+
+import net.ihe.gazelle.goctests.definitions.models.AnnotatedTestMethod;
+import net.ihe.gazelle.goctests.definitions.utils.CSVUtils;
+
+import javax.lang.model.element.Element;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ReportGenerator {
+
+    private final List<AnnotatedTestMethod> validMethods;
+    private final List<Element> invalidMethods;
+
+    public ReportGenerator(List<AnnotatedTestMethod> validMethods, List<Element> invalidMethods) {
+        this.validMethods = validMethods;
+        this.invalidMethods = invalidMethods;
+    }
+
+    public void generateReport() throws IOException {
+        String filePath = System.getProperty("csv");
+        Object element;
+
+        if(filePath == null || filePath.isEmpty()){
+            throw new IOException("CSV File path not provided, please set it as system property");
+        }
+
+        List<String[]> document = new ArrayList<>();
+        for(AnnotatedTestMethod method : validMethods){
+            document.add(new String[]{method.getMethodName(),
+                    String.join(",",method.getRequirements()),
+                    method.getTestType().getValue(),
+                    method.getPackageName(),
+                    method.getClassName(),
+                    method.getComment()});
+        }
+        CSVUtils.WriteDataToCSV(document,filePath);
+
+        System.out.println("Report created successfully at: "+filePath);
+
+
+
+    }
+
+
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CSVUtils.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CSVUtils.java
new file mode 100644
index 0000000..3c04f29
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CSVUtils.java
@@ -0,0 +1,54 @@
+package net.ihe.gazelle.goctests.definitions.utils;
+
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class CSVUtils {
+
+    private final static String CSV_COLONE_1 = "Methode name";
+    private final static String CSV_COLONE_2 = "requirement";
+    private final static String CSV_COLONE_3 = "Test type";
+    private final static String CSV_COLONE_4 = "Package name";
+    private final static String CSV_COLONE_5 = "Class Name";
+    private final static String CSV_COLONE_6 = "Comments";
+
+    private final static String CSV_HEADER = CSV_COLONE_1+","+CSV_COLONE_2+","+CSV_COLONE_3+","+CSV_COLONE_4+","+CSV_COLONE_5+","+CSV_COLONE_6;
+
+    private static final Pattern ESCAPED_DATA_PATT = Pattern.compile("\\R");
+
+    public static String convertLineToCSV(String[] line){
+        return Stream.of(line)
+                .map(CSVUtils::escapeSpecialCharacters)
+                .collect(Collectors.joining(","));
+    }
+
+    public static void WriteDataToCSV(List<String[]> data, String filePath) throws IOException {
+        boolean filExist = Files.exists(Path.of(filePath));
+        FileWriter fileWriter = new FileWriter(filePath,true);
+        PrintWriter printWriter = new PrintWriter(fileWriter);
+        if(!filExist){
+            printWriter.println(CSV_HEADER);
+        }
+        data.stream()
+                .map(CSVUtils::convertLineToCSV)
+                .forEach(printWriter::println);
+        printWriter.close();
+    }
+
+
+    public static String escapeSpecialCharacters(String data) {
+        String escapedData = ESCAPED_DATA_PATT.matcher(data).replaceAll(" ");
+        if (data.contains(",") || data.contains("\"") || data.contains("'")) {
+            data = data.replace("\"", "\"\"");
+            escapedData = "\"" + data + "\"";
+        }
+        return escapedData;
+    }
+
+
+}
diff --git a/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CoverageProcessorUtil.java b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CoverageProcessorUtil.java
new file mode 100644
index 0000000..6d01cd4
--- /dev/null
+++ b/hl7templates/goc-tests/goc-annotations/src/main/java/net/ihe/gazelle/goctests/definitions/utils/CoverageProcessorUtil.java
@@ -0,0 +1,54 @@
+package net.ihe.gazelle.goctests.definitions.utils;
+
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
+import net.ihe.gazelle.goctests.definitions.models.AnnotatedTestMethod;
+import net.ihe.gazelle.goctests.definitions.processors.MethodTestIdentifier;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.PackageElement;
+import java.util.List;
+import java.util.stream.Collectors;
+
+final public class CoverageProcessorUtil {
+
+    private CoverageProcessorUtil(){}
+
+
+    public static boolean isElementIdentifierValide(Element element){
+        if(element == null || element.getSimpleName() == null){
+            return false;
+        }
+        return isElementIdentifierValide(element.getSimpleName().toString());
+    }
+
+
+    public static boolean isElementIdentifierValide(String stringIdentifier){
+        if(stringIdentifier == null){
+            return  false;
+        }
+        for(MethodTestIdentifier methodTestIdentifier:MethodTestIdentifier.values()){
+            if(stringIdentifier.startsWith(methodTestIdentifier.getValue())
+                    ||stringIdentifier.endsWith(methodTestIdentifier.getValue())){
+                return  true;
+            }
+        }
+        return false;
+    }
+
+    public static List<AnnotatedTestMethod> getAnnotatedTestMethods(List<Element> methods){
+        return
+                methods.stream()
+                        .map(method -> {
+                            String methodName = method.getSimpleName().toString();
+                            String[] requirements = method.getAnnotation(Covers.class).requirements();
+                            TestType testType = method.getAnnotation(Covers.class).testType();
+                            String comment = method.getAnnotation(Covers.class).comment();
+                            String packageName = ((PackageElement) (method.getEnclosingElement().getEnclosingElement())).toString();
+                            String className = method.getEnclosingElement().getSimpleName().toString();
+                            return  new AnnotatedTestMethod(methodName, requirements, testType, packageName, className, comment);
+                        })
+                        .collect(Collectors.toList());
+    }
+
+}
diff --git a/hl7templates/goc-tests/pom.xml b/hl7templates/goc-tests/pom.xml
new file mode 100644
index 0000000..1e8025b
--- /dev/null
+++ b/hl7templates/goc-tests/pom.xml
@@ -0,0 +1,46 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <artifactId>gazelle-objects-checker</artifactId>
+        <groupId>net.ihe.gazelle</groupId>
+        <version>3.0.4-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>net.ihe.gazelle</groupId>
+    <artifactId>goc-tests</artifactId>
+    <name>GOC Tests</name>
+    <version>3.0.4-SNAPSHOT</version>
+
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>goc-annotations</module>
+        <module>goc-tests-runner</module>
+    </modules>
+
+    <organization>
+        <name>IHE-Europe</name>
+        <url>https://ihe-europe.net/</url>
+    </organization>
+    <description>
+        This module defines System Tests for Gazelle Objects Checker based on a prototyping BBR
+    </description>
+    <issueManagement>
+        <system>JIRA</system>
+        <url>https://gazelle.ihe.net/jira/projects/GOC</url>
+    </issueManagement>
+
+    <inceptionYear>2021</inceptionYear>
+
+    <developers>
+        <developer>
+            <name>Achraf Achkari</name>
+            <email>achraf.achkari-begdouri@kereval.com</email>
+        </developer>
+    </developers>
+
+
+
+</project>
\ No newline at end of file
diff --git a/hl7templates/gocmodel-jar/pom.xml b/hl7templates/gocmodel-jar/pom.xml
index ec74fd7..5edc768 100644
--- a/hl7templates/gocmodel-jar/pom.xml
+++ b/hl7templates/gocmodel-jar/pom.xml
@@ -334,6 +334,11 @@
             <artifactId>commons-io</artifactId>
             <version>2.6</version>
         </dependency>
+        <dependency>
+            <groupId>net.ihe.gazelle.goctests</groupId>
+            <artifactId>goc-annotations</artifactId>
+            <version>3.0.4-SNAPSHOT</version>
+        </dependency>
 
     </dependencies>
 </project>
diff --git a/hl7templates/hl7templates-generator-jar/.gitignore b/hl7templates/hl7templates-generator-jar/.gitignore
index 821f4de..f8ec57a 100644
--- a/hl7templates/hl7templates-generator-jar/.gitignore
+++ b/hl7templates/hl7templates-generator-jar/.gitignore
@@ -15,3 +15,4 @@
 /src/test/resources/out
 
 /src/test/java/net/ihe/gazelle/tempgen/ignoredTests/
+/src/it/java/net/ihe/gazelle/tempgen/lab/
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/ItemsProcessorIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/ItemsProcessorIT.java
new file mode 100644
index 0000000..f9ac54e
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/ItemsProcessorIT.java
@@ -0,0 +1,54 @@
+package net.ihe.gazelle.tempgen.RDprocessors.test;
+
+import net.ihe.gazelle.goc.uml.utils.PackagedElementUtil;
+import net.ihe.gazelle.goc.xmm.OwnedRule;
+import net.ihe.gazelle.goc.xmm.PackagedElement;
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
+import net.ihe.gazelle.tempgen.action.RuleDefinitionAnalyzer;
+import net.ihe.gazelle.tempgen.handler.ProblemHandler;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.Decor;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.*;
+import net.ihe.gazelle.validation.Notification;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ItemsProcessorIT extends RuleDefinitionAnalyzer {
+
+    @Ignore
+    @Test
+    public void print(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_vocab_VS.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition code = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        RuleDefinition observation = RuleDefinitionUtil.getElementByName(code,"hl7:observation");
+        this.selectedRuleDefinition = code;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processVocabularys(code.getVocabulary());
+
+
+        for(OwnedRule ownedRule : this.currentPackagedElement.getOwnedRule()){
+            System.out.println(ownedRule.getSpecification().getBody());
+            System.out.println(ownedRule.getOwnedRuleKind().getValue());
+            System.out.println(ownedRule.getOwnedRuleType().getValue());
+        }
+        for(Notification notification : ProblemHandler.getDiagnostic()){
+            System.out.println(notification.getDescription());
+        }
+    }
+
+    @Covers(requirements = {"GOC-021"}, testType = TestType.INTEGRATION_TEST, comment = "RuleDefinitions Coverage")
+    @Test
+    public void testProcessItem(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_item.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition value = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        RuleDefinitionAnalyzer rda = new RuleDefinitionAnalyzer();
+        PackagedElement pe = PackagedElementUtil.initPackagedElement();
+        rda.process(value,pe);
+        assertEquals(1,pe.getOwnedRule().size());
+        assertTrue(pe.getOwnedRule().get(0).getOwnedComment().getBody().contains("(Item : CONF-test)"));
+    }
+}
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/MultiplicityProcessorsIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/MultiplicityProcessorsIT.java
new file mode 100644
index 0000000..5144b02
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/MultiplicityProcessorsIT.java
@@ -0,0 +1,132 @@
+package net.ihe.gazelle.tempgen.RDprocessors.test;
+
+import net.ihe.gazelle.goc.uml.utils.PackagedElementUtil;
+import net.ihe.gazelle.goc.xmm.OwnedRule;
+import net.ihe.gazelle.goc.xmm.OwnedRuleKind;
+import net.ihe.gazelle.goc.xmm.OwnedRuleType;
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
+import net.ihe.gazelle.tempgen.action.RuleDefinitionAnalyzer;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.Decor;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.DecorMarshaller;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.RuleDefinitionUtil;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.RulesUtil;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.TemplateDefinitionUtil;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+
+public class MultiplicityProcessorsIT extends RuleDefinitionAnalyzer {
+
+
+
+
+    /**
+     * Test with the min 0 and conformance R, expected to have a size()>1 but just a warning
+     */
+    @Covers(requirements = {"GOC-001","GOC-028"}, testType = TestType.INTEGRATION_TEST, comment = "RuleDefintions Coverage")
+    @Test
+    public void testProcessMinimumMultiplicity_0_R(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_multiplicity_0_n_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        this.selectedRuleDefinition = entry;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processMinimumMultiplicity(entry.getMinimumMultiplicity());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("(not self.nullFlavor.oclIsUndefined()) or self.entryRelationship" +
+                "->select((not observation.code.code.oclIsUndefined()) " +
+                "and observation.code.code='48766-0')->size()>0",
+                ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.CARDINALITY,ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.WARNING,ownedRule.getOwnedRuleType());
+
+    }
+
+    /**
+     * Test with the min 1 (or >) and conformance R, expected to have a size()>1 with an a error
+     */
+    @Covers(requirements = {"GOC-009","GOC-028"}, testType = TestType.INTEGRATION_TEST, comment = "RuleDefintions Coverage")
+    @Test
+    public void testProcessMinimumMultiplicity_1_R(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_multiplicity_1_n_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        this.selectedRuleDefinition = entry;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processMinimumMultiplicity(entry.getMinimumMultiplicity());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("(not self.nullFlavor.oclIsUndefined()) or self.entryRelationship" +
+                        "->select((not observation.code.code.oclIsUndefined()) " +
+                        "and observation.code.code='48766-0')->size()>0",
+                ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.CARDINALITY,ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.ERROR,ownedRule.getOwnedRuleType());
+
+    }
+
+//    @Covers(requirements = {"GOC-009"}, testType = TestType.INTEGRATION_TEST)
+
+    /**
+     * The NP and C conformances are not processed by goc: GOC-010, GOC-011
+     */
+    @Ignore
+    @Test
+    public void testProcessMinimumMultiplicity_NP(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_multiplicity_1_n_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        this.selectedRuleDefinition = entry;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processMinimumMultiplicity(entry.getMinimumMultiplicity());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("(not self.nullFlavor.oclIsUndefined()) or self.entryRelationship" +
+                        "->select((not observation.code.code.oclIsUndefined()) " +
+                        "and observation.code.code='48766-0')->size()>0",
+                ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.CARDINALITY,ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.ERROR,ownedRule.getOwnedRuleType());
+
+    }
+
+    @Covers(requirements = {"GOC-004"}, testType = TestType.INTEGRATION_TEST, comment = "RuleDefintions Coverage")
+    @Test
+    public void testProcessMaximumMultiplicity_n(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_multiplicity_0_n_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        this.selectedRuleDefinition = entry;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processMaximumMultiplicity(entry.getMaximumMultiplicity());
+        assertEquals(0,this.currentPackagedElement.getOwnedRule().size());
+
+    }
+
+    @Covers(requirements = {"GOC-003","GOC-026"}, testType = TestType.INTEGRATION_TEST, comment = "RuleDefintions Coverage")
+    @Test
+    public void testProcessMaximumMultiplicity_2(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_multiplicity_0_2_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        this.selectedRuleDefinition = entry;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processMaximumMultiplicity(entry.getMaximumMultiplicity());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("self.entryRelationship->select((not observation.code.code.oclIsUndefined()) " +
+                "and observation.code.code='48766-0')->size()<3",ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.CARDINALITY,ownedRule.getOwnedRuleKind());
+
+    }
+
+
+
+
+
+
+}
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/VocabularyProcessorsIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/VocabularyProcessorsIT.java
new file mode 100644
index 0000000..7c89796
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/RDprocessors/test/VocabularyProcessorsIT.java
@@ -0,0 +1,103 @@
+package net.ihe.gazelle.tempgen.RDprocessors.test;
+
+import net.ihe.gazelle.goc.uml.utils.PackagedElementUtil;
+import net.ihe.gazelle.goc.xmm.OwnedRule;
+import net.ihe.gazelle.goc.xmm.OwnedRuleKind;
+import net.ihe.gazelle.goc.xmm.OwnedRuleType;
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
+import net.ihe.gazelle.tempgen.action.RuleDefinitionAnalyzer;
+import net.ihe.gazelle.tempgen.handler.ProblemHandler;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.Decor;
+import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.DecorMarshaller;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.RuleDefinitionUtil;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.RulesUtil;
+import net.ihe.gazelle.tempmodel.org.decor.art.utils.TemplateDefinitionUtil;
+import net.ihe.gazelle.validation.Notification;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+
+public class VocabularyProcessorsIT extends RuleDefinitionAnalyzer {
+
+    @Ignore
+    @Test
+    public void print(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_vocab_VS_dynamic.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition code = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        RuleDefinition observation = RuleDefinitionUtil.getElementByName(code,"hl7:observation");
+        this.selectedRuleDefinition = code;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processVocabularys(code.getVocabulary());
+
+
+        for(OwnedRule ownedRule : this.currentPackagedElement.getOwnedRule()){
+            System.out.println(ownedRule.getSpecification().getBody());
+            System.out.println(ownedRule.getOwnedRuleKind().getValue());
+            System.out.println(ownedRule.getOwnedRuleType().getValue());
+        }
+        for(Notification notification : ProblemHandler.getDiagnostic()){
+            System.out.println(notification.getDescription());
+        }
+    }
+
+
+    @Covers(requirements = {"GOC-012"},testType = TestType.INTEGRATION_TEST, comment = "RuleDefinitions Coverage")
+    @Test
+    public void testProcessVocabularys_FixedVal(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_vocab_fixdedVal.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition value = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        this.selectedRuleDefinition = value;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processVocabularys(value.getVocabulary());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("self.value->forAll( (not nullFlavor.oclIsUndefined()) " +
+                "or (((oclAsType(CS).codeSystem.oclIsUndefined()) or oclAsType(CS).codeSystem='1.2.3')))",
+                ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.VOCABULARY, ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.ERROR, ownedRule.getOwnedRuleType());
+    }
+
+    @Covers(requirements = {"GOC-013","GOC-017"},testType = TestType.INTEGRATION_TEST, comment = "RuleDefinitions Coverage")
+    @Test
+    public void testProcessVocabularys_VS(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_vocab_VS.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition value = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        this.selectedRuleDefinition = value;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processVocabularys(value.getVocabulary());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("self.value->forAll( (not nullFlavor.oclIsUndefined()) or ((not oclAsType(CS).code.oclIsUndefined()) and " +
+                        "CommonOperationsStatic::matchesCodeToValueSet('1.3.6.1.4.1.12559.11.10.1.3.1.42.10&version=2015-01-01T01:02:02', oclAsType(CS).code)))",
+                        ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.VOCABULARY, ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.ERROR, ownedRule.getOwnedRuleType());
+    }
+
+    @Covers(requirements = {"GOC-018"},testType = TestType.INTEGRATION_TEST, comment = "RuleDefinitions Coverage")
+    @Test
+    public void testProcessVocabularys_VS_dynamic(){
+        Decor decor = DecorMarshaller.loadDecor("src/test/resources/processors/decor_vocab_VS_dynamic.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decor.getRules()).get(0));
+        RuleDefinition value = RuleDefinitionUtil.getElementByName(firstRD, "hl7:value");
+        this.selectedRuleDefinition = value;
+        this.currentPackagedElement = PackagedElementUtil.initPackagedElement();
+        this.processVocabularys(value.getVocabulary());
+        assertEquals(1,this.currentPackagedElement.getOwnedRule().size());
+        OwnedRule ownedRule = this.currentPackagedElement.getOwnedRule().get(0);
+        assertEquals("self.value->forAll( (not nullFlavor.oclIsUndefined()) or ((not oclAsType(CS).code.oclIsUndefined()) " +
+                        "and CommonOperationsStatic::matchesCodeToValueSet('1.3.6.1.4.1.12559.11.10.1.3.1.42.10', oclAsType(CS).code)))",
+                ownedRule.getSpecification().getBody());
+        assertEquals(OwnedRuleKind.VOCABULARY, ownedRule.getOwnedRuleKind());
+        assertEquals(OwnedRuleType.ERROR, ownedRule.getOwnedRuleType());
+    }
+
+
+}
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/assertions/test/XPATHValidationIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/assertions/test/XPATHValidationIT.java
index 5bb1d62..007b3a8 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/assertions/test/XPATHValidationIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/assertions/test/XPATHValidationIT.java
@@ -26,6 +26,8 @@ import static org.junit.Assert.*;
 
 public class XPATHValidationIT extends AssertAnalyzer {
 
+    // Bad cases
+
     private Decor decorTemplate = null;
 //    private List<TemplateDefinition> templateDefinitions = null;
     private TemplateDefinition currentTemplate = null;
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/choice/test/AssertionChoicesIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/choice/test/AssertionChoicesIT.java
index 4e93589..1e2d416 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/choice/test/AssertionChoicesIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/choice/test/AssertionChoicesIT.java
@@ -32,6 +32,7 @@ public class AssertionChoicesIT extends ChoiceDefinitionAnalyzer {
     @Before
     public void setUp(){
         decor = DecorMarshaller.loadDecor("src/test/resources/choices/decor_assertionChoices3.xml");
+//        decor = DecorMarshaller.loadDecor("src/test/resources/choices/decor_helper.xml");
         decor = DecorUtil.cleanupForEffectiveDate(decor);
         decor = GeneralFlattenDecor.generalFlattenDecor(decor);
         td = RulesUtil.getTemplates(decor.getRules()).get(0);
@@ -45,7 +46,7 @@ public class AssertionChoicesIT extends ChoiceDefinitionAnalyzer {
     public void TestPrintChoices(){
         List<RuleDefinition> ruleDefinitions = ChoiceDefinitionUtil.getElements(currentChoice);
         for(RuleDefinition element:ruleDefinitions){
-            
+            System.out.println(element.getName());
         }
         assertEquals(ruleDefinitions.size(),3);
     }
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMaximumMultiplicityAnalyzerIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMaximumMultiplicityAnalyzerIT.java
index 5683d9a..91d78cb 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMaximumMultiplicityAnalyzerIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMaximumMultiplicityAnalyzerIT.java
@@ -1,5 +1,7 @@
 package net.ihe.gazelle.tempgen.rules.analyzer;
 
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
 import net.ihe.gazelle.tempmodel.org.decor.art.model.Decor;
 import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
 import net.ihe.gazelle.tempmodel.org.decor.art.utils.DecorMarshaller;
@@ -20,6 +22,7 @@ public class ContainMaximumMultiplicityAnalyzerIT {
         decorTemplates = DecorMarshaller.loadDecor("src/test/resources/contain/decor_contain_ter_max.xml");
     }
 
+    @Covers(requirements = {"GOC-003"}, testType = TestType.INTEGRATION_TEST)
     @Test
     public void generateOCLConstraint() {
         RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMinimumMultiplicityAnalyzerIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMinimumMultiplicityAnalyzerIT.java
index 85dc74f..632fb97 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMinimumMultiplicityAnalyzerIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/rules/analyzer/ContainMinimumMultiplicityAnalyzerIT.java
@@ -1,5 +1,7 @@
 package net.ihe.gazelle.tempgen.rules.analyzer;
 
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
 import net.ihe.gazelle.tempmodel.org.decor.art.model.Decor;
 import net.ihe.gazelle.tempmodel.org.decor.art.model.RuleDefinition;
 import net.ihe.gazelle.tempmodel.org.decor.art.utils.DecorMarshaller;
@@ -20,6 +22,7 @@ public class ContainMinimumMultiplicityAnalyzerIT {
         decorTemplates = DecorMarshaller.loadDecor("src/test/resources/contain/decor_contain_ter.xml");
     }
 
+    @Covers(requirements = {"GOC-002"}, testType = TestType.INTEGRATION_TEST)
     @Test
     public void testGenerateOCLConstraint1() {
         RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryAnalyzerIT.java
similarity index 61%
rename from hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryIT.java
rename to hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryAnalyzerIT.java
index 2991d67..3d8918f 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMandatoryAnalyzerIT.java
@@ -2,7 +2,10 @@ package net.ihe.gazelle.tempgen.test;
 
 import static org.junit.Assert.assertTrue;
 
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import net.ihe.gazelle.tempgen.rules.analyzer.RDMandatoryAnalyzer;
@@ -18,18 +21,21 @@ import net.ihe.gazelle.tempmodel.org.decor.art.utils.TemplateDefinitionUtil;
  * @author Abderrazek Boufahja
  *
  */
-public class RDMandatoryIT {
+public class RDMandatoryAnalyzerIT {
 	
-	Decor decorTemplates = null;
+	Decor decorTemplatesMandatory = null;
+	Decor decorTemplatesNotMandatory = null;
 	
 	@Before
 	public void setUp(){
-		decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_custodian.xml");
+		decorTemplatesMandatory = DecorMarshaller.loadDecor("src/test/resources/decor_custodian.xml");
+		decorTemplatesNotMandatory = DecorMarshaller.loadDecor("src/test/resources/decor_custodian_optional.xml");
 	}
 
+	@Covers(requirements = {"GOC-006","GOC-027"}, testType = TestType.INTEGRATION_TEST)
 	@Test
 	public void testGenerateOCLConstraint() {
-		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
+		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplatesMandatory.getRules()).get(0));
 		RuleDefinition custodian = RuleDefinitionUtil.getElementByName(firstRD, "cda:custodian");
 		assertTrue((new RDMandatoryAnalyzer()).generateOCLConstraint(custodian).equals(
 				"self.custodian->forAll(nullFlavor.oclIsUndefined())"));
@@ -38,9 +44,24 @@ public class RDMandatoryIT {
 				"self.custodian.assignedCustodian->forAll(nullFlavor.oclIsUndefined())"));
 	}
 
+
+	/**
+	 * /!\ Should Covers GOC-005 but gives wrong output in the low layer,
+	 * Behaviour correctly provided at processing time, needed "processIsMandatoryTest" to cover
+	 */
+	@Ignore
+	@Test
+	public void testGenerateOCLConstraintNotMandatory(){
+		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplatesNotMandatory.getRules()).get(0));
+		RuleDefinition custodian = RuleDefinitionUtil.getElementByName(firstRD, "cda:custodian");
+		RuleDefinition assignedCustodian = RuleDefinitionUtil.getElementByName(custodian, "cda:assignedCustodian");
+		String gen = (new RDMandatoryAnalyzer()).generateOCLConstraint(assignedCustodian);
+		System.out.println(gen);
+	}
+
 	@Test
 	public void testGenerateCommentConstraint() {
-		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
+		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplatesMandatory.getRules()).get(0));
 		RuleDefinition custodian = RuleDefinitionUtil.getElementByName(firstRD, "cda:custodian");
 		assertTrue((new RDMandatoryAnalyzer()).generateCommentConstraint(custodian).equals(
 				"In US Realm Header, in /hl7:ClinicalDocument[hl7:templateId/@root='2.16.840.1.113883.10.20.22.1.1'], "
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityAnalyzerIT.java
similarity index 75%
rename from hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityIT.java
rename to hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityAnalyzerIT.java
index 66a1373..d0def1a 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMaximumMultiplicityAnalyzerIT.java
@@ -2,6 +2,8 @@ package net.ihe.gazelle.tempgen.test;
 
 import static org.junit.Assert.assertTrue;
 
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -18,8 +20,11 @@ import net.ihe.gazelle.tempmodel.org.decor.art.utils.TemplateDefinitionUtil;
  * @author Abderrazek Boufahja
  *
  */
-public class RDMaximumMultiplicityIT {
-	
+public class RDMaximumMultiplicityAnalyzerIT {
+
+	static final int MAX_INTEGER = 1000000000;
+
+
 	Decor decorTemplates = null;
 	
 	@Before
@@ -27,6 +32,7 @@ public class RDMaximumMultiplicityIT {
 		decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_obs.xml");
 	}
 
+	@Covers(requirements = {"GOC-003","GOC-026"}, testType = TestType.INTEGRATION_TEST)
 	@Test
 	public void testGenerateMaximumMultiplicityBodyConstraint1() {
 		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
@@ -49,6 +55,17 @@ public class RDMaximumMultiplicityIT {
 				+ "observation.code.code='48766-0').observation->forAll(targetSiteCode->size()<2)"));
 	}
 
+
+	//This case figures in the oclGeneration level (low) but ignored in the processing level (high)
+	@Covers(requirements = {"GOC-004"}, testType = TestType.INTEGRATION_TEST)
+	@Test
+	public void testGenerateMaximumMultiplicityBodyConstraintNMulplicity(){
+		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
+		RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+		String gen = (new RDMaximumMultiplicityAnalyzer()).generateOCLConstraint(entry);
+		assertTrue(gen.equals("self.entryRelationship->select((not observation.code.code.oclIsUndefined()) and observation.code.code='48766-0')->size()<"+Integer.valueOf(MAX_INTEGER+1)));
+	}
+
 	@Test
 	public void testGenerateMaximumMultiplicityDescriptionRule() {
 		RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
diff --git a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMinimumMultiplicityAnalyzerIT.java b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMinimumMultiplicityAnalyzerIT.java
index 362fdc7..fbe6d34 100644
--- a/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMinimumMultiplicityAnalyzerIT.java
+++ b/hl7templates/hl7templates-generator-jar/src/it/java/net/ihe/gazelle/tempgen/test/RDMinimumMultiplicityAnalyzerIT.java
@@ -1,5 +1,6 @@
 package net.ihe.gazelle.tempgen.test;
 
+import net.ihe.gazelle.goctests.definitions.annotations.TestType;
 import net.ihe.gazelle.tempgen.rules.analyzer.AnalyzerEnum;
 import net.ihe.gazelle.tempgen.rules.analyzer.RDMinimumMultiplicityAnalyzer;
 import net.ihe.gazelle.tempmodel.org.decor.art.model.ChoiceDefinition;
@@ -11,6 +12,7 @@ import org.junit.Test;
 
 import javax.xml.bind.JAXBException;
 import java.io.FileNotFoundException;
+import net.ihe.gazelle.goctests.definitions.annotations.Covers;
 
 import static org.junit.Assert.assertEquals;
 
@@ -23,8 +25,9 @@ public class RDMinimumMultiplicityAnalyzerIT {
         decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_obs.xml");
     }
 
+    @Covers(requirements = {"GOC-002","GOC-025"}, testType = TestType.INTEGRATION_TEST)
     @Test
-    public void testGenerateOCLConstraint1() {
+    public void testGenerateOCLConstraint1Test() {
         RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
         RuleDefinition entr = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
         RuleDefinition obs = RuleDefinitionUtil.getElementByName(entr, "hl7:observation");
@@ -37,6 +40,28 @@ public class RDMinimumMultiplicityAnalyzerIT {
                 "->reject(not nullFlavor.oclIsUndefined()).observation->forAll((not nullFlavor.oclIsUndefined()) or targetSiteCode->size()>0)", gen);
     }
 
+    @Covers(requirements = {"GOC-001"}, testType = TestType.INTEGRATION_TEST)
+    @Test
+    public void testGenerateOCLConstraint0Minimum(){
+        Decor decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_obs_conf_O.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
+        RuleDefinition entry = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+        String gen = (new RDMinimumMultiplicityAnalyzer()).generateOCLConstraint(entry);
+        assertEquals("(not self.nullFlavor.oclIsUndefined()) or self.entryRelationship" +
+                "->select((not observation.code.code.oclIsUndefined()) and observation.code.code='48766-0')->size()>0", gen);
+    }
+
+    @Test
+    public void testGenerateOCLConfmR(){
+        Decor decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_obs_conf_R.xml");
+        RuleDefinition firstRD = TemplateDefinitionUtil.getFirstElement(RulesUtil.getTemplates(decorTemplates.getRules()).get(0));
+        RuleDefinition entr = RuleDefinitionUtil.getElementByName(firstRD, "hl7:entryRelationship");
+//        RuleDefinition obs = RuleDefinitionUtil.getElementByName(entr, "hl7:observation");
+//        RuleDefinition status = RuleDefinitionUtil.getElementByName(obs, "hl7:targetSiteCode");
+        String gen = (new RDMinimumMultiplicityAnalyzer()).generateOCLConstraint(entr);
+        System.out.println(gen);
+    }
+
     @Test
     public void testGenerateOCLConstraint2() throws FileNotFoundException, JAXBException {
         Decor decorTemplates = DecorMarshaller.loadDecor("src/test/resources/decor_obs_dist1.xml");
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/decor_custodian_optional.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_custodian_optional.xml
new file mode 100644
index 0000000..50cb21c
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_custodian_optional.xml
@@ -0,0 +1,39 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--US Realm Header-->
+        <template id="2.16.840.1.113883.10.20.22.1.1" name="USRealmHeader" effectiveDate="2013-01-31T00:00:00" statusCode="pending" displayName="US Realm Header">
+            <desc language="en-US">This section describes constraints that apply to the header for all documents within the scope of this implementation guide. Header constraints specific to each document type are described in the appropriate document-specific section below.</desc>
+            <classification type="cdadocumentlevel"/>
+            <context path="cda:ClinicalDocument"/>
+            <element name="cda:ClinicalDocument">
+                <element name="cda:templateId">
+                    <desc language="en-US">SHALL contain exactly one [1..1] templateId (CONF:5252) such that it</desc>
+                    <item label="conf-5252"/>
+                    <attribute name="root" value="2.16.840.1.113883.10.20.22.1.1">
+                        <item label="conf-10036"/>
+                    </attribute>
+                    <attribute name="extension" prohibited="true" />
+                </element>
+                
+                <element name="cda:custodian" minimumMultiplicity="1" maximumMultiplicity="1" isMandatory="true">
+                    <desc language="en-US">SHALL contain exactly one [1..1] custodian (CONF:5519).</desc>
+                    <item label="conf-5519"/>
+                    <element name="cda:assignedCustodian" minimumMultiplicity="0" maximumMultiplicity="1"  isMandatory="false">
+                        <desc language="en-US">This custodian SHALL contain exactly one [1..1] assignedCustodian (CONF:5520).</desc>
+                        <item label="conf-5520"/>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_C.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_C.xml
new file mode 100644
index 0000000..9e22e57
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_C.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="*" conformance="R">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_M.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_M.xml
new file mode 100644
index 0000000..c44c44f
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_M.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="*" conformance="M">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_O.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_O.xml
new file mode 100644
index 0000000..ba7bdb4
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_O.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="*" conformance="R" >
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_R.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_R.xml
new file mode 100644
index 0000000..47700aa
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/decor_obs_conf_R.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="1" maximumMultiplicity="*" conformance="R">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_item.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_item.xml
new file mode 100644
index 0000000..21822bd
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_item.xml
@@ -0,0 +1,31 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--Pregnancy Observation-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.13.5" displayName="Pregnancy Observation" name="EntryPregnancyObservation" effectiveDate="2013-12-20T00:00:00" statusCode="draft">
+            <classification type="cdaentrylevel"/>
+            <relationship type="SPEC" template="2.16.840.1.113883.10.20.1.33"/>
+            <context id="**"/>
+            <element name="hl7:observation" conformance="R">
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13"/>
+                </element>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13.5"/>
+                </element>
+                <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CD" conformance="R" isMandatory="true">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.9" flexibility="2015-01-01T01:02:03"/>
+                </element>
+                <element name="hl7:statusCode" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CS" conformance="R">
+                    <vocabulary code="completed" codeSystem="2.16.840.1.113883.5.14"/>
+                </element>
+                <element name="hl7:repeatNumber" conformance="NP" />
+                <element name="hl7:value" datatype="CS">
+                    <item label="CONF-test" />
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_2_R.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_2_R.xml
new file mode 100644
index 0000000..4c68524
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_2_R.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="2" conformance="R">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_n_R.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_n_R.xml
new file mode 100644
index 0000000..9e22e57
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_0_n_R.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="*" conformance="R">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_1_n_R.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_1_n_R.xml
new file mode 100644
index 0000000..47700aa
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_1_n_R.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+<!--
+ This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41 
+ PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE 
+ Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved 
+ Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url] 
+ Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found 
+ Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="1" maximumMultiplicity="*" conformance="R">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+		                    <attribute name="code">
+		                        <item label="conf-16563"/>
+		                        <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+		                    </attribute>
+		                </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_NP.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_NP.xml
new file mode 100644
index 0000000..3e4083d
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_multiplicity_NP.xml
@@ -0,0 +1,59 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+    <!--
+     This is a compiled version of a DECOR based project. Compilation date:  2015-06-09T11:03:41
+     PLEASE NOTE THAT ITS ONLY PURPOSE IS TO FACILITATE HTML AND SCHEMATRON GENERATION. HENCE THIS IS A ONE OFF FILE UNSUITED FOR ANY OTHER PURPOSE
+     Compilation process calls getFullDataSetTree where all inheritance of concepts from repositories is resolved
+     Compilation process leaves valueSet[@ref] as-is but adds, if available, the valueSet (versions) it references. These are marked with valueSet[@referencedFrom, @ident and/or @url]
+     Compilation process tries to find names for any OIDs referenced in the project but not yet in ids/id, and adds an entry if a name is found
+     Compilation process does not yet handle retrieval of referenced templates if they are not inside this project-->
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--epSOS CDA ManufacturedProduct-->
+        <!--Problem Concern-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.5.2" name="EntryProblemConcern" effectiveDate="2013-12-20T00:00:00" statusCode="draft" displayName="Problem Concern">
+            <desc language="en-US">
+                <p>This entry is a specialization of the Concern Entry, wherein the subject of the concern is focused on a problem. Elements shown in the example below in gray are explained in the Concern Entry. </p>
+                <p>Parent Template </p>
+                <p>The parent of this template is Concern Entry. This template is compatible with the ASTM/HL7 Continuity of Care Document template: 2.16.840.1.113883.10.20.1.27 </p>
+                <p>This entry has a template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.2, and is a subtype of the Concern Entry, and so must also conform to that specification, with the template identifier of 1.3.6.1.4.1.19376.1.5.3.1.4.5.1. These elements are required and shall be recorded exactly as shown. </p>
+            </desc>
+            <classification type="cdaentrylevel"/>
+            <context id="**"/>
+            <element name="hl7:act" conformance="R">
+                <attribute name="classCode" value="ACT"/>
+                <attribute name="moodCode" value="EVN"/>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II" isMandatory="true" conformance="R">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
+                </element>
+                <!-- optional entry relationship providing more information about the concern -->
+                <element name="hl7:entryRelationship" minimumMultiplicity="0" maximumMultiplicity="1" conformance="C">
+                    <desc language="en-US">optional entry relationship providing more information about the concern. A source of information observation SHALL be the target of an entryRelationship whose value for “entryRelationship / @typeCode” SHALL be “REFR”  “Refers to” 2.16.840.1.113883.5.1002 ActRelationshipType STATIC. A source of information observation SHALL be represented with Observation.</desc>
+                    <item label="CONF-524 / CONF-525"/>
+                    <attribute name="typeCode" value="REFR" isOptional="false"/>
+                    <element name="hl7:observation">
+                        <desc language="en-US">ASTM CCR requires that all data objects have a stated source (or state explicitly that the source is unknown) so that any data within the summary can be validated. The source of data may be a person, organization, reference to some other data object, etc.</desc>
+                        <attribute classCode="OBS" isOptional="true">
+                            <desc language="en-US">The value for “Observation / @classCode” in a source of information observation SHALL be “OBS” 2.16.840.1.113883.5.6 ActClass STATIC.</desc>
+                            <item label="CONF-526"/>
+                        </attribute>
+                        <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R" datatype="CD">
+                            <desc language="en-US">A source of information observation SHALL contain exactly one Observation / code. The value for “Observation / code” in a source of information observation SHALL be “48766-0” “Information source” 2.16.840.1.113883.6.1 LOINC STATIC.</desc>
+                            <item label="CONF-530 / CONF-531"/>
+                            <vocabulary code="48766-0" codeSystem="2.16.840.1.113883.6.1" displayName="Information source"/>
+                            <attribute name="code" value="48766-0" />
+                        </element>
+                        <element name="hl7:targetSiteCode" minimumMultiplicity="1" maximumMultiplicity="1" conformance="R"/>
+                        <element name="hl7:value" datatype="CD">
+                            <attribute name="code">
+                                <item label="conf-16563"/>
+                                <vocabulary valueSet="2.16.840.1.113883.11.20.9.41"/>
+                            </attribute>
+                        </element>
+                    </element>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS.xml
new file mode 100644
index 0000000..ce3947c
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS.xml
@@ -0,0 +1,31 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--Pregnancy Observation-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.13.5" displayName="Pregnancy Observation" name="EntryPregnancyObservation" effectiveDate="2013-12-20T00:00:00" statusCode="draft">
+            <classification type="cdaentrylevel"/>
+            <relationship type="SPEC" template="2.16.840.1.113883.10.20.1.33"/>
+            <context id="**"/>
+            <element name="hl7:observation" conformance="R">
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13"/>
+                </element>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13.5"/>
+                </element>
+                <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CD" conformance="R" isMandatory="true">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.9" flexibility="2015-01-01T01:02:03"/>
+                </element>
+                <element name="hl7:statusCode" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CS" conformance="R">
+                    <vocabulary code="completed" codeSystem="2.16.840.1.113883.5.14"/>
+                </element>
+                <element name="hl7:repeatNumber" conformance="NP" />
+                <element name="hl7:value" datatype="CS">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.10" flexibility="2015-01-01T01:02:02"/>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS_dynamic.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS_dynamic.xml
new file mode 100644
index 0000000..0275701
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_VS_dynamic.xml
@@ -0,0 +1,31 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--Pregnancy Observation-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.13.5" displayName="Pregnancy Observation" name="EntryPregnancyObservation" effectiveDate="2013-12-20T00:00:00" statusCode="draft">
+            <classification type="cdaentrylevel"/>
+            <relationship type="SPEC" template="2.16.840.1.113883.10.20.1.33"/>
+            <context id="**"/>
+            <element name="hl7:observation" conformance="R">
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13"/>
+                </element>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13.5"/>
+                </element>
+                <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CD" conformance="R" isMandatory="true">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.9" flexibility="2015-01-01T01:02:03"/>
+                </element>
+                <element name="hl7:statusCode" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CS" conformance="R">
+                    <vocabulary code="completed" codeSystem="2.16.840.1.113883.5.14"/>
+                </element>
+                <element name="hl7:repeatNumber" conformance="NP" />
+                <element name="hl7:value" datatype="CS">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.10" flexibility="dynamic"/>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_fixdedVal.xml b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_fixdedVal.xml
new file mode 100644
index 0000000..52ce60c
--- /dev/null
+++ b/hl7templates/hl7templates-generator-jar/src/test/resources/processors/decor_vocab_fixdedVal.xml
@@ -0,0 +1,31 @@
+<?xml-model href="http://art-decor.org/ADAR/rv/DECOR.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
+<decor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epsos="urn:epSOS:ps:ps:2010" xsi:noNamespaceSchemaLocation="http://art-decor.org/ADAR/rv/DECOR.xsd" repository="true" epsos:dummy-1="urn:epSOS:ps:ps:2010" xsi:dummy-2="http://www.w3.org/2001/XMLSchema-instance" versionDate="2015-06-09T11:03:41" versionLabel="" compilationDate="2015-06-09T11:03:41" language="en-US" deeplinkprefix="http://decor.nictiz.nl/art-decor/" deeplinkprefixservices="http://decor.nictiz.nl/decor/services/">
+    <project id="2.16.840.1.113883.2.4.3.11.60.22" prefix="ccda-" defaultLanguage="en-US">
+    </project>
+    <rules>
+        <!--Pregnancy Observation-->
+        <template id="1.3.6.1.4.1.19376.1.5.3.1.4.13.5" displayName="Pregnancy Observation" name="EntryPregnancyObservation" effectiveDate="2013-12-20T00:00:00" statusCode="draft">
+            <classification type="cdaentrylevel"/>
+            <relationship type="SPEC" template="2.16.840.1.113883.10.20.1.33"/>
+            <context id="**"/>
+            <element name="hl7:observation" conformance="R">
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13"/>
+                </element>
+                <element name="hl7:templateId" minimumMultiplicity="1" maximumMultiplicity="1" datatype="II.EPSOS" conformance="R" isMandatory="false">
+                    <attribute name="root" value="1.3.6.1.4.1.19376.1.5.3.1.4.13.5"/>
+                </element>
+                <element name="hl7:code" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CD" conformance="R" isMandatory="true">
+                    <vocabulary valueSet="1.3.6.1.4.1.12559.11.10.1.3.1.42.9" flexibility="2015-01-01T01:02:03"/>
+                </element>
+                <element name="hl7:statusCode" minimumMultiplicity="1" maximumMultiplicity="1" datatype="CS" conformance="R">
+                    <vocabulary code="completed" codeSystem="2.16.840.1.113883.5.14"/>
+                </element>
+                <element name="hl7:repeatNumber" conformance="NP" />
+                <element name="hl7:value" datatype="CS">
+                    <vocabulary codeSystem="1.2.3"/>
+                </element>
+            </element>
+        </template>
+    </rules>
+</decor>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 023f5c6..98ba6aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,20 +71,38 @@
         <module>hl7templates/hl7templates-api-jar</module>
         <module>hl7templates/hl7templates-generator-jar</module>
         <module>hl7templates/hl7templates-packager-jar</module>
+        <module>hl7templates/goc-tests</module>
     </modules>
 
     <build>
         <plugins>
             <plugin>
+
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.8.0</version>
+                <version>3.8.1</version>
                 <configuration>
-                    <compilerVersion>11</compilerVersion>
-                    <fork>true</fork>
                     <source>11</source>
                     <target>11</target>
+                    <annotationProcessors>
+                        <annotationProcessor>
+                            net.ihe.gazelle.goctests.definitions.processors.CoverageProcessor
+                        </annotationProcessor>
+                    </annotationProcessors>
                 </configuration>
+<!--                <executions> &lt;!&ndash; exclude src from annotation processing &ndash;&gt;-->
+<!--                    <execution>-->
+<!--                        <id>default-compile</id>-->
+<!--                        <goals>-->
+<!--                            <goal>compile</goal>-->
+<!--                        </goals>-->
+<!--                        <configuration>-->
+<!--                            <proc>none</proc>-->
+<!--                        </configuration>-->
+<!--                    </execution>-->
+<!--                </executions>-->
             </plugin>
+
             <plugin>
                 <groupId>org.jacoco</groupId>
                 <artifactId>jacoco-maven-plugin</artifactId>
-- 
GitLab