This is an automated email from the ASF dual-hosted git repository.

mariofusco pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git


The following commit(s) were added to refs/heads/main by this push:
     new 75871b8587 [KIE-726] create a maven archetype for rules in yaml format 
(#5595)
75871b8587 is described below

commit 75871b8587efc7f2cf5618dbace8fae5991b6876
Author: Mario Fusco <[email protected]>
AuthorDate: Wed Nov 29 10:19:18 2023 +0100

    [KIE-726] create a maven archetype for rules in yaml format (#5595)
---
 .../org/drools/drl/extensions/YamlFactory.java     |  10 ++
 .../kie-drools-yaml-archetype/.gitignore           |  14 +++
 kie-archetypes/kie-drools-yaml-archetype/pom.xml   |  90 +++++++++++++++
 .../META-INF/maven/archetype-metadata.xml          |  71 ++++++++++++
 .../src/main/resources/archetype-resources/pom.xml | 100 +++++++++++++++++
 .../src/main/java/Measurement.java                 |  71 ++++++++++++
 .../src/main/resources/META-INF/kmodule.xml        |  27 +++++
 .../src/main/resources/rules.drl.yaml              |  30 +++++
 .../src/test/java/RuleTest.java                    | 123 +++++++++++++++++++++
 .../src/test/resources/logback-test.xml            |  32 ++++++
 .../integrationtestDefaults/archetype.properties   |  27 +++++
 .../projects/integrationtestDefaults/goal.txt      |   1 +
 .../integrationtestDefaults/reference/pom.xml      |  97 ++++++++++++++++
 .../src/main/java/it/pkg/Measurement.java          |  34 ++++--
 .../src/main/resources/META-INF/kmodule.xml        |  24 ++++
 .../src/main/resources/it/pkg/rules.drl.yaml       |  14 +++
 .../reference/src/test/java/it/pkg/RuleTest.java   | 103 +++++++++++++++++
 .../reference/src/test/resources/logback-test.xml  |  32 ++++++
 kie-archetypes/pom.xml                             |   1 +
 kie-maven-plugin/pom.xml                           |   5 +
 .../invoker.properties                             |  26 +++++
 .../it/kie-maven-plugin-test-kjar-15-yaml/pom.xml  |  77 +++++++++++++
 .../src/main/java/org/yaml/Measurement.java        |  34 ++++--
 .../src/main/resources/META-INF/kmodule.xml        |  27 +++++
 .../src/main/resources/org/yaml/rules.drl.yaml     |  13 +++
 .../org/kie/maven/plugin/ittests/YamlTestIT.java   |  85 ++++++++++++++
 26 files changed, 1148 insertions(+), 20 deletions(-)

diff --git 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
 
b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
index fcfc21b932..ef564015bd 100644
--- 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
+++ 
b/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
@@ -18,20 +18,30 @@
  */
 package org.drools.drl.extensions;
 
+import org.drools.base.common.MissingDependencyException;
 import org.kie.api.internal.utils.KieService;
 import org.kie.api.io.Resource;
 
 public class YamlFactory {
 
+    private static final String NO_YAML = "You're trying to parse a rule file 
in YAML format without having drools yaml support. Please add the module 
org.drools:drools-drlonyaml-todrl to your classpath.";
+
     private static class YamlProviderHolder {
         private static final YamlProvider provider = 
KieService.load(YamlProvider.class);
     }
 
     public static YamlProvider getYamlProvider() {
+        if (YamlProviderHolder.provider == null) {
+            throwExceptionForMissingYaml();
+        }
         return YamlProviderHolder.provider;
     }
 
     public static String loadFromResource(Resource resource) {
         return getYamlProvider().loadFromResource(resource);
     }
+
+    private static void throwExceptionForMissingYaml() {
+        throw new MissingDependencyException(NO_YAML);
+    }
 }
diff --git a/kie-archetypes/kie-drools-yaml-archetype/.gitignore 
b/kie-archetypes/kie-drools-yaml-archetype/.gitignore
new file mode 100644
index 0000000000..adf03446e4
--- /dev/null
+++ b/kie-archetypes/kie-drools-yaml-archetype/.gitignore
@@ -0,0 +1,14 @@
+/target
+/local
+
+# Eclipse, Netbeans and IntelliJ files
+/.*
+!.gitignore
+/nbproject
+/*.ipr
+/*.iws
+/*.iml
+*.xpr
+
+# Repository wide ignore mac DS_Store files
+.DS_Store
diff --git a/kie-archetypes/kie-drools-yaml-archetype/pom.xml 
b/kie-archetypes/kie-drools-yaml-archetype/pom.xml
new file mode 100644
index 0000000000..b684ef46d9
--- /dev/null
+++ b/kie-archetypes/kie-drools-yaml-archetype/pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kie-archetypes</artifactId>
+    <version>8.45.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>kie-drools-yaml-archetype</artifactId>
+  <packaging>maven-archetype</packaging>
+
+  <name>KIE :: Drools Maven Archetype with Executable Model and YAML format 
rules</name>
+  <description>
+      Drools rule example with executable model and traditional API and rule 
style with rules in yaml format.
+      Use property droolsVersion to specify which version of Drools to use in 
a generated project.
+  </description>
+  <url>http://drools.org</url>
+
+  <properties>
+    <dollar>$</dollar>
+  </properties>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>false</filtering>
+        <excludes>
+          <exclude>**/pom.xml</exclude>
+          <exclude>**/archetype.properties</exclude>
+        </excludes>
+      </testResource>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>**/pom.xml</include>
+          <include>**/archetype.properties</include>
+        </includes>
+      </testResource>
+    </testResources>
+
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>3.2.1</version>
+      </extension>
+    </extensions>
+
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>3.2.1</version>
+          <configuration>
+            <ignoreEOLStyle>true</ignoreEOLStyle>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000000..9d9247c21e
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<archetype-descriptor 
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0
 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"; 
name="drools6test.asd"
+    
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+    <requiredProperties>
+        <requiredProperty key="droolsVersion">
+            <defaultValue>${project.version}</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="slf4jVersion">
+            <defaultValue>${version.org.slf4j}</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="junitVersion">
+            <defaultValue>${version.junit}</defaultValue>
+        </requiredProperty>
+        <requiredProperty key="logbackVersion">
+            <defaultValue>${version.ch.qos.logback}</defaultValue>
+        </requiredProperty>
+    </requiredProperties>
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.drl.yaml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/test/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/test/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000000..163da14646
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,100 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${dollar}{groupId}</groupId>
+  <artifactId>${dollar}{artifactId}</artifactId>
+  <version>${dollar}{version}</version>
+  <packaging>kjar</packaging>
+
+  <name>${dollar}{artifactId}</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.release>11</maven.compiler.release>
+    <drools-version>${droolsVersion}</drools-version>
+    <slf4j-version>${slf4jVersion}</slf4j-version>
+    <junit-version>${junitVersion}</junit-version>
+    <logback-version>${logbackVersion}</logback-version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.drools</groupId>
+        <artifactId>drools-bom</artifactId>
+        <type>pom</type>
+        <version>${drools-version}</version>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-engine</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-drlonyaml-todrl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-xml-support</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>${logback-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-maven-plugin</artifactId>
+        <version>${drools-version}</version>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+
+  </build>
+</project>
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java
new file mode 100644
index 0000000000..9c8f9f2950
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*#
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+public class Measurement {
+    private String id;
+    private String val;
+
+    public Measurement(String id, String val) {
+        super();
+        this.id = id;
+        this.val = val;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getVal() {
+        return val;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Measurement [");
+        if (id != null)
+            builder.append("id=").append(id).append(", ");
+        if (val != null)
+            builder.append("val=").append(val);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
new file mode 100644
index 0000000000..d0701d8883
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/kmodule.xml
@@ -0,0 +1,27 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<kmodule xmlns="http://www.drools.org/xsd/kmodule";>
+  <!-- This is a minimal kmodule.xml. Ref Drools documentation, see 
http://docs.jboss.org/drools/release/latest/drools-docs/html_single/index.html${symbol_pound}_creatingandbuildingakieproject
 -->
+</kmodule>
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml
new file mode 100644
index 0000000000..3bf3bcd0cb
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/main/resources/rules.drl.yaml
@@ -0,0 +1,30 @@
+#*
+* Copyright 2022 Red Hat, Inc. and/or its affiliates.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*#
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+name: ${package}
+globals:
+- type: java.util.Set
+  id: controlSet
+rules:
+- name: will execute per each Measurement having ID color
+  when:
+  - given: Measurement
+    having:
+    - id == "color"
+    - "$colorVal : val"
+  then: |
+    controlSet.add($colorVal);
\ No newline at end of file
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java
new file mode 100644
index 0000000000..050caa121f
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/java/RuleTest.java
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*#
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.drools.model.codegen.ExecutableModelProject;
+import org.junit.Test;
+import org.kie.api.KieBase;
+import org.kie.api.KieServices;
+import org.kie.api.builder.KieFileSystem;
+import org.kie.api.builder.ReleaseId;
+import org.kie.api.definition.KiePackage;
+import org.kie.api.definition.rule.Rule;
+import org.kie.api.runtime.KieContainer;
+import org.kie.api.runtime.KieSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class RuleTest {
+    static final Logger LOG = LoggerFactory.getLogger(RuleTest.class);
+
+    @Test
+    public void test() {
+        KieContainer kContainer = createKieContainer();
+
+        LOG.info("Creating kieBase");
+        KieBase kieBase = kContainer.getKieBase();
+
+        LOG.info("There should be rules: ");
+        for ( KiePackage kp : kieBase.getKiePackages() ) {
+            for (Rule rule : kp.getRules()) {
+                LOG.info("kp " + kp + " rule " + rule.getName());
+            }
+        }
+
+        LOG.info("Creating kieSession");
+        KieSession session = kieBase.newKieSession();
+
+        try {
+            LOG.info("Populating globals");
+            Set<String> check = new HashSet<String>();
+            session.setGlobal("controlSet", check);
+
+            LOG.info("Now running data");
+
+            Measurement mRed = new Measurement("color", "red");
+            session.insert(mRed);
+            session.fireAllRules();
+
+            Measurement mGreen = new Measurement("color", "green");
+            session.insert(mGreen);
+            session.fireAllRules();
+
+            Measurement mBlue = new Measurement("color", "blue");
+            session.insert(mBlue);
+            session.fireAllRules();
+
+            LOG.info("Final checks");
+
+            assertEquals("Size of object in Working Memory is 3", 3, 
session.getObjects().size());
+            assertTrue("contains red", check.contains("red"));
+            assertTrue("contains green", check.contains("green"));
+            assertTrue("contains blue", check.contains("blue"));
+        } finally {
+            session.dispose();
+        }
+    }
+
+    private KieContainer createKieContainer() {
+        // Programmatically collect resources and build a KieContainer
+        KieServices ks = KieServices.Factory.get();
+        KieFileSystem kfs = ks.newKieFileSystem();
+        String packagePath = "${dollar}{package}".replace(".", "/");
+        kfs.write("src/main/resources/" + packagePath + "/rules.drl.yaml",
+                  
ks.getResources().newInputStreamResource(this.getClass().getClassLoader().getResourceAsStream(packagePath
 + "/rules.drl.yaml")));
+        ReleaseId releaseId = ks.newReleaseId("${dollar}{groupId}", 
"${dollar}{artifactId}", "${dollar}{version}");
+        kfs.generateAndWritePomXML(releaseId);
+        ks.newKieBuilder(kfs).buildAll(ExecutableModelProject.class);
+        return ks.newKieContainer(releaseId);
+    }
+}
\ No newline at end of file
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..58a20a4733
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/src/test/resources/logback-test.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<configuration>
+  <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d [%t] %-5p %m%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="consoleAppender" />
+  </root>
+</configuration>
\ No newline at end of file
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties
new file mode 100644
index 0000000000..c7ece5a606
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/archetype.properties
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
+droolsVersion=${project.version}
+slf4jVersion=1.7.2
+junitVersion=4.11
+logbackVersion=1.2.9
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt
new file mode 100644
index 0000000000..31ed2f87a2
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/goal.txt
@@ -0,0 +1 @@
+clean verify
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml
new file mode 100644
index 0000000000..cf2ffc0924
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>archetype.it</groupId>
+  <artifactId>basic</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>kjar</packaging>
+
+  <name>basic</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.release>11</maven.compiler.release>
+    <drools-version>${project.version}</drools-version>
+    <slf4j-version>1.7.2</slf4j-version>
+    <junit-version>4.11</junit-version>
+    <logback-version>1.2.9</logback-version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.drools</groupId>
+        <artifactId>drools-bom</artifactId>
+        <type>pom</type>
+        <version>${dollar}{drools-version}</version>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-engine</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-drlonyaml-todrl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-xml-support</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>${logback-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-maven-plugin</artifactId>
+        <version>${drools-version}</version>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+
+  </build>
+</project>
diff --git 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java
similarity index 55%
copy from 
drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
copy to 
kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java
index fcfc21b932..26a3ff5470 100644
--- 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/java/it/pkg/Measurement.java
@@ -16,22 +16,36 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.drools.drl.extensions;
 
-import org.kie.api.internal.utils.KieService;
-import org.kie.api.io.Resource;
+package it.pkg;
 
-public class YamlFactory {
+public class Measurement {
+    private String id;
+    private String val;
 
-    private static class YamlProviderHolder {
-        private static final YamlProvider provider = 
KieService.load(YamlProvider.class);
+    public Measurement(String id, String val) {
+        super();
+        this.id = id;
+        this.val = val;
     }
 
-    public static YamlProvider getYamlProvider() {
-        return YamlProviderHolder.provider;
+    public String getId() {
+        return id;
     }
 
-    public static String loadFromResource(Resource resource) {
-        return getYamlProvider().loadFromResource(resource);
+    public String getVal() {
+        return val;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Measurement [");
+        if (id != null)
+            builder.append("id=").append(id).append(", ");
+        if (val != null)
+            builder.append("val=").append(val);
+        builder.append("]");
+        return builder.toString();
     }
 }
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml
new file mode 100644
index 0000000000..decf47d1de
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/META-INF/kmodule.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<kmodule xmlns="http://www.drools.org/xsd/kmodule";>
+  <!-- This is a minimal kmodule.xml. Ref Drools documentation, see 
http://docs.jboss.org/drools/release/latest/drools-docs/html_single/index.html#_creatingandbuildingakieproject
 -->
+</kmodule>
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml
new file mode 100644
index 0000000000..62a2f1944a
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/main/resources/it/pkg/rules.drl.yaml
@@ -0,0 +1,14 @@
+
+name: it.pkg
+globals:
+- type: java.util.Set
+  id: controlSet
+rules:
+- name: will execute per each Measurement having ID color
+  when:
+  - given: Measurement
+    having:
+    - id == "color"
+    - "$colorVal : val"
+  then: |
+    controlSet.add($colorVal);
\ No newline at end of file
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java
new file mode 100644
index 0000000000..07dd2a90bc
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/java/it/pkg/RuleTest.java
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package it.pkg;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.drools.model.codegen.ExecutableModelProject;
+import org.junit.Test;
+import org.kie.api.KieBase;
+import org.kie.api.KieServices;
+import org.kie.api.builder.KieFileSystem;
+import org.kie.api.builder.ReleaseId;
+import org.kie.api.definition.KiePackage;
+import org.kie.api.definition.rule.Rule;
+import org.kie.api.runtime.KieContainer;
+import org.kie.api.runtime.KieSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class RuleTest {
+    static final Logger LOG = LoggerFactory.getLogger(RuleTest.class);
+
+    @Test
+    public void test() {
+        KieContainer kContainer = createKieContainer();
+
+        LOG.info("Creating kieBase");
+        KieBase kieBase = kContainer.getKieBase();
+
+        LOG.info("There should be rules: ");
+        for ( KiePackage kp : kieBase.getKiePackages() ) {
+            for (Rule rule : kp.getRules()) {
+                LOG.info("kp " + kp + " rule " + rule.getName());
+            }
+        }
+
+        LOG.info("Creating kieSession");
+        KieSession session = kieBase.newKieSession();
+
+        try {
+            LOG.info("Populating globals");
+            Set<String> check = new HashSet<String>();
+            session.setGlobal("controlSet", check);
+
+            LOG.info("Now running data");
+
+            Measurement mRed = new Measurement("color", "red");
+            session.insert(mRed);
+            session.fireAllRules();
+
+            Measurement mGreen = new Measurement("color", "green");
+            session.insert(mGreen);
+            session.fireAllRules();
+
+            Measurement mBlue = new Measurement("color", "blue");
+            session.insert(mBlue);
+            session.fireAllRules();
+
+            LOG.info("Final checks");
+
+            assertEquals("Size of object in Working Memory is 3", 3, 
session.getObjects().size());
+            assertTrue("contains red", check.contains("red"));
+            assertTrue("contains green", check.contains("green"));
+            assertTrue("contains blue", check.contains("blue"));
+        } finally {
+            session.dispose();
+        }
+    }
+
+    private KieContainer createKieContainer() {
+        // Programmatically collect resources and build a KieContainer
+        KieServices ks = KieServices.Factory.get();
+        KieFileSystem kfs = ks.newKieFileSystem();
+        String packagePath = "it.pkg".replace(".", "/");
+        kfs.write("src/main/resources/" + packagePath + "/rules.drl.yaml",
+                  
ks.getResources().newInputStreamResource(this.getClass().getClassLoader().getResourceAsStream(packagePath
 + "/rules.drl.yaml")));
+        ReleaseId releaseId = ks.newReleaseId("archetype.it", "basic", 
"0.1-SNAPSHOT");
+        kfs.generateAndWritePomXML(releaseId);
+        ks.newKieBuilder(kfs).buildAll(ExecutableModelProject.class);
+        return ks.newKieContainer(releaseId);
+    }
+}
\ No newline at end of file
diff --git 
a/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml
 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..58a20a4733
--- /dev/null
+++ 
b/kie-archetypes/kie-drools-yaml-archetype/src/test/resources/projects/integrationtestDefaults/reference/src/test/resources/logback-test.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<configuration>
+  <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d [%t] %-5p %m%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="consoleAppender" />
+  </root>
+</configuration>
\ No newline at end of file
diff --git a/kie-archetypes/pom.xml b/kie-archetypes/pom.xml
index d06d304611..3b9d4eb99d 100644
--- a/kie-archetypes/pom.xml
+++ b/kie-archetypes/pom.xml
@@ -40,6 +40,7 @@
     <module>kie-drools-dmn-archetype</module>
     <module>kie-drools-exec-model-ruleunit-archetype</module>
     <module>kie-drools-exec-model-archetype</module>
+    <module>kie-drools-yaml-archetype</module>
   </modules>
 
   <!-- ensure integration test of the archetypes, after the kie-maven-plugin 
build -->
diff --git a/kie-maven-plugin/pom.xml b/kie-maven-plugin/pom.xml
index 0605f95698..6483ad5185 100644
--- a/kie-maven-plugin/pom.xml
+++ b/kie-maven-plugin/pom.xml
@@ -255,6 +255,11 @@
       <artifactId>drools-decisiontables</artifactId>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-drlonyaml-todrl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
     <dependency>
       <groupId>org.drools</groupId>
       <artifactId>drools-templates</artifactId>
diff --git 
a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties
new file mode 100644
index 0000000000..c5669b7288
--- /dev/null
+++ 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/invoker.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# A comma or space separated list of goals/phases to execute, may
+# specify an empty list to execute the default goal of the IT project.
+# Environment variables used by maven plugins can be added here
+invoker.goals = clean install
+
+# Uncomment the following to debug invoker. Do note that you have to connect 
the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on 
console
+#invoker.mavenOpts=-Xdebug -Xnoagent 
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml
new file mode 100644
index 0000000000..1471752feb
--- /dev/null
+++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kie-maven-plugin-test-kjar-parent</artifactId>
+    <version>@org.kie.version@</version>
+    
<relativePath>../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>kie-maven-plugin-test-kjar-15-yaml</artifactId>
+
+  <packaging>kjar</packaging>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-api</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-model-compiler</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-canonical-model</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-core</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-compiler</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.drools</groupId>
+      <artifactId>drools-drlonyaml-todrl</artifactId>
+      <version>${org.kie.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-maven-plugin-test-kjar-common</artifactId>
+      <version>@org.kie.version@</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java
similarity index 55%
copy from 
drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
copy to 
kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java
index fcfc21b932..e341d6943d 100644
--- 
a/drools-drl/drools-drl-extensions/src/main/java/org/drools/drl/extensions/YamlFactory.java
+++ 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/java/org/yaml/Measurement.java
@@ -16,22 +16,36 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.drools.drl.extensions;
 
-import org.kie.api.internal.utils.KieService;
-import org.kie.api.io.Resource;
+package org.yaml;
 
-public class YamlFactory {
+public class Measurement {
+    private String id;
+    private String val;
 
-    private static class YamlProviderHolder {
-        private static final YamlProvider provider = 
KieService.load(YamlProvider.class);
+    public Measurement(String id, String val) {
+        super();
+        this.id = id;
+        this.val = val;
     }
 
-    public static YamlProvider getYamlProvider() {
-        return YamlProviderHolder.provider;
+    public String getId() {
+        return id;
     }
 
-    public static String loadFromResource(Resource resource) {
-        return getYamlProvider().loadFromResource(resource);
+    public String getVal() {
+        return val;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Measurement [");
+        if (id != null)
+            builder.append("id=").append(id).append(", ");
+        if (val != null)
+            builder.append("val=").append(val);
+        builder.append("]");
+        return builder.toString();
     }
 }
diff --git 
a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml
 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml
new file mode 100644
index 0000000000..1fe23858ca
--- /dev/null
+++ 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/META-INF/kmodule.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule";>
+  <kbase name="YamlKBase" packages="org.yaml">
+    <ksession name="YamlKBase.session" type="stateful"/>
+  </kbase>
+</kmodule>
\ No newline at end of file
diff --git 
a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml
 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml
new file mode 100644
index 0000000000..a9f81455d9
--- /dev/null
+++ 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/main/resources/org/yaml/rules.drl.yaml
@@ -0,0 +1,13 @@
+name: org.yaml
+globals:
+- type: java.util.Set
+  id: controlSet
+rules:
+- name: will execute per each Measurement having ID color
+  when:
+  - given: Measurement
+    having:
+    - id == "color"
+    - "$colorVal : val"
+  then: |
+    controlSet.add($colorVal);
\ No newline at end of file
diff --git 
a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java
 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java
new file mode 100644
index 0000000000..ded38386ad
--- /dev/null
+++ 
b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-15-yaml/src/test/java-filtered/org/kie/maven/plugin/ittests/YamlTestIT.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.maven.plugin.ittests;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.kie.api.KieBase;
+import org.kie.api.runtime.KieContainer;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.kie.api.runtime.KieSession;
+
+import org.yaml.Measurement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class YamlTestIT {
+
+    private final static String GROUP_ID = "org.kie";
+    private final static String GAV_ARTIFACT_ID = 
"kie-maven-plugin-test-kjar-15-yaml";
+    private static final String GAV_VERSION = "${org.kie.version}";
+    private final static String KBASE_NAME = "YamlKBase";
+
+
+    @Test
+    public void testYamlRules() throws Exception {
+        final URL targetLocation = 
YamlTestIT.class.getProtectionDomain().getCodeSource().getLocation();
+        final KieContainer kieContainer = 
ITTestsUtils.getKieContainer(targetLocation, GAV_ARTIFACT_ID, GAV_VERSION);
+        final KieBase kieBase = kieContainer.getKieBase(KBASE_NAME);
+        Assertions.assertThat(kieBase).isNotNull();
+        KieSession kSession = null;
+        try {
+
+            kSession = kieBase.newKieSession();
+            Assertions.assertThat(kSession).isNotNull();
+
+            Set<String> check = new HashSet<String>();
+            kSession.setGlobal("controlSet", check);
+
+            Measurement mRed = new Measurement("color", "red");
+            kSession.insert(mRed);
+            kSession.fireAllRules();
+
+            Measurement mGreen = new Measurement("color", "green");
+            kSession.insert(mGreen);
+            kSession.fireAllRules();
+
+            Measurement mBlue = new Measurement("color", "blue");
+            kSession.insert(mBlue);
+            kSession.fireAllRules();
+
+            assertEquals("Size of object in Working Memory is 3", 3, 
kSession.getObjects().size());
+            assertTrue("contains red", check.contains("red"));
+            assertTrue("contains green", check.contains("green"));
+            assertTrue("contains blue", check.contains("blue"));
+
+        } finally {
+            kSession.dispose();
+        }
+    }
+}
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to