[jboss-jira] [JBoss JIRA] (DROOLS-280) lock-on-active broken

Anthony Patricio (JIRA) jira-events at lists.jboss.org
Tue Oct 29 08:35:02 EDT 2013


    [ https://issues.jboss.org/browse/DROOLS-280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12825481#comment-12825481 ] 

Anthony Patricio commented on DROOLS-280:
-----------------------------------------

Thanks for the workaround, it seems to work.
However, is this considered as the way to use lock-on-active? Or is this just a workaround?
I didn't manage to find documentation on @Eager, what is it supposed to do?

Thanks.

                
> lock-on-active broken
> ---------------------
>
>                 Key: DROOLS-280
>                 URL: https://issues.jboss.org/browse/DROOLS-280
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions:  6.0.0.CR4
>            Reporter: Anthony Patricio
>
> Hi,
> lock-on-active is not working as expected.
> I seems to work as activation-group.
> Works fine with 5.x
> Fails with 6.0.0 CR3 and CR4
> Fact:
> {code:java}
> public class Poc implements Serializable {
> 	private static final long serialVersionUID = 1L;
> 	private long id = 1;
> 	private boolean test1 = false;
> 	private boolean test2 = false;
> 	private int foundTest = 0;
> ...
> }
> {code}
> Rule:
> {code:java}
> rule "test1"
> lock-on-active 
> dialect "mvel"
>     when
>     	$poc:Poc( isTest1() )
>     then
>     	System.out.println("test1 found");
>     	modify($poc) { setFoundTest($poc.getFoundTest() + 1) }    	
> end
> rule "test2"
> lock-on-active 
> dialect "mvel"
>     when
>     	$poc:Poc( isTest2() )
>     then
>     	System.out.println("test2 found");
>     	modify($poc) { setFoundTest($poc.getFoundTest() + 1) }    	
> end
> {code}
> Test:
> {code:java}
> @Test
> public void lockOnActiveTest() {
> 	// Get the Knowledge base from the DRL file 
> 	KieSession kSession = getSF();
> 			
> 	Poc poc = new Poc();
> 	poc.setTest1(true);
> 	poc.setTest2(true);
> 	
> 	kSession.insert(poc);
> 	
> 	// Fire the rules
> 	kSession.fireAllRules();
> 	
> 	assertTrue("broken",poc.getFoundTest()==2);
> 	
> 	// Clean up
> 	kSession.dispose();
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list