[jboss-jira] [JBoss JIRA] (DROOLS-5065) md5Hash results with line endings \r\n on MaterializedLambda tests on Windows
Daniel Rosa (Jira)
issues at jboss.org
Thu Feb 13 07:40:00 EST 2020
Daniel Rosa created DROOLS-5065:
-----------------------------------
Summary: md5Hash results with line endings \r\n on MaterializedLambda tests on Windows
Key: DROOLS-5065
URL: https://issues.redhat.com/browse/DROOLS-5065
Project: Drools
Issue Type: Bug
Affects Versions: 7.33.0.Final
Reporter: Daniel Rosa
Assignee: Mario Fusco
Attachments: materialized_lambda_hash.patch, materialized_lambda_jenkins_output.pdf
Several testes are failing on org.drools.modelcompiler.util.lambdareplace package due the md5Hash function called on className method on classes which extend MatarializedLamda class because Windows consider \r\n as line endings. So the md5Hash results different hashcodes than the expected on assertions. The tests might be changed to have the same behaviour of the operating system, but I believe that the software should take care of this situation.
Failing tests:
* MaterializedLambdaPredicateTest.createClassWithOneParameter
* MaterializedLambdaPredicateTest.createClassWithTwoParameters
* MaterializedLambdaExtractorTest.createExtractor
* MaterializedLambdaConsequenceTest.createConsequence
* ExecModelLambdaPostProcessorTest.convertFlowLambdaDoNotConvertConsequenceWhenDrools
* ExecModelLambdaPostProcessorTest.convertPatternLambda
If the \r is removed when calling md5Hash function, all testes pass. See the attachment [materialized_lambda_hash.patch].
See this output instance on Jenkins (see [materialized_lambda_jenkins_output.pdf] for the full output):
03:39:57 [INFO] Running org.drools.modelcompiler.util.lambdareplace.MaterializedLambdaPredicateTest
03:39:57 [ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.019 s <<< FAILURE! - in org.drools.modelcompiler.util.lambdareplace.MaterializedLambdaPredicateTest
03:39:57 [ERROR] createClassWithOneParameter(org.drools.modelcompiler.util.lambdareplace.MaterializedLambdaPredicateTest) Time elapsed: 0.015 s <<< FAILURE!
03:39:57 java.lang.AssertionError:
03:39:57
03:39:57 Expected: equalToIgnoringWhiteSpace("package org.drools.modelcompiler.util.lambdareplace;\nimport static rulename.*; import org.drools.modelcompiler.dsl.pattern.D; @org.drools.compiler.kie.builder.MaterializedLambda() public enum LambdaPredicateE80C351B847736E5C59FD9AEAA280D96 implements org.drools.model.functions.Predicate1<org.drools.modelcompiler.domain.Person> {\n INSTANCE; \npublic static final String EXPRESSION_HASH = \"4DEB93975D9859892B1A5FD4B38E2155\"; @Override()\n public boolean test(org.drools.modelcompiler.domain.Person p) {\n return p.getAge() > 35;\n }\n }\n")
03:39:57 but: was package org.drools.modelcompiler.util.lambdareplace; import static rulename.*; import org.drools.modelcompiler.dsl.pattern.D; @org.drools.compiler.kie.builder.MaterializedLambda() public enum LambdaPredicate425FBB5FADBC73A980E3A8CE22FB92A0 implements org.drools.model.functions.Predicate1<org.drools.modelcompiler.domain.Person> { INSTANCE; public static final String EXPRESSION_HASH = "4DEB93975D9859892B1A5FD4B38E2155"; @Override() public boolean test(org.drools.modelcompiler.domain.Person p) { return p.getAge() > 35; } }
03:39:57 at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
03:39:57 at org.junit.Assert.assertThat(Assert.java:956)
03:39:57 at org.junit.Assert.assertThat(Assert.java:923)
03:39:57 at org.drools.modelcompiler.util.lambdareplace.MaterializedLambdaPredicateTest.createClassWithOneParameter(MaterializedLambdaPredicateTest.java:34)
03:39:57 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
03:39:57 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
03:39:57 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
03:39:57 at java.lang.reflect.Method.invoke(Method.java:498)
03:39:57 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
03:39:57 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
03:39:57 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
03:39:57 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
03:39:57 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
03:39:57 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
03:39:57 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
03:39:57 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
03:39:57 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
03:39:57 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
03:39:57 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
03:39:57 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
03:39:57 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
03:39:57 at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
03:39:57 at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
03:39:57 at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
03:39:57 at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
03:39:57 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
03:39:57 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
03:39:57 at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
03:39:57 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list