final Activation activation = new MockActivation( rule,
0,
rule.getLhs(),
tuple );
DefaultKnowledgeHelper knowledgeHelper = new org.drools.core.base.DefaultKnowledgeHelper( ((StatefulKnowledgeSessionImpl)workingMemory) );
knowledgeHelper.setActivation( activation );
rule.getConsequence().evaluate( knowledgeHelper,
((StatefulKnowledgeSessionImpl)workingMemory) );
assertEquals( new Integer( 1 ),
map.get( "value" ) );
ruleDescr.setConsequence( "map.put(\"value\", new Integer(2) );" );
pkg.removeRule( rule );
// Make sure the compiled classes are also removed
assertEquals( 0,
((JavaDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( "java" )).list().length );
builder.addPackage( packageDescr );
pkg = builder.getPackage();
rule = pkg.getRule( "rule-1" );
knowledgeHelper = new org.drools.core.base.DefaultKnowledgeHelper( ((StatefulKnowledgeSessionImpl)workingMemory) );
knowledgeHelper.setActivation( activation );
rule.getConsequence().evaluate( knowledgeHelper,
((StatefulKnowledgeSessionImpl)workingMemory) );
assertEquals( new Integer( 2 ),
map.get( "value" ) );