From 0c12bd7b9f2d92a0b6b449361d9b59bd3b7fa7a3 Mon Sep 17 00:00:00 2001 From: Jozef Marko Date: Fri, 29 Nov 2024 07:03:49 +0100 Subject: [PATCH 1/4] kie-issues#1613: Add `CI :: License headers` GitHub Actions workflow (#3714) * Add license header * Revert "Add license header" This reverts commit 00cfcc576ecbf25385000527951183892bcf4844. * Add license header * revert beans.xml * .rat-excludes and rat check action * remove checkstyle.header.template * OMG BPMN SPEC files license * .rat-excludes fix format - escaping * .rat-excludes * storage-jpa license * apache rat 17 * fix exit logic * print rat check output * align with other PRs of kie-issues#1613 * license text placeholder * LICENSE SPEC * Revert "LICENSE SPEC" This reverts commit 3e4e2f87ec31c7b425eff0f51c6a337750c91bc2. * List explicitely all files in the .rat-excludes * Use apache-rat v0.16.1 * Everthing -> Everything * BPMN LICENSE text * CI :: License headers * kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources * .bpmn[2] files --- .../workflows/ci_check_license_headers.yaml | 40 ++++ .gitignore | 5 +- .rat-excludes | 220 ++++++++++++++++++ LICENSE | 110 +++++++++ NOTICE | 2 +- .../common/jbpm-usertask-storage-jpa/pom.xml | 18 ++ .../jbpm-deps-group-bpmn2-compiler/pom.xml | 20 ++ .../jbpm-deps-group-compiler/pom.xml | 20 ++ .../jbpm-deps-group-engine/pom.xml | 20 ++ jbpm/jbpm-deps-groups/pom.xml | 20 ++ ...rySignalEventOnTaskWithTransformation.bpmn | 18 ++ .../BPMN2-UserTaskAssignmentActor.bpmn | 18 ++ .../BPMN2-UserTaskAssignmentActorGroup.bpmn | 18 ++ .../BPMN2-UserTaskAssignmentGroup.bpmn | 18 ++ .../BPMN2-UserTaskAssignmentNone.bpmn | 18 ++ .../adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 | 18 ++ .../BPMN2-BusinessCalendarTimer.bpmn2 | 18 ++ .../BPMN2-EventSubprocessEscalation.bpmn2 | 18 ++ .../escalation/BPMN2-Multiescalation.bpmn2 | 18 ++ .../escalation/BPMN2-TopLevelEscalation.bpmn2 | 18 ++ .../flow/BPMN2-BooleanStructureRef.bpmn2 | 18 ++ .../bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 | 18 ++ .../BPMN2-DefaultObjectStructureRef.bpmn2 | 18 ++ .../bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 | 18 ++ .../flow/BPMN2-IntegerStructureRef.bpmn2 | 18 ++ .../bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 | 18 ++ ...iInstanceLoopSubprocessBoundaryTimer.bpmn2 | 18 ++ ...BPMN2-SubProcessWithEntryExitScripts.bpmn2 | 18 ++ .../resources/BPMN2-StringStructureRef.bpmn2 | 18 ++ jbpm/jbpm-usertask-workitem/pom.xml | 18 ++ jbpm/jbpm-usertask/pom.xml | 20 ++ .../kogito-build-no-bom-parent/pom.xml | 26 --- .../UserTasksNotCompletedDeadline.bpmn2 | 18 ++ .../UserTasksNotCompletedReassign.bpmn2 | 20 +- .../UserTasksNotStartedDeadline.bpmn2 | 18 ++ .../UserTasksNotStartedReasssign.bpmn2 | 18 ++ pom.xml | 30 --- .../addons/dynamic/integration-tests/pom.xml | 20 ++ .../src/main/resources/application.properties | 19 +- .../main/resources/com/example/flexible.bpmn | 18 ++ .../src/main/resources/AddedTask.bpmn | 18 ++ .../src/main/resources/EmbeddedProcess.bpmn | 18 ++ .../src/main/resources/AdHocFragments.bpmn | 18 ++ .../src/main/resources/cinema.bpmn | 18 ++ .../src/main/resources/monitoring.bpmn | 18 ++ .../main/resources/multi-instance-task.bpmn | 18 ++ .../src/main/resources/approval.bpmn | 18 ++ .../addons/jbpm-usertask-storage-jpa/pom.xml | 18 ++ .../src/main/resources/AdHocFragments.bpmn | 18 ++ .../src/main/resources/cinema.bpmn | 18 ++ .../src/main/resources/monitoring.bpmn | 18 ++ .../main/resources/multi-instance-task.bpmn | 18 ++ .../src/main/resources/approval.bpmn | 18 ++ 53 files changed, 1216 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/ci_check_license_headers.yaml create mode 100644 .rat-excludes diff --git a/.github/workflows/ci_check_license_headers.yaml b/.github/workflows/ci_check_license_headers.yaml new file mode 100644 index 00000000000..cb3819f18a0 --- /dev/null +++ b/.github/workflows/ci_check_license_headers.yaml @@ -0,0 +1,40 @@ +# +# 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. +# + +name: "CI :: License headers" + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download Apache RAT + run: | + curl -LO https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.16.1/apache-rat-0.16.1.jar + + - name: Run Apache RAT + run: | + java -jar apache-rat-0.16.1.jar -d . -E .rat-excludes | grep "== File:" && echo "The files listed above are missing license headers." && exit 1 || echo "All files have license headers." diff --git a/.gitignore b/.gitignore index 5aa47c7c3d7..f158718de37 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ target/ .run/ .checkstyle -*.log \ No newline at end of file +*.log + +# Apache RAT check excludes file +!.rat-excludes \ No newline at end of file diff --git a/.rat-excludes b/.rat-excludes new file mode 100644 index 00000000000..fbf8012a8da --- /dev/null +++ b/.rat-excludes @@ -0,0 +1,220 @@ +# .rat-excludes +.rat-excludes +# DISCLAIMER-WIP +DISCLAIMER-WIP +# addons/common/jbpm-usertask-storage-jpa/src/main/resources/META-INF/beans.xml +beans.xml +# addons/common/marshallers/avro/src/main/resources/jsonNode.avsc +jsonNode.avsc +# addons/common/marshallers/avro/src/main/resources/spec.avsc +spec.avsc +# addons/common/marshallers/avro/src/test/avro/pojo.avsc +pojo.avsc +# addons/common/monitoring/prometheus/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/filesystem/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/infinispan/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/jdbc/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/mongodb/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/postgresql/src/main/resources/META-INF/kogito.addon +kogito.addon +# addons/common/persistence/rocksdb/src/main/resources/META-INF/kogito.addon +kogito.addon +# api/kogito-events-core/src/main/resources/META-INF/services/com.fasterxml.jackson.databind.Module +com.fasterxml.jackson.databind.Module +# api/kogito-events-core/src/main/resources/META-INF/services/org.kie.kogito.event.impl.adapter.DataEventAdapter +org.kie.kogito.event.impl.adapter.DataEventAdapter +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMN20.xsd +BPMN20.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMNDI.xsd +BPMNDI.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/DC.xsd +DC.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/DI.xsd +DI.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/DiagramDefinition.xsd +DiagramDefinition.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/DiagramInterchange.xsd +DiagramInterchange.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/Semantic.xsd +Semantic.xsd +# jbpm/jbpm-bpmn2/src/main/resources/META-INF/bpsim.xsd +bpsim.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/BPMN20.xsd +BPMN20.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/BPMNDI.xsd +BPMNDI.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/DC.xsd +DC.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/DI.xsd +DI.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/DiagramDefinition.xsd +DiagramDefinition.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/DiagramInterchange.xsd +DiagramInterchange.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/Semantic.xsd +Semantic.xsd +# jbpm/jbpm-bpmn2/src/main/xsd/bpsim.xsd +bpsim.xsd +# jbpm/jbpm-flow/src/main/resources/META-INF/services/org.jbpm.ruleflow.core.factory.provider.NodeFactoryProvider +org.jbpm.ruleflow.core.factory.provider.NodeFactoryProvider +# jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.compiler.canonical.builtin.ReturnValueEvaluatorBuilder +org.jbpm.compiler.canonical.builtin.ReturnValueEvaluatorBuilder +# jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.compiler.canonical.node.NodeVisitorBuilder +org.jbpm.compiler.canonical.node.NodeVisitorBuilder +# jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.process.builder.transformation.DataTransformerCompiler +org.jbpm.process.builder.transformation.DataTransformerCompiler +# jbpm/jbpm-flow-migration/src/test/resources/META-INF/migration-plan/simple_invalid_migration.invalid +simple_invalid_migration.invalid +# jbpm/jbpm-flow-migration/src/test/resources/META-INF/migration-plan/simple_migration.mpf +simple_migration.mpf +# jbpm/jbpm-flow-migration/src/test/resources/META-INF/migration-plan/simple_migration_version.mpf +simple_migration_version.mpf +# jbpm/jbpm-tests/src/test/resources/calendar.properties +calendar.properties +# jbpm/jbpm-tests/src/test/resources/xxe-protection/Text1.txt +Text1.txt +# jbpm/jbpm-tests/src/test/resources/xxe-protection/Text2.txt +Text2.txt +# jbpm/jbpm-usertask-workitem/src/main/resources/META-INF/services/org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory +org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory +# jbpm/process-workitems/src/main/resources/META-INF/services/org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory +org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory +# kogito-codegen-modules/kogito-codegen-core/src/test/resources/.a-hidden-file.txt +.a-hidden-file.txt +# kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/META-INF/kogito.addon +kogito.addon +# kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/org/kie/kogito/codegen/process/process-generation-test.skip.txt +process-generation-test.skip.txt +# kogito-codegen-modules/kogito-codegen-sample/kogito-codegen-sample-generator/src/test/resources/sampleFile1.txt +sampleFile1.txt +# kogito-codegen-modules/kogito-codegen-sample/kogito-codegen-sample-generator/src/test/resources/sampleFile2.txt +sampleFile2.txt +# kogito-serverless-workflow/kogito-serverless-workflow-builder/src/test/resources/pepe a pepa.txt +pepe a pepa.txt +# kogito-serverless-workflow/kogito-serverless-workflow-executor-python/requirements.txt +requirements.txt +# kogito-serverless-workflow/kogito-serverless-workflow-executor-tests/src/test/resources/logback.xml +logback.xml +# quarkus/addons/dynamic/integration-tests/src/main/resources/application.properties +application.properties +# quarkus/addons/dynamic/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/events/decisions/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/events/predictions/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/events/rules/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/explainability/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/jbpm-usertask-storage-jpa/runtime/src/test/resources/META-INF/beans.xml +beans.xml +# quarkus/addons/jobs/knative-eventing/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/jobs/management/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/jobs/messaging/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/knative/eventing/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/knative/serving/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/kubernetes/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/mail/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/messaging/common/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/messaging/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/microprofile-config-service-catalog/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/monitoring/core/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/monitoring/elastic/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/monitoring/prometheus/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/persistence/kafka/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/process-management/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/process-svg/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/python/integration-tests/requirements.txt +requirements.txt +# quarkus/addons/source-files/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/task-management/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/task-notification/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/addons/tracing-decision/runtime/src/main/resources/META-INF/kogito.addon +kogito.addon +# quarkus/extensions/kogito-quarkus-decisions-extension/kogito-quarkus-decisions-integration-test-hot-reload/src/test/resources/TrafficViolation.txt +TrafficViolation.txt +# quarkus/extensions/kogito-quarkus-decisions-extension/kogito-quarkus-decisions-integration-test-hot-reload/src/test/resources/adult.txt +adult.txt +# quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules-integration-test-hot-reload/src/test/resources/adult.txt +adult.txt +# quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules-integration-test-hot-reload/src/test/resources/drl1.txt +drl1.txt +# quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/long-call.sw.yaml +long-call.sw.yaml +# quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/resources/__snapshots__/ServerlessWorkflowCodestartTest/testContent/src_test_resources_application.yml +src_test_resources_application.yml +# quarkus/integration-tests/integration-tests-quarkus-rules/src/test/resources/LoanUnit.xls.properties.test +LoanUnit.xls.properties.test +# springboot/addons/events/decisions/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/events/predictions/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/explainability/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/flyway/src/main/resources/META-INF/beans.xml +beans.xml +# springboot/addons/jbpm-usertask-storage-jpa/src/main/resources/META-INF/beans.xml +beans.xml +# springboot/addons/jobs/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/kubernetes/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/mail/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/messaging/implementation/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/monitoring/core/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/monitoring/elastic/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/monitoring/prometheus/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/process-management/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/process-svg/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/task-management/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/task-notification/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/addons/tracing-decision/src/main/resources/META-INF/kogito.addon +kogito.addon +# springboot/archetype/src/test/resources/projects/it-basic/goal.txt +goal.txt +# springboot/archetype/src/test/resources/projects/it-custom-decisions/goal.txt +goal.txt +# springboot/archetype/src/test/resources/projects/it-custom-process/goal.txt +goal.txt +# springboot/integration-tests/integration-tests-springboot-kafka-it/.gitignore +.gitignore +# springboot/integration-tests/integration-tests-springboot-processes-it/.gitignore +.gitignore +# springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-persistence-common/.gitignore +.gitignore diff --git a/LICENSE b/LICENSE index 261eeb9e9f8..0f75c3b036b 100644 --- a/LICENSE +++ b/LICENSE @@ -199,3 +199,113 @@ 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. + + +------------------------------------------------------------------------------------ +for jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMN20.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMNDI.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/DC.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/DI.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/DiagramDefinition.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/DiagramInterchange.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/Semantic.xsd + jbpm/jbpm-bpmn2/src/main/resources/META-INF/bpsim.xsd + jbpm/jbpm-bpmn2/src/main/xsd/BPMN20.xsd + jbpm/jbpm-bpmn2/src/main/xsd/BPMNDI.xsd + jbpm/jbpm-bpmn2/src/main/xsd/DC.xsd + jbpm/jbpm-bpmn2/src/main/xsd/DI.xsd + jbpm/jbpm-bpmn2/src/main/xsd/DiagramDefinition.xsd + jbpm/jbpm-bpmn2/src/main/xsd/DiagramInterchange.xsd + jbpm/jbpm-bpmn2/src/main/xsd/Semantic.xsd + jbpm/jbpm-bpmn2/src/main/xsd/bpsim.xsd + +Copyright © 2010, Axway +Copyright © 2010, BizAgi +Copyright © 2010, Bruce Silver Associates +Copyright © 2010, IDS Scheer +Copyright © 2010, IBM Corp. +Copyright © 2010, MEGA International +Copyright © 2010, Model Driven Solutions +Copyright © 2010, Object Management Group +Copyright © 2010, Oracle +Copyright © 2010, SAP AG +Copyright © 2010, Software AG +Copyright © 2010, TIBCO Software +Copyright © 2010, Unisys + +USE OF SPECIFICATION - TERMS, CONDITIONS & NOTICES +The material in this document details an Object Management Group specification in accordance with the terms, +conditions and notices set forth below. This document does not represent a commitment to implement any portion of this +specification in any company's products. The information contained in this document is subject to change without notice. + +LICENSES +The companies listed above have granted to the Object Management Group, Inc. (OMG) a nonexclusive, royalty-free, +paid up, worldwide license to copy and distribute this document and to modify this document and distribute copies of the +modified version. Each of the copyright holders listed above has agreed that no person shall be deemed to have infringed +the copyright in the included material of any such copyright holder by reason of having used the specification set forth +herein or having conformed any computer software to the specification. +Subject to all of the terms and conditions below, the owners of the copyright in this specification hereby grant you a fullypaid up, non-exclusive, nontransferable, perpetual, worldwide license (without the right to sublicense), to use this +specification to create and distribute software and special purpose specifications that are based upon this specification, +and to use, copy, and distribute this specification as provided under the Copyright Act; provided that: (1) both the +copyright notice identified above and this permission notice appear on any copies of this specification; (2) the use of the +specifications is for informational purposes and will not be copied or posted on any network computer or broadcast in any +media and will not be otherwise resold or transferred for commercial purposes; and (3) no modifications are made to this +specification. This limited permission automatically terminates without notice if you breach any of these terms or +conditions. Upon termination, you will destroy immediately any copies of the specifications in your possession or control. + +PATENTS +The attention of adopters is directed to the possibility that compliance with or adoption of OMG specifications may +require use of an invention covered by patent rights. OMG shall not be responsible for identifying patents for which a +license may be required by any OMG specification, or for conducting legal inquiries into the legal validity or scope of +those patents that are brought to its attention. OMG specifications are prospective and advisory only. Prospective users are +responsible for protecting themselves against liability for infringement of patents. + +GENERAL USE RESTRICTIONS +Any unauthorized use of this specification may violate copyright laws, trademark laws, and communications regulations +and statutes. This document contains information which is protected by copyright. All Rights Reserved. No part of this +work covered by copyright herein may be reproduced or used in any form or by any means--graphic, electronic, or +mechanical, including photocopying, recording, taping, or information storage and retrieval systems--without permission +of the copyright owner. + +DISCLAIMER OF WARRANTY +WHILE THIS PUBLICATION IS BELIEVED TO BE ACCURATE, IT IS PROVIDED "AS IS" AND MAY CONTAIN +ERRORS OR MISPRINTS. THE OBJECT MANAGEMENT GROUP AND THE COMPANIES LISTED ABOVE +MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS PUBLICATION, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF TITLE OR OWNERSHIP, IMPLIED WARRANTY OF +MERCHANTABILITY OR WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE. +IN NO EVENT SHALL THE OBJECT MANAGEMENT GROUP OR ANY OF THE COMPANIES LISTED ABOVE +BE LIABLE FOR ERRORS CONTAINED HEREIN OR FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +CONSEQUENTIAL, RELIANCE OR COVER DAMAGES, INCLUDING LOSS OF PROFITS, REVENUE, DATA OR +USE, INCURRED BY ANY USER OR ANY THIRD PARTY IN CONNECTION WITH THE FURNISHING, +PERFORMANCE, OR USE OF THIS MATERIAL, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. +The entire risk as to the quality and performance of software developed using this specification is borne by you. This +disclaimer of warranty constitutes an essential part of the license granted to you to use this specification. + +RESTRICTED RIGHTS LEGEND +Use, duplication or disclosure by the U.S. Government is subject to the restrictions set forth in subparagraph (c) (1) (ii) of +The Rights in Technical Data and Computer Software Clause at DFARS 252.227-7013 or in subparagraph (c)(1) and (2) +of the Commercial Computer Software - Restricted Rights clauses at 48 C.F.R. 52.227-19 or as specified in 48 C.F.R. 227- +7202-2 of the DoD F.A.R. Supplement and its successors, or as specified in 48 C.F.R. 12.212 of the Federal Acquisition +Regulations and its successors, as applicable. The specification copyright owners are as indicated above and may be +contacted through the Object Management Group, 140 Kendrick Street, Needham, MA 02494, U.S.A. + +TRADEMARKS +MDA®, Model Driven Architecture®, UML®, UML Cube logo®, OMG Logo®, CORBA® and XMI® are registered +trademarks of the Object Management Group, Inc., and Object Management Group™, OMG™ , Unified Modeling +Language™, Model Driven Architecture Logo™, Model Driven Architecture Diagram™, CORBA logos™, XMI +Logo™, CWM™, CWM Logo™, IIOP™ , IMM™ , MOF™ , OMG Interface Definition Language (IDL)™ , and OMG +Systems Modeling Language (OMG SysML)™ are trademarks of the Object Management Group. All other products or +company names mentioned are used for identification purposes only, and may be trademarks of their respective owners. + +COMPLIANCE +The copyright holders listed above acknowledge that the Object Management Group (acting itself or through its +designees) is and shall at all times be the sole entity that may authorize developers, suppliers and sellers of computer +software to use certification marks, trademarks or other special designations to indicate compliance with these materials. +Software developed under the terms of this license may claim compliance or conformance with this specification if and +only if the software compliance is of a nature fully matching the applicable compliance points as stated in the +specification. Software developed only partially matching the applicable compliance points may claim only that the +software was based on this specification, but may not claim compliance or conformance with this specification. In the +event that testing suites are implemented or approved by Object Management Group, Inc., software developed using this +specification may claim compliance or conformance with the specification only if the software satisfactorily completes +the testing suites. diff --git a/NOTICE b/NOTICE index 6a7d335aa36..a1c5656ff47 100644 --- a/NOTICE +++ b/NOTICE @@ -5,5 +5,5 @@ This product includes software developed at The Apache Software Foundation (http://www.apache.org/). The Initial Developer of some parts of the framework, which are copied from, derived from, or -inspired by KIE (Knowledge Is Everthing) group, is Red Hat, Inc (https://www.redhat.com/). +inspired by KIE (Knowledge Is Everything) group, is Red Hat, Inc (https://www.redhat.com/). Copyright Red Hat, Inc. and/or its affiliates.. All Rights Reserved. diff --git a/addons/common/jbpm-usertask-storage-jpa/pom.xml b/addons/common/jbpm-usertask-storage-jpa/pom.xml index dd28be272d2..edb4604dc98 100644 --- a/addons/common/jbpm-usertask-storage-jpa/pom.xml +++ b/addons/common/jbpm-usertask-storage-jpa/pom.xml @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-deps-groups/jbpm-deps-group-bpmn2-compiler/pom.xml b/jbpm/jbpm-deps-groups/jbpm-deps-group-bpmn2-compiler/pom.xml index fc95ee21aa7..7588fbab07f 100644 --- a/jbpm/jbpm-deps-groups/jbpm-deps-group-bpmn2-compiler/pom.xml +++ b/jbpm/jbpm-deps-groups/jbpm-deps-group-bpmn2-compiler/pom.xml @@ -1,4 +1,24 @@ + + + diff --git a/jbpm/jbpm-deps-groups/jbpm-deps-group-compiler/pom.xml b/jbpm/jbpm-deps-groups/jbpm-deps-group-compiler/pom.xml index dc1c82939e6..1ea04bab788 100644 --- a/jbpm/jbpm-deps-groups/jbpm-deps-group-compiler/pom.xml +++ b/jbpm/jbpm-deps-groups/jbpm-deps-group-compiler/pom.xml @@ -1,4 +1,24 @@ + + + diff --git a/jbpm/jbpm-deps-groups/jbpm-deps-group-engine/pom.xml b/jbpm/jbpm-deps-groups/jbpm-deps-group-engine/pom.xml index 49de8b3f4a1..63afdf2a343 100644 --- a/jbpm/jbpm-deps-groups/jbpm-deps-group-engine/pom.xml +++ b/jbpm/jbpm-deps-groups/jbpm-deps-group-engine/pom.xml @@ -1,4 +1,24 @@ + + + diff --git a/jbpm/jbpm-deps-groups/pom.xml b/jbpm/jbpm-deps-groups/pom.xml index 6bcfa255cd8..aed41006ffa 100644 --- a/jbpm/jbpm-deps-groups/pom.xml +++ b/jbpm/jbpm-deps-groups/pom.xml @@ -1,4 +1,24 @@ + + + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-BoundarySignalEventOnTaskWithTransformation.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-BoundarySignalEventOnTaskWithTransformation.bpmn index abf5d076e7a..ee6aad92430 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-BoundarySignalEventOnTaskWithTransformation.bpmn +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-BoundarySignalEventOnTaskWithTransformation.bpmn @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn index 6b34d02f0a1..84c60ee4f21 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn index 1b11d2f4e48..4f1b3db6caa 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn index 3f8dd4c29d9..9fa56737657 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn index f73402a78db..6d71eff3385 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 index 9fa6ea3c097..3cb4b05dbca 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/calendar/BPMN2-BusinessCalendarTimer.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/calendar/BPMN2-BusinessCalendarTimer.bpmn2 index 490924b1f18..6abea3abfdd 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/calendar/BPMN2-BusinessCalendarTimer.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/calendar/BPMN2-BusinessCalendarTimer.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EventSubprocessEscalation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EventSubprocessEscalation.bpmn2 index 9a923a86940..f72432f60ad 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EventSubprocessEscalation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EventSubprocessEscalation.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-Multiescalation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-Multiescalation.bpmn2 index 053b00c8824..69e84769c4f 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-Multiescalation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-Multiescalation.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-TopLevelEscalation.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-TopLevelEscalation.bpmn2 index 140b641e691..35ec595f2e1 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-TopLevelEscalation.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-TopLevelEscalation.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 index 4f1a5f4cf1c..6fe9d32d026 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 index d3e534a9a0a..41ebdf3ab35 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 index fa9f4215e59..6f2e1f92175 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 index 6adad3b6485..df0dedc9973 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 index b3897ef2253..0784051ab9e 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 index 103d1d5156b..9cb60b2a748 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopSubprocessBoundaryTimer.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopSubprocessBoundaryTimer.bpmn2 index 5afcff04cbd..d95a3e1753a 100644 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopSubprocessBoundaryTimer.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopSubprocessBoundaryTimer.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 index 0f9b4dc9e88..5d76e80189b 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 index 60b94bb8129..2565119cc93 100755 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-usertask-workitem/pom.xml b/jbpm/jbpm-usertask-workitem/pom.xml index f00c773f32a..1d009ffdd9c 100644 --- a/jbpm/jbpm-usertask-workitem/pom.xml +++ b/jbpm/jbpm-usertask-workitem/pom.xml @@ -1,4 +1,22 @@ + diff --git a/jbpm/jbpm-usertask/pom.xml b/jbpm/jbpm-usertask/pom.xml index 29975eebb3f..9e1072a02fd 100644 --- a/jbpm/jbpm-usertask/pom.xml +++ b/jbpm/jbpm-usertask/pom.xml @@ -1,4 +1,24 @@ + + + diff --git a/kogito-build/kogito-build-no-bom-parent/pom.xml b/kogito-build/kogito-build-no-bom-parent/pom.xml index b7c3505d201..afe76bd494e 100644 --- a/kogito-build/kogito-build-no-bom-parent/pom.xml +++ b/kogito-build/kogito-build-no-bom-parent/pom.xml @@ -45,28 +45,6 @@ --> false - - - java,groovy true @@ -189,10 +167,6 @@ - - - - diff --git a/kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/usertask/UserTasksNotCompletedDeadline.bpmn2 b/kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/usertask/UserTasksNotCompletedDeadline.bpmn2 index 1c7eb2d169e..bd2ed487829 100644 --- a/kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/usertask/UserTasksNotCompletedDeadline.bpmn2 +++ b/kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/usertask/UserTasksNotCompletedDeadline.bpmn2 @@ -1,4 +1,22 @@ + + + + + UTF-8 2024-01-16T00:00:00Z 3.4.1 - 0.16.1 3.6.2 @@ -115,35 +114,6 @@ ${project.build.outputTimestamp} - - org.apache.rat - apache-rat-plugin - ${version.apache-rat-plugin} - - - .mvn/maven.config - **/simple_invalid_migration.invalid - **/*.mpf - **/src/test/**/*.txt - **/.gitkeep - **/checkstyle-cachefile - **/*.log - **/*.lst - **/requirements.txt - **/*.addon - **/*.avsc - **/LoanUnit.xls.properties.test - **/src_test_resources_application.yml - **/BPMN*.xsd - **/bpsim.xsd - **/DC.xsd - **/DI.xsd - **/DiagramDefinition.xsd - **/DiagramInterchange.xsd - **/Semantic.xsd - - - diff --git a/quarkus/addons/dynamic/integration-tests/pom.xml b/quarkus/addons/dynamic/integration-tests/pom.xml index 7109502889e..2fca76b377f 100644 --- a/quarkus/addons/dynamic/integration-tests/pom.xml +++ b/quarkus/addons/dynamic/integration-tests/pom.xml @@ -1,4 +1,24 @@ + + + 4.0.0 diff --git a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common-deployment/src/main/resources/application.properties b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common-deployment/src/main/resources/application.properties index 9aed8899255..d2f97a4e497 100644 --- a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common-deployment/src/main/resources/application.properties +++ b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common-deployment/src/main/resources/application.properties @@ -1 +1,18 @@ -quarkus.native.auto-service-loader-registration=true \ No newline at end of file +# 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. + +quarkus.native.auto-service-loader-registration=true diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn index a0d6fa7e761..0d29c270357 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/AddedTask.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/AddedTask.bpmn index 6668aa4f716..efb2f7ad948 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/AddedTask.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/AddedTask.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn index 9dfe55cf448..4605d5b444f 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn index b1f2dcd8979..3ee426fb402 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn index 31001420145..e8f66a7b3c9 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn index 417df6efeb6..b8cdfe0d4c8 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn index 61bfd8853fa..7e22eb7fc81 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn @@ -1,4 +1,22 @@ + diff --git a/quarkus/integration-tests/integration-tests-quarkus-usertasks/src/main/resources/approval.bpmn b/quarkus/integration-tests/integration-tests-quarkus-usertasks/src/main/resources/approval.bpmn index 275d148f7ac..521099709e4 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-usertasks/src/main/resources/approval.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-usertasks/src/main/resources/approval.bpmn @@ -1,4 +1,22 @@ + diff --git a/springboot/addons/jbpm-usertask-storage-jpa/pom.xml b/springboot/addons/jbpm-usertask-storage-jpa/pom.xml index 36bed41e5cc..7dad79c279c 100644 --- a/springboot/addons/jbpm-usertask-storage-jpa/pom.xml +++ b/springboot/addons/jbpm-usertask-storage-jpa/pom.xml @@ -1,3 +1,21 @@ + diff --git a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn index 5910d68133c..a9bdf9430c1 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn +++ b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn @@ -1,4 +1,22 @@ + diff --git a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn index 07fad205630..00a1672ff1e 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn +++ b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn @@ -1,4 +1,22 @@ + diff --git a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn index 29c2c5ca76b..acc31665c02 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn +++ b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn @@ -1,4 +1,22 @@ + diff --git a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn index 1d6cd33cf0a..4479cce36ef 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn +++ b/springboot/integration-tests/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn @@ -1,4 +1,22 @@ + diff --git a/springboot/integration-tests/integration-tests-springboot-usertasks-it/src/main/resources/approval.bpmn b/springboot/integration-tests/integration-tests-springboot-usertasks-it/src/main/resources/approval.bpmn index 275d148f7ac..521099709e4 100644 --- a/springboot/integration-tests/integration-tests-springboot-usertasks-it/src/main/resources/approval.bpmn +++ b/springboot/integration-tests/integration-tests-springboot-usertasks-it/src/main/resources/approval.bpmn @@ -1,4 +1,22 @@ + From 86fe14918a133be699e1685fae1d38d88c108029 Mon Sep 17 00:00:00 2001 From: Jozef Marko Date: Mon, 2 Dec 2024 09:18:33 +0100 Subject: [PATCH 2/4] kie-issues#1634: Fix pmml files licensing (#3798) Address copyright issue from the apache/incubator-kie-issues/issues/1634: - https://github.com/apache/incubator-kie-issues/issues/1634#issuecomment-2505506658 This PR is not for adding license headers into files as no such file was marked as blocker from Apache KIE 10 release. --- .rat-excludes | 30 ++++++++++++ LICENSE | 46 +++++++++++++++++++ .../org/kie/kogito/pmml/test_regression.pmml | 18 -------- .../org/kie/kogito/pmml/test_tree.pmml | 18 -------- .../resources/dmnPmml/test_regression.pmml | 18 -------- .../src/test/resources/dmnPmml/test_tree.pmml | 18 -------- .../prediction/test_miningmodel.pmml | 18 -------- .../resources/prediction/test_regression.pmml | 18 -------- .../resources/prediction/test_scorecard.pmml | 18 -------- .../src/main/resources/PMMLRegression.pmml | 17 ------- .../src/main/resources/META-INF/beans.xml | 19 -------- .../src/main/resources/PMMLRegression.pmml | 17 ------- .../src/main/resources/PMMLRegression.pmml | 18 -------- .../src/main/resources/PMMLTree.pmml | 18 -------- .../src/main/resources/PMMLRegression.pmml | 18 -------- .../src/main/resources/PMMLTree.pmml | 18 -------- .../src/main/resources/PMMLRegression.pmml | 18 -------- 17 files changed, 76 insertions(+), 269 deletions(-) diff --git a/.rat-excludes b/.rat-excludes index fbf8012a8da..14df5c25a4c 100644 --- a/.rat-excludes +++ b/.rat-excludes @@ -28,6 +28,14 @@ kogito.addon com.fasterxml.jackson.databind.Module # api/kogito-events-core/src/main/resources/META-INF/services/org.kie.kogito.event.impl.adapter.DataEventAdapter org.kie.kogito.event.impl.adapter.DataEventAdapter +# drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml +test_tree.pmml +# drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml +test_regression.pmml +# drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml +test_tree.pmml +# drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml +test_regression.pmml # jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMN20.xsd BPMN20.xsd # jbpm/jbpm-bpmn2/src/main/resources/META-INF/BPMNDI.xsd @@ -86,6 +94,14 @@ org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory org.kie.kogito.internal.process.workitem.KogitoWorkItemHandlerFactory # kogito-codegen-modules/kogito-codegen-core/src/test/resources/.a-hidden-file.txt .a-hidden-file.txt +# kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_multiplemodels.pmml +test_multiplemodels.pmml +# kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml +test_scorecard.pmml +# kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml +test_regression.pmml +# kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml +test_miningmodel.pmml # kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/META-INF/kogito.addon kogito.addon # kogito-codegen-modules/kogito-codegen-processes-integration-tests/src/test/resources/org/kie/kogito/codegen/process/process-generation-test.skip.txt @@ -162,6 +178,8 @@ kogito.addon TrafficViolation.txt # quarkus/extensions/kogito-quarkus-decisions-extension/kogito-quarkus-decisions-integration-test-hot-reload/src/test/resources/adult.txt adult.txt +# quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml +PMMLRegression.pmml # quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules-integration-test-hot-reload/src/test/resources/adult.txt adult.txt # quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules-integration-test-hot-reload/src/test/resources/drl1.txt @@ -170,6 +188,12 @@ drl1.txt long-call.sw.yaml # quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/resources/__snapshots__/ServerlessWorkflowCodestartTest/testContent/src_test_resources_application.yml src_test_resources_application.yml +# quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml +PMMLRegression.pmml +# quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml +PMMLTree.pmml +# quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml +PMMLRegression.pmml # quarkus/integration-tests/integration-tests-quarkus-rules/src/test/resources/LoanUnit.xls.properties.test LoanUnit.xls.properties.test # springboot/addons/events/decisions/src/main/resources/META-INF/kogito.addon @@ -212,8 +236,14 @@ goal.txt goal.txt # springboot/archetype/src/test/resources/projects/it-custom-process/goal.txt goal.txt +# springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml +PMMLTree.pmml +# springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml +PMMLRegression.pmml # springboot/integration-tests/integration-tests-springboot-kafka-it/.gitignore .gitignore +# springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml +PMMLRegression.pmml # springboot/integration-tests/integration-tests-springboot-processes-it/.gitignore .gitignore # springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-persistence-common/.gitignore diff --git a/LICENSE b/LICENSE index 0f75c3b036b..34bba9983f4 100644 --- a/LICENSE +++ b/LICENSE @@ -309,3 +309,49 @@ software was based on this specification, but may not claim compliance or confor event that testing suites are implemented or approved by Object Management Group, Inc., software developed using this specification may claim compliance or conformance with the specification only if the software satisfactorily completes the testing suites. + +------------------------------------------------------------------------------------------------------- +for kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_multiplemodels.pmml + kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml + kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml + kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml + quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml + quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml + quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml + quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml + drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml + drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml + drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml + drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml + springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml + springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml + springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml + +Copyright (c) 2008-2016, The Data Mining Group +All rights reserved. +This notice and license applies the.pmml +notice and license is selected by the working group developing the release and is approved +by the DMG Chair. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: +* Redistributions of source code must include the copyright notice below, this list of +conditions and the following disclaimer. +* Redistributions in binary form must reproduce the copyright notice below, this list +of conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution +* Neither the name of the Data Mining Group nor the names of its members or +contributors may be used to endorse or promote products derived from a release +without specific prior written permission. + +THIS STANDARD IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS RELEASE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml b/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml index 66680317633..9caae7e41db 100644 --- a/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml +++ b/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_regression.pmml @@ -1,22 +1,4 @@ -
diff --git a/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml b/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml index 1eaad5e813a..26b06f6a4e8 100644 --- a/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml +++ b/drools/kogito-pmml/src/test/resources/org/kie/kogito/pmml/test_tree.pmml @@ -1,22 +1,4 @@ - diff --git a/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml b/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml index 58d3f9ce67c..6920a9a182f 100644 --- a/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml +++ b/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_regression.pmml @@ -1,22 +1,4 @@ -
diff --git a/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml b/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml index 7f2a84a0dd3..30560bb5ac8 100644 --- a/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml +++ b/drools/kogito-scenario-simulation/src/test/resources/dmnPmml/test_tree.pmml @@ -1,22 +1,4 @@ - diff --git a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml index d6e456f34e9..fa44a45922f 100644 --- a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml +++ b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_miningmodel.pmml @@ -1,22 +1,4 @@ -
diff --git a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml index 288596e1248..76fcfdcb254 100644 --- a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml +++ b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_regression.pmml @@ -1,22 +1,4 @@ -
diff --git a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml index f9c7cc920f2..be0aec00df6 100644 --- a/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml +++ b/kogito-codegen-modules/kogito-codegen-predictions/src/test/resources/prediction/test_scorecard.pmml @@ -1,22 +1,4 @@ -
diff --git a/quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml b/quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml index f4d07efe08f..6920a9a182f 100644 --- a/quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml +++ b/quarkus/extensions/kogito-quarkus-predictions-extension/kogito-quarkus-predictions-integration-test/src/main/resources/PMMLRegression.pmml @@ -1,22 +1,5 @@ -
diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/resources/META-INF/beans.xml b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/resources/META-INF/beans.xml index ab538ff6ee1..cf613e84705 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/resources/META-INF/beans.xml +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/resources/META-INF/beans.xml @@ -17,22 +17,3 @@ ~ under the License. --> - - diff --git a/quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml b/quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml index f4d07efe08f..6920a9a182f 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml +++ b/quarkus/integration-tests/integration-tests-quarkus-norest/src/main/resources/PMMLRegression.pmml @@ -1,22 +1,5 @@ -
diff --git a/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml b/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml index 58d3f9ce67c..6920a9a182f 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml +++ b/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLRegression.pmml @@ -1,22 +1,4 @@ -
diff --git a/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml b/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml index 80dc1cb9407..d5f3d858620 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml +++ b/quarkus/integration-tests/integration-tests-quarkus-predictions/src/main/resources/PMMLTree.pmml @@ -1,22 +1,4 @@ - diff --git a/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml b/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml index 58d3f9ce67c..6920a9a182f 100644 --- a/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml +++ b/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLRegression.pmml @@ -1,22 +1,4 @@ -
diff --git a/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml b/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml index 80dc1cb9407..d5f3d858620 100644 --- a/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml +++ b/springboot/integration-tests/integration-tests-springboot-decisions-it/src/main/resources/PMMLTree.pmml @@ -1,22 +1,4 @@ - diff --git a/springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml b/springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml index 58d3f9ce67c..6920a9a182f 100644 --- a/springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml +++ b/springboot/integration-tests/integration-tests-springboot-norest-it/src/main/resources/PMMLRegression.pmml @@ -1,22 +1,4 @@ -
From 9fa9e3bd118f907cee065d13a64a32c7d150c3b3 Mon Sep 17 00:00:00 2001 From: Gabriele Cardosi Date: Mon, 2 Dec 2024 14:18:20 +0100 Subject: [PATCH 3/4] [incubator-kie-issues#1460] Fix kogito-maven-plugin (#3757) * [incubator-kie-issues#1460] Working unit tests. Working external example * [incubator-kie-issues#1460] Implemented it tests * [incubator-kie-issues#1460] Adapted tests * [incubator-kie-issues#1460] Disable flaky test * [incubator-kie-issues#1460] Fix maven reactor * [incubator-kie-issues#1460] Fix maven reactor * [incubator-kie-issues#1460] Fix maven reactor * [incubator-kie-issues#1460] Optimizing compilation invocation. Removing ProcessClassesMojo.java * [incubator-kie-issues#1460] Removing left-overs * [incubator-kie-issues#1460] Moving kogito-maven-plugin-test as standalone module to avoid springboot dependency inside kogito-maven-plugin * [incubator-kie-issues#1460] Removing leftover properties --------- Co-authored-by: Gabriele-Cardosi --- .../persistence/PersistenceGenerator.java | 16 +- .../proto/AbstractProtoGenerator.java | 2 +- kogito-maven-plugin-test/pom.xml | 181 ++++++ .../org/kie/kogito/traffic/DriverService.java | 45 ++ .../java/org/kie/kogito/traffic/Fine.java | 46 ++ .../kie/kogito/traffic/KogitoApplication.java | 30 + .../org/kie/kogito/traffic/Violation.java | 92 +++ .../LicenseValidatedService.java | 49 ++ .../traffic/licensevalidated/Validated.java | 55 ++ .../traffic/licensevalidation/Driver.java | 131 +++++ .../LicenseValidationService.java | 49 ++ .../resources/LicenseValidatedService.drl | 32 ++ .../resources/LicenseValidationService.drl | 39 ++ .../src/main/resources/TrafficViolation.dmn | 288 ++++++++++ .../src/main/resources/application.properties | 22 + .../src/main/resources/traffic-rules-dmn.bpmn | 534 ++++++++++++++++++ .../TrafficProcessIT.java | 81 +++ kogito-maven-plugin/pom.xml | 83 +-- .../kogito/maven/plugin/AbstractKieMojo.java | 8 + .../maven/plugin/GenerateModelMojo.java | 102 ++-- .../maven/plugin/ProcessClassesMojo.java | 145 ----- .../kie/kogito/maven/plugin/ScaffoldMojo.java | 5 +- .../maven/plugin/util/CompilerHelper.java | 109 ++++ .../plugin/util/GenerateModelHelper.java | 66 +++ .../util/PersistenceGenerationHelper.java | 101 ++++ .../m2e/lifecycle-mapping-metadata.xml | 39 -- .../resources/META-INF/plexus/components.xml | 48 -- .../maven/plugin/GenerateModelMojoTest.java | 97 ++++ .../stubs/GenerateModelMojoProjectStub.java | 83 +++ .../resources/unit/generate-model/pom.xml | 43 ++ pom.xml | 1 + .../pom.xml | 12 +- .../resources/archetype-resources/pom.xml | 9 +- springboot/bom/pom.xml | 9 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- .../pom.xml | 10 +- 44 files changed, 2320 insertions(+), 432 deletions(-) create mode 100644 kogito-maven-plugin-test/pom.xml create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/DriverService.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Fine.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/KogitoApplication.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Violation.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/LicenseValidatedService.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/Validated.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/Driver.java create mode 100644 kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/LicenseValidationService.java create mode 100644 kogito-maven-plugin-test/src/main/resources/LicenseValidatedService.drl create mode 100644 kogito-maven-plugin-test/src/main/resources/LicenseValidationService.drl create mode 100644 kogito-maven-plugin-test/src/main/resources/TrafficViolation.dmn create mode 100644 kogito-maven-plugin-test/src/main/resources/application.properties create mode 100644 kogito-maven-plugin-test/src/main/resources/traffic-rules-dmn.bpmn create mode 100644 kogito-maven-plugin-test/src/test/java/org.kie.kogito.traffic/TrafficProcessIT.java delete mode 100644 kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ProcessClassesMojo.java create mode 100644 kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/CompilerHelper.java create mode 100644 kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/GenerateModelHelper.java create mode 100644 kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/PersistenceGenerationHelper.java delete mode 100644 kogito-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml delete mode 100644 kogito-maven-plugin/src/main/resources/META-INF/plexus/components.xml create mode 100644 kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/GenerateModelMojoTest.java create mode 100644 kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/testing/stubs/GenerateModelMojoProjectStub.java create mode 100644 kogito-maven-plugin/src/test/resources/unit/generate-model/pom.xml diff --git a/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/PersistenceGenerator.java b/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/PersistenceGenerator.java index 7a469697202..11f36da56e7 100644 --- a/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/PersistenceGenerator.java +++ b/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/PersistenceGenerator.java @@ -119,8 +119,6 @@ public Optional section() { @Override protected Collection internalGenerate() { - Collection generatedFiles = new ArrayList<>(); - switch (persistenceType()) { case INFINISPAN_PERSISTENCE_TYPE: case FILESYSTEM_PERSISTENCE_TYPE: @@ -128,15 +126,10 @@ protected Collection internalGenerate() { case JDBC_PERSISTENCE_TYPE: case KAFKA_PERSISTENCE_TYPE: case POSTGRESQL_PERSISTENCE_TYPE: - break; + return generateFiles(); default: throw new IllegalArgumentException("Unknown persistenceType " + persistenceType()); } - - generatedFiles.addAll(generateProtoMarshaller()); - generatedFiles.addAll(generateProtoForDataIndex()); - - return generatedFiles; } @Override @@ -149,6 +142,13 @@ public String persistenceType() { return context().getApplicationProperty(KOGITO_PERSISTENCE_TYPE).orElse(PersistenceGenerator.DEFAULT_PERSISTENCE_TYPE); } + protected Collection generateFiles() { + Collection toReturn = new ArrayList<>(); + toReturn.addAll(generateProtoMarshaller()); + toReturn.addAll(generateProtoForDataIndex()); + return toReturn; + } + protected Collection generateProtoMarshaller() { if (!hasProtoMarshaller(context())) { // TODO implement a validation check to verify that data classes implement Serializable diff --git a/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/proto/AbstractProtoGenerator.java b/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/proto/AbstractProtoGenerator.java index b7e55ec8369..10576e43d51 100644 --- a/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/proto/AbstractProtoGenerator.java +++ b/kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/persistence/proto/AbstractProtoGenerator.java @@ -171,7 +171,7 @@ protected Proto generate(String messageComment, String fieldComment, String pack alreadyGenerated.addAll(protoBuiltins()); for (T dataModel : dataModels.stream().filter(this::filterDataModels).toList()) { try { - LOGGER.debug("internal proto geneartion {}", fqn(dataModel)); + LOGGER.debug("internal proto generation {}", fqn(dataModel)); internalGenerate( proto, alreadyGenerated, diff --git a/kogito-maven-plugin-test/pom.xml b/kogito-maven-plugin-test/pom.xml new file mode 100644 index 00000000000..d830611e87d --- /dev/null +++ b/kogito-maven-plugin-test/pom.xml @@ -0,0 +1,181 @@ + + + 4.0.0 + + + org.kie.kogito + kogito-build-parent + 999-SNAPSHOT + ../kogito-build/kogito-build-parent/pom.xml + + + kogito-maven-plugin-test + + + + org.kie.kogito.maven.plugin.testing + + + + + + org.kie.kogito + kogito-spring-boot-bom + ${project.version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.jbpm + jbpm-spring-boot-starter + + + org.drools + drools-decisions-spring-boot-starter + + + + + org.springframework.boot + spring-boot-starter-test + test + + + io.rest-assured + rest-assured + test + + + + + + ${project.artifactId} + + + + org.apache.maven.plugins + maven-jar-plugin + ${version.jar.plugin} + + + default-jar + + + + ${java.module.name} + + + + + + + test-jar + + test-jar + + + true + + **/logback-test.xml + **/jndi.properties + + + + ${java.module.name}.tests + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier} + ${project.name} + ${project.organization.name} + + + + + + + + + true + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${version.org.springframework.boot} + + + + repackage + + + + + + org.kie.kogito + kogito-maven-plugin + ${project.version} + + + compile + + generateModel + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${version.surefire.plugin} + + + integration-test + + integration-test + verify + + + + + ${project.build.outputDirectory} + + java.util.logging.LogManager + + + + + org.apache.maven.plugins + maven-resources-plugin + + + add-it-resources + pre-integration-test + + copy-resources + + + ${project.build.directory}/test-run/META-INF + + + target/classes/META-INF + + + + + + + + + \ No newline at end of file diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/DriverService.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/DriverService.java new file mode 100644 index 00000000000..3518f838715 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/DriverService.java @@ -0,0 +1,45 @@ +/* + * 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.kogito.traffic; + +import java.time.ZonedDateTime; +import java.util.Date; + +import org.kie.kogito.traffic.licensevalidation.Driver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@Service +public class DriverService { + + private static Logger LOGGER = LoggerFactory.getLogger(DriverService.class); + + public Driver getDriver(String driverId) { + LOGGER.info("Get Driver Information for id = {}", driverId); + //Could call an external service, database, etc. + + //Mocking driver details + String[] parts = driverId.split("-"); + long days = Long.parseLong(parts[0]); + int points = Integer.parseInt(parts[1]); + Date licenseExpiration = new Date(ZonedDateTime.now().plusDays(days).toInstant().toEpochMilli()); + return new Driver(driverId, "Arthur", "SP", "Campinas", points, 30, licenseExpiration); + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Fine.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Fine.java new file mode 100644 index 00000000000..928562fb5f6 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Fine.java @@ -0,0 +1,46 @@ +/* + * 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.kogito.traffic; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Fine { + + @JsonProperty("Amount") + private Double amount; + + @JsonProperty("Points") + private Integer points; + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Integer getPoints() { + return points; + } + + public void setPoints(Integer points) { + this.points = points; + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/KogitoApplication.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/KogitoApplication.java new file mode 100644 index 00000000000..5e7ea292a0e --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/KogitoApplication.java @@ -0,0 +1,30 @@ +/* + * 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.kogito.traffic; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication(scanBasePackages = { "org.kie.kogito.**", "com.example.**" }) +public class KogitoApplication { + + public static void main(String[] args) { + SpringApplication.run(KogitoApplication.class, args); + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Violation.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Violation.java new file mode 100644 index 00000000000..170dd2dda02 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/Violation.java @@ -0,0 +1,92 @@ +/* + * 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.kogito.traffic; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Violation { + + @JsonProperty("Code") + private String code; + + @JsonProperty("Date") + private Date date; + + @JsonProperty("Type") + private String type; + + @JsonProperty("Speed Limit") + private BigDecimal speedLimit; + + @JsonProperty("Actual Speed") + private BigDecimal actualSpeed; + + public Violation() { + } + + public Violation(String type, BigDecimal speedLimit, BigDecimal actualSpeed) { + this.type = type; + this.speedLimit = speedLimit; + this.actualSpeed = actualSpeed; + this.date = new Date(); + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public BigDecimal getSpeedLimit() { + return speedLimit; + } + + public void setSpeedLimit(BigDecimal speedLimit) { + this.speedLimit = speedLimit; + } + + public BigDecimal getActualSpeed() { + return actualSpeed; + } + + public void setActualSpeed(BigDecimal actualSpeed) { + this.actualSpeed = actualSpeed; + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/LicenseValidatedService.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/LicenseValidatedService.java new file mode 100644 index 00000000000..374e5efa230 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/LicenseValidatedService.java @@ -0,0 +1,49 @@ +/* + * 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.kogito.traffic.licensevalidated; + +import java.util.Date; + +import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.RuleUnitData; +import org.drools.ruleunits.api.SingletonStore; + +public class LicenseValidatedService implements RuleUnitData { + private SingletonStore validated; + + public LicenseValidatedService() { + this(DataSource.createSingleton()); + } + + public LicenseValidatedService(SingletonStore validated) { + this.validated = validated; + } + + public void setValidated(SingletonStore validated) { + this.validated = validated; + } + + public SingletonStore getValidated() { + return validated; + } + + public Date getCurrentTime() { + return new Date(); + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/Validated.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/Validated.java new file mode 100644 index 00000000000..a24f9189e0b --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidated/Validated.java @@ -0,0 +1,55 @@ +/* + * 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.kogito.traffic.licensevalidated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Validated { + + @JsonProperty("Suspended") + private String suspended; + + @JsonProperty("ValidLicense") + private Boolean validLicense = Boolean.FALSE; + + public Validated() { + } + + public Validated(String suspended) { + this.suspended = suspended; + } + + public String getSuspended() { + return suspended; + } + + public Boolean isValidLicense() { + return validLicense; + } + + public Boolean getValidLicense() { + return validLicense; + } + + public void setValidLicense(Boolean validLicense) { + this.validLicense = validLicense; + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/Driver.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/Driver.java new file mode 100644 index 00000000000..cfe7d07937f --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/Driver.java @@ -0,0 +1,131 @@ +/* + * 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.kogito.traffic.licensevalidation; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Driver { + + private String id; + + @JsonProperty("Name") + private String name; + + @JsonProperty("State") + private String state; + + @JsonProperty("City") + private String city; + + @JsonProperty("Points") + private Integer points; + + @JsonProperty("Age") + private Integer age; + + private Date licenseExpiration; + + @JsonProperty("ValidLicense") + private Boolean validLicense = Boolean.FALSE; + + public Driver() { + } + + public Driver(String id, String name, String state, String city, Integer points, Integer age, Date licenseExpiration) { + this.id = id; + this.name = name; + this.state = state; + this.city = city; + this.points = points; + this.age = age; + this.licenseExpiration = licenseExpiration; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Integer getPoints() { + return points; + } + + public void setPoints(Integer points) { + this.points = points; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public Date getLicenseExpiration() { + return licenseExpiration; + } + + public void setLicenseExpiration(Date licenseExpiration) { + this.licenseExpiration = licenseExpiration; + } + + public Boolean isValidLicense() { + return validLicense; + } + + public Boolean getValidLicense() { + return validLicense; + } + + public void setValidLicense(Boolean validLicense) { + this.validLicense = validLicense; + } +} diff --git a/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/LicenseValidationService.java b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/LicenseValidationService.java new file mode 100644 index 00000000000..278b5fb4708 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/java/org/kie/kogito/traffic/licensevalidation/LicenseValidationService.java @@ -0,0 +1,49 @@ +/* + * 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.kogito.traffic.licensevalidation; + +import java.util.Date; + +import org.drools.ruleunits.api.DataSource; +import org.drools.ruleunits.api.RuleUnitData; +import org.drools.ruleunits.api.SingletonStore; + +public class LicenseValidationService implements RuleUnitData { + private SingletonStore driver; + + public LicenseValidationService() { + this(DataSource.createSingleton()); + } + + public LicenseValidationService(SingletonStore driver) { + this.driver = driver; + } + + public void setDriver(SingletonStore driver) { + this.driver = driver; + } + + public SingletonStore getDriver() { + return driver; + } + + public Date getCurrentTime() { + return new Date(); + } +} diff --git a/kogito-maven-plugin-test/src/main/resources/LicenseValidatedService.drl b/kogito-maven-plugin-test/src/main/resources/LicenseValidatedService.drl new file mode 100644 index 00000000000..f3b50665c71 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/resources/LicenseValidatedService.drl @@ -0,0 +1,32 @@ +/** + * 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.kogito.traffic.licensevalidated + +unit LicenseValidatedService + +rule "Is validated license validated" +when + $validated: /validated[suspended.equalsIgnoreCase("no")] +then + $validated.setValidLicense(true); +end + +query "validate" + $validated : /validated +end \ No newline at end of file diff --git a/kogito-maven-plugin-test/src/main/resources/LicenseValidationService.drl b/kogito-maven-plugin-test/src/main/resources/LicenseValidationService.drl new file mode 100644 index 00000000000..da7439087da --- /dev/null +++ b/kogito-maven-plugin-test/src/main/resources/LicenseValidationService.drl @@ -0,0 +1,39 @@ +/** + * 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.kogito.traffic.licensevalidation + +unit LicenseValidationService + +rule "Is driver license valid" +when + $driver: /driver[licenseExpiration.after(currentTime)] +then + $driver.setValidLicense(true); +end + +rule "Is driver license expired" +when + $driver: /driver[licenseExpiration.before(currentTime)] +then + $driver.setValidLicense(false); +end + +query "validation" + $driver : /driver +end \ No newline at end of file diff --git a/kogito-maven-plugin-test/src/main/resources/TrafficViolation.dmn b/kogito-maven-plugin-test/src/main/resources/TrafficViolation.dmn new file mode 100644 index 00000000000..daac1062afb --- /dev/null +++ b/kogito-maven-plugin-test/src/main/resources/TrafficViolation.dmn @@ -0,0 +1,288 @@ + + + + + + string + + + number + + + string + + + string + + + number + + + + + string + + + date + + + string + + "speed", "parking", "driving under the influence" + + + + number + + + number + + + + + number + + + number + + + + + string + + + boolean + + + + + + + + + + + + + + + + Violation.Type + + + + + Violation.Actual Speed - Violation.Speed Limit + + + + + + + + "speed" + + + [10..30) + + + 500 + + + 3 + + + + + + + + "speed" + + + >= 30 + + + 1000 + + + 7 + + + + + + + + "parking" + + + - + + + 100 + + + 1 + + + + + + + + "driving under the influence" + + + - + + + 1000 + + + 5 + + + + + + + + + + + + + + + + + + + + + + + + Driver.Points + + + + + + + + < 20 + + + "yes" + + + false + + + + + + + + = 20 + + + "no" + + + true + + + + + + + + > 20 + + + "no" + + + true + + + + + + + + + + + + + 50 + 254 + 329 + 119 + 100 + 186 + + + 50 + 329 + 100 + 119 + 186 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kogito-maven-plugin-test/src/main/resources/application.properties b/kogito-maven-plugin-test/src/main/resources/application.properties new file mode 100644 index 00000000000..37162bfd232 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/resources/application.properties @@ -0,0 +1,22 @@ +# +# 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. +# + +server.address=0.0.0.0 +kogito.generate.rest.decisions=false +kogito.generate.rest.processes=true diff --git a/kogito-maven-plugin-test/src/main/resources/traffic-rules-dmn.bpmn b/kogito-maven-plugin-test/src/main/resources/traffic-rules-dmn.bpmn new file mode 100644 index 00000000000..1ddb14979f1 --- /dev/null +++ b/kogito-maven-plugin-test/src/main/resources/traffic-rules-dmn.bpmn @@ -0,0 +1,534 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _BB963FF4-CF17-4CA0-A727-9AFC2BE17C29 + _E7EF578E-3735-42D9-BF0C-8CCBF398D41C + + + + + _3F719C8E-DA3F-46F8-B8F2-5F04DB132E9C_validatedInputX + + + _3F719C8E-DA3F-46F8-B8F2-5F04DB132E9C_validatedOutputX + + + + validated + _3F719C8E-DA3F-46F8-B8F2-5F04DB132E9C_validatedInputX + + + _3F719C8E-DA3F-46F8-B8F2-5F04DB132E9C_validatedOutputX + validated + + + + _044AA388-325A-45DE-B783-4F48421B788B + + + + + + + + _D3E2F4B7-7739-452F-8D55-0C4F169D4A44 + _D2252EFF-5EC4-4D61-B797-653F71652627 + _044AA388-325A-45DE-B783-4F48421B788B + + + + + + + + _A19108FE-08A2-4E80-B7A8-0254C49209A6 + _D3E2F4B7-7739-452F-8D55-0C4F169D4A44 + + + + + _95EFED1F-73F8-47E7-9604-A81EFE5DE8F5_driverInputX + + + _95EFED1F-73F8-47E7-9604-A81EFE5DE8F5_driverOutputX + + + + driver + _95EFED1F-73F8-47E7-9604-A81EFE5DE8F5_driverInputX + + + _95EFED1F-73F8-47E7-9604-A81EFE5DE8F5_driverOutputX + driver + + + + + + + + + _2C2FFD79-4241-4F9E-A486-2482F817595E + _A19108FE-08A2-4E80-B7A8-0254C49209A6 + + + + + _93FFD317-476E-4624-84EF-994617572560_driverIdInputX + + + _93FFD317-476E-4624-84EF-994617572560_responseOutputX + + + + driverId + _93FFD317-476E-4624-84EF-994617572560_driverIdInputX + + + _93FFD317-476E-4624-84EF-994617572560_responseOutputX + driver + + + + _1287C97D-3568-458A-A907-0123A64A93BE + + + + + + + + _249EB7E9-5847-47C9-8B4D-8BEFED257600 + _1287C97D-3568-458A-A907-0123A64A93BE + System.out.println("Driver is suspended!"); + + + + + + + + _E7EF578E-3735-42D9-BF0C-8CCBF398D41C + _19CC68B6-D2DC-4E39-99E5-CE5B30C5FEE6 + _249EB7E9-5847-47C9-8B4D-8BEFED257600 + + + _521A00FC-6A79-44ED-8485-45DB97A621F2 + + + + + + + + _19CC68B6-D2DC-4E39-99E5-CE5B30C5FEE6 + _521A00FC-6A79-44ED-8485-45DB97A621F2 + System.out.println("Driver is NOT suspended!"); + + + + + + + + _D2252EFF-5EC4-4D61-B797-653F71652627 + _BB963FF4-CF17-4CA0-A727-9AFC2BE17C29 + + + + + + + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_namespaceInputX + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_modelInputX + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_ViolationInputX + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_DriverInputX + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_ValidatedOutputX + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_FineOutputX + + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_namespaceInputX + + + + + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_modelInputX + + + + + + + violation + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_ViolationInputX + + + driver + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_DriverInputX + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_ValidatedOutputX + validated + + + _B076DF7E-91A5-47C7-B3FC-2C2EC06E5941_FineOutputX + fine + + + + _2C2FFD79-4241-4F9E-A486-2482F817595E + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _FcMNgJTYEDuJVMby5BR7SQ + _FcMNgJTYEDuJVMby5BR7SQ + + \ No newline at end of file diff --git a/kogito-maven-plugin-test/src/test/java/org.kie.kogito.traffic/TrafficProcessIT.java b/kogito-maven-plugin-test/src/test/java/org.kie.kogito.traffic/TrafficProcessIT.java new file mode 100644 index 00000000000..abc87fb6202 --- /dev/null +++ b/kogito-maven-plugin-test/src/test/java/org.kie.kogito.traffic/TrafficProcessIT.java @@ -0,0 +1,81 @@ +/* + * 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.kogito.traffic; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.server.LocalServerPort; + +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import io.restassured.response.ValidatableResponse; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = KogitoApplication.class) +public class TrafficProcessIT { + + public static final BigDecimal SPEED_LIMIT = new BigDecimal(100); + + static { + RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); + } + + @LocalServerPort + int randomServerPort; + + @BeforeEach + public void setup() { + RestAssured.port = randomServerPort; + } + + @Test + public void testTrafficViolationEmbeddedDecisionOnQuarkus() { + testTrafficProcess("traffic", "12-345", 120d, "no", true, true); + testTrafficProcess("traffic", "12-15", 140d, "yes", true, false); + testTrafficProcess("traffic", "0-150", 140d, null, false, false); + } + + private void testTrafficProcess(String processId, String driverId, Double speed, String suspended, boolean validLicense, boolean validatedLicense) { + Map request = new HashMap<>(); + request.put("driverId", driverId); + request.put("violation", new Violation("speed", SPEED_LIMIT, new BigDecimal(speed))); + ValidatableResponse body = given() + .body(request) + .contentType(ContentType.JSON) + .when() + .post("/" + processId) + .then() + .statusCode(201) + .body("driver.ValidLicense", is(validLicense)); + if (suspended != null) { + body.body("validated.ValidLicense", is(validatedLicense)) + .body("validated.Suspended", is(suspended)); + } else { + body.body("validated", nullValue()); + } + } +} diff --git a/kogito-maven-plugin/pom.xml b/kogito-maven-plugin/pom.xml index 3079354dc00..8fe97c300b3 100644 --- a/kogito-maven-plugin/pom.xml +++ b/kogito-maven-plugin/pom.xml @@ -71,40 +71,10 @@ - - org.apache.maven - maven-artifact - provided - - - org.apache.maven - maven-core - provided - - - org.eclipse.sisu - org.eclipse.sisu.inject - - - org.eclipse.sisu - org.eclipse.sisu.plexus - - - commons-io - commons-io - - - org.apache.maven maven-plugin-api provided - - - org.eclipse.sisu - org.eclipse.sisu.plexus - - org.apache.maven.plugin-tools @@ -112,32 +82,16 @@ provided - org.codehaus.plexus - plexus-component-annotations - - - org.codehaus.plexus - plexus-classworlds + org.apache.maven + maven-core + provided - org.codehaus.plexus - plexus-container-default - - - log4j - log4j - - - commons-logging - commons-logging-api - - - - com.google.collections - google-collections - - + org.apache.maven + maven-project + provided + com.google.protobuf protobuf-java @@ -209,10 +163,33 @@ reflections + ch.qos.logback logback-classic test + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + test + + + diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java index 3f6ef379091..6bab6ec5dd5 100644 --- a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java @@ -128,6 +128,14 @@ protected Reflections getReflections() throws MojoExecutionException { return reflections; } + protected Reflections getReflections(ClassLoader toAdd) throws MojoExecutionException { + URLClassLoader classLoader = (URLClassLoader) projectClassLoader(); + ConfigurationBuilder builder = new ConfigurationBuilder(); + builder.addUrls(classLoader.getURLs()); + builder.addClassLoaders(classLoader, toAdd); + return new Reflections(builder); + } + protected Predicate> classSubTypeAvailabilityResolver() { return clazz -> { try { diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/GenerateModelMojo.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/GenerateModelMojo.java index 8d4aed73a1a..50be9c2a7ec 100644 --- a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/GenerateModelMojo.java +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/GenerateModelMojo.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.maven.plugin; -import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.FileSystems; @@ -26,24 +25,31 @@ import java.nio.file.Path; import java.nio.file.PathMatcher; import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.HashMap; import java.util.Map; -import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; import org.drools.codegen.common.GeneratedFile; -import org.drools.codegen.common.GeneratedFileType; -import org.kie.kogito.codegen.core.ApplicationGenerator; -import org.kie.kogito.codegen.core.utils.ApplicationGeneratorDiscovery; +import org.kie.kogito.codegen.api.context.KogitoBuildContext; +import org.kie.kogito.maven.plugin.util.CompilerHelper; +import org.kie.kogito.maven.plugin.util.GenerateModelHelper; +import org.kie.kogito.maven.plugin.util.PersistenceGenerationHelper; +import org.reflections.Reflections; -import static org.drools.codegen.common.GeneratedFileType.COMPILED_CLASS; import static org.kie.efesto.common.api.constants.Constants.INDEXFILE_DIRECTORY_PROPERTY; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.RESOURCES; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.SOURCES; @Mojo(name = "generateModel", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, @@ -69,8 +75,27 @@ public class GenerateModelMojo extends AbstractKieMojo { @Parameter(property = "kogito.sources.keep", defaultValue = "false") private boolean keepSources; + @Parameter(property = "kogito.jsonSchema.version", required = false) + String schemaVersion; + + @Parameter(defaultValue = "${mojoExecution}") + private MojoExecution mojoExecution; + + /** + * The maven-compiler-plugin version to use. + * Default to 3.8.1 + */ + @Parameter(defaultValue = "3.8.1", property = "version.compiler.plugin") + private String compilerPluginVersion; + + @Component + private MavenProject mavenProject; + + @Component + private MavenSession mavenSession; + @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { // TODO to be removed with DROOLS-7090 boolean indexFileDirectorySet = false; getLog().debug("execute -> " + outputDirectory); @@ -82,15 +107,30 @@ public void execute() throws MojoExecutionException { indexFileDirectorySet = true; } addCompileSourceRoots(); + Map> generatedModelFiles; + ClassLoader projectClassLoader = projectClassLoader(); + KogitoBuildContext kogitoBuildContext = discoverKogitoRuntimeContext(projectClassLoader); if (isOnDemand()) { getLog().info("On-Demand Mode is On. Use mvn compile kogito:scaffold"); + generatedModelFiles = new HashMap<>(); } else { - generateModel(); + generatedModelFiles = generateModel(kogitoBuildContext); } // TODO to be removed with DROOLS-7090 if (indexFileDirectorySet) { System.clearProperty(INDEXFILE_DIRECTORY_PROPERTY); } + + // Compile and write model files + compileAndDump(generatedModelFiles, projectClassLoader, getLog()); + + Map> generatedPersistenceFiles = generatePersistence(kogitoBuildContext, getReflections(projectClassLoader)); + + compileAndDump(generatedPersistenceFiles, projectClassLoader, getLog()); + + if (!keepSources) { + deleteDrlFiles(); + } } protected boolean isOnDemand() { @@ -101,42 +141,20 @@ protected void addCompileSourceRoots() { project.addCompileSourceRoot(getGeneratedFileWriter().getScaffoldedSourcesDir().toString()); } - protected void generateModel() throws MojoExecutionException { - + protected Map> generateModel(KogitoBuildContext kogitoBuildContext) { setSystemProperties(properties); + return GenerateModelHelper.generateModelFiles(kogitoBuildContext, generatePartial); + } - ClassLoader projectClassLoader = projectClassLoader(); - ApplicationGenerator appGen = ApplicationGeneratorDiscovery.discover(discoverKogitoRuntimeContext(projectClassLoader)); - - Collection generatedFiles; - if (generatePartial) { - generatedFiles = appGen.generateComponents(); - } else { - generatedFiles = appGen.generate(); - } - - Map> mappedGeneratedFiles = generatedFiles.stream() - .collect(Collectors.groupingBy(GeneratedFile::type)); - List generatedUncompiledFiles = mappedGeneratedFiles.entrySet().stream() - .filter(entry -> !entry.getKey().equals(COMPILED_CLASS)) - .flatMap(entry -> entry.getValue().stream()) - .toList(); - writeGeneratedFiles(generatedUncompiledFiles); - - List generatedCompiledFiles = mappedGeneratedFiles.getOrDefault(COMPILED_CLASS, - Collections.emptyList()) - .stream().map(originalGeneratedFile -> new GeneratedFile(COMPILED_CLASS, convertPath(originalGeneratedFile.path().toString()), originalGeneratedFile.contents())) - .collect(Collectors.toList()); - - writeGeneratedFiles(generatedCompiledFiles); - - if (!keepSources) { - deleteDrlFiles(); - } + protected Map> generatePersistence(KogitoBuildContext kogitoBuildContext, Reflections reflections) throws MojoExecutionException { + return PersistenceGenerationHelper.generatePersistenceFiles(kogitoBuildContext, reflections, schemaVersion); } - private String convertPath(String toConvert) { - return toConvert.replace('.', File.separatorChar) + ".class"; + protected void compileAndDump(Map> generatedFiles, ClassLoader classloader, Log log) throws MojoExecutionException { + // Compile and write files + CompilerHelper.dumpAndCompileGeneratedSources(generatedFiles.get(SOURCES), classloader, project, baseDir, log); + // Dump resources + CompilerHelper.dumpResources(generatedFiles.get(RESOURCES), baseDir, log); } private void deleteDrlFiles() throws MojoExecutionException { diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ProcessClassesMojo.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ProcessClassesMojo.java deleted file mode 100644 index ef491c7eca3..00000000000 --- a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ProcessClassesMojo.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.kogito.maven.plugin; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.drools.codegen.common.GeneratedFile; -import org.drools.codegen.common.GeneratedFileType; -import org.drools.compiler.compiler.io.memory.MemoryFileSystem; -import org.drools.util.PortablePath; -import org.kie.kogito.Model; -import org.kie.kogito.ProcessInput; -import org.kie.kogito.UserTask; -import org.kie.kogito.codegen.api.context.KogitoBuildContext; -import org.kie.kogito.codegen.json.JsonSchemaGenerator; -import org.kie.kogito.codegen.process.persistence.PersistenceGenerator; -import org.kie.kogito.codegen.process.persistence.marshaller.ReflectionMarshallerGenerator; -import org.kie.kogito.codegen.process.persistence.proto.ReflectionProtoGenerator; -import org.kie.memorycompiler.CompilationResult; -import org.kie.memorycompiler.JavaCompiler; -import org.kie.memorycompiler.JavaCompilerFactory; -import org.kie.memorycompiler.JavaCompilerSettings; -import org.kie.memorycompiler.JavaConfiguration; - -import static java.util.Arrays.asList; -import static org.kie.kogito.codegen.core.utils.GeneratedFileValidation.validateGeneratedFileTypes; - -@Mojo(name = "process-model-classes", - requiresDependencyResolution = ResolutionScope.RUNTIME, - requiresProject = true, - defaultPhase = LifecyclePhase.PROCESS_CLASSES, - threadSafe = true) -public class ProcessClassesMojo extends AbstractKieMojo { - - private static final JavaCompiler JAVA_COMPILER = JavaCompilerFactory.loadCompiler(JavaConfiguration.CompilerType.NATIVE, "1.8"); - - @Parameter(property = "kogito.jsonSchema.version", required = false) - private String schemaVersion; - - @Override - public void execute() throws MojoExecutionException { - try { - JavaCompilerSettings settings = new JavaCompilerSettings(); - for (String path : project.getRuntimeClasspathElements()) { - File pathFile = new File(path); - settings.addClasspath(pathFile); - } - - @SuppressWarnings({ "rawtype", "unchecked" }) - Set> modelClasses = (Set) getReflections().getSubTypesOf(Model.class); - - ReflectionProtoGenerator protoGenerator = ReflectionProtoGenerator.builder() - .build(modelClasses); - - ClassLoader classLoader = projectClassLoader(); - KogitoBuildContext context = discoverKogitoRuntimeContext(classLoader); - - // Generate persistence files - PersistenceGenerator persistenceGenerator = new PersistenceGenerator(context, protoGenerator, new ReflectionMarshallerGenerator(context, protoGenerator.getDataClasses())); - Collection persistenceFiles = persistenceGenerator.generate(); - - validateGeneratedFileTypes(persistenceFiles, asList(GeneratedFileType.Category.SOURCE, GeneratedFileType.Category.INTERNAL_RESOURCE, GeneratedFileType.Category.STATIC_HTTP_RESOURCE)); - - Collection generatedClasses = persistenceFiles.stream().filter(x -> x.category().equals(GeneratedFileType.Category.SOURCE)).collect(Collectors.toList()); - Collection generatedResources = persistenceFiles.stream() - .filter(x -> x.category().equals(GeneratedFileType.Category.INTERNAL_RESOURCE) || x.category().equals(GeneratedFileType.Category.STATIC_HTTP_RESOURCE)) - .collect(Collectors.toList()); - - // Compile and write persistence files - compileAndWriteClasses(generatedClasses, classLoader, settings); - - // Dump resources - this.writeGeneratedFiles(generatedResources); - - // Json schema generation - Stream> processClassStream = getReflections().getTypesAnnotatedWith(ProcessInput.class).stream(); - writeGeneratedFiles(generateJsonSchema(processClassStream)); - - Stream> userTaskClassStream = getReflections().getTypesAnnotatedWith(UserTask.class).stream(); - writeGeneratedFiles(generateJsonSchema(userTaskClassStream)); - } catch (Exception e) { - throw new MojoExecutionException("Error during processing model classes", e); - } - } - - private void compileAndWriteClasses(Collection generatedClasses, ClassLoader cl, JavaCompilerSettings settings) throws MojoFailureException { - MemoryFileSystem srcMfs = new MemoryFileSystem(); - MemoryFileSystem trgMfs = new MemoryFileSystem(); - - String[] sources = new String[generatedClasses.size()]; - int index = 0; - for (GeneratedFile entry : generatedClasses) { - String fileName = entry.relativePath(); - sources[index++] = fileName; - srcMfs.write(fileName, entry.contents()); - } - - if (sources.length > 0) { - - CompilationResult result = JAVA_COMPILER.compile(sources, srcMfs, trgMfs, cl, settings); - if (result.getErrors().length > 0) { - throw new MojoFailureException(Arrays.toString(result.getErrors())); - } - - for (PortablePath path : trgMfs.getFilePaths()) { - byte[] data = trgMfs.getBytes(path); - writeGeneratedFile(new GeneratedFile(GeneratedFileType.COMPILED_CLASS, path.asString(), data)); - } - } - } - - private Collection generateJsonSchema(Stream> classes) throws IOException { - return new JsonSchemaGenerator.ClassBuilder(classes) - .withSchemaVersion(schemaVersion).build() - .generate(); - } -} diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ScaffoldMojo.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ScaffoldMojo.java index 06bfb3c8288..72c1b3e0032 100644 --- a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ScaffoldMojo.java +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/ScaffoldMojo.java @@ -24,6 +24,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; +import org.kie.kogito.codegen.api.context.KogitoBuildContext; @Mojo(name = "scaffold", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, @@ -40,7 +41,9 @@ public class ScaffoldMojo extends GenerateModelMojo { @Override public void execute() throws MojoExecutionException { addCompileSourceRoots(); - generateModel(); + ClassLoader projectClassLoader = projectClassLoader(); + KogitoBuildContext kogitoBuildContext = discoverKogitoRuntimeContext(projectClassLoader); + generateModel(kogitoBuildContext); } @Override diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/CompilerHelper.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/CompilerHelper.java new file mode 100644 index 00000000000..ca658d60378 --- /dev/null +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/CompilerHelper.java @@ -0,0 +1,109 @@ +/* + * 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.kogito.maven.plugin.util; + +import java.io.File; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Collection; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.drools.codegen.common.GeneratedFileWriter; +import org.drools.compiler.compiler.io.memory.MemoryFileSystem; +import org.drools.util.PortablePath; +import org.kie.memorycompiler.CompilationResult; +import org.kie.memorycompiler.JavaCompiler; +import org.kie.memorycompiler.JavaCompilerFactory; +import org.kie.memorycompiler.JavaCompilerSettings; +import org.kie.memorycompiler.JavaConfiguration; + +public class CompilerHelper { + + private static final JavaCompiler JAVA_COMPILER = JavaCompilerFactory.loadCompiler(JavaConfiguration.CompilerType.NATIVE, "1.8"); + private static final GeneratedFileWriter.Builder generatedFileWriterBuilder = GeneratedFileWriter.builder("kogito", "kogito.codegen.resources.directory", "kogito.codegen.sources.directory"); + public static final String SOURCES = "SOURCES"; + public static final String RESOURCES = "RESOURCES"; + + private CompilerHelper() { + } + + public static void dumpAndCompileGeneratedSources(Collection generatedSources, + ClassLoader classLoader, + MavenProject project, + File baseDir, Log log) throws MojoExecutionException { + try { + JavaCompilerSettings settings = new JavaCompilerSettings(); + for (String path : project.getRuntimeClasspathElements()) { + File pathFile = new File(path); + settings.addClasspath(pathFile); + } + // Compile and write persistence files + compileAndWriteClasses(generatedSources, classLoader, settings, getGeneratedFileWriter(baseDir), log); + } catch (Exception e) { + throw new MojoExecutionException("Error during processing model classes", e); + } + } + + public static void dumpResources(Collection generatedFiles, File baseDir, Log log) { + GeneratedFileWriter writer = getGeneratedFileWriter(baseDir); + generatedFiles.forEach(generatedFile -> writeGeneratedFile(generatedFile, writer, log)); + } + + static void writeGeneratedFile(GeneratedFile generatedFile, GeneratedFileWriter writer, Log log) { + log.info("Generating: " + generatedFile.relativePath()); + writer.write(generatedFile); + } + + static void compileAndWriteClasses(Collection generatedClasses, ClassLoader cl, JavaCompilerSettings settings, GeneratedFileWriter fileWriter, Log log) + throws MojoFailureException { + MemoryFileSystem srcMfs = new MemoryFileSystem(); + MemoryFileSystem trgMfs = new MemoryFileSystem(); + + String[] sources = new String[generatedClasses.size()]; + int index = 0; + for (GeneratedFile entry : generatedClasses) { + String fileName = entry.relativePath(); + sources[index++] = fileName; + srcMfs.write(fileName, entry.contents()); + } + + if (sources.length > 0) { + + CompilationResult result = JAVA_COMPILER.compile(sources, srcMfs, trgMfs, cl, settings); + if (result.getErrors().length > 0) { + throw new MojoFailureException(Arrays.toString(result.getErrors())); + } + + for (PortablePath path : trgMfs.getFilePaths()) { + byte[] data = trgMfs.getBytes(path); + writeGeneratedFile(new GeneratedFile(GeneratedFileType.COMPILED_CLASS, path.asString(), data), fileWriter, log); + } + } + } + + private static GeneratedFileWriter getGeneratedFileWriter(File baseDir) { + return generatedFileWriterBuilder + .build(Path.of(baseDir.getAbsolutePath())); + } +} diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/GenerateModelHelper.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/GenerateModelHelper.java new file mode 100644 index 00000000000..826c92eb581 --- /dev/null +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/GenerateModelHelper.java @@ -0,0 +1,66 @@ +/* + * 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.kogito.maven.plugin.util; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; + +import org.drools.codegen.common.GeneratedFile; +import org.kie.kogito.codegen.api.context.KogitoBuildContext; +import org.kie.kogito.codegen.core.ApplicationGenerator; +import org.kie.kogito.codegen.core.utils.ApplicationGeneratorDiscovery; + +import static org.drools.codegen.common.GeneratedFileType.COMPILED_CLASS; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.RESOURCES; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.SOURCES; + +public class GenerateModelHelper { + + private GenerateModelHelper() { + } + + public static Map> generateModelFiles(KogitoBuildContext kogitoBuildContext, boolean generatePartial) { + ApplicationGenerator appGen = ApplicationGeneratorDiscovery.discover(kogitoBuildContext); + + Collection generatedFiles; + if (generatePartial) { + generatedFiles = appGen.generateComponents(); + } else { + generatedFiles = appGen.generate(); + } + Collection generatedClasses = new HashSet<>(); + Collection generatedResources = new HashSet<>(); + generatedFiles.forEach(generatedFile -> { + switch (generatedFile.category()) { + case SOURCE -> generatedClasses.add(generatedFile); + case INTERNAL_RESOURCE, STATIC_HTTP_RESOURCE -> generatedResources.add(generatedFile); + case COMPILED_CLASS -> generatedResources.add(new GeneratedFile(COMPILED_CLASS, convertPath(generatedFile.path().toString()), generatedFile.contents())); + default -> throw new IllegalStateException("Unexpected file with category: " + generatedFile.category()); + } + + }); + return Map.of(SOURCES, generatedClasses, RESOURCES, generatedResources); + } + + private static String convertPath(String toConvert) { + return toConvert.replace('.', File.separatorChar) + ".class"; + } +} diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/PersistenceGenerationHelper.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/PersistenceGenerationHelper.java new file mode 100644 index 00000000000..c783408ecaa --- /dev/null +++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/util/PersistenceGenerationHelper.java @@ -0,0 +1,101 @@ +/* + * 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.kogito.maven.plugin.util; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import org.apache.maven.plugin.MojoExecutionException; +import org.drools.codegen.common.GeneratedFile; +import org.drools.codegen.common.GeneratedFileType; +import org.kie.kogito.Model; +import org.kie.kogito.ProcessInput; +import org.kie.kogito.UserTask; +import org.kie.kogito.codegen.api.context.KogitoBuildContext; +import org.kie.kogito.codegen.json.JsonSchemaGenerator; +import org.kie.kogito.codegen.process.persistence.PersistenceGenerator; +import org.kie.kogito.codegen.process.persistence.marshaller.ReflectionMarshallerGenerator; +import org.kie.kogito.codegen.process.persistence.proto.ReflectionProtoGenerator; +import org.reflections.Reflections; + +import static java.util.Arrays.asList; +import static org.kie.kogito.codegen.core.utils.GeneratedFileValidation.validateGeneratedFileTypes; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.RESOURCES; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.SOURCES; + +public class PersistenceGenerationHelper { + + private PersistenceGenerationHelper() { + } + + public static Map> generatePersistenceFiles(KogitoBuildContext context, + Reflections reflections, + String schemaVersion) throws MojoExecutionException { + try { + + @SuppressWarnings({ "rawtype", "unchecked" }) + Set> modelClasses = (Set) reflections.getSubTypesOf(Model.class); + + ReflectionProtoGenerator protoGenerator = ReflectionProtoGenerator.builder() + .build(modelClasses); + + // Generate persistence files + PersistenceGenerator persistenceGenerator = new PersistenceGenerator(context, protoGenerator, new ReflectionMarshallerGenerator(context, protoGenerator.getDataClasses())); + Map> toReturn = getMappedGeneratedFiles(persistenceGenerator); + + // Json schema generation + Stream> processClassStream = reflections.getTypesAnnotatedWith(ProcessInput.class).stream(); + toReturn.get(RESOURCES).addAll(generateJsonSchemaFromClasses(processClassStream, schemaVersion)); + + Stream> userTaskClassStream = reflections.getTypesAnnotatedWith(UserTask.class).stream(); + toReturn.get(RESOURCES).addAll(generateJsonSchemaFromClasses(userTaskClassStream, schemaVersion)); + return toReturn; + } catch (Exception e) { + throw new MojoExecutionException("Error during processing model classes", e); + } + } + + static Map> getMappedGeneratedFiles(PersistenceGenerator persistenceGenerator) { + Collection persistenceFiles = persistenceGenerator.generate(); + + validateGeneratedFileTypes(persistenceFiles, asList(GeneratedFileType.Category.SOURCE, GeneratedFileType.Category.INTERNAL_RESOURCE, GeneratedFileType.Category.STATIC_HTTP_RESOURCE)); + + Collection generatedClasses = new HashSet<>(); // avoid duplicated + Collection generatedResources = new HashSet<>(); // avoid duplicated + persistenceFiles.forEach(generatedFile -> { + switch (generatedFile.category()) { + case SOURCE -> generatedClasses.add(generatedFile); + case INTERNAL_RESOURCE, STATIC_HTTP_RESOURCE -> generatedResources.add(generatedFile); + default -> throw new IllegalStateException("Unexpected file with category: " + generatedFile.category()); + } + }); + return Map.of(SOURCES, generatedClasses, RESOURCES, generatedResources); + } + + private static Collection generateJsonSchemaFromClasses(Stream> classes, String schemaVersion) throws IOException { + return new JsonSchemaGenerator.ClassBuilder(classes) + .withSchemaVersion(schemaVersion).build() + .generate(); + } + +} diff --git a/kogito-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/kogito-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml deleted file mode 100644 index e682184726b..00000000000 --- a/kogito-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - generateModel - process-model-classes - - - - - true - true - - - - - \ No newline at end of file diff --git a/kogito-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/kogito-maven-plugin/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index c5fdc25970a..00000000000 --- a/kogito-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - org.apache.maven.lifecycle.mapping.LifecycleMapping - jar - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - org.apache.maven.plugins:maven-resources-plugin:resources - org.apache.maven.plugins:maven-compiler-plugin:compile,org.kie.kogito:kogito-maven-plugin:generateModel,org.apache.maven.plugins:maven-compiler-plugin:compile - - org.kie.kogito:kogito-maven-plugin:process-model-classes - org.apache.maven.plugins:maven-resources-plugin:testResources - org.apache.maven.plugins:maven-compiler-plugin:testCompile - org.apache.maven.plugins:maven-surefire-plugin:test - org.apache.maven.plugins:maven-jar-plugin:jar - org.apache.maven.plugins:maven-install-plugin:install - org.apache.maven.plugins:maven-deploy-plugin:deploy - - - - - - - \ No newline at end of file diff --git a/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/GenerateModelMojoTest.java b/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/GenerateModelMojoTest.java new file mode 100644 index 00000000000..fb009ed4e3d --- /dev/null +++ b/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/GenerateModelMojoTest.java @@ -0,0 +1,97 @@ +/* + * 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.kogito.maven.plugin; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.testing.junit5.InjectMojo; +import org.apache.maven.plugin.testing.junit5.MojoTest; +import org.drools.codegen.common.GeneratedFile; +import org.junit.jupiter.api.Test; +import org.kie.kogito.codegen.api.context.KogitoBuildContext; +import org.kie.kogito.maven.plugin.util.CompilerHelper; +import org.kie.kogito.maven.plugin.util.GenerateModelHelper; +import org.kie.kogito.maven.plugin.util.PersistenceGenerationHelper; +import org.mockito.MockedStatic; +import org.reflections.Reflections; + +import static org.assertj.core.api.Fail.fail; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.RESOURCES; +import static org.kie.kogito.maven.plugin.util.CompilerHelper.SOURCES; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; + +@MojoTest +class GenerateModelMojoTest { + + private static final KogitoBuildContext kogitoBuildContextMocked = mock(KogitoBuildContext.class); + private static final ClassLoader classLoaderMocked = mock(ClassLoader.class); + private static final Reflections reflectionsMocked = mock(Reflections.class); + private static final Log logMocked = mock(Log.class); + + @Test + @InjectMojo(goal = "generateModel", pom = "src/test/resources/unit/generate-model/pom.xml") + void generateModel(GenerateModelMojo mojo) { + commonSetup(mojo); + try (MockedStatic generateModelHelperMockedStatic = mockStatic(GenerateModelHelper.class)) { + mojo.generateModel(kogitoBuildContextMocked); + generateModelHelperMockedStatic.verify(() -> GenerateModelHelper.generateModelFiles(kogitoBuildContextMocked, false), times(1)); + } + } + + @Test + @InjectMojo(goal = "generateModel", pom = "src/test/resources/unit/generate-model/pom.xml") + void generatePersistence(GenerateModelMojo mojo) { + commonSetup(mojo); + try (MockedStatic persistenceGenerationHelperMockedStatic = mockStatic(PersistenceGenerationHelper.class)) { + mojo.generatePersistence(kogitoBuildContextMocked, reflectionsMocked); + persistenceGenerationHelperMockedStatic.verify(() -> PersistenceGenerationHelper.generatePersistenceFiles(kogitoBuildContextMocked, reflectionsMocked, mojo.schemaVersion), times(1)); + } catch (MojoExecutionException e) { + fail(e.getMessage(), e); + } + } + + @Test + @InjectMojo(goal = "generateModel", pom = "src/test/resources/unit/generate-model/pom.xml") + void compileAndDump(GenerateModelMojo mojo) { + commonSetup(mojo); + try (MockedStatic compilerHelperMockedStatic = mockStatic(CompilerHelper.class)) { + Collection generatedSources = new HashSet<>(); + Collection generatedResources = new HashSet<>(); + Map> generatedFiles = Map.of(SOURCES, generatedSources, RESOURCES, generatedResources); + mojo.compileAndDump(generatedFiles, classLoaderMocked, logMocked); + compilerHelperMockedStatic.verify(() -> CompilerHelper.dumpAndCompileGeneratedSources(generatedSources, classLoaderMocked, mojo.project, mojo.baseDir, logMocked), times(1)); + compilerHelperMockedStatic.verify(() -> CompilerHelper.dumpResources(generatedResources, mojo.baseDir, logMocked), times(1)); + } catch (MojoExecutionException e) { + fail(e.getMessage(), e); + } + } + + private void commonSetup(GenerateModelMojo mojo) { + mojo.outputDirectory = new File(mojo.project.getModel().getBuild().getOutputDirectory()); + mojo.baseDir = mojo.project.getBasedir(); + mojo.projectDir = mojo.project.getBasedir(); + } +} \ No newline at end of file diff --git a/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/testing/stubs/GenerateModelMojoProjectStub.java b/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/testing/stubs/GenerateModelMojoProjectStub.java new file mode 100644 index 00000000000..e2860070fec --- /dev/null +++ b/kogito-maven-plugin/src/test/java/org/kie/kogito/maven/plugin/testing/stubs/GenerateModelMojoProjectStub.java @@ -0,0 +1,83 @@ +/* + * 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.kogito.maven.plugin.testing.stubs; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.input.XmlStreamReader; +import org.apache.maven.model.Build; +import org.apache.maven.model.Model; +import org.apache.maven.model.Resource; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.project.MavenProject; + +public class GenerateModelMojoProjectStub extends MavenProject { + + public GenerateModelMojoProjectStub() { + try { + + MavenXpp3Reader pomReader = new MavenXpp3Reader(); + File pomFile = new File(getBasedir(), "pom.xml"); + Model model = pomReader.read(XmlStreamReader.builder().setFile(pomFile).get()); + setModel(model); + setFile(pomFile); + setGroupId(model.getGroupId()); + setArtifactId(model.getArtifactId()); + setVersion(model.getVersion()); + setName(model.getName()); + setUrl(model.getUrl()); + setPackaging(model.getPackaging()); + + Build build = new Build(); + build.setFinalName(model.getArtifactId()); + build.setSourceDirectory(getBasedir() + "/src/main/java"); + build.setTestSourceDirectory(getBasedir() + "/src/test/java"); + build.setDirectory(getTargetdir().toString()); + + build.setTestOutputDirectory(getTargetdir() + "/test-classes"); + build.setOutputDirectory(getTargetdir() + "/classes"); + + Resource resource = new Resource(); + resource.setDirectory(getBasedir() + "/src/main/resources"); + addResource(resource); + + setBuild(build); + + setCompileSourceRoots(new ArrayList<>(List.of(getBasedir() + "/src/main/java"))); + setTestCompileSourceRoots(new ArrayList<>(List.of(getBasedir() + "/src/test/java"))); + + getTargetdir().mkdirs(); + new File(build.getOutputDirectory()).mkdirs(); + new File(build.getTestOutputDirectory()).mkdirs(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public File getBasedir() { + return new File("src/test/resources/unit/generate-model/").getAbsoluteFile(); + } + + public File getTargetdir() { + return new File("target/unit/generate-model/target").getAbsoluteFile(); + } +} \ No newline at end of file diff --git a/kogito-maven-plugin/src/test/resources/unit/generate-model/pom.xml b/kogito-maven-plugin/src/test/resources/unit/generate-model/pom.xml new file mode 100644 index 00000000000..1ab1b0ae4ac --- /dev/null +++ b/kogito-maven-plugin/src/test/resources/unit/generate-model/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + org.kie.kogito + project-name + jar + 1.0-SNAPSHOT + project-name + + + + + org.kie.kogito + kogito-maven-plugin + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index fad4ac03b58..27d1b9aeefc 100644 --- a/pom.xml +++ b/pom.xml @@ -133,6 +133,7 @@ kogito-serverless-workflow kogito-maven-plugin springboot + kogito-maven-plugin-test diff --git a/springboot/addons/messaging/integration-tests/src/it/cloudevents-spring-boot-addon-it-invoked/pom.xml b/springboot/addons/messaging/integration-tests/src/it/cloudevents-spring-boot-addon-it-invoked/pom.xml index 441ae79acdc..76fe0824346 100644 --- a/springboot/addons/messaging/integration-tests/src/it/cloudevents-spring-boot-addon-it-invoked/pom.xml +++ b/springboot/addons/messaging/integration-tests/src/it/cloudevents-spring-boot-addon-it-invoked/pom.xml @@ -86,9 +86,15 @@ org.kie.kogito kogito-maven-plugin - ${project.version} - - true + ${project.version} + + + compile + + generateModel + + + org.springframework.boot diff --git a/springboot/archetype/src/main/resources/archetype-resources/pom.xml b/springboot/archetype/src/main/resources/archetype-resources/pom.xml index 21f342ef793..06fee90d8a9 100644 --- a/springboot/archetype/src/main/resources/archetype-resources/pom.xml +++ b/springboot/archetype/src/main/resources/archetype-resources/pom.xml @@ -89,7 +89,14 @@ org.kie.kogito kogito-maven-plugin ${kogito.version} - true + + + compile + + generateModel + + + org.springframework.boot diff --git a/springboot/bom/pom.xml b/springboot/bom/pom.xml index f314e002ea7..72209c0054b 100644 --- a/springboot/bom/pom.xml +++ b/springboot/bom/pom.xml @@ -107,7 +107,14 @@ org.kie.kogito kogito-maven-plugin ${project.version} - true + + + compile + + generateModel + + + diff --git a/springboot/integration-tests/integration-tests-springboot-decisions-it/pom.xml b/springboot/integration-tests/integration-tests-springboot-decisions-it/pom.xml index 844e657acd3..22c7f4d38ac 100644 --- a/springboot/integration-tests/integration-tests-springboot-decisions-it/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-decisions-it/pom.xml @@ -140,19 +140,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-kafka-it/pom.xml b/springboot/integration-tests/integration-tests-springboot-kafka-it/pom.xml index b40463110b7..5940bf10dbd 100644 --- a/springboot/integration-tests/integration-tests-springboot-kafka-it/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-kafka-it/pom.xml @@ -134,19 +134,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-norest-it/pom.xml b/springboot/integration-tests/integration-tests-springboot-norest-it/pom.xml index eaa58d571bf..4bb9dc49461 100644 --- a/springboot/integration-tests/integration-tests-springboot-norest-it/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-norest-it/pom.xml @@ -130,19 +130,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-it/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-it/pom.xml index 66bd8d48053..4a5d5c1e4d2 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-it/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-it/pom.xml @@ -160,19 +160,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-filesystem/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-filesystem/pom.xml index 5e09343afcb..3f3c3eb7f10 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-filesystem/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-filesystem/pom.xml @@ -126,19 +126,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-infinispan/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-infinispan/pom.xml index 5054c7c4156..37ff62b89c8 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-infinispan/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-infinispan/pom.xml @@ -151,19 +151,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-jdbc/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-jdbc/pom.xml index 790361dfe8f..25a1853be0b 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-jdbc/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-jdbc/pom.xml @@ -143,19 +143,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-mongodb/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-mongodb/pom.xml index 7f8bb15e3e6..e6878593406 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-mongodb/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-mongodb/pom.xml @@ -135,19 +135,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-postgresql/pom.xml b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-postgresql/pom.xml index b454ed8004f..4b3b7c24628 100644 --- a/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-postgresql/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-postgresql/pom.xml @@ -140,19 +140,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - diff --git a/springboot/integration-tests/integration-tests-springboot-usertasks-it/pom.xml b/springboot/integration-tests/integration-tests-springboot-usertasks-it/pom.xml index d3a7645e5f9..c9eadd17d81 100644 --- a/springboot/integration-tests/integration-tests-springboot-usertasks-it/pom.xml +++ b/springboot/integration-tests/integration-tests-springboot-usertasks-it/pom.xml @@ -133,19 +133,11 @@ ${project.version} - kogito-generate-model - process-resources + compile generateModel - - kogito-process-model-classes - process-classes - - process-model-classes - - From 53ad4d96d7cdc0e78e4844ab90462d051448ee86 Mon Sep 17 00:00:00 2001 From: Roberto Oliveira Date: Mon, 2 Dec 2024 11:05:45 -0500 Subject: [PATCH 4/4] remove rat check --- .../workflows/ci_check_license_headers.yaml | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/ci_check_license_headers.yaml diff --git a/.github/workflows/ci_check_license_headers.yaml b/.github/workflows/ci_check_license_headers.yaml deleted file mode 100644 index cb3819f18a0..00000000000 --- a/.github/workflows/ci_check_license_headers.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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. -# - -name: "CI :: License headers" - -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Download Apache RAT - run: | - curl -LO https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.16.1/apache-rat-0.16.1.jar - - - name: Run Apache RAT - run: | - java -jar apache-rat-0.16.1.jar -d . -E .rat-excludes | grep "== File:" && echo "The files listed above are missing license headers." && exit 1 || echo "All files have license headers."