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


##########
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.

Review Comment:
   Could we please add also a link for github repository? 
https://github.com/apache/incubator-kie-drools/tree/main/kie-dmn/kie-dmn-test-resources



##########
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");

Review Comment:
   we can remove this line probably



##########
packages/dmn-marshaller/tests-data--manual/other/decisionAndInputWithAddition.dmn:
##########
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   Maybe we should move also this model under 
https://github.com/apache/incubator-kie-drools/tree/main/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5
 ?



##########
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);
   }

Review Comment:
   sorry, it may be silly question, I am not expert of reading directories in 
typescript, I also believe this does the expected work, I am just concerned if 
in the future for some reason we move the directory or models of the directory 
to a new location, this will silently still pass reading zero files?
   
   maybe some assertion of how many files were tested would make slightly more 
explicit, what models do we test? I do not know, or in different test suites I 
saw a hard-coded list of files intended to be 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:
   ```suggestion
   Simply issue `mvn clean generate-resources` to download the jar and extract 
the models under `target/generated-resources/valid_models`.
   ```



##########
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",

Review Comment:
   shouldn't this PR physically remove these models? are they still used 
elsewhere? 



-- 
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