From 834c8ea83a1f3fc9b19f46563d61c5d201cf94ed Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Fri, 6 Dec 2024 18:23:42 +0900 Subject: [PATCH] [incubator-kie-drools-6160] Clean up leftover of .rf support --- .../base/definitions/ProcessPackage.java | 3 +- .../impl/CompositeKnowledgeBuilderImpl.java | 3 - .../builder/impl/KnowledgeBuilderImpl.java | 15 - .../META-INF/drools-processes-5.0.xsd | 623 ------------------ .../modelcompiler/CanonicalKieModule.java | 2 +- .../FakeDRFAssemblerService.java | 50 -- .../mvel/integrationtests/KieBuilderTest.java | 2 +- .../PackageInMultipleResourcesTest.java | 72 -- ...api.internal.assembler.KieAssemblerService | 20 - .../mvel/integrationtests/rf_test_ruleflow.rf | 64 -- .../test_modifyWithRuleflowAndSubnetwork.rf | 42 -- .../functional/ResourcesTest.java | 2 +- .../drools/testcoverage/functional/sample.rf | 97 --- .../java/org/kie/api/io/ResourceType.java | 6 - 14 files changed, 4 insertions(+), 997 deletions(-) delete mode 100644 drools-compiler/src/main/resources/META-INF/drools-processes-5.0.xsd delete mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FakeDRFAssemblerService.java delete mode 100644 drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/PackageInMultipleResourcesTest.java delete mode 100644 drools-test-coverage/test-compiler-integration/src/test/resources/META-INF/services/org.kie.api.internal.assembler.KieAssemblerService delete mode 100644 drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/rf_test_ruleflow.rf delete mode 100644 drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/test_modifyWithRuleflowAndSubnetwork.rf delete mode 100644 drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/sample.rf diff --git a/drools-base/src/main/java/org/drools/base/definitions/ProcessPackage.java b/drools-base/src/main/java/org/drools/base/definitions/ProcessPackage.java index 92e579ca676..3424ce3a146 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/ProcessPackage.java +++ b/drools-base/src/main/java/org/drools/base/definitions/ProcessPackage.java @@ -41,7 +41,6 @@ public static ProcessPackage getOrCreate(ResourceTypePackageRegistry rtps) { rtp = new ProcessPackage(); // register the same instance for all types. There is no distinction rtps.put(ResourceType.BPMN2, rtp); - rtps.put(ResourceType.DRF, rtp); rtps.put(ResourceType.CMMN, rtp); } return rtp; @@ -55,7 +54,7 @@ public Map getRuleFlows() { /** * The ResourceType for {@link ProcessPackage} is always BPMN2, - * but there is no distinction between DRF, and CMMN as they all live under + * but there is no distinction between CMMN as they all live under * the same package. */ @Override diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java index 1c53ddae0b3..2cb56df7f9c 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/CompositeKnowledgeBuilderImpl.java @@ -136,7 +136,6 @@ private void buildProcesses() { private void buildResources() { buildResourceType(ResourceBuilder.DSL_RESOURCE_BUILDER, ResourceType.DSL); - buildResourceType(ResourceBuilder.DRF_RESOURCE_BUILDER, ResourceType.DRF); buildResourceType(ResourceBuilder.XSD_RESOURCE_BUILDER, ResourceType.XSD); } @@ -277,8 +276,6 @@ private interface ResourceBuilder { ResourceBuilder BPMN2_RESOURCE_BUILDER = ( kBuilder, resourceDescr ) -> kBuilder.addKnowledgeResource( resourceDescr.resource, ResourceType.BPMN2, resourceDescr.configuration ); ResourceBuilder CMMN_RESOURCE_BUILDER = ( kBuilder, resourceDescr ) -> kBuilder.addKnowledgeResource( resourceDescr.resource, ResourceType.CMMN, resourceDescr.configuration ); - - ResourceBuilder DRF_RESOURCE_BUILDER = ( kBuilder, resourceDescr ) -> kBuilder.addKnowledgeResource( resourceDescr.resource, ResourceType.DRF, resourceDescr.configuration ); } } diff --git a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java index cd19e2ded43..8b332a20d7f 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java +++ b/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java @@ -340,16 +340,6 @@ public void addDsl(Resource resource) throws IOException { } } - /** - * Add a ruleflow (.rfm) asset to this package. - */ - public void addRuleFlow(Reader processSource) { - addKnowledgeResource( - new ReaderResource(processSource, ResourceType.DRF), - ResourceType.DRF, - null); - } - @Deprecated public void addProcessFromXml(Resource resource) { addKnowledgeResource( @@ -362,11 +352,6 @@ public ProcessBuilder getProcessBuilder() { return processBuilder; } - @Deprecated - public void addProcessFromXml( Reader processSource) { - addProcessFromXml(new ReaderResource(processSource, ResourceType.DRF)); - } - public void addKnowledgeResource(Resource resource, ResourceType type, ResourceConfiguration configuration) { diff --git a/drools-compiler/src/main/resources/META-INF/drools-processes-5.0.xsd b/drools-compiler/src/main/resources/META-INF/drools-processes-5.0.xsd deleted file mode 100644 index 4afa6fad704..00000000000 --- a/drools-compiler/src/main/resources/META-INF/drools-processes-5.0.xsd +++ /dev/null @@ -1,623 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/CanonicalKieModule.java b/drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/CanonicalKieModule.java index f64be9e4257..b0d55434303 100644 --- a/drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/CanonicalKieModule.java +++ b/drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/CanonicalKieModule.java @@ -371,7 +371,7 @@ private List findProcesses(InternalKieModule kieModule, KieBaseModelImp List processResources = kieModule.getFileNames().stream() .filter(fileName -> { ResourceType resourceType = determineResourceType(fileName); - return resourceType == ResourceType.DRF || resourceType == ResourceType.BPMN2; + return resourceType == ResourceType.BPMN2; }) .map(fileName -> { final Resource processResource = kieModule.getResource(fileName); diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FakeDRFAssemblerService.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FakeDRFAssemblerService.java deleted file mode 100644 index 8519aa265d7..00000000000 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/FakeDRFAssemblerService.java +++ /dev/null @@ -1,50 +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.drools.mvel.integrationtests; - -import java.io.StringReader; - -import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; -import org.kie.api.internal.assembler.KieAssemblerService; -import org.kie.api.io.Resource; -import org.kie.api.io.ResourceConfiguration; -import org.kie.api.io.ResourceType; - -public class FakeDRFAssemblerService implements KieAssemblerService { - - private static final String GATEWAY_RULE = "package com.example.rules\n" + - "import com.example.*;\n" + - "rule \"RuleFlow-Split-example-xxx-DROOLS_DEFAULT\" @Propagation(EAGER)\n" + - " ruleflow-group \"DROOLS_SYSTEM\"\n" + - " when\n" + - " exists String(this == \"Left\")\n" + - " then\n" + - "end"; - - @Override - public ResourceType getResourceType() { - return ResourceType.DRF; - } - - @Override - public void addResourceAfterRules(Object kbuilder, Resource resource, ResourceType type, ResourceConfiguration configuration) throws Exception { - // Just add one fake gateway drl rule. Not for process capability testing - ((KnowledgeBuilderImpl) kbuilder).addPackageFromDrl(new StringReader(GATEWAY_RULE), resource); - } -} diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/KieBuilderTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/KieBuilderTest.java index 8a38692c5d5..9beb2166246 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/KieBuilderTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/KieBuilderTest.java @@ -497,7 +497,7 @@ private void checkKModule(KieBaseTestConfiguration kieBaseTestConfiguration , fi public void testAddMissingResourceToPackageBuilder(KieBaseTestConfiguration kieBaseTestConfiguration) throws Exception { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); - assertThatThrownBy(() -> kbuilder.add(ResourceFactory.newClassPathResource("some.rf"), ResourceType.DRL)) + assertThatThrownBy(() -> kbuilder.add(ResourceFactory.newClassPathResource("some.drl"), ResourceType.DRL)) .isInstanceOf(RuntimeException.class); assertThatThrownBy(() -> kbuilder.add(ResourceFactory.newClassPathResource("some.bpmn"), ResourceType.BPMN2)) diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/PackageInMultipleResourcesTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/PackageInMultipleResourcesTest.java deleted file mode 100644 index 665f16b7143..00000000000 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/PackageInMultipleResourcesTest.java +++ /dev/null @@ -1,72 +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.drools.mvel.integrationtests; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.drools.testcoverage.common.util.KieBaseTestConfiguration; -import org.drools.testcoverage.common.util.KieBaseUtil; -import org.drools.testcoverage.common.util.TestParametersUtil2; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.kie.api.KieBase; -import org.kie.api.definition.KiePackage; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PackageInMultipleResourcesTest { - - public static Stream parameters() { - return TestParametersUtil2.getKieBaseCloudConfigurations(true).stream(); - } - - @ParameterizedTest(name = "KieBase type={0}") - @MethodSource("parameters") - public void testSamePackageRulesInDRLAndRF(KieBaseTestConfiguration kieBaseTestConfiguration) { - // DROOLS-6785 - KieBase kbase = KieBaseUtil.getKieBaseFromClasspathResources(this.getClass(), kieBaseTestConfiguration, "rf_test_rules.drl", "rf_test_rueflow.rf"); - - KiePackage kiePackage = kbase.getKiePackage("com.example.rules"); - List ruleNames = kiePackage.getRules().stream().map(rule -> rule.getName()).collect(Collectors.toList()); - - assertThat(ruleNames.size()).isEqualTo(3); - assertThat(ruleNames).contains("RuleFlow-Split-example-xxx-DROOLS_DEFAULT", "Left Rule", "Right Rule"); - } - - @ParameterizedTest(name = "KieBase type={0}") - @MethodSource("parameters") - public void testDifferentPackagesRulesInDRLAndRF(KieBaseTestConfiguration kieBaseTestConfiguration) { - // DROOLS-6797 - KieBase kbase = KieBaseUtil.getKieBaseFromClasspathResources(this.getClass(), kieBaseTestConfiguration, "rf_test_rules_different_pkg.drl", "rf_test_rueflow.rf"); - - KiePackage kiePackage = kbase.getKiePackage("com.example.rules"); - List ruleNames = kiePackage.getRules().stream().map(rule -> rule.getName()).collect(Collectors.toList()); - - assertThat(ruleNames.size()).isEqualTo(1); - assertThat(ruleNames).contains("RuleFlow-Split-example-xxx-DROOLS_DEFAULT"); - - KiePackage kiePackageDiffPkg = kbase.getKiePackage("com.example.rules.different.pkg"); - List ruleNamesDiffPkg = kiePackageDiffPkg.getRules().stream().map(rule -> rule.getName()).collect(Collectors.toList()); - - assertThat(ruleNamesDiffPkg.size()).isEqualTo(2); - assertThat(ruleNamesDiffPkg).contains("Left Rule", "Right Rule"); - } -} diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/META-INF/services/org.kie.api.internal.assembler.KieAssemblerService b/drools-test-coverage/test-compiler-integration/src/test/resources/META-INF/services/org.kie.api.internal.assembler.KieAssemblerService deleted file mode 100644 index 1870ad6f091..00000000000 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/META-INF/services/org.kie.api.internal.assembler.KieAssemblerService +++ /dev/null @@ -1,20 +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. -# - -org.drools.mvel.integrationtests.FakeDRFAssemblerService \ No newline at end of file diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/rf_test_ruleflow.rf b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/rf_test_ruleflow.rf deleted file mode 100644 index c21ca9b59bd..00000000000 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/rf_test_ruleflow.rf +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -
- - - -
- - - - - - - - _jbpm-unique-3 - - - exists Values(this == Values.LEFT) - exists Values(this == Values.RIGHT) - eval(true) - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/test_modifyWithRuleflowAndSubnetwork.rf b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/test_modifyWithRuleflowAndSubnetwork.rf deleted file mode 100644 index b08a8b14a95..00000000000 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/test_modifyWithRuleflowAndSubnetwork.rf +++ /dev/null @@ -1,42 +0,0 @@ - - - - - -
-
- - - - - - - - - - - - -
\ No newline at end of file diff --git a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/ResourcesTest.java b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/ResourcesTest.java index a042326508b..b1cf2959b31 100644 --- a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/ResourcesTest.java +++ b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/ResourcesTest.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** - * Tests loading of different types of resources (DRL, DSL, DRF, BPMN2, DTABLE). + * Tests loading of different types of resources (DRL, DSL, BPMN2, DTABLE). * Packages are loaded and built using KnowledgeBuilder. */ public class ResourcesTest { diff --git a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/sample.rf b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/sample.rf deleted file mode 100644 index 6a511d3e509..00000000000 --- a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/sample.rf +++ /dev/null @@ -1,97 +0,0 @@ - - - - - -
- - - - -
- - - - - - - - - - - Message ( message == "XOR" ) - Message ( message == "OR" ) - eval(true) - Message ( message == "AND" ) - - - - - - - - - - - - Person ( id >= 5 ) - Person ( id <= 5 ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/kie-api/src/main/java/org/kie/api/io/ResourceType.java b/kie-api/src/main/java/org/kie/api/io/ResourceType.java index 868e2698537..5d0ed93353d 100644 --- a/kie-api/src/main/java/org/kie/api/io/ResourceType.java +++ b/kie-api/src/main/java/org/kie/api/io/ResourceType.java @@ -135,12 +135,6 @@ public static ResourceType addResourceTypeToRegistry(final String resourceType, "src/main/resources", "rdslr"); - /** Drools Rule Flow Language */ - public static final ResourceType DRF = addResourceTypeToRegistry("DRF", - "Drools Rule Flow Language", - "src/main/resources", - "rf"); - /** jBPM BPMN2 Language */ public static final ResourceType BPMN2 = addResourceTypeToRegistry("BPMN2", "jBPM BPMN2 Language",