From 3d8f35d0771473acdd454ebe7cf26c487e39aa50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Thu, 6 Feb 2025 15:20:54 +0100 Subject: [PATCH 1/9] Fix json serialization and deserialization of decimal numbers with big scale. --- .../org/kie/server/api/marshalling/json/JSONMarshaller.java | 1 + .../kie/server/services/dmn/ModelEvaluatorServiceBase.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java index 2c058f34f1..89e78c1fed 100644 --- a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java +++ b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java @@ -279,6 +279,7 @@ protected void configureMarshaller(Set> classes, final ClassLoader clas deserializeObjectMapper.setConfig(objectMapper.getDeserializationConfig() .with(introspectorPair) .with(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + .with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) .without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); objectMapper.configure(MapperFeature.USE_STD_BEAN_NAMING, this.useStrictJavaBeans); diff --git a/kie-server-parent/kie-server-services/kie-server-services-dmn/src/main/java/org/kie/server/services/dmn/ModelEvaluatorServiceBase.java b/kie-server-parent/kie-server-services/kie-server-services-dmn/src/main/java/org/kie/server/services/dmn/ModelEvaluatorServiceBase.java index a46276892a..1c6072d81a 100644 --- a/kie-server-parent/kie-server-services/kie-server-services-dmn/src/main/java/org/kie/server/services/dmn/ModelEvaluatorServiceBase.java +++ b/kie-server-parent/kie-server-services/kie-server-services-dmn/src/main/java/org/kie/server/services/dmn/ModelEvaluatorServiceBase.java @@ -28,6 +28,8 @@ import javax.xml.namespace.QName; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.cfg.JsonNodeFeature; import org.kie.api.builder.ReleaseId; import org.kie.api.runtime.KieRuntimeFactory; import org.kie.dmn.api.core.DMNContext; @@ -87,7 +89,9 @@ public class ModelEvaluatorServiceBase { .addSerializer(org.kie.dmn.feel.lang.types.impl.ComparablePeriod.class, new DMNFEELComparablePeriodSerializer())) .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS); + .disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS) + .configure(JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES, false) + .configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true); public ModelEvaluatorServiceBase(KieServerRegistry context) { this.context = context; From 27705ec37f0caa213cd44daecb9b089728bd4ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 7 Feb 2025 14:42:18 +0100 Subject: [PATCH 2/9] Align PMML tests with BigDecimal usage. --- ...ApplyPmmlMultipleTimesIntegrationTest.java | 29 +++++++++++-------- .../ApplyRegressionModelIntegrationTest.java | 10 ++++--- .../ApplyScorecardModelIntegrationTest.java | 21 +++++++------- .../pmml/ApplyMiningModelIntegrationTest.java | 3 +- .../ApplyRegressionModelIntegrationTest.java | 3 +- .../ApplyScorecardModelIntegrationTest.java | 3 +- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java index 746f3652ce..bf8be3039d 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java @@ -16,6 +16,8 @@ package org.kie.server.integrationtests.drools.pmml; +import java.math.BigDecimal; +import java.math.MathContext; import java.util.HashMap; import java.util.Map; @@ -58,8 +60,8 @@ public static void buildAndDeployArtifacts() { @Test public void testMultipleRegressionEvaluation() { - double fld1 = 12.0; - double fld2 = 25.0; + BigDecimal fld1 = BigDecimal.valueOf(12.0); + BigDecimal fld2 = BigDecimal.valueOf(25.0); String fld3 = "x"; PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); @@ -77,13 +79,13 @@ public void testMultipleRegressionEvaluation() { Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); - fld1 = 5; - fld2 = 8; + fld1 = BigDecimal.valueOf(5); + fld2 = BigDecimal.valueOf(8); fld3 = "y"; request = new PMMLRequestData("123", "LinReg"); request.addRequestParam("fld1", fld1); @@ -100,24 +102,27 @@ public void testMultipleRegressionEvaluation() { obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); } - private static double simpleRegressionResult(double fld1, double fld2, String fld3) { - double result = 0.5 + 5 * fld1 * fld1 + 2 * fld2 + fld3Coefficient(fld3) + 0.4 * fld1 * fld2; - result = 1.0 / (1.0 + Math.exp(-result)); - + private static BigDecimal simpleRegressionResult(BigDecimal fld1, BigDecimal fld2, String fld3) { + BigDecimal result = fld1.multiply(fld1).multiply(BigDecimal.valueOf(5)) + .add(BigDecimal.valueOf(0.5)) + .add(fld2.multiply(BigDecimal.valueOf(2))) + .add(fld3Coefficient(fld3)) + .add(fld1.multiply(fld2).multiply(BigDecimal.valueOf(0.4))); + result = BigDecimal.ONE.divide(BigDecimal.ONE.add(BigDecimal.valueOf(Math.exp(-result.doubleValue())))); return result; } - private static double fld3Coefficient(String fld3) { + private static BigDecimal fld3Coefficient(String fld3) { final Map fld3ValueMap = new HashMap<>(); fld3ValueMap.put("x", -3.0); fld3ValueMap.put("y", 3.0); - return fld3ValueMap.getOrDefault(fld3, 0.0); + return BigDecimal.valueOf(fld3ValueMap.getOrDefault(fld3, 0.0)); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java index 4fd3052466..2a32412496 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java @@ -33,6 +33,8 @@ import org.kie.server.integrationtests.shared.KieServerAssert; import org.kie.server.integrationtests.shared.KieServerDeployer; +import java.math.BigDecimal; + public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest { private static final ReleaseId releaseId = @@ -57,8 +59,8 @@ public static void buildAndDeployArtifacts() { public void testApplyPmmlRegressionModel() { final PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); - request.addRequestParam("fld1", 12.0); - request.addRequestParam("fld2", 25.0); + request.addRequestParam("fld1", BigDecimal.valueOf(12.0)); + request.addRequestParam("fld2", BigDecimal.valueOf(25.0)); request.addRequestParam("fld3", "x"); final ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory) @@ -71,9 +73,9 @@ public void testApplyPmmlRegressionModel() { final Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - final Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + final BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); - Assertions.assertThat(targetValue).isEqualTo(1.0); + Assertions.assertThat(targetValue).isEqualTo(BigDecimal.valueOf(1.0)); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java index 85bdf05726..9f2a5767b9 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java @@ -16,6 +16,7 @@ package org.kie.server.integrationtests.drools.pmml; import java.io.File; +import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -90,8 +91,8 @@ public void testApplyPmmlScorecard() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", 10.0); - request.addRequestParam("param2", 15.0); + request.addRequestParam("param1", BigDecimal.valueOf(10.0)); + request.addRequestParam("param2", BigDecimal.valueOf(15.0)); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -102,9 +103,9 @@ public void testApplyPmmlScorecard() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); - Assertions.assertThat(score).isEqualTo(40.8); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); + Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecard completed successfully"); @@ -115,8 +116,8 @@ public void testApplyPmmlScorecardInBatch() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", 10.0); - request.addRequestParam("param2", 15.0); + request.addRequestParam("param1", BigDecimal.valueOf(10.0)); + request.addRequestParam("param2", BigDecimal.valueOf(15.0)); List> cmds = new ArrayList<>(); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -129,9 +130,9 @@ public void testApplyPmmlScorecardInBatch() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); - Assertions.assertThat(score).isEqualTo(40.8); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); + Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecardInBatch completed successfully"); diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java index 42c41856f9..2307bb3fbc 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -28,7 +29,7 @@ public class ApplyMiningModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "MixedMining"; private static final String FILE_NAME = "MiningModelMixed.pmml"; private static final String TARGET_FIELD = "categoricalResult"; - private static final Object EXPECTED_RESULT = 2.3724999999999987; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(2.3724999999999987); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 90000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java index 15f0c020f7..052382969a 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -28,7 +29,7 @@ public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest private static final String MODEL_NAME = "LinReg"; private static final String FILE_NAME = "test_regression.pmml"; private static final String TARGET_FIELD = "fld4"; - private static final Object EXPECTED_RESULT = 1.0; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(1.0); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java index f08716c6d5..5ed6cc1448 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -31,7 +32,7 @@ public class ApplyScorecardModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "CompoundPredicateScorecard"; private static final String FILE_NAME = "CompoundPredicateScorecard.pmml"; private static final String TARGET_FIELD = "score"; - private static final Object EXPECTED_RESULT = -93.0; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(-93.0); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup From d7aa94d8c357bcfed989b5485bea466352785e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Mon, 10 Feb 2025 14:48:44 +0100 Subject: [PATCH 3/9] Revert "Align PMML tests with BigDecimal usage." This reverts commit 0d465020f9041843d01d89fefa8270b48a889ee2. --- ...ApplyPmmlMultipleTimesIntegrationTest.java | 29 ++++++++----------- .../ApplyRegressionModelIntegrationTest.java | 10 +++---- .../ApplyScorecardModelIntegrationTest.java | 21 +++++++------- .../pmml/ApplyMiningModelIntegrationTest.java | 3 +- .../ApplyRegressionModelIntegrationTest.java | 3 +- .../ApplyScorecardModelIntegrationTest.java | 3 +- 6 files changed, 29 insertions(+), 40 deletions(-) diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java index bf8be3039d..746f3652ce 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java @@ -16,8 +16,6 @@ package org.kie.server.integrationtests.drools.pmml; -import java.math.BigDecimal; -import java.math.MathContext; import java.util.HashMap; import java.util.Map; @@ -60,8 +58,8 @@ public static void buildAndDeployArtifacts() { @Test public void testMultipleRegressionEvaluation() { - BigDecimal fld1 = BigDecimal.valueOf(12.0); - BigDecimal fld2 = BigDecimal.valueOf(25.0); + double fld1 = 12.0; + double fld2 = 25.0; String fld3 = "x"; PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); @@ -79,13 +77,13 @@ public void testMultipleRegressionEvaluation() { Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); - fld1 = BigDecimal.valueOf(5); - fld2 = BigDecimal.valueOf(8); + fld1 = 5; + fld2 = 8; fld3 = "y"; request = new PMMLRequestData("123", "LinReg"); request.addRequestParam("fld1", fld1); @@ -102,27 +100,24 @@ public void testMultipleRegressionEvaluation() { obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); } - private static BigDecimal simpleRegressionResult(BigDecimal fld1, BigDecimal fld2, String fld3) { - BigDecimal result = fld1.multiply(fld1).multiply(BigDecimal.valueOf(5)) - .add(BigDecimal.valueOf(0.5)) - .add(fld2.multiply(BigDecimal.valueOf(2))) - .add(fld3Coefficient(fld3)) - .add(fld1.multiply(fld2).multiply(BigDecimal.valueOf(0.4))); - result = BigDecimal.ONE.divide(BigDecimal.ONE.add(BigDecimal.valueOf(Math.exp(-result.doubleValue())))); + private static double simpleRegressionResult(double fld1, double fld2, String fld3) { + double result = 0.5 + 5 * fld1 * fld1 + 2 * fld2 + fld3Coefficient(fld3) + 0.4 * fld1 * fld2; + result = 1.0 / (1.0 + Math.exp(-result)); + return result; } - private static BigDecimal fld3Coefficient(String fld3) { + private static double fld3Coefficient(String fld3) { final Map fld3ValueMap = new HashMap<>(); fld3ValueMap.put("x", -3.0); fld3ValueMap.put("y", 3.0); - return BigDecimal.valueOf(fld3ValueMap.getOrDefault(fld3, 0.0)); + return fld3ValueMap.getOrDefault(fld3, 0.0); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java index 2a32412496..4fd3052466 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java @@ -33,8 +33,6 @@ import org.kie.server.integrationtests.shared.KieServerAssert; import org.kie.server.integrationtests.shared.KieServerDeployer; -import java.math.BigDecimal; - public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest { private static final ReleaseId releaseId = @@ -59,8 +57,8 @@ public static void buildAndDeployArtifacts() { public void testApplyPmmlRegressionModel() { final PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); - request.addRequestParam("fld1", BigDecimal.valueOf(12.0)); - request.addRequestParam("fld2", BigDecimal.valueOf(25.0)); + request.addRequestParam("fld1", 12.0); + request.addRequestParam("fld2", 25.0); request.addRequestParam("fld3", "x"); final ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory) @@ -73,9 +71,9 @@ public void testApplyPmmlRegressionModel() { final Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - final BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + final Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); - Assertions.assertThat(targetValue).isEqualTo(BigDecimal.valueOf(1.0)); + Assertions.assertThat(targetValue).isEqualTo(1.0); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java index 9f2a5767b9..85bdf05726 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java @@ -16,7 +16,6 @@ package org.kie.server.integrationtests.drools.pmml; import java.io.File; -import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -91,8 +90,8 @@ public void testApplyPmmlScorecard() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", BigDecimal.valueOf(10.0)); - request.addRequestParam("param2", BigDecimal.valueOf(15.0)); + request.addRequestParam("param1", 10.0); + request.addRequestParam("param2", 15.0); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -103,9 +102,9 @@ public void testApplyPmmlScorecard() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); - Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); + Assertions.assertThat(score).isEqualTo(40.8); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecard completed successfully"); @@ -116,8 +115,8 @@ public void testApplyPmmlScorecardInBatch() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", BigDecimal.valueOf(10.0)); - request.addRequestParam("param2", BigDecimal.valueOf(15.0)); + request.addRequestParam("param1", 10.0); + request.addRequestParam("param2", 15.0); List> cmds = new ArrayList<>(); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -130,9 +129,9 @@ public void testApplyPmmlScorecardInBatch() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); - Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); + Assertions.assertThat(score).isEqualTo(40.8); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecardInBatch completed successfully"); diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java index 2307bb3fbc..42c41856f9 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -29,7 +28,7 @@ public class ApplyMiningModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "MixedMining"; private static final String FILE_NAME = "MiningModelMixed.pmml"; private static final String TARGET_FIELD = "categoricalResult"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(2.3724999999999987); + private static final Object EXPECTED_RESULT = 2.3724999999999987; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 90000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java index 052382969a..15f0c020f7 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -29,7 +28,7 @@ public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest private static final String MODEL_NAME = "LinReg"; private static final String FILE_NAME = "test_regression.pmml"; private static final String TARGET_FIELD = "fld4"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(1.0); + private static final Object EXPECTED_RESULT = 1.0; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java index 5ed6cc1448..f08716c6d5 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -32,7 +31,7 @@ public class ApplyScorecardModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "CompoundPredicateScorecard"; private static final String FILE_NAME = "CompoundPredicateScorecard.pmml"; private static final String TARGET_FIELD = "score"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(-93.0); + private static final Object EXPECTED_RESULT = -93.0; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup From 77251833a45d10f1af3de0d4780593a4957db638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Tue, 11 Feb 2025 14:27:52 +0100 Subject: [PATCH 4/9] Revert "Revert "Align PMML tests with BigDecimal usage."" This reverts commit 9836ee1ae475a6f9eb6c221e57ad7567127d8365. --- ...ApplyPmmlMultipleTimesIntegrationTest.java | 29 +++++++++++-------- .../ApplyRegressionModelIntegrationTest.java | 10 ++++--- .../ApplyScorecardModelIntegrationTest.java | 21 +++++++------- .../pmml/ApplyMiningModelIntegrationTest.java | 3 +- .../ApplyRegressionModelIntegrationTest.java | 3 +- .../ApplyScorecardModelIntegrationTest.java | 3 +- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java index 746f3652ce..bf8be3039d 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java @@ -16,6 +16,8 @@ package org.kie.server.integrationtests.drools.pmml; +import java.math.BigDecimal; +import java.math.MathContext; import java.util.HashMap; import java.util.Map; @@ -58,8 +60,8 @@ public static void buildAndDeployArtifacts() { @Test public void testMultipleRegressionEvaluation() { - double fld1 = 12.0; - double fld2 = 25.0; + BigDecimal fld1 = BigDecimal.valueOf(12.0); + BigDecimal fld2 = BigDecimal.valueOf(25.0); String fld3 = "x"; PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); @@ -77,13 +79,13 @@ public void testMultipleRegressionEvaluation() { Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); - fld1 = 5; - fld2 = 8; + fld1 = BigDecimal.valueOf(5); + fld2 = BigDecimal.valueOf(8); fld3 = "y"; request = new PMMLRequestData("123", "LinReg"); request.addRequestParam("fld1", fld1); @@ -100,24 +102,27 @@ public void testMultipleRegressionEvaluation() { obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); } - private static double simpleRegressionResult(double fld1, double fld2, String fld3) { - double result = 0.5 + 5 * fld1 * fld1 + 2 * fld2 + fld3Coefficient(fld3) + 0.4 * fld1 * fld2; - result = 1.0 / (1.0 + Math.exp(-result)); - + private static BigDecimal simpleRegressionResult(BigDecimal fld1, BigDecimal fld2, String fld3) { + BigDecimal result = fld1.multiply(fld1).multiply(BigDecimal.valueOf(5)) + .add(BigDecimal.valueOf(0.5)) + .add(fld2.multiply(BigDecimal.valueOf(2))) + .add(fld3Coefficient(fld3)) + .add(fld1.multiply(fld2).multiply(BigDecimal.valueOf(0.4))); + result = BigDecimal.ONE.divide(BigDecimal.ONE.add(BigDecimal.valueOf(Math.exp(-result.doubleValue())))); return result; } - private static double fld3Coefficient(String fld3) { + private static BigDecimal fld3Coefficient(String fld3) { final Map fld3ValueMap = new HashMap<>(); fld3ValueMap.put("x", -3.0); fld3ValueMap.put("y", 3.0); - return fld3ValueMap.getOrDefault(fld3, 0.0); + return BigDecimal.valueOf(fld3ValueMap.getOrDefault(fld3, 0.0)); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java index 4fd3052466..2a32412496 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java @@ -33,6 +33,8 @@ import org.kie.server.integrationtests.shared.KieServerAssert; import org.kie.server.integrationtests.shared.KieServerDeployer; +import java.math.BigDecimal; + public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest { private static final ReleaseId releaseId = @@ -57,8 +59,8 @@ public static void buildAndDeployArtifacts() { public void testApplyPmmlRegressionModel() { final PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); - request.addRequestParam("fld1", 12.0); - request.addRequestParam("fld2", 25.0); + request.addRequestParam("fld1", BigDecimal.valueOf(12.0)); + request.addRequestParam("fld2", BigDecimal.valueOf(25.0)); request.addRequestParam("fld3", "x"); final ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory) @@ -71,9 +73,9 @@ public void testApplyPmmlRegressionModel() { final Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - final Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) + final BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); - Assertions.assertThat(targetValue).isEqualTo(1.0); + Assertions.assertThat(targetValue).isEqualTo(BigDecimal.valueOf(1.0)); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java index 85bdf05726..9f2a5767b9 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java @@ -16,6 +16,7 @@ package org.kie.server.integrationtests.drools.pmml; import java.io.File; +import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -90,8 +91,8 @@ public void testApplyPmmlScorecard() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", 10.0); - request.addRequestParam("param2", 15.0); + request.addRequestParam("param1", BigDecimal.valueOf(10.0)); + request.addRequestParam("param2", BigDecimal.valueOf(15.0)); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -102,9 +103,9 @@ public void testApplyPmmlScorecard() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); - Assertions.assertThat(score).isEqualTo(40.8); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); + Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecard completed successfully"); @@ -115,8 +116,8 @@ public void testApplyPmmlScorecardInBatch() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", 10.0); - request.addRequestParam("param2", 15.0); + request.addRequestParam("param1", BigDecimal.valueOf(10.0)); + request.addRequestParam("param2", BigDecimal.valueOf(15.0)); List> cmds = new ArrayList<>(); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -129,9 +130,9 @@ public void testApplyPmmlScorecardInBatch() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); - Assertions.assertThat(score).isEqualTo(40.8); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); + Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecardInBatch completed successfully"); diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java index 42c41856f9..2307bb3fbc 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -28,7 +29,7 @@ public class ApplyMiningModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "MixedMining"; private static final String FILE_NAME = "MiningModelMixed.pmml"; private static final String TARGET_FIELD = "categoricalResult"; - private static final Object EXPECTED_RESULT = 2.3724999999999987; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(2.3724999999999987); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 90000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java index 15f0c020f7..052382969a 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -28,7 +29,7 @@ public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest private static final String MODEL_NAME = "LinReg"; private static final String FILE_NAME = "test_regression.pmml"; private static final String TARGET_FIELD = "fld4"; - private static final Object EXPECTED_RESULT = 1.0; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(1.0); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java index f08716c6d5..5ed6cc1448 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java @@ -15,6 +15,7 @@ */ package org.kie.server.integrationtests.pmml; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -31,7 +32,7 @@ public class ApplyScorecardModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "CompoundPredicateScorecard"; private static final String FILE_NAME = "CompoundPredicateScorecard.pmml"; private static final String TARGET_FIELD = "score"; - private static final Object EXPECTED_RESULT = -93.0; + private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(-93.0); private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup From c3fc51c84332f73bdabf0a4aeb00d1b1cc32a258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Tue, 11 Feb 2025 14:34:00 +0100 Subject: [PATCH 5/9] Revert "Revert "Revert "Align PMML tests with BigDecimal usage.""" This reverts commit f5fd8601b3d741d197db23d41c39c90ff6c4d973. --- ...ApplyPmmlMultipleTimesIntegrationTest.java | 29 ++++++++----------- .../ApplyRegressionModelIntegrationTest.java | 10 +++---- .../ApplyScorecardModelIntegrationTest.java | 21 +++++++------- .../pmml/ApplyMiningModelIntegrationTest.java | 3 +- .../ApplyRegressionModelIntegrationTest.java | 3 +- .../ApplyScorecardModelIntegrationTest.java | 3 +- 6 files changed, 29 insertions(+), 40 deletions(-) diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java index bf8be3039d..746f3652ce 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyPmmlMultipleTimesIntegrationTest.java @@ -16,8 +16,6 @@ package org.kie.server.integrationtests.drools.pmml; -import java.math.BigDecimal; -import java.math.MathContext; import java.util.HashMap; import java.util.Map; @@ -60,8 +58,8 @@ public static void buildAndDeployArtifacts() { @Test public void testMultipleRegressionEvaluation() { - BigDecimal fld1 = BigDecimal.valueOf(12.0); - BigDecimal fld2 = BigDecimal.valueOf(25.0); + double fld1 = 12.0; + double fld2 = 25.0; String fld3 = "x"; PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); @@ -79,13 +77,13 @@ public void testMultipleRegressionEvaluation() { Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); - fld1 = BigDecimal.valueOf(5); - fld2 = BigDecimal.valueOf(8); + fld1 = 5; + fld2 = 8; fld3 = "y"; request = new PMMLRequestData("123", "LinReg"); request.addRequestParam("fld1", fld1); @@ -102,27 +100,24 @@ public void testMultipleRegressionEvaluation() { obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); Assertions.assertThat(targetValue).isEqualTo(simpleRegressionResult(fld1, fld2, fld3)); } - private static BigDecimal simpleRegressionResult(BigDecimal fld1, BigDecimal fld2, String fld3) { - BigDecimal result = fld1.multiply(fld1).multiply(BigDecimal.valueOf(5)) - .add(BigDecimal.valueOf(0.5)) - .add(fld2.multiply(BigDecimal.valueOf(2))) - .add(fld3Coefficient(fld3)) - .add(fld1.multiply(fld2).multiply(BigDecimal.valueOf(0.4))); - result = BigDecimal.ONE.divide(BigDecimal.ONE.add(BigDecimal.valueOf(Math.exp(-result.doubleValue())))); + private static double simpleRegressionResult(double fld1, double fld2, String fld3) { + double result = 0.5 + 5 * fld1 * fld1 + 2 * fld2 + fld3Coefficient(fld3) + 0.4 * fld1 * fld2; + result = 1.0 / (1.0 + Math.exp(-result)); + return result; } - private static BigDecimal fld3Coefficient(String fld3) { + private static double fld3Coefficient(String fld3) { final Map fld3ValueMap = new HashMap<>(); fld3ValueMap.put("x", -3.0); fld3ValueMap.put("y", 3.0); - return BigDecimal.valueOf(fld3ValueMap.getOrDefault(fld3, 0.0)); + return fld3ValueMap.getOrDefault(fld3, 0.0); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java index 2a32412496..4fd3052466 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyRegressionModelIntegrationTest.java @@ -33,8 +33,6 @@ import org.kie.server.integrationtests.shared.KieServerAssert; import org.kie.server.integrationtests.shared.KieServerDeployer; -import java.math.BigDecimal; - public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest { private static final ReleaseId releaseId = @@ -59,8 +57,8 @@ public static void buildAndDeployArtifacts() { public void testApplyPmmlRegressionModel() { final PMMLRequestData request = new PMMLRequestData("123", "LinReg"); request.setSource("test_regression.pmml"); - request.addRequestParam("fld1", BigDecimal.valueOf(12.0)); - request.addRequestParam("fld2", BigDecimal.valueOf(25.0)); + request.addRequestParam("fld1", 12.0); + request.addRequestParam("fld2", 25.0); request.addRequestParam("fld3", "x"); final ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory) @@ -73,9 +71,9 @@ public void testApplyPmmlRegressionModel() { final Object obj = resultHolder.getResultValue("Fld4", null); Assertions.assertThat(obj).isNotNull(); - final BigDecimal targetValue = resultHolder.getResultValue("Fld4", "value", BigDecimal.class) + final Double targetValue = resultHolder.getResultValue("Fld4", "value", Double.class) .orElse(null); Assertions.assertThat(targetValue).isNotNull(); - Assertions.assertThat(targetValue).isEqualTo(BigDecimal.valueOf(1.0)); + Assertions.assertThat(targetValue).isEqualTo(1.0); } } diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java index 9f2a5767b9..85bdf05726 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/src/test/java/org/kie/server/integrationtests/drools/pmml/ApplyScorecardModelIntegrationTest.java @@ -16,7 +16,6 @@ package org.kie.server.integrationtests.drools.pmml; import java.io.File; -import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -91,8 +90,8 @@ public void testApplyPmmlScorecard() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", BigDecimal.valueOf(10.0)); - request.addRequestParam("param2", BigDecimal.valueOf(15.0)); + request.addRequestParam("param1", 10.0); + request.addRequestParam("param2", 15.0); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -103,9 +102,9 @@ public void testApplyPmmlScorecard() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); - Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); + Assertions.assertThat(score).isEqualTo(40.8); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecard completed successfully"); @@ -116,8 +115,8 @@ public void testApplyPmmlScorecardInBatch() { Thread.currentThread().setContextClassLoader(classLoader); PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard"); request.setSource("test_scorecard_simple.pmml"); - request.addRequestParam("param1", BigDecimal.valueOf(10.0)); - request.addRequestParam("param2", BigDecimal.valueOf(15.0)); + request.addRequestParam("param1", 10.0); + request.addRequestParam("param2", 15.0); List> cmds = new ArrayList<>(); ApplyPmmlModelCommand command = (ApplyPmmlModelCommand) ((CommandFactoryServiceImpl) commandsFactory).newApplyPmmlModel(request); @@ -130,9 +129,9 @@ public void testApplyPmmlScorecardInBatch() { assertNotNull(resultHolder); assertEquals("OK", resultHolder.getResultCode()); - BigDecimal score = resultHolder.getResultValue("ScoreCard", "score", BigDecimal.class).get(); - Assertions.assertThat(score).isEqualTo(BigDecimal.valueOf(40.8)); - Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); + double score = resultHolder.getResultValue("ScoreCard", "score", Double.class).get(); + Assertions.assertThat(score).isEqualTo(40.8); + Map rankingMap = (Map) resultHolder.getResultValue("ScoreCard", "ranking"); Assertions.assertThat(rankingMap.get("reasonCh1")).isEqualTo(5); Assertions.assertThat(rankingMap.get("reasonCh2")).isEqualTo(-6); logger.info("ApplyScorecardModelIntegrationTest#testApplyPmmlScorecardInBatch completed successfully"); diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java index 2307bb3fbc..42c41856f9 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyMiningModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -29,7 +28,7 @@ public class ApplyMiningModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "MixedMining"; private static final String FILE_NAME = "MiningModelMixed.pmml"; private static final String TARGET_FIELD = "categoricalResult"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(2.3724999999999987); + private static final Object EXPECTED_RESULT = 2.3724999999999987; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 90000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java index 052382969a..15f0c020f7 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyRegressionModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -29,7 +28,7 @@ public class ApplyRegressionModelIntegrationTest extends PMMLApplyModelBaseTest private static final String MODEL_NAME = "LinReg"; private static final String FILE_NAME = "test_regression.pmml"; private static final String TARGET_FIELD = "fld4"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(1.0); + private static final Object EXPECTED_RESULT = 1.0; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java index 5ed6cc1448..f08716c6d5 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-pmml/src/test/java/org/kie/server/integrationtests/pmml/ApplyScorecardModelIntegrationTest.java @@ -15,7 +15,6 @@ */ package org.kie.server.integrationtests.pmml; -import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -32,7 +31,7 @@ public class ApplyScorecardModelIntegrationTest extends PMMLApplyModelBaseTest { private static final String MODEL_NAME = "CompoundPredicateScorecard"; private static final String FILE_NAME = "CompoundPredicateScorecard.pmml"; private static final String TARGET_FIELD = "score"; - private static final BigDecimal EXPECTED_RESULT = BigDecimal.valueOf(-93.0); + private static final Object EXPECTED_RESULT = -93.0; private static final Map INPUT_DATA; private static final long EXTENDED_TIMEOUT = 30000000L; // Test setup From c14bb684b3cd61be79fb283b1bd8bb400d7dbdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 28 Feb 2025 12:36:10 +0100 Subject: [PATCH 6/9] Remove unneeded kjars --- .../invoker.properties | 7 -- .../it/kie-maven-plugin-test-kjar-4/pom.xml | 54 ------------- .../xpath/tobeinstrumented/model/Adult.java | 38 --------- .../xpath/tobeinstrumented/model/Child.java | 47 ----------- .../model/FieldIsNotListInterface.java | 32 -------- .../model/FieldsSomeInterfacesSomeNot.java | 55 ------------- .../tobeinstrumented/model/ImmutablePojo.java | 36 --------- .../xpath/tobeinstrumented/model/Man.java | 35 --------- .../xpath/tobeinstrumented/model/Person.java | 45 ----------- .../model/PojoWithCollections.java | 40 ---------- .../xpath/tobeinstrumented/model/School.java | 46 ----------- .../tobeinstrumented/model/TMDirectory.java | 37 --------- .../xpath/tobeinstrumented/model/TMFile.java | 47 ----------- .../tobeinstrumented/model/TMFileSet.java | 37 --------- .../xpath/tobeinstrumented/model/Toy.java | 39 ---------- .../model/UsingADependencyClass.java | 28 ------- .../model/UsingSpecializedList.java | 28 ------- .../xpath/tobeinstrumented/model/Woman.java | 35 --------- .../src/main/resources/META-INF/kmodule.xml | 2 - .../InjectReactiveIntegrationTest4IT.java | 66 ---------------- .../invoker.properties | 7 -- .../it/kie-maven-plugin-test-kjar-5/pom.xml | 59 -------------- .../xpath/tobeinstrumented/model/Adult.java | 38 --------- .../xpath/tobeinstrumented/model/Child.java | 47 ----------- .../tobeinstrumented/model/ImmutablePojo.java | 36 --------- .../xpath/tobeinstrumented/model/Man.java | 35 --------- .../xpath/tobeinstrumented/model/Person.java | 45 ----------- .../xpath/tobeinstrumented/model/School.java | 46 ----------- .../tobeinstrumented/model/TMDirectory.java | 37 --------- .../xpath/tobeinstrumented/model/TMFile.java | 47 ----------- .../tobeinstrumented/model/TMFileSet.java | 37 --------- .../xpath/tobeinstrumented/model/Toy.java | 39 ---------- .../model/UsingADependencyClass.java | 28 ------- .../model/UsingSpecializedList.java | 28 ------- .../xpath/tobeinstrumented/model/Woman.java | 35 --------- .../src/main/java/to/instrument/Adult.java | 38 --------- .../src/main/java/to/instrument/Child.java | 47 ----------- .../java/to/instrument/ImmutablePojo.java | 36 --------- .../src/main/java/to/instrument/Man.java | 35 --------- .../src/main/java/to/instrument/Person.java | 45 ----------- .../src/main/java/to/instrument/School.java | 46 ----------- .../main/java/to/instrument/TMDirectory.java | 37 --------- .../src/main/java/to/instrument/TMFile.java | 47 ----------- .../main/java/to/instrument/TMFileSet.java | 37 --------- .../src/main/java/to/instrument/Toy.java | 39 ---------- .../to/instrument/UsingADependencyClass.java | 28 ------- .../to/instrument/UsingSpecializedList.java | 28 ------- .../src/main/java/to/instrument/Woman.java | 35 --------- .../main/java/to/not/instrument/Adult.java | 38 --------- .../main/java/to/not/instrument/Child.java | 47 ----------- .../java/to/not/instrument/ImmutablePojo.java | 36 --------- .../src/main/java/to/not/instrument/Man.java | 35 --------- .../main/java/to/not/instrument/Person.java | 45 ----------- .../main/java/to/not/instrument/School.java | 46 ----------- .../java/to/not/instrument/TMDirectory.java | 37 --------- .../main/java/to/not/instrument/TMFile.java | 47 ----------- .../java/to/not/instrument/TMFileSet.java | 37 --------- .../src/main/java/to/not/instrument/Toy.java | 39 ---------- .../not/instrument/UsingADependencyClass.java | 28 ------- .../not/instrument/UsingSpecializedList.java | 28 ------- .../main/java/to/not/instrument/Woman.java | 35 --------- .../src/main/resources/META-INF/kmodule.xml | 2 - .../InjectReactiveIntegrationTest5IT.java | 77 ------------------- 63 files changed, 2393 deletions(-) delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml delete mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties deleted file mode 100644 index f669db2cd4..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties +++ /dev/null @@ -1,7 +0,0 @@ -# A comma or space separated list of goals/phases to execute, may -# specify an empty list to execute the default goal of the IT project. -# Environment variables used by maven plugins can be added here -invoker.goals = clean package verify -invoker.mavenOpts = -Dmaven.wagon.http.ssl.insecure=true -# Uncomment the following to debug invoker. Do note that you have to connect the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on console -#invoker.mavenOpts=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml deleted file mode 100644 index 48585863c1..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 4.0.0 - - org.kie - kie-maven-plugin-test-kjar-parent - @org.kie.version@ - ../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml - - - kie-maven-plugin-test-kjar-4 - - kjar - - - - org.drools - drools-model-compiler - ${org.kie.version} - - - org.apache.commons - commons-math3 - 3.6.1 - - - org.magicwerk - brownies-collections - 0.9.13 - - - org.kie - kie-maven-plugin - ${org.kie.version} - test - - - - - - - org.kie - kie-maven-plugin - ${org.kie.version} - true - - true - - - - - diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java deleted file mode 100644 index c53cf24d34..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class Adult extends Person { - - private final List children = new ArrayList(); - - public Adult(String name, - int age) { - super(name, - age); - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java deleted file mode 100644 index 63a9edde7c..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class Child extends Person { - - private final List toys = new ArrayList(); - private String mother; - - public Child(String name, - int age) { - super(name, - age); - } - - public List getToys() { - return toys; - } - - public void addToy(Toy toy) { - toys.add(toy); - } - - public String getMother() { - return mother; - } - - public void setMother(String mother) { - this.mother = mother; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java deleted file mode 100644 index e9f4a00e6f..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class FieldIsNotListInterface { - - private final ArrayList myField; - - public FieldIsNotListInterface() { - myField = new ArrayList(); - } - - public List getMyField() { - return myField; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java deleted file mode 100644 index a06a405d9f..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class FieldsSomeInterfacesSomeNot { - - private ArrayList myField = new ArrayList(); - private List myField2 = new ArrayList(); - private Collection myField3 = new ArrayList(); - - public FieldsSomeInterfacesSomeNot() { - myField = new ArrayList(); - } - - public List getMyField() { - return myField; - } - - public void setMyField(ArrayList myField) { - this.myField = myField; - } - - public List getMyField2() { - return myField2; - } - - public void setMyField2(List myField2) { - this.myField2 = myField2; - } - - public Collection getMyField3() { - return myField3; - } - - public void setMyField3(Collection myField3) { - this.myField3 = myField3; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java deleted file mode 100644 index 72064892e4..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public abstract class ImmutablePojo { - - private final String name; - private final int age; - - public ImmutablePojo(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java deleted file mode 100644 index 89d643f381..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Man extends Adult { - - private Woman wife; - - public Man(String name, - int age) { - super(name, - age); - } - - public Woman getWife() { - return wife; - } - - public void setWife(Woman wife) { - this.wife = wife; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java deleted file mode 100644 index a5029ed7ed..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public abstract class Person { - - private final String name; - private int age; - - public Person(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - @Override - public String toString() { - return name; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java deleted file mode 100644 index 946811b891..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.drools.compiler.xpath.tobeinstrumented.model; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -public class PojoWithCollections { - - private final Collection fieldCollection; - private final List fieldList; - private final Set fieldSet; - - public PojoWithCollections(Collection fieldCollection, - List fieldList, - Set fieldSet) { - super(); - this.fieldCollection = fieldCollection; - this.fieldList = fieldList; - this.fieldSet = fieldSet; - } - - public Collection getFieldCollection() { - return fieldCollection; - } - - public List getFieldList() { - return fieldList; - } - - public Set getFieldSet() { - return fieldSet; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("PojoWithCollections [fieldCollection=").append(fieldCollection).append(", fieldList=").append(fieldList).append(", fieldSet=").append(fieldSet).append("]"); - return builder.toString(); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java deleted file mode 100644 index 447e2790c1..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class School { - - private final String name; - - private final List children = new ArrayList(); - - public School(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } - - public void removeChild(Child child) { - children.remove(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java deleted file mode 100644 index 78dfab44be..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class TMDirectory { - - private final String name; - private final List members = new ArrayList(); - - public TMDirectory(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java deleted file mode 100644 index f445b7b76d..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class TMFile { - - private final String name; - private int size; - - public TMFile(String name, - int size) { - this.name = name; - this.size = size; - } - - public String getName() { - return name; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); - return builder.toString(); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java deleted file mode 100644 index d6cd411490..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.HashSet; -import java.util.Set; - -public class TMFileSet { - - private final String name; - private final Set members = new HashSet(); - - public TMFileSet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public Set getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java deleted file mode 100644 index aae472c039..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Toy { - - private final String name; - - private String owner; - - public Toy(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java deleted file mode 100644 index f9c37bf26b..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.drools.compiler.xpath.tobeinstrumented.model; - -import org.apache.commons.math3.ml.clustering.Cluster; -import org.apache.commons.math3.ml.clustering.Clusterable; - -public class UsingADependencyClass { - - private final String name; - private Cluster aCluster; - - public UsingADependencyClass(String name) { - super(); - this.name = name; - this.aCluster = new Cluster(); - } - - public String getName() { - return name; - } - - public Cluster getaCluster() { - return aCluster; - } - - public void setACluster(Cluster aCluster) { - this.aCluster = aCluster; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java deleted file mode 100644 index 53beeae970..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.drools.compiler.xpath.tobeinstrumented.model; - -import java.util.List; - -import org.magicwerk.brownies.collections.GapList; - -public class UsingSpecializedList { - - private final String name; - private List gapList; - - public UsingSpecializedList(String name) { - super(); - this.name = name; - this.gapList = new GapList(); - } - - public String getName() { - return name; - } - - public List getGapList() { - if (gapList == null) { - gapList = new GapList(); - } - return gapList; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java deleted file mode 100644 index 8898fe18ec..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Woman extends Adult { - - private String husband; - - public Woman(String name, - int age) { - super(name, - age); - } - - public String getHusband() { - return husband; - } - - public void setHusband(String husband) { - this.husband = husband; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml deleted file mode 100644 index 2172472f79..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java deleted file mode 100644 index f1165566c9..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.kie.maven.plugin.ittests; - -import java.lang.reflect.Method; - -import org.drools.core.phreak.ReactiveObject; -import org.junit.Test; -import org.kie.maven.plugin.BytecodeInjectReactive; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class InjectReactiveIntegrationTest4IT { - - private static Logger logger = LoggerFactory.getLogger(InjectReactiveIntegrationTest4IT.class); - - @Test - public void testBasicBytecodeInjection() throws Exception { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.Adult"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingADependencyClass"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingSpecializedList"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFile"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFileSet"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.ImmutablePojo"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.FieldIsNotListInterface"))); - } - - private boolean looksLikeInstrumentedClass(Class personClass) { - boolean foundReactiveObjectInterface = false; - for (Class i : personClass.getInterfaces()) { - if (i.getName().equals(ReactiveObject.class.getName())) { - foundReactiveObjectInterface = true; - } - } - // the ReactiveObject interface method are injected by the bytecode instrumenter, better check they are indeed available.. - boolean containsGetLeftTuple = checkContainsMethod(personClass, - "getLeftTuples"); - boolean containsAddLeftTuple = checkContainsMethod(personClass, - "addLeftTuple"); - boolean containsRemoveLeftTuple = checkContainsMethod(personClass, - "removeLeftTuple"); - - boolean foundReactiveInjectedMethods = false; - for (Method m : personClass.getMethods()) { - if (m.getName().startsWith(BytecodeInjectReactive.DROOLS_PREFIX)) { - foundReactiveInjectedMethods = true; - } - } - return foundReactiveObjectInterface - && containsGetLeftTuple && containsAddLeftTuple && containsRemoveLeftTuple - && foundReactiveInjectedMethods; - } - - private boolean checkContainsMethod(Class personClass, - Object methodName) { - for (Method m : personClass.getMethods()) { - if (m.getName().equals(methodName)) { - return true; - } - } - return false; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties deleted file mode 100644 index f669db2cd4..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties +++ /dev/null @@ -1,7 +0,0 @@ -# A comma or space separated list of goals/phases to execute, may -# specify an empty list to execute the default goal of the IT project. -# Environment variables used by maven plugins can be added here -invoker.goals = clean package verify -invoker.mavenOpts = -Dmaven.wagon.http.ssl.insecure=true -# Uncomment the following to debug invoker. Do note that you have to connect the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on console -#invoker.mavenOpts=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml deleted file mode 100644 index 3887d96034..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - 4.0.0 - - org.kie - kie-maven-plugin-test-kjar-parent - @org.kie.version@ - ../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml - - - kie-maven-plugin-test-kjar-5 - - kjar - - - - org.drools - drools-model-compiler - ${org.kie.version} - - - org.apache.commons - commons-math3 - 3.2 - - - org.magicwerk - brownies-collections - 0.9.13 - - - org.kie - kie-maven-plugin - ${org.kie.version} - test - - - - - - - org.kie - kie-maven-plugin - ${org.kie.version} - true - - true - true - - to.instrument - org.drools.compiler.xpath.tobeinstrumented.* - - - - - - diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java deleted file mode 100644 index c53cf24d34..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class Adult extends Person { - - private final List children = new ArrayList(); - - public Adult(String name, - int age) { - super(name, - age); - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java deleted file mode 100644 index 63a9edde7c..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class Child extends Person { - - private final List toys = new ArrayList(); - private String mother; - - public Child(String name, - int age) { - super(name, - age); - } - - public List getToys() { - return toys; - } - - public void addToy(Toy toy) { - toys.add(toy); - } - - public String getMother() { - return mother; - } - - public void setMother(String mother) { - this.mother = mother; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java deleted file mode 100644 index 72064892e4..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public abstract class ImmutablePojo { - - private final String name; - private final int age; - - public ImmutablePojo(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java deleted file mode 100644 index 89d643f381..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Man extends Adult { - - private Woman wife; - - public Man(String name, - int age) { - super(name, - age); - } - - public Woman getWife() { - return wife; - } - - public void setWife(Woman wife) { - this.wife = wife; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java deleted file mode 100644 index a5029ed7ed..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public abstract class Person { - - private final String name; - private int age; - - public Person(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - @Override - public String toString() { - return name; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java deleted file mode 100644 index 447e2790c1..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class School { - - private final String name; - - private final List children = new ArrayList(); - - public School(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } - - public void removeChild(Child child) { - children.remove(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java deleted file mode 100644 index 78dfab44be..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.ArrayList; -import java.util.List; - -public class TMDirectory { - - private final String name; - private final List members = new ArrayList(); - - public TMDirectory(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java deleted file mode 100644 index f445b7b76d..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class TMFile { - - private final String name; - private int size; - - public TMFile(String name, - int size) { - this.name = name; - this.size = size; - } - - public String getName() { - return name; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); - return builder.toString(); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java deleted file mode 100644 index d6cd411490..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -import java.util.HashSet; -import java.util.Set; - -public class TMFileSet { - - private final String name; - private final Set members = new HashSet(); - - public TMFileSet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public Set getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java deleted file mode 100644 index aae472c039..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Toy { - - private final String name; - - private String owner; - - public Toy(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java deleted file mode 100644 index f9c37bf26b..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.drools.compiler.xpath.tobeinstrumented.model; - -import org.apache.commons.math3.ml.clustering.Cluster; -import org.apache.commons.math3.ml.clustering.Clusterable; - -public class UsingADependencyClass { - - private final String name; - private Cluster aCluster; - - public UsingADependencyClass(String name) { - super(); - this.name = name; - this.aCluster = new Cluster(); - } - - public String getName() { - return name; - } - - public Cluster getaCluster() { - return aCluster; - } - - public void setACluster(Cluster aCluster) { - this.aCluster = aCluster; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java deleted file mode 100644 index 53beeae970..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.drools.compiler.xpath.tobeinstrumented.model; - -import java.util.List; - -import org.magicwerk.brownies.collections.GapList; - -public class UsingSpecializedList { - - private final String name; - private List gapList; - - public UsingSpecializedList(String name) { - super(); - this.name = name; - this.gapList = new GapList(); - } - - public String getName() { - return name; - } - - public List getGapList() { - if (gapList == null) { - gapList = new GapList(); - } - return gapList; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java deleted file mode 100644 index 8898fe18ec..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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.compiler.xpath.tobeinstrumented.model; - -public class Woman extends Adult { - - private String husband; - - public Woman(String name, - int age) { - super(name, - age); - } - - public String getHusband() { - return husband; - } - - public void setHusband(String husband) { - this.husband = husband; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java deleted file mode 100644 index 503b63d804..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class Adult extends Person { - - private final List children = new ArrayList(); - - public Adult(String name, - int age) { - super(name, - age); - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java deleted file mode 100644 index 0a3b338dcb..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class Child extends Person { - - private final List toys = new ArrayList(); - private String mother; - - public Child(String name, - int age) { - super(name, - age); - } - - public List getToys() { - return toys; - } - - public void addToy(Toy toy) { - toys.add(toy); - } - - public String getMother() { - return mother; - } - - public void setMother(String mother) { - this.mother = mother; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java deleted file mode 100644 index 4de9461c6b..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public abstract class ImmutablePojo { - - private final String name; - private final int age; - - public ImmutablePojo(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java deleted file mode 100644 index 11eabe7681..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public class Man extends Adult { - - private Woman wife; - - public Man(String name, - int age) { - super(name, - age); - } - - public Woman getWife() { - return wife; - } - - public void setWife(Woman wife) { - this.wife = wife; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java deleted file mode 100644 index ebfea7c012..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public abstract class Person { - - private final String name; - private int age; - - public Person(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - @Override - public String toString() { - return name; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java deleted file mode 100644 index 59692aba92..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class School { - - private final String name; - - private final List children = new ArrayList(); - - public School(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } - - public void removeChild(Child child) { - children.remove(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java deleted file mode 100644 index 5bf09d52bf..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class TMDirectory { - - private final String name; - private final List members = new ArrayList(); - - public TMDirectory(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java deleted file mode 100644 index 7f8f343ef8..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public class TMFile { - - private final String name; - private int size; - - public TMFile(String name, - int size) { - this.name = name; - this.size = size; - } - - public String getName() { - return name; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); - return builder.toString(); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java deleted file mode 100644 index 6b6f839a91..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -import java.util.HashSet; -import java.util.Set; - -public class TMFileSet { - - private final String name; - private final Set members = new HashSet(); - - public TMFileSet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public Set getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java deleted file mode 100644 index 016c8e4942..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public class Toy { - - private final String name; - - private String owner; - - public Toy(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java deleted file mode 100644 index ccae711021..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java +++ /dev/null @@ -1,28 +0,0 @@ -package to.instrument; - -import org.apache.commons.math3.ml.clustering.Cluster; -import org.apache.commons.math3.ml.clustering.Clusterable; - -public class UsingADependencyClass { - - private final String name; - private Cluster aCluster; - - public UsingADependencyClass(String name) { - super(); - this.name = name; - this.aCluster = new Cluster(); - } - - public String getName() { - return name; - } - - public Cluster getaCluster() { - return aCluster; - } - - public void setACluster(Cluster aCluster) { - this.aCluster = aCluster; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java deleted file mode 100644 index 595c17faf8..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java +++ /dev/null @@ -1,28 +0,0 @@ -package to.instrument; - -import java.util.List; - -import org.magicwerk.brownies.collections.GapList; - -public class UsingSpecializedList { - - private final String name; - private List gapList; - - public UsingSpecializedList(String name) { - super(); - this.name = name; - this.gapList = new GapList(); - } - - public String getName() { - return name; - } - - public List getGapList() { - if (gapList == null) { - gapList = new GapList(); - } - return gapList; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java deleted file mode 100644 index 40141aa2bc..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.instrument; - -public class Woman extends Adult { - - private String husband; - - public Woman(String name, - int age) { - super(name, - age); - } - - public String getHusband() { - return husband; - } - - public void setHusband(String husband) { - this.husband = husband; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java deleted file mode 100644 index 3927b8b550..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class Adult extends Person { - - private final List children = new ArrayList(); - - public Adult(String name, - int age) { - super(name, - age); - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java deleted file mode 100644 index fc049e90f3..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class Child extends Person { - - private final List toys = new ArrayList(); - private String mother; - - public Child(String name, - int age) { - super(name, - age); - } - - public List getToys() { - return toys; - } - - public void addToy(Toy toy) { - toys.add(toy); - } - - public String getMother() { - return mother; - } - - public void setMother(String mother) { - this.mother = mother; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java deleted file mode 100644 index 343e4f1d0a..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public abstract class ImmutablePojo { - - private final String name; - private final int age; - - public ImmutablePojo(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java deleted file mode 100644 index c3a5a968cf..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public class Man extends Adult { - - private Woman wife; - - public Man(String name, - int age) { - super(name, - age); - } - - public Woman getWife() { - return wife; - } - - public void setWife(Woman wife) { - this.wife = wife; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java deleted file mode 100644 index c3b7043434..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public abstract class Person { - - private final String name; - private int age; - - public Person(String name, - int age) { - this.name = name; - this.age = age; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - @Override - public String toString() { - return name; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java deleted file mode 100644 index 8163e18f5d..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class School { - - private final String name; - - private final List children = new ArrayList(); - - public School(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getChildren() { - return children; - } - - public void addChild(Child child) { - children.add(child); - } - - public void removeChild(Child child) { - children.remove(child); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java deleted file mode 100644 index 648f9ed23a..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -import java.util.ArrayList; -import java.util.List; - -public class TMDirectory { - - private final String name; - private final List members = new ArrayList(); - - public TMDirectory(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public List getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java deleted file mode 100644 index b1bac1ef7a..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public class TMFile { - - private final String name; - private int size; - - public TMFile(String name, - int size) { - this.name = name; - this.size = size; - } - - public String getName() { - return name; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); - return builder.toString(); - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java deleted file mode 100644 index 205080a0a8..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -import java.util.HashSet; -import java.util.Set; - -public class TMFileSet { - - private final String name; - private final Set members = new HashSet(); - - public TMFileSet(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public Set getFiles() { - return members; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java deleted file mode 100644 index de30ec3597..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public class Toy { - - private final String name; - - private String owner; - - public Toy(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java deleted file mode 100644 index 3f40388ed8..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java +++ /dev/null @@ -1,28 +0,0 @@ -package to.not.instrument; - -import org.apache.commons.math3.ml.clustering.Cluster; -import org.apache.commons.math3.ml.clustering.Clusterable; - -public class UsingADependencyClass { - - private final String name; - private Cluster aCluster; - - public UsingADependencyClass(String name) { - super(); - this.name = name; - this.aCluster = new Cluster(); - } - - public String getName() { - return name; - } - - public Cluster getaCluster() { - return aCluster; - } - - public void setACluster(Cluster aCluster) { - this.aCluster = aCluster; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java deleted file mode 100644 index 0a2ebd2533..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java +++ /dev/null @@ -1,28 +0,0 @@ -package to.not.instrument; - -import java.util.List; - -import org.magicwerk.brownies.collections.GapList; - -public class UsingSpecializedList { - - private final String name; - private List gapList; - - public UsingSpecializedList(String name) { - super(); - this.name = name; - this.gapList = new GapList(); - } - - public String getName() { - return name; - } - - public List getGapList() { - if (gapList == null) { - gapList = new GapList(); - } - return gapList; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java deleted file mode 100644 index a4a4533bd8..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Red Hat, Inc. and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * 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 to.not.instrument; - -public class Woman extends Adult { - - private String husband; - - public Woman(String name, - int age) { - super(name, - age); - } - - public String getHusband() { - return husband; - } - - public void setHusband(String husband) { - this.husband = husband; - } -} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml deleted file mode 100644 index 2172472f79..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java deleted file mode 100644 index f3b0ce6d66..0000000000 --- a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.kie.maven.plugin.ittests; - -import java.lang.reflect.Method; - -import org.drools.core.phreak.ReactiveObject; -import org.junit.Test; -import org.kie.maven.plugin.BytecodeInjectReactive; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class InjectReactiveIntegrationTest5IT { - - private static Logger logger = LoggerFactory.getLogger(InjectReactiveIntegrationTest5IT.class); - - @Test - public void testBasicBytecodeInjectionSelected() throws Exception { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.Adult"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingADependencyClass"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingSpecializedList"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFile"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFileSet"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.ImmutablePojo"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.Adult"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.UsingADependencyClass"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.UsingSpecializedList"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.TMFile"))); - assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.TMFileSet"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.instrument.ImmutablePojo"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.Adult"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.UsingADependencyClass"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.UsingSpecializedList"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.TMFile"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.TMFileSet"))); - assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.ImmutablePojo"))); - } - - private boolean looksLikeInstrumentedClass(Class personClass) { - boolean foundReactiveObjectInterface = false; - for (Class i : personClass.getInterfaces()) { - if (i.getName().equals(ReactiveObject.class.getName())) { - foundReactiveObjectInterface = true; - } - } - // the ReactiveObject interface method are injected by the bytecode instrumenter, better check they are indeed available.. - boolean containsGetLeftTuple = checkContainsMethod(personClass, - "getLeftTuples"); - boolean containsAddLeftTuple = checkContainsMethod(personClass, - "addLeftTuple"); - boolean containsRemoveLeftTuple = checkContainsMethod(personClass, - "removeLeftTuple"); - - boolean foundReactiveInjectedMethods = false; - for (Method m : personClass.getMethods()) { - if (m.getName().startsWith(BytecodeInjectReactive.DROOLS_PREFIX)) { - foundReactiveInjectedMethods = true; - } - } - return foundReactiveObjectInterface - && containsGetLeftTuple && containsAddLeftTuple && containsRemoveLeftTuple - && foundReactiveInjectedMethods; - } - - private boolean checkContainsMethod(Class personClass, - Object methodName) { - for (Method m : personClass.getMethods()) { - if (m.getName().equals(methodName)) { - return true; - } - } - return false; - } -} From fb02c245d74b5a5e8a0bc9439b1275983821afaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 28 Feb 2025 13:08:38 +0100 Subject: [PATCH 7/9] When unmarshalling DMN from JSON, use BigDecimals. --- .../kie/server/api/marshalling/json/JSONMarshaller.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java index 89e78c1fed..4d1ada99df 100644 --- a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java +++ b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java @@ -279,7 +279,7 @@ protected void configureMarshaller(Set> classes, final ClassLoader clas deserializeObjectMapper.setConfig(objectMapper.getDeserializationConfig() .with(introspectorPair) .with(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) - .with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) +// .with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) .without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); objectMapper.configure(MapperFeature.USE_STD_BEAN_NAMING, this.useStrictJavaBeans); @@ -438,6 +438,9 @@ public T unmarshall(String serializedInput, Class type) { try { Class actualType = classesSet.contains(type) ? Object.class : type; + if (actualType.getPackage().getName().endsWith(".dmn")) { + deserializeObjectMapper.setConfig(deserializeObjectMapper.getDeserializationConfig().with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)); + } return (T) unwrap(deserializeObjectMapper.readValue(serializedInput, actualType)); } catch (IOException e) { throw new MarshallingException("Error unmarshalling input", e); @@ -451,6 +454,9 @@ public T unmarshall(byte[] serializedInput, Class type) { try { Class actualType = classesSet.contains(type) ? Object.class : type; + if (actualType.getPackage().getName().endsWith(".dmn")) { + deserializeObjectMapper.setConfig(deserializeObjectMapper.getDeserializationConfig().with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)); + } return (T) unwrap(deserializeObjectMapper.readValue(serializedInput, actualType)); } catch (IOException e) { throw new MarshallingException("Error unmarshalling input", e); From f10d0895cde5bbe060f0f2934fe175790481ebd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 28 Feb 2025 13:09:11 +0100 Subject: [PATCH 8/9] Revert "Remove unneeded kjars" This reverts commit 4a62b6cf2c10fec4f10abf0c66754e3cec02c2b6. --- .../invoker.properties | 7 ++ .../it/kie-maven-plugin-test-kjar-4/pom.xml | 54 +++++++++++++ .../xpath/tobeinstrumented/model/Adult.java | 38 +++++++++ .../xpath/tobeinstrumented/model/Child.java | 47 +++++++++++ .../model/FieldIsNotListInterface.java | 32 ++++++++ .../model/FieldsSomeInterfacesSomeNot.java | 55 +++++++++++++ .../tobeinstrumented/model/ImmutablePojo.java | 36 +++++++++ .../xpath/tobeinstrumented/model/Man.java | 35 +++++++++ .../xpath/tobeinstrumented/model/Person.java | 45 +++++++++++ .../model/PojoWithCollections.java | 40 ++++++++++ .../xpath/tobeinstrumented/model/School.java | 46 +++++++++++ .../tobeinstrumented/model/TMDirectory.java | 37 +++++++++ .../xpath/tobeinstrumented/model/TMFile.java | 47 +++++++++++ .../tobeinstrumented/model/TMFileSet.java | 37 +++++++++ .../xpath/tobeinstrumented/model/Toy.java | 39 ++++++++++ .../model/UsingADependencyClass.java | 28 +++++++ .../model/UsingSpecializedList.java | 28 +++++++ .../xpath/tobeinstrumented/model/Woman.java | 35 +++++++++ .../src/main/resources/META-INF/kmodule.xml | 2 + .../InjectReactiveIntegrationTest4IT.java | 66 ++++++++++++++++ .../invoker.properties | 7 ++ .../it/kie-maven-plugin-test-kjar-5/pom.xml | 59 ++++++++++++++ .../xpath/tobeinstrumented/model/Adult.java | 38 +++++++++ .../xpath/tobeinstrumented/model/Child.java | 47 +++++++++++ .../tobeinstrumented/model/ImmutablePojo.java | 36 +++++++++ .../xpath/tobeinstrumented/model/Man.java | 35 +++++++++ .../xpath/tobeinstrumented/model/Person.java | 45 +++++++++++ .../xpath/tobeinstrumented/model/School.java | 46 +++++++++++ .../tobeinstrumented/model/TMDirectory.java | 37 +++++++++ .../xpath/tobeinstrumented/model/TMFile.java | 47 +++++++++++ .../tobeinstrumented/model/TMFileSet.java | 37 +++++++++ .../xpath/tobeinstrumented/model/Toy.java | 39 ++++++++++ .../model/UsingADependencyClass.java | 28 +++++++ .../model/UsingSpecializedList.java | 28 +++++++ .../xpath/tobeinstrumented/model/Woman.java | 35 +++++++++ .../src/main/java/to/instrument/Adult.java | 38 +++++++++ .../src/main/java/to/instrument/Child.java | 47 +++++++++++ .../java/to/instrument/ImmutablePojo.java | 36 +++++++++ .../src/main/java/to/instrument/Man.java | 35 +++++++++ .../src/main/java/to/instrument/Person.java | 45 +++++++++++ .../src/main/java/to/instrument/School.java | 46 +++++++++++ .../main/java/to/instrument/TMDirectory.java | 37 +++++++++ .../src/main/java/to/instrument/TMFile.java | 47 +++++++++++ .../main/java/to/instrument/TMFileSet.java | 37 +++++++++ .../src/main/java/to/instrument/Toy.java | 39 ++++++++++ .../to/instrument/UsingADependencyClass.java | 28 +++++++ .../to/instrument/UsingSpecializedList.java | 28 +++++++ .../src/main/java/to/instrument/Woman.java | 35 +++++++++ .../main/java/to/not/instrument/Adult.java | 38 +++++++++ .../main/java/to/not/instrument/Child.java | 47 +++++++++++ .../java/to/not/instrument/ImmutablePojo.java | 36 +++++++++ .../src/main/java/to/not/instrument/Man.java | 35 +++++++++ .../main/java/to/not/instrument/Person.java | 45 +++++++++++ .../main/java/to/not/instrument/School.java | 46 +++++++++++ .../java/to/not/instrument/TMDirectory.java | 37 +++++++++ .../main/java/to/not/instrument/TMFile.java | 47 +++++++++++ .../java/to/not/instrument/TMFileSet.java | 37 +++++++++ .../src/main/java/to/not/instrument/Toy.java | 39 ++++++++++ .../not/instrument/UsingADependencyClass.java | 28 +++++++ .../not/instrument/UsingSpecializedList.java | 28 +++++++ .../main/java/to/not/instrument/Woman.java | 35 +++++++++ .../src/main/resources/META-INF/kmodule.xml | 2 + .../InjectReactiveIntegrationTest5IT.java | 77 +++++++++++++++++++ 63 files changed, 2393 insertions(+) create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml create mode 100644 kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties new file mode 100644 index 0000000000..f669db2cd4 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/invoker.properties @@ -0,0 +1,7 @@ +# A comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project. +# Environment variables used by maven plugins can be added here +invoker.goals = clean package verify +invoker.mavenOpts = -Dmaven.wagon.http.ssl.insecure=true +# Uncomment the following to debug invoker. Do note that you have to connect the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on console +#invoker.mavenOpts=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml new file mode 100644 index 0000000000..48585863c1 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + org.kie + kie-maven-plugin-test-kjar-parent + @org.kie.version@ + ../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml + + + kie-maven-plugin-test-kjar-4 + + kjar + + + + org.drools + drools-model-compiler + ${org.kie.version} + + + org.apache.commons + commons-math3 + 3.6.1 + + + org.magicwerk + brownies-collections + 0.9.13 + + + org.kie + kie-maven-plugin + ${org.kie.version} + test + + + + + + + org.kie + kie-maven-plugin + ${org.kie.version} + true + + true + + + + + diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java new file mode 100644 index 0000000000..c53cf24d34 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class Adult extends Person { + + private final List children = new ArrayList(); + + public Adult(String name, + int age) { + super(name, + age); + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java new file mode 100644 index 0000000000..63a9edde7c --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class Child extends Person { + + private final List toys = new ArrayList(); + private String mother; + + public Child(String name, + int age) { + super(name, + age); + } + + public List getToys() { + return toys; + } + + public void addToy(Toy toy) { + toys.add(toy); + } + + public String getMother() { + return mother; + } + + public void setMother(String mother) { + this.mother = mother; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java new file mode 100644 index 0000000000..e9f4a00e6f --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldIsNotListInterface.java @@ -0,0 +1,32 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class FieldIsNotListInterface { + + private final ArrayList myField; + + public FieldIsNotListInterface() { + myField = new ArrayList(); + } + + public List getMyField() { + return myField; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java new file mode 100644 index 0000000000..a06a405d9f --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/FieldsSomeInterfacesSomeNot.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class FieldsSomeInterfacesSomeNot { + + private ArrayList myField = new ArrayList(); + private List myField2 = new ArrayList(); + private Collection myField3 = new ArrayList(); + + public FieldsSomeInterfacesSomeNot() { + myField = new ArrayList(); + } + + public List getMyField() { + return myField; + } + + public void setMyField(ArrayList myField) { + this.myField = myField; + } + + public List getMyField2() { + return myField2; + } + + public void setMyField2(List myField2) { + this.myField2 = myField2; + } + + public Collection getMyField3() { + return myField3; + } + + public void setMyField3(Collection myField3) { + this.myField3 = myField3; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java new file mode 100644 index 0000000000..72064892e4 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public abstract class ImmutablePojo { + + private final String name; + private final int age; + + public ImmutablePojo(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java new file mode 100644 index 0000000000..89d643f381 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Man extends Adult { + + private Woman wife; + + public Man(String name, + int age) { + super(name, + age); + } + + public Woman getWife() { + return wife; + } + + public void setWife(Woman wife) { + this.wife = wife; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java new file mode 100644 index 0000000000..a5029ed7ed --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public abstract class Person { + + private final String name; + private int age; + + public Person(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java new file mode 100644 index 0000000000..946811b891 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/PojoWithCollections.java @@ -0,0 +1,40 @@ +package org.drools.compiler.xpath.tobeinstrumented.model; + +import java.util.Collection; +import java.util.List; +import java.util.Set; + +public class PojoWithCollections { + + private final Collection fieldCollection; + private final List fieldList; + private final Set fieldSet; + + public PojoWithCollections(Collection fieldCollection, + List fieldList, + Set fieldSet) { + super(); + this.fieldCollection = fieldCollection; + this.fieldList = fieldList; + this.fieldSet = fieldSet; + } + + public Collection getFieldCollection() { + return fieldCollection; + } + + public List getFieldList() { + return fieldList; + } + + public Set getFieldSet() { + return fieldSet; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("PojoWithCollections [fieldCollection=").append(fieldCollection).append(", fieldList=").append(fieldList).append(", fieldSet=").append(fieldSet).append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java new file mode 100644 index 0000000000..447e2790c1 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java @@ -0,0 +1,46 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class School { + + private final String name; + + private final List children = new ArrayList(); + + public School(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } + + public void removeChild(Child child) { + children.remove(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java new file mode 100644 index 0000000000..78dfab44be --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class TMDirectory { + + private final String name; + private final List members = new ArrayList(); + + public TMDirectory(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java new file mode 100644 index 0000000000..f445b7b76d --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class TMFile { + + private final String name; + private int size; + + public TMFile(String name, + int size) { + this.name = name; + this.size = size; + } + + public String getName() { + return name; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java new file mode 100644 index 0000000000..d6cd411490 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.HashSet; +import java.util.Set; + +public class TMFileSet { + + private final String name; + private final Set members = new HashSet(); + + public TMFileSet(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public Set getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java new file mode 100644 index 0000000000..aae472c039 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Toy { + + private final String name; + + private String owner; + + public Toy(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java new file mode 100644 index 0000000000..f9c37bf26b --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java @@ -0,0 +1,28 @@ +package org.drools.compiler.xpath.tobeinstrumented.model; + +import org.apache.commons.math3.ml.clustering.Cluster; +import org.apache.commons.math3.ml.clustering.Clusterable; + +public class UsingADependencyClass { + + private final String name; + private Cluster aCluster; + + public UsingADependencyClass(String name) { + super(); + this.name = name; + this.aCluster = new Cluster(); + } + + public String getName() { + return name; + } + + public Cluster getaCluster() { + return aCluster; + } + + public void setACluster(Cluster aCluster) { + this.aCluster = aCluster; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java new file mode 100644 index 0000000000..53beeae970 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java @@ -0,0 +1,28 @@ +package org.drools.compiler.xpath.tobeinstrumented.model; + +import java.util.List; + +import org.magicwerk.brownies.collections.GapList; + +public class UsingSpecializedList { + + private final String name; + private List gapList; + + public UsingSpecializedList(String name) { + super(); + this.name = name; + this.gapList = new GapList(); + } + + public String getName() { + return name; + } + + public List getGapList() { + if (gapList == null) { + gapList = new GapList(); + } + return gapList; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java new file mode 100644 index 0000000000..8898fe18ec --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Woman extends Adult { + + private String husband; + + public Woman(String name, + int age) { + super(name, + age); + } + + public String getHusband() { + return husband; + } + + public void setHusband(String husband) { + this.husband = husband; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 0000000000..2172472f79 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java new file mode 100644 index 0000000000..f1165566c9 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-4/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest4IT.java @@ -0,0 +1,66 @@ +package org.kie.maven.plugin.ittests; + +import java.lang.reflect.Method; + +import org.drools.core.phreak.ReactiveObject; +import org.junit.Test; +import org.kie.maven.plugin.BytecodeInjectReactive; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class InjectReactiveIntegrationTest4IT { + + private static Logger logger = LoggerFactory.getLogger(InjectReactiveIntegrationTest4IT.class); + + @Test + public void testBasicBytecodeInjection() throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.Adult"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingADependencyClass"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingSpecializedList"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFile"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFileSet"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.ImmutablePojo"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.FieldIsNotListInterface"))); + } + + private boolean looksLikeInstrumentedClass(Class personClass) { + boolean foundReactiveObjectInterface = false; + for (Class i : personClass.getInterfaces()) { + if (i.getName().equals(ReactiveObject.class.getName())) { + foundReactiveObjectInterface = true; + } + } + // the ReactiveObject interface method are injected by the bytecode instrumenter, better check they are indeed available.. + boolean containsGetLeftTuple = checkContainsMethod(personClass, + "getLeftTuples"); + boolean containsAddLeftTuple = checkContainsMethod(personClass, + "addLeftTuple"); + boolean containsRemoveLeftTuple = checkContainsMethod(personClass, + "removeLeftTuple"); + + boolean foundReactiveInjectedMethods = false; + for (Method m : personClass.getMethods()) { + if (m.getName().startsWith(BytecodeInjectReactive.DROOLS_PREFIX)) { + foundReactiveInjectedMethods = true; + } + } + return foundReactiveObjectInterface + && containsGetLeftTuple && containsAddLeftTuple && containsRemoveLeftTuple + && foundReactiveInjectedMethods; + } + + private boolean checkContainsMethod(Class personClass, + Object methodName) { + for (Method m : personClass.getMethods()) { + if (m.getName().equals(methodName)) { + return true; + } + } + return false; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties new file mode 100644 index 0000000000..f669db2cd4 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/invoker.properties @@ -0,0 +1,7 @@ +# A comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project. +# Environment variables used by maven plugins can be added here +invoker.goals = clean package verify +invoker.mavenOpts = -Dmaven.wagon.http.ssl.insecure=true +# Uncomment the following to debug invoker. Do note that you have to connect the remote debugger after "maven-invoker-plugin:3.2.0:run" has been print on console +#invoker.mavenOpts=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml new file mode 100644 index 0000000000..3887d96034 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.kie + kie-maven-plugin-test-kjar-parent + @org.kie.version@ + ../kie-maven-plugin-test-kjar-setup/kie-maven-plugin-test-kjar-parent/pom.xml + + + kie-maven-plugin-test-kjar-5 + + kjar + + + + org.drools + drools-model-compiler + ${org.kie.version} + + + org.apache.commons + commons-math3 + 3.2 + + + org.magicwerk + brownies-collections + 0.9.13 + + + org.kie + kie-maven-plugin + ${org.kie.version} + test + + + + + + + org.kie + kie-maven-plugin + ${org.kie.version} + true + + true + true + + to.instrument + org.drools.compiler.xpath.tobeinstrumented.* + + + + + + diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java new file mode 100644 index 0000000000..c53cf24d34 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Adult.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class Adult extends Person { + + private final List children = new ArrayList(); + + public Adult(String name, + int age) { + super(name, + age); + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java new file mode 100644 index 0000000000..63a9edde7c --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Child.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class Child extends Person { + + private final List toys = new ArrayList(); + private String mother; + + public Child(String name, + int age) { + super(name, + age); + } + + public List getToys() { + return toys; + } + + public void addToy(Toy toy) { + toys.add(toy); + } + + public String getMother() { + return mother; + } + + public void setMother(String mother) { + this.mother = mother; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java new file mode 100644 index 0000000000..72064892e4 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/ImmutablePojo.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public abstract class ImmutablePojo { + + private final String name; + private final int age; + + public ImmutablePojo(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java new file mode 100644 index 0000000000..89d643f381 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Man.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Man extends Adult { + + private Woman wife; + + public Man(String name, + int age) { + super(name, + age); + } + + public Woman getWife() { + return wife; + } + + public void setWife(Woman wife) { + this.wife = wife; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java new file mode 100644 index 0000000000..a5029ed7ed --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Person.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public abstract class Person { + + private final String name; + private int age; + + public Person(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java new file mode 100644 index 0000000000..447e2790c1 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/School.java @@ -0,0 +1,46 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class School { + + private final String name; + + private final List children = new ArrayList(); + + public School(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } + + public void removeChild(Child child) { + children.remove(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java new file mode 100644 index 0000000000..78dfab44be --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMDirectory.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.ArrayList; +import java.util.List; + +public class TMDirectory { + + private final String name; + private final List members = new ArrayList(); + + public TMDirectory(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java new file mode 100644 index 0000000000..f445b7b76d --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class TMFile { + + private final String name; + private int size; + + public TMFile(String name, + int size) { + this.name = name; + this.size = size; + } + + public String getName() { + return name; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java new file mode 100644 index 0000000000..d6cd411490 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/TMFileSet.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +import java.util.HashSet; +import java.util.Set; + +public class TMFileSet { + + private final String name; + private final Set members = new HashSet(); + + public TMFileSet(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public Set getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java new file mode 100644 index 0000000000..aae472c039 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Toy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Toy { + + private final String name; + + private String owner; + + public Toy(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java new file mode 100644 index 0000000000..f9c37bf26b --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingADependencyClass.java @@ -0,0 +1,28 @@ +package org.drools.compiler.xpath.tobeinstrumented.model; + +import org.apache.commons.math3.ml.clustering.Cluster; +import org.apache.commons.math3.ml.clustering.Clusterable; + +public class UsingADependencyClass { + + private final String name; + private Cluster aCluster; + + public UsingADependencyClass(String name) { + super(); + this.name = name; + this.aCluster = new Cluster(); + } + + public String getName() { + return name; + } + + public Cluster getaCluster() { + return aCluster; + } + + public void setACluster(Cluster aCluster) { + this.aCluster = aCluster; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java new file mode 100644 index 0000000000..53beeae970 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/UsingSpecializedList.java @@ -0,0 +1,28 @@ +package org.drools.compiler.xpath.tobeinstrumented.model; + +import java.util.List; + +import org.magicwerk.brownies.collections.GapList; + +public class UsingSpecializedList { + + private final String name; + private List gapList; + + public UsingSpecializedList(String name) { + super(); + this.name = name; + this.gapList = new GapList(); + } + + public String getName() { + return name; + } + + public List getGapList() { + if (gapList == null) { + gapList = new GapList(); + } + return gapList; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java new file mode 100644 index 0000000000..8898fe18ec --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/org/drools/compiler/xpath/tobeinstrumented/model/Woman.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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.compiler.xpath.tobeinstrumented.model; + +public class Woman extends Adult { + + private String husband; + + public Woman(String name, + int age) { + super(name, + age); + } + + public String getHusband() { + return husband; + } + + public void setHusband(String husband) { + this.husband = husband; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java new file mode 100644 index 0000000000..503b63d804 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Adult.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class Adult extends Person { + + private final List children = new ArrayList(); + + public Adult(String name, + int age) { + super(name, + age); + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java new file mode 100644 index 0000000000..0a3b338dcb --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Child.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class Child extends Person { + + private final List toys = new ArrayList(); + private String mother; + + public Child(String name, + int age) { + super(name, + age); + } + + public List getToys() { + return toys; + } + + public void addToy(Toy toy) { + toys.add(toy); + } + + public String getMother() { + return mother; + } + + public void setMother(String mother) { + this.mother = mother; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java new file mode 100644 index 0000000000..4de9461c6b --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/ImmutablePojo.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public abstract class ImmutablePojo { + + private final String name; + private final int age; + + public ImmutablePojo(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java new file mode 100644 index 0000000000..11eabe7681 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Man.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public class Man extends Adult { + + private Woman wife; + + public Man(String name, + int age) { + super(name, + age); + } + + public Woman getWife() { + return wife; + } + + public void setWife(Woman wife) { + this.wife = wife; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java new file mode 100644 index 0000000000..ebfea7c012 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Person.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public abstract class Person { + + private final String name; + private int age; + + public Person(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java new file mode 100644 index 0000000000..59692aba92 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/School.java @@ -0,0 +1,46 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class School { + + private final String name; + + private final List children = new ArrayList(); + + public School(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } + + public void removeChild(Child child) { + children.remove(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java new file mode 100644 index 0000000000..5bf09d52bf --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMDirectory.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class TMDirectory { + + private final String name; + private final List members = new ArrayList(); + + public TMDirectory(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java new file mode 100644 index 0000000000..7f8f343ef8 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public class TMFile { + + private final String name; + private int size; + + public TMFile(String name, + int size) { + this.name = name; + this.size = size; + } + + public String getName() { + return name; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java new file mode 100644 index 0000000000..6b6f839a91 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/TMFileSet.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +import java.util.HashSet; +import java.util.Set; + +public class TMFileSet { + + private final String name; + private final Set members = new HashSet(); + + public TMFileSet(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public Set getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java new file mode 100644 index 0000000000..016c8e4942 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Toy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public class Toy { + + private final String name; + + private String owner; + + public Toy(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java new file mode 100644 index 0000000000..ccae711021 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingADependencyClass.java @@ -0,0 +1,28 @@ +package to.instrument; + +import org.apache.commons.math3.ml.clustering.Cluster; +import org.apache.commons.math3.ml.clustering.Clusterable; + +public class UsingADependencyClass { + + private final String name; + private Cluster aCluster; + + public UsingADependencyClass(String name) { + super(); + this.name = name; + this.aCluster = new Cluster(); + } + + public String getName() { + return name; + } + + public Cluster getaCluster() { + return aCluster; + } + + public void setACluster(Cluster aCluster) { + this.aCluster = aCluster; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java new file mode 100644 index 0000000000..595c17faf8 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/UsingSpecializedList.java @@ -0,0 +1,28 @@ +package to.instrument; + +import java.util.List; + +import org.magicwerk.brownies.collections.GapList; + +public class UsingSpecializedList { + + private final String name; + private List gapList; + + public UsingSpecializedList(String name) { + super(); + this.name = name; + this.gapList = new GapList(); + } + + public String getName() { + return name; + } + + public List getGapList() { + if (gapList == null) { + gapList = new GapList(); + } + return gapList; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java new file mode 100644 index 0000000000..40141aa2bc --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/instrument/Woman.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.instrument; + +public class Woman extends Adult { + + private String husband; + + public Woman(String name, + int age) { + super(name, + age); + } + + public String getHusband() { + return husband; + } + + public void setHusband(String husband) { + this.husband = husband; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java new file mode 100644 index 0000000000..3927b8b550 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Adult.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class Adult extends Person { + + private final List children = new ArrayList(); + + public Adult(String name, + int age) { + super(name, + age); + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java new file mode 100644 index 0000000000..fc049e90f3 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Child.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class Child extends Person { + + private final List toys = new ArrayList(); + private String mother; + + public Child(String name, + int age) { + super(name, + age); + } + + public List getToys() { + return toys; + } + + public void addToy(Toy toy) { + toys.add(toy); + } + + public String getMother() { + return mother; + } + + public void setMother(String mother) { + this.mother = mother; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java new file mode 100644 index 0000000000..343e4f1d0a --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/ImmutablePojo.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public abstract class ImmutablePojo { + + private final String name; + private final int age; + + public ImmutablePojo(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java new file mode 100644 index 0000000000..c3a5a968cf --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Man.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public class Man extends Adult { + + private Woman wife; + + public Man(String name, + int age) { + super(name, + age); + } + + public Woman getWife() { + return wife; + } + + public void setWife(Woman wife) { + this.wife = wife; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java new file mode 100644 index 0000000000..c3b7043434 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Person.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public abstract class Person { + + private final String name; + private int age; + + public Person(String name, + int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java new file mode 100644 index 0000000000..8163e18f5d --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/School.java @@ -0,0 +1,46 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class School { + + private final String name; + + private final List children = new ArrayList(); + + public School(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getChildren() { + return children; + } + + public void addChild(Child child) { + children.add(child); + } + + public void removeChild(Child child) { + children.remove(child); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java new file mode 100644 index 0000000000..648f9ed23a --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMDirectory.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +import java.util.ArrayList; +import java.util.List; + +public class TMDirectory { + + private final String name; + private final List members = new ArrayList(); + + public TMDirectory(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public List getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java new file mode 100644 index 0000000000..b1bac1ef7a --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFile.java @@ -0,0 +1,47 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public class TMFile { + + private final String name; + private int size; + + public TMFile(String name, + int size) { + this.name = name; + this.size = size; + } + + public String getName() { + return name; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TMFile [name=").append(name).append(", size=").append(size).append("]"); + return builder.toString(); + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java new file mode 100644 index 0000000000..205080a0a8 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/TMFileSet.java @@ -0,0 +1,37 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +import java.util.HashSet; +import java.util.Set; + +public class TMFileSet { + + private final String name; + private final Set members = new HashSet(); + + public TMFileSet(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public Set getFiles() { + return members; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java new file mode 100644 index 0000000000..de30ec3597 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Toy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public class Toy { + + private final String name; + + private String owner; + + public Toy(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java new file mode 100644 index 0000000000..3f40388ed8 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingADependencyClass.java @@ -0,0 +1,28 @@ +package to.not.instrument; + +import org.apache.commons.math3.ml.clustering.Cluster; +import org.apache.commons.math3.ml.clustering.Clusterable; + +public class UsingADependencyClass { + + private final String name; + private Cluster aCluster; + + public UsingADependencyClass(String name) { + super(); + this.name = name; + this.aCluster = new Cluster(); + } + + public String getName() { + return name; + } + + public Cluster getaCluster() { + return aCluster; + } + + public void setACluster(Cluster aCluster) { + this.aCluster = aCluster; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java new file mode 100644 index 0000000000..0a2ebd2533 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/UsingSpecializedList.java @@ -0,0 +1,28 @@ +package to.not.instrument; + +import java.util.List; + +import org.magicwerk.brownies.collections.GapList; + +public class UsingSpecializedList { + + private final String name; + private List gapList; + + public UsingSpecializedList(String name) { + super(); + this.name = name; + this.gapList = new GapList(); + } + + public String getName() { + return name; + } + + public List getGapList() { + if (gapList == null) { + gapList = new GapList(); + } + return gapList; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java new file mode 100644 index 0000000000..a4a4533bd8 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/java/to/not/instrument/Woman.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * 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 to.not.instrument; + +public class Woman extends Adult { + + private String husband; + + public Woman(String name, + int age) { + super(name, + age); + } + + public String getHusband() { + return husband; + } + + public void setHusband(String husband) { + this.husband = husband; + } +} diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 0000000000..2172472f79 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java new file mode 100644 index 0000000000..f3b0ce6d66 --- /dev/null +++ b/kie-maven-plugin/src/it/kie-maven-plugin-test-kjar-5/src/test/java/org/kie/maven/plugin/ittests/InjectReactiveIntegrationTest5IT.java @@ -0,0 +1,77 @@ +package org.kie.maven.plugin.ittests; + +import java.lang.reflect.Method; + +import org.drools.core.phreak.ReactiveObject; +import org.junit.Test; +import org.kie.maven.plugin.BytecodeInjectReactive; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class InjectReactiveIntegrationTest5IT { + + private static Logger logger = LoggerFactory.getLogger(InjectReactiveIntegrationTest5IT.class); + + @Test + public void testBasicBytecodeInjectionSelected() throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.Adult"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingADependencyClass"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.UsingSpecializedList"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFile"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.TMFileSet"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("org.drools.compiler.xpath.tobeinstrumented.model.ImmutablePojo"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.Adult"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.UsingADependencyClass"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.UsingSpecializedList"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.TMFile"))); + assertTrue(looksLikeInstrumentedClass(cl.loadClass("to.instrument.TMFileSet"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.instrument.ImmutablePojo"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.Adult"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.UsingADependencyClass"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.UsingSpecializedList"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.TMFile"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.TMFileSet"))); + assertFalse(looksLikeInstrumentedClass(cl.loadClass("to.not.instrument.ImmutablePojo"))); + } + + private boolean looksLikeInstrumentedClass(Class personClass) { + boolean foundReactiveObjectInterface = false; + for (Class i : personClass.getInterfaces()) { + if (i.getName().equals(ReactiveObject.class.getName())) { + foundReactiveObjectInterface = true; + } + } + // the ReactiveObject interface method are injected by the bytecode instrumenter, better check they are indeed available.. + boolean containsGetLeftTuple = checkContainsMethod(personClass, + "getLeftTuples"); + boolean containsAddLeftTuple = checkContainsMethod(personClass, + "addLeftTuple"); + boolean containsRemoveLeftTuple = checkContainsMethod(personClass, + "removeLeftTuple"); + + boolean foundReactiveInjectedMethods = false; + for (Method m : personClass.getMethods()) { + if (m.getName().startsWith(BytecodeInjectReactive.DROOLS_PREFIX)) { + foundReactiveInjectedMethods = true; + } + } + return foundReactiveObjectInterface + && containsGetLeftTuple && containsAddLeftTuple && containsRemoveLeftTuple + && foundReactiveInjectedMethods; + } + + private boolean checkContainsMethod(Class personClass, + Object methodName) { + for (Method m : personClass.getMethods()) { + if (m.getName().equals(methodName)) { + return true; + } + } + return false; + } +} From aebf71148fe21f47999859f10053db5b1b6cf7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Zim=C3=A1nyi?= Date: Fri, 28 Feb 2025 13:17:52 +0100 Subject: [PATCH 9/9] When unmarshalling DMN from JSON, use BigDecimals. --- .../org/kie/server/api/marshalling/json/JSONMarshaller.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java index 4d1ada99df..b47b02da32 100644 --- a/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java +++ b/kie-server-parent/kie-server-api/src/main/java/org/kie/server/api/marshalling/json/JSONMarshaller.java @@ -438,7 +438,7 @@ public T unmarshall(String serializedInput, Class type) { try { Class actualType = classesSet.contains(type) ? Object.class : type; - if (actualType.getPackage().getName().endsWith(".dmn")) { + if (actualType != null && actualType.getPackage() != null && actualType.getPackage().getName().endsWith(".dmn")) { deserializeObjectMapper.setConfig(deserializeObjectMapper.getDeserializationConfig().with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)); } return (T) unwrap(deserializeObjectMapper.readValue(serializedInput, actualType)); @@ -454,7 +454,7 @@ public T unmarshall(byte[] serializedInput, Class type) { try { Class actualType = classesSet.contains(type) ? Object.class : type; - if (actualType.getPackage().getName().endsWith(".dmn")) { + if (actualType != null && actualType.getPackage() != null && actualType.getPackage().getName().endsWith(".dmn")) { deserializeObjectMapper.setConfig(deserializeObjectMapper.getDeserializationConfig().with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)); } return (T) unwrap(deserializeObjectMapper.readValue(serializedInput, actualType));