tiagobento commented on code in PR #2207:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2207#discussion_r1537790153


##########
packages/dmn-marshaller/tests/idempotency.test.ts:
##########
@@ -20,30 +20,61 @@
 import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { DmnMarshaller, DmnMarshallerOpts, DmnMarshallerVersions } from 
"../src";
 
 const files = [
-  "../tests-data--manual/other/attachment.dmn",
-  "../tests-data--manual/other/empty13.dmn",
-  "../tests-data--manual/other/sample12.dmn",
-  "../tests-data--manual/other/list.dmn",
-  "../tests-data--manual/other/list2.dmn",
-  "../tests-data--manual/other/external.dmn",
-  "../tests-data--manual/other/weird.dmn",
-  "../tests-data--manual/dmn-1_4--examples/Chapter 11 Example 1 
Originations/Chapter 11 Example.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/OneOfEachType.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/allTypes.dmn",
+];
+
+const testing_models_paths = [
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5",
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x",
 ];
 
 describe("idempotency", () => {
   for (const file of files) {
-    test(path.basename(file), () => {
-      const xml_original = fs.readFileSync(path.join(__dirname, file), 
"utf-8");
-
-      const { parser, builder } = getMarshaller(xml_original, { upgradeTo: 
"latest" });
-      const json = parser.parse();
-
-      const xml_firstPass = builder.build(json);
-      const xml_secondPass = builder.build(getMarshaller(xml_firstPass, { 
upgradeTo: "latest" }).parser.parse());
+    testFile(path.join(__dirname, file));
+  }
+});
 
-      expect(xml_firstPass).toStrictEqual(xml_secondPass);
-    });
+describe("idempotency_all", () => {
+  for (const models_paths of testing_models_paths) {
+    const parent_path = path.join(__dirname, models_paths);
+    testDirectory(parent_path);
   }
 });
+
+function testDirectory(fullPathOfModels: string) {
+  fs.readdirSync(fullPathOfModels).forEach((file) => {
+    const child_path = path.join(fullPathOfModels, file);
+    const stats = fs.statSync(child_path);
+    if (stats.isFile()) {
+      testFile(child_path);
+    } else {
+      testDirectory(child_path);
+    }
+  });
+}
+
+function testFile(fullPathOfFile: string) {
+  test(fullPathOfFile.substring(fullPathOfFile.lastIndexOf("/") + 1), () => {
+    console.log("Testing " + fullPathOfFile);

Review Comment:
   We don't need this log here, as the name of the test already makes it clear 
what's being tested.



##########
packages/dmn-testing-models/install.js:
##########
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+const buildEnv = require("./env");
+const { setup } = require("@kie-tools/maven-config-setup-helper");
+
+setup(`
+    -Dversion.org.kie.kogito=${buildEnv.env.kogitoRuntime.version}

Review Comment:
   (*)... so you can add a `-Drevision` here. In `kie-tools`, the version of a 
package is determined by the package.json, and all technology-specific files 
are generated/parameterized from there. That's why you see `-Drevision` 
configured for other Maven packages.



##########
packages/dmn-testing-models/pom.xml:
##########
@@ -0,0 +1,150 @@
+<?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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.kie.tools</groupId>
+    <artifactId>dmn-testing-models</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
+    <name>DMN Testing Models</name>
+    <description>Testing models for DMN editor</description>

Review Comment:
   Not sure if that's the better description here, as these models are 
currently only being used by the marshaller... Maybe we can leave this as a 
generic description...



##########
packages/dmn-marshaller/tests/idempotency.test.ts:
##########
@@ -20,30 +20,61 @@
 import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { DmnMarshaller, DmnMarshallerOpts, DmnMarshallerVersions } from 
"../src";
 
 const files = [
-  "../tests-data--manual/other/attachment.dmn",
-  "../tests-data--manual/other/empty13.dmn",
-  "../tests-data--manual/other/sample12.dmn",
-  "../tests-data--manual/other/list.dmn",
-  "../tests-data--manual/other/list2.dmn",
-  "../tests-data--manual/other/external.dmn",
-  "../tests-data--manual/other/weird.dmn",
-  "../tests-data--manual/dmn-1_4--examples/Chapter 11 Example 1 
Originations/Chapter 11 Example.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/OneOfEachType.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/allTypes.dmn",
+];
+
+const testing_models_paths = [
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5",
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x",
 ];
 
 describe("idempotency", () => {
   for (const file of files) {
-    test(path.basename(file), () => {
-      const xml_original = fs.readFileSync(path.join(__dirname, file), 
"utf-8");
-
-      const { parser, builder } = getMarshaller(xml_original, { upgradeTo: 
"latest" });
-      const json = parser.parse();
-
-      const xml_firstPass = builder.build(json);
-      const xml_secondPass = builder.build(getMarshaller(xml_firstPass, { 
upgradeTo: "latest" }).parser.parse());
+    testFile(path.join(__dirname, file));
+  }
+});
 
-      expect(xml_firstPass).toStrictEqual(xml_secondPass);
-    });
+describe("idempotency_all", () => {
+  for (const models_paths of testing_models_paths) {
+    const parent_path = path.join(__dirname, models_paths);
+    testDirectory(parent_path);
   }
 });
+
+function testDirectory(fullPathOfModels: string) {
+  fs.readdirSync(fullPathOfModels).forEach((file) => {
+    const child_path = path.join(fullPathOfModels, file);
+    const stats = fs.statSync(child_path);
+    if (stats.isFile()) {
+      testFile(child_path);
+    } else {
+      testDirectory(child_path);
+    }
+  });
+}
+
+function testFile(fullPathOfFile: string) {

Review Comment:
   We usually name `path` string variables with some more details.
   
   Please take a look at this comment: 
https://github.com/apache/incubator-kie-issues/issues/783



##########
packages/dmn-marshaller/tests/xsdSequence.test.ts:
##########
@@ -21,74 +21,57 @@ import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
 
-const files = [
+const filesForAddition = [
   { path: "../tests-data--manual/other/decisionAndInput.dmn" },
+  { path: "../tests-data--manual/other/decisionAndInputWithAddition.dmn" },
+];
+
+const filesForNormalization = [
   { path: 
"../tests-data--manual/other/decisionAndInput_wrongSequenceOrder.dmn" },
+  { path: "../tests-data--manual/other/decisionAndInput.dmn" },
 ];
 
-describe("build always produces elements in the same order", () => {
-  for (const file of files) {
-    test(path.basename(file.path), () => {
-      const xml = fs.readFileSync(path.join(__dirname, file.path), "utf-8");
-      const marshaller = getMarshaller(xml, { upgradeTo: "1.5" });
-      const json = marshaller.parser.parse();
+describe("build always add elements in the same order", () => {
+  test("Addition", () => {
+    const fileSource = filesForAddition[0];
+    const fileExpected = filesForAddition[1];
+    const xml = fs.readFileSync(path.join(__dirname, fileSource.path), 
"utf-8");
+    const marshaller = getMarshaller(xml, { upgradeTo: "1.5" });
+    const json = marshaller.parser.parse();
 
-      // Adding some props in an arbitrary order shouldn't alter the end 
result.
+    // Adding some props in an arbitrary order shouldn't alter the end result.
 
-      json.definitions.import = [
-        {
-          "@_name": "some-import",
-          "@_namespace": "some-namespace",
-          "@_importType": "some-import-type",
-        },
-      ];
+    json.definitions.import = [
+      {
+        "@_name": "some-import",
+        "@_namespace": "some-namespace",
+        "@_importType": "some-import-type",
+      },
+    ];
 
-      json.definitions.artifact = [
-        {
-          __$$element: "group",
-          "@_name": "some-group",
-        },
-      ];
+    json.definitions.artifact = [
+      {
+        __$$element: "group",
+        "@_name": "some-group",
+      },
+    ];
+
+    const xmlRetrieved = marshaller.builder.build(json).replace(/\s/g, "");
+    const xmlExpected = fs.readFileSync(path.join(__dirname, 
fileExpected.path), "utf-8").replace(/\s/g, "");
+    expect(xmlRetrieved).toEqual(xmlExpected);
+  });
+});
+
+describe("build always produces elements in the same order", () => {
+  test("Normalization", () => {
+    const fileSource = filesForNormalization[0];
+    const fileExpected = filesForNormalization[1];
+    const xmlSource = fs.readFileSync(path.join(__dirname, fileSource.path), 
"utf-8");
+    const marshaller = getMarshaller(xmlSource, { upgradeTo: "1.5" });
+    const json = marshaller.parser.parse();
 
-      expect(marshaller.builder.build(json)).toStrictEqual(`<?xml 
version="1.0" encoding="UTF-8" ?>
-<definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"; 
expressionLanguage="https://www.omg.org/spec/DMN/20230324/FEEL/"; 
namespace="https://kie.org/dmn/_D19C1092-7677-427F-A493-BCED38F74A9B"; 
id="_11655DE3-BEA5-45B1-B54E-8AD84FBBED25" 
name="DMN_1E889EDB-B967-4508-8DB1-E0DF5986E62F" 
xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/"; 
xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"; 
xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/"; 
xmlns:kie="https://kie.org/dmn/extensions/1.0";>
-  <import name="some-import" namespace="some-namespace" 
importType="some-import-type" />
-  <inputData name="New Input Data" id="_154F9E03-B180-4C87-B7D3-8745DA4336F4">
-    <variable name="New Input Data" id="_A28401DD-9A87-4251-A1E4-C63FC3A7C729" 
typeRef="string" />
-  </inputData>
-  <decision name="New Decision" id="_392BEF3D-44B5-47DC-8A06-C36F15DB2984">
-    <variable id="_C2C9C21A-E708-46D9-876A-52BB25692B66" typeRef="string" 
name="New Decision" />
-    <informationRequirement id="_E781E253-D97E-4A1D-BE51-037B012B30F0">
-      <requiredInput href="#_154F9E03-B180-4C87-B7D3-8745DA4336F4" />
-    </informationRequirement>
-    <literalExpression id="_509ED9AF-3852-48F4-89A7-3CCF221B809C" label="New 
Decision" typeRef="string">
-      <text>&quot;New Decision&quot;</text>
-    </literalExpression>
-  </decision>
-  <group name="some-group" />
-  <dmndi:DMNDI>
-    <dmndi:DMNDiagram id="_0D2FD42B-91FF-4795-B71F-E501CE115389" name="Default 
DRD" useAlternativeInputDataShape="false">
-      <di:extension>
-        <kie:ComponentsWidthsExtension>
-          <kie:ComponentWidths 
dmnElementRef="_509ED9AF-3852-48F4-89A7-3CCF221B809C">
-            <kie:width>190</kie:width>
-          </kie:ComponentWidths>
-        </kie:ComponentsWidthsExtension>
-      </di:extension>
-      <dmndi:DMNShape id="_92B3305F-A892-4E38-BD92-398906A9BC24" 
dmnElementRef="_154F9E03-B180-4C87-B7D3-8745DA4336F4" isCollapsed="false" 
isListedInputData="false">
-        <dc:Bounds x="100" y="280" width="160" height="80" />
-      </dmndi:DMNShape>
-      <dmndi:DMNShape id="_1E49EEEB-9296-4AE5-B37C-2EE0044C0CC2" 
dmnElementRef="_392BEF3D-44B5-47DC-8A06-C36F15DB2984" isCollapsed="false" 
isListedInputData="false">
-        <dc:Bounds x="100" y="100" width="160" height="80" />
-      </dmndi:DMNShape>
-      <dmndi:DMNEdge id="_C54C8ED9-7DB2-47BC-844A-E79D7142844B-AUTO-TARGET" 
dmnElementRef="_E781E253-D97E-4A1D-BE51-037B012B30F0" 
sourceElement="_92B3305F-A892-4E38-BD92-398906A9BC24" 
targetElement="_1E49EEEB-9296-4AE5-B37C-2EE0044C0CC2">
-        <di:waypoint x="180" y="320" />
-        <di:waypoint x="180" y="140" />
-      </dmndi:DMNEdge>
-    </dmndi:DMNDiagram>
-  </dmndi:DMNDI>
-</definitions>
-`);
-    });
-  }
+    const xmlRetrieved = marshaller.builder.build(json).replace(/\s/g, "");
+    const xmlExpected = fs.readFileSync(path.join(__dirname, 
fileExpected.path), "utf-8").replace(/\s/g, "");
+    expect(xmlRetrieved).toStrictEqual(xmlExpected);
+  });

Review Comment:
   Several comments here:
   
   1. 
   Using an array for `fileSource` and `fileExpected` is not the way to go 
here. I would inline the paths, to be honest.
   
   2.
   Having one `describe` for each `test` looks weird too. I would do one 
describe like this:
   
   `describe("build always produces elements in the same order"`
   
   and two tests like this:
   
   `test("after adding elements")`
   `test("after reading denormalized file")`
   
   
   3. 
   Replacing blank spaces with an empty string is tempering with the tests. My 
suggestion is that we match the files char by char, without exceptions.



##########
packages/dmn-testing-models/package.json:
##########
@@ -0,0 +1,43 @@
+{
+  "private": true,
+  "name": "@kie-tools/dmn-testing-models",
+  "version": "0.0.0",
+  "description": "",
+  "license": "Apache-2.0",
+  "homepage": "https://github.com/apache/incubator-kie-tools";,
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/apache/incubator-kie-tools.git";
+  },
+  "bugs": {
+    "url": "https://github.com/apache/incubator-kie-tools/issues";
+  },
+  "files": [
+    "dist"
+  ],
+  "scripts": {
+    "build:dev": "run-script-os",
+    "build:dev:linux:darwin": "mvn clean generate-resources",
+    "build:dev:win32": "pnpm powershell \"mvn clean generate-resources\"",
+    "build:prod": "pnpm build:dev",
+    "copy:app": "run-script-os",
+    "copy:app:linux:darwin": "copyfiles -u 1 
\"target/generated-resources/valid_models/**/*.dmn\" dist/",
+    "copy:app:win32": "copyfiles -u 1 
\"target/generated-resources/valid_models/**/*.dmn\" dist/",
+    "dist": "rimraf dist && mkdir dist && pnpm copy:app",

Review Comment:
   These 4 scripts are being used, from what I understood. Can you please check 
and remove them if that's true?



##########
packages/dmn-testing-models/pom.xml:
##########
@@ -0,0 +1,150 @@
+<?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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.kie.tools</groupId>
+    <artifactId>dmn-testing-models</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
+    <name>DMN Testing Models</name>
+    <description>Testing models for DMN editor</description>
+
+    <licenses>
+        <license>
+            <name>Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+
+    <scm>
+        
<connection>scm:git:[email protected]:apache/incubator-kie-tools.git</connection>
+        
<developerConnection>scm:git:[email protected]:apache/incubator-kie-tools.git</developerConnection>
+        <url>scm:git:[email protected]:apache/incubator-kie-tools.git</url>
+    </scm>
+
+    <developers>
+        <developer>
+            <name>All developers are listed in the KIE GitHub 
organization</name>
+            <url>https://github.com/orgs/kiegroup/people</url>
+        </developer>
+    </developers>
+
+    <repositories>
+        <repository>
+            <!-- Duplicating the Maven Central repository here (as it is 
already coming from Super POM) makes the build much faster,
+                 as the Maven Central is now treated as the first (default) 
repository (because it is before the Apache Nexus one).
+                 Artifacts with release (fixed) versions are being downloaded 
primarily from there. Without the central being the
+                 first repository the Apache Nexus would be contacted first 
and since it is quite slow it slows down the build.
+                 We use Apache repo only to download our SNAPSHOTs. -->
+            <id>central</id>
+            <name>Central Repository</name>
+            <url>https://repo.maven.apache.org/maven2</url>
+            <layout>default</layout>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>apache-public-repository-group</id>
+            <name>Apache Public Repository Group</name>
+            <url>https://repository.apache.org/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>daily</updatePolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <dependency-plugin.version>3.6.1</dependency-plugin.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.kie</groupId>
+                <artifactId>kie-dmn-test-resources</artifactId>
+                <version>${version.org.kie.kogito}</version>
+                <classifier>tests</classifier>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-dmn-test-resources</artifactId>
+            <classifier>tests</classifier>
+        </dependency>
+    </dependencies>
+
+    <build>
+<!--        <resources>-->
+<!--            &lt;!&ndash; DMN generated resources unpacked from 
org.kie:kie-dmn-test-resources &ndash;&gt;-->
+<!--            <resource>-->
+<!--                
<directory>${project.build.directory}/generated-resources/valid_models</directory>-->
+<!--            </resource>-->
+<!--        </resources>-->

Review Comment:
   Remove?



##########
packages/dmn-marshaller/tests/idempotency.test.ts:
##########
@@ -20,30 +20,61 @@
 import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { DmnMarshaller, DmnMarshallerOpts, DmnMarshallerVersions } from 
"../src";
 
 const files = [
-  "../tests-data--manual/other/attachment.dmn",
-  "../tests-data--manual/other/empty13.dmn",
-  "../tests-data--manual/other/sample12.dmn",
-  "../tests-data--manual/other/list.dmn",
-  "../tests-data--manual/other/list2.dmn",
-  "../tests-data--manual/other/external.dmn",
-  "../tests-data--manual/other/weird.dmn",
-  "../tests-data--manual/dmn-1_4--examples/Chapter 11 Example 1 
Originations/Chapter 11 Example.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/OneOfEachType.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/allTypes.dmn",
+];
+
+const testing_models_paths = [
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5",
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x",
 ];

Review Comment:
   In order not make make packages dependent on the directory structure of the 
monorepo, for these cases we use 
`require.resolve("@kie-tools/dmn-testing-models")`, using the package name, 
instead of the package directory. The command above is like an import, but for 
a directory inside a package. You can use `path.join` then to concatenate the 
result of `require.resolve` with the path string you're pointing to. Keep in 
mind that we need to support these tests on Windows as well, if I'm not 
mistaken.



##########
packages/dmn-testing-models/env/index.js:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+//const { getOrDefault, varsWithName, composeEnv } = 
require("@kie-tools-scripts/build-env");
+const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env");
+
+module.exports = composeEnv([require("@kie-tools/root-env/env")], {
+  vars: varsWithName({}),
+  get env() {
+    return {};
+  },
+});

Review Comment:
   You need the package.json version here to be exposed as a variable (*)....



##########
packages/dmn-marshaller/tests/idempotency.test.ts:
##########
@@ -20,30 +20,61 @@
 import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { DmnMarshaller, DmnMarshallerOpts, DmnMarshallerVersions } from 
"../src";

Review Comment:
   Please do not import from `src` directly, and instead use 
`@kie-tools/dmn-marshaller`.



##########
packages/dmn-testing-models/pom.xml:
##########
@@ -0,0 +1,150 @@
+<?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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.kie.tools</groupId>
+    <artifactId>dmn-testing-models</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
+    <name>DMN Testing Models</name>
+    <description>Testing models for DMN editor</description>
+
+    <licenses>
+        <license>
+            <name>Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+
+    <scm>
+        
<connection>scm:git:[email protected]:apache/incubator-kie-tools.git</connection>
+        
<developerConnection>scm:git:[email protected]:apache/incubator-kie-tools.git</developerConnection>
+        <url>scm:git:[email protected]:apache/incubator-kie-tools.git</url>
+    </scm>
+
+    <developers>
+        <developer>
+            <name>All developers are listed in the KIE GitHub 
organization</name>
+            <url>https://github.com/orgs/kiegroup/people</url>
+        </developer>
+    </developers>

Review Comment:
   Maybe remove this?



##########
packages/dmn-marshaller/tests/idempotency.test.ts:
##########
@@ -20,30 +20,61 @@
 import * as fs from "fs";
 import * as path from "path";
 import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { DmnMarshaller, DmnMarshallerOpts, DmnMarshallerVersions } from 
"../src";
 
 const files = [
-  "../tests-data--manual/other/attachment.dmn",
-  "../tests-data--manual/other/empty13.dmn",
-  "../tests-data--manual/other/sample12.dmn",
-  "../tests-data--manual/other/list.dmn",
-  "../tests-data--manual/other/list2.dmn",
-  "../tests-data--manual/other/external.dmn",
-  "../tests-data--manual/other/weird.dmn",
-  "../tests-data--manual/dmn-1_4--examples/Chapter 11 Example 1 
Originations/Chapter 11 Example.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/OneOfEachType.dmn",
+  
"../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x/allTypes.dmn",
+];
+
+const testing_models_paths = [
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_5",
+  "../node_modules/@kie-tools/dmn-testing-models/dist/valid_models/DMNv1_x",
 ];
 
 describe("idempotency", () => {
   for (const file of files) {
-    test(path.basename(file), () => {
-      const xml_original = fs.readFileSync(path.join(__dirname, file), 
"utf-8");
-
-      const { parser, builder } = getMarshaller(xml_original, { upgradeTo: 
"latest" });
-      const json = parser.parse();
-
-      const xml_firstPass = builder.build(json);
-      const xml_secondPass = builder.build(getMarshaller(xml_firstPass, { 
upgradeTo: "latest" }).parser.parse());
+    testFile(path.join(__dirname, file));
+  }
+});

Review Comment:
   Why stop testing the models that are currently being tested? 



##########
packages/dmn-testing-models/README.md:
##########
@@ -0,0 +1,10 @@
+## DMN testing models
+
+This package is meant to contain all the DMN models published inside 
`org.kie:kie-dmn-test-resources` to make them available for testing purposes.
+
+Simply issue `mvn clean generated-resources` to download the jar and extract 
the models under `target/generated-resources/valid_models`.

Review Comment:
   I guess this paragraph is not true, as we're unpacking directly at `dist`, 
no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to