Hi,
I have a unit test written which tests my rules. In my setup, I am loading
my drl and rf files via a changeset into an agent and getting my knowledge
base. The test then sets globals and facts on my stateful session and
execute my ruleflow. I can execute this unit test in JUnit and debug. My drl
and rf files build ok and I can step through my java breakpoints.
However, when I execute the very same Junit test using debug as Drools Junit
Test, I get the following exception when the knowledge agent is building my
drl and rf files in my junit setup.
The only difference between the two scenarios is that I am using the debug
as Drools Unit Test in the exception scenario and plain debug as junit test
in the first. I make no configuration or code changes.
java.lang.ClassCastException: org.drools.workflow.core.node.RuleSetNode
cannot be cast to org.drools.workflow.core.node.StateBasedNode
at
org.drools.process.builder.EventBasedNodeBuilder.build(EventBasedNodeBuilder.java:21)
at org.drools.compiler.ProcessBuilder.processNodes(ProcessBuilder.java:185)
at org.drools.compiler.ProcessBuilder.buildNodes(ProcessBuilder.java:171)
at org.drools.compiler.ProcessBuilder.buildProcess(ProcessBuilder.java:139)
at
org.drools.compiler.ProcessBuilder.addProcessFromFile(ProcessBuilder.java:222)
at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:448)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:504)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:386)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:120)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)
at com.ac.logistics.usps.IQ.UspsIQEngine.<init>(UspsIQEngine.java:21)
at
com.ac.logistics.usps.transformation.UspsRateRequestTransformer.<init>(UspsRateRequestTransformer.java:25)
at
com.ac.logistics.usps.transformation.TestUspsRateRequestTransformer.setUp(TestUspsRateRequestTransformer.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
View this message in context:
http://n3.nabble.com/ClassCastException-when-debugging-as-a-drools-unit-t...
Sent from the Drools - User mailing list archive at
Nabble.com.