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


##########
packages/dmn-marshaller-backend-compatibility-tester/src/DmnSemanticComparison.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ */
+
+///usr/bin/env jbang "$0" "$@" ; exit $?
+//SOURCES ./DmnMarshallerBackendCompatibilityTesterScript.java
+/* Please do not declare new dependencies here, but in the above Parent class 
to preserve 
+ *  the dependencies fetching mechanism */
+
+package jbang;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+import org.kie.api.io.Resource;
+import org.kie.dmn.api.core.DMNContext;
+import org.kie.dmn.api.core.DMNModel;
+import org.kie.dmn.api.core.DMNRuntime;
+import org.kie.dmn.model.api.Definitions;
+import org.kie.dmn.model.api.NamedElement;
+import org.kie.dmn.core.internal.utils.DMNRuntimeBuilder;
+import org.kie.internal.io.ResourceFactory;
+
+/**
+ * JBang script that performs DMN files' XML (in string format) validation
+ * relying on KIE DMN Validator
+ * 
(https://github.com/apache/incubator-kie-drools/tree/main/kie-dmn/kie-dmn-validation).
+ * The script can manage one or two (in case of imported model) DMN file paths.
+ * The XSD SCHEMA, DMN COMPLIANCE and DMN COMPILATION are validated.
+ */
+class DmnSemanticComparison extends 
DmnMarshallerBackendCompatibilityTesterScript {

Review Comment:
   My comment to this jbang class is we mix a terminology. In class `Option` we 
speak about `generated` files while in the method implementation and logs we 
speak about `parsed` files, I think we could unify the naming. What is your 
opinion?



##########
packages/dmn-marshaller/tests/dmnValidation.test.ts:
##########
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+import * as fs from "fs";
+import * as path from "path";
+import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { fail } from "assert";
+import {
+  checkDmnValidation,
+  checkDmnValidationWithImports,
+} from "@kie-tools/dmn-marshaller-backend-compatibility-tester";
+
+/**
+ * This test suite validates the xml produced (parsed and built) by the 
marshaller relying on KIE DMN Validator
+ * 
(https://github.com/apache/incubator-kie-drools/tree/main/kie-dmn/kie-dmn-validation).
+ * A JBang script is used to actually call the KIE DMN Validator Java code.
+ */
+
+const dmnTestingModelsPath = 
path.dirname(require.resolve("@kie-tools/dmn-testing-models/package.json"));
+
+const dmnTestingModels = [
+  "dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  "dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  "dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  "dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/NegationOfDurationEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  "dist/valid_models/DMNv1_x/multiple/Financial.dmn",
+  "dist/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn",

Review Comment:
   is it intentional we introduce the same constants as in the file above?



##########
packages/dmn-marshaller/tests/dmnSemanticComparison.test.ts:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+import * as fs from "fs";
+import * as path from "path";
+import { getMarshaller } from "@kie-tools/dmn-marshaller";
+import { fail } from "assert";
+import {
+  checkDmnSemanticComparison,
+  checkDmnSemanticComparisonWithImports,
+} from "@kie-tools/dmn-marshaller-backend-compatibility-tester";
+
+/**
+ * This test suite compares the xml generated (parsed and built) by the 
dmn-parser with the original xml.
+ * The original xml and the generated one are passed and compered to the KIE 
DMN Core backend API.
+ * A JBang script is used to actually call the KIE DMN Core backend API.
+ */
+
+const dmnTestingModelsPath = 
path.dirname(require.resolve("@kie-tools/dmn-testing-models/package.json"));
+
+const dmnTestingModels = [
+  "dist/valid_models/DMNv1_5/AllowedValuesChecksInsideCollection.dmn",
+  "dist/valid_models/DMNv1_5/DateToDateTimeFunction.dmn",
+  "dist/valid_models/DMNv1_5/ForLoopDatesEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+  "dist/valid_models/DMNv1_5/ListReplaceEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/NegationOfDurationEvaluate.dmn",
+  "dist/valid_models/DMNv1_5/TypeConstraintsChecks.dmn",
+  "dist/valid_models/DMNv1_x/multiple/Financial.dmn",
+  "dist/valid_models/DMNv1_x/multiple/Imported_Traffic_Violation.dmn",
+  "dist/valid_models/DMNv1_x/multiple/stdlib.dmn",
+  "dist/valid_models/DMNv1_x/allTypes.dmn",
+  "dist/valid_models/DMNv1_x/dtevent.dmn",
+  "dist/valid_models/DMNv1_x/habitability.dmn",
+  "dist/valid_models/DMNv1_x/loan.dmn",
+  "dist/valid_models/DMNv1_x/LoanEligibility.dmn",
+  "dist/valid_models/DMNv1_x/OneOfEachType.dmn",
+  "dist/valid_models/DMNv1_x/Prequalification.dmn",
+  "dist/valid_models/DMNv1_x/testWithExtensionElements.dmn",
+  "dist/valid_models/DMNv1_x/Traffic Violation Simple.dmn",
+  "dist/valid_models/DMNv1_x/Traffic Violation.dmn",

Review Comment:
   is it intentional we do not have all content from 
https://github.com/apache/incubator-kie-drools/tree/main/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models
 ?



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