Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Kie API refactor

  • Loading branch information...
commit 66b81a1c9c22b7320c0add2e6782ed6a02fac2f9 1 parent f417abf
@mariofusco mariofusco authored
Showing with 192 additions and 1,144 deletions.
  1. +19 −19 drools-compiler/src/test/java/org/drools/factmodel/traits/TraitTest.java
  2. +7 −7 drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java
  3. +15 −15 drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
  4. +4 −4 drools-compiler/src/test/java/org/drools/integrationtests/DeclarativeAgendaTest.java
  5. +14 −14 drools-compiler/src/test/java/org/drools/integrationtests/DynamicRulesTest.java
  6. +15 −15 drools-compiler/src/test/java/org/drools/integrationtests/ExtendsTest.java
  7. +2 −2 drools-compiler/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java
  8. +18 −17 drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
  9. +4 −4 drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java
  10. +1 −1  drools-compiler/src/test/java/org/drools/integrationtests/MultithreadTest.java
  11. +6 −6 drools-compiler/src/test/java/org/drools/integrationtests/PseudoClockEventsTest.java
  12. +1 −1  drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java
  13. +6 −6 drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java
  14. +5 −5 drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
  15. +9 −9 drools-compiler/src/test/java/org/drools/integrationtests/marshalling/MarshallingTest.java
  16. +6 −6 drools-compiler/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java
  17. +1 −1  drools-compiler/src/test/java/org/drools/lang/api/DescrBuilderTest.java
  18. +3 −3 drools-compiler/src/test/java/org/kie/builder/WireListenerTest.java
  19. +1 −1  drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
  20. +1 −1  drools-core/src/main/java/org/drools/command/impl/CommandBasedStatefulKnowledgeSession.java
  21. +1 −2  drools-core/src/main/java/org/drools/command/runtime/GetKnowledgeBaseCommand.java
  22. +1 −1  drools-core/src/main/java/org/drools/common/ActivationIterator.java
  23. +4 −4 ...src/main/java/org/drools/event/rule/impl/{ObjectRetractedEventImpl.java → ObjectDeletedEventImpl.java}
  24. +1 −1  drools-core/src/main/java/org/drools/impl/KnowledgeBaseImpl.java
  25. +12 −12 drools-core/src/main/java/org/drools/impl/StatefulKnowledgeSessionImpl.java
  26. +1 −1  drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java
  27. +3 −5 drools-core/src/test/java/org/drools/event/WorkingMemoryEventSupportTest.java
  28. +4 −4 drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java
  29. +4 −11 drools-core/src/test/java/org/drools/event/rule/WorkingMemoryEventSupportTest.java
  30. +7 −7 drools-core/src/test/java/org/drools/examples/manners/ReteooMannersTest.java
  31. +1 −2  drools-core/src/test/java/org/drools/reteoo/ReteDumper.java
  32. +2 −2 drools-docs/drools-expert-docs/src/main/docbook/en-US/Chapter-ApiReference/Section-Running.xml
  33. +4 −16 drools-examples/src/main/java/org/drools/examples/DroolsExamplesApp.java
  34. +0 −41 drools-examples/src/main/java/org/drools/examples/pacman/Cell.java
  35. +0 −45 drools-examples/src/main/java/org/drools/examples/pacman/CellContents.java
  36. +0 −24 drools-examples/src/main/java/org/drools/examples/pacman/CellType.java
  37. +0 −44 drools-examples/src/main/java/org/drools/examples/pacman/Character.java
  38. +0 −114 drools-examples/src/main/java/org/drools/examples/pacman/Direction.java
  39. +0 −69 drools-examples/src/main/java/org/drools/examples/pacman/DirectionDiff.java
  40. +0 −21 drools-examples/src/main/java/org/drools/examples/pacman/DirectionEnum.java
  41. +0 −56 drools-examples/src/main/java/org/drools/examples/pacman/Location.java
  42. +0 −23 drools-examples/src/main/java/org/drools/examples/pacman/Monster.java
  43. +0 −23 drools-examples/src/main/java/org/drools/examples/pacman/PacMan.java
  44. +0 −183 drools-examples/src/main/java/org/drools/examples/pacman/PacmanExample.java
  45. +0 −146 drools-examples/src/main/java/org/drools/examples/pacman/PacmanGui.java
  46. +0 −74 drools-examples/src/main/java/org/drools/examples/pacman/ScheduledLocationUpdate.java
  47. +0 −31 drools-examples/src/main/java/org/drools/examples/pacman/Score.java
  48. +0 −34 drools-examples/src/main/java/org/drools/examples/pacman/Tick.java
  49. +2 −2 drools-examples/src/main/java/org/drools/examples/sudoku/Sudoku.java
  50. +4 −4 drools-examples/src/main/java/org/drools/games/pong/PongMain.java
  51. +1 −1  drools-persistence-jpa/src/main/java/org/drools/persistence/SessionMarshallingHelper.java
  52. +1 −3 drools-persistence-jpa/src/main/java/org/drools/persistence/jpa/processinstance/JPAWorkItemManager.java
  53. +1 −1  drools-persistence-jpa/src/test/java/org/drools/persistence/jta/TransactionTestCommand.java
View
38 drools-compiler/src/test/java/org/drools/factmodel/traits/TraitTest.java
@@ -214,7 +214,7 @@ public void traitShed( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitShed.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
@@ -271,7 +271,7 @@ public void traitDon( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitDon.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -307,7 +307,7 @@ public void mixin( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitMixin.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -339,7 +339,7 @@ public void traitMethodsWithObjects( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitWrapping.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List errors = new ArrayList();
ks.setGlobal( "list",
@@ -373,7 +373,7 @@ public void traitMethodsWithPrimitives( TraitFactory.VirtualPropertyMode mode )
String source = "org/drools/factmodel/traits/testTraitWrappingPrimitives.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List errors = new ArrayList();
ks.setGlobal( "list",
@@ -1125,7 +1125,7 @@ public void isA( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitIsA.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -1166,7 +1166,7 @@ public void overrideType( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitOverride.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -1202,7 +1202,7 @@ public void traitLegacy( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitLegacyTrait.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
@@ -1250,7 +1250,7 @@ public void traitCollections( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitCollections.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
@@ -1294,7 +1294,7 @@ public void traitCore( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitLegacyCore.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -1338,7 +1338,7 @@ public void traitWithEquality( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitWithEquality.drl";
StatefulKnowledgeSession ks = getSession( source );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
List info = new ArrayList();
ks.setGlobal( "list",
@@ -1373,7 +1373,7 @@ public void traitDeclared( TraitFactory.VirtualPropertyMode mode ) {
List<Integer> untrueTraits = new ArrayList<Integer>();
StatefulKnowledgeSession ks = getSession( "org/drools/factmodel/traits/testDeclaredFactTrait.drl" );
- TraitFactory.setMode( mode, ks.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ks.getKieBase() );
ks.setGlobal( "trueTraits",
trueTraits );
@@ -1411,7 +1411,7 @@ public void traitPojo( TraitFactory.VirtualPropertyMode mode ) {
List<Integer> untrueTraits = new ArrayList<Integer>();
StatefulKnowledgeSession session = getSession( "org/drools/factmodel/traits/testPojoFactTrait.drl" );
- TraitFactory.setMode( mode, session.getKnowledgeBase() );
+ TraitFactory.setMode( mode, session.getKieBase() );
session.setGlobal( "trueTraits",
trueTraits );
@@ -1446,7 +1446,7 @@ public void testPojoMap() {
public void isAOperator( TraitFactory.VirtualPropertyMode mode ) {
String source = "org/drools/factmodel/traits/testTraitIsA2.drl";
StatefulKnowledgeSession ksession = getSession( source );
- TraitFactory.setMode( mode, ksession.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ksession.getKieBase() );
AgendaEventListener ael = mock( AgendaEventListener.class );
@@ -1459,7 +1459,7 @@ public void isAOperator( TraitFactory.VirtualPropertyMode mode ) {
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
verify( ael,
- times( 3 ) ).afterActivationFired( cap.capture() );
+ times( 3 ) ).afterMatchFired(cap.capture());
List<AfterMatchFiredEvent> values = cap.getAllValues();
@@ -1529,7 +1529,7 @@ protected void manyTraits( TraitFactory.VirtualPropertyMode mode ) {
" list.add(\"OK\");\n" +
" end";
StatefulKnowledgeSession ksession = getSessionFromString( source );
- TraitFactory.setMode( mode, ksession.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ksession.getKieBase() );
List list = new ArrayList();
@@ -1564,7 +1564,7 @@ public void testManyTraitsMap() {
public void traitManyTimes( TraitFactory.VirtualPropertyMode mode ) {
StatefulKnowledgeSession ksession = getSession( "org/drools/factmodel/traits/testTraitDonMultiple.drl" );
- TraitFactory.setMode( mode, ksession.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ksession.getKieBase() );
List list = new ArrayList();
@@ -1806,7 +1806,7 @@ public void aliasing( TraitFactory.VirtualPropertyMode mode ) {
"end";
StatefulKnowledgeSession ksession = getSessionFromString( drl );
- TraitFactory.setMode( mode, ksession.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ksession.getKieBase() );
List list = new ArrayList();
ksession.setGlobal( "list", list );
@@ -1881,7 +1881,7 @@ public void traitLogicalRemoval( TraitFactory.VirtualPropertyMode mode ) {
StatefulKnowledgeSession ksession = getSessionFromString(drl);
- TraitFactory.setMode( mode, ksession.getKnowledgeBase() );
+ TraitFactory.setMode( mode, ksession.getKieBase() );
List list = new ArrayList();
ksession.setGlobal( "list", list );
View
14 drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java
@@ -1578,7 +1578,7 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
ksession.fireAllRules();
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
Match activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
@@ -1596,7 +1596,7 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
cheese[index] );
ksession.fireAllRules();
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
@@ -1613,7 +1613,7 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
bob );
ksession.fireAllRules();
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
@@ -1628,7 +1628,7 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
ksession.retract( cheeseHandles[3] );
ksession.fireAllRules();
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
@@ -1671,7 +1671,7 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
ksession.fireAllRules();
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
Match activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
@@ -1689,7 +1689,7 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
cheese[index] );
ksession.fireAllRules();
- Mockito.verify( ael, Mockito.never() ).afterActivationFired( Mockito.any(AfterMatchFiredEvent.class) );
+ Mockito.verify( ael, Mockito.never() ).afterMatchFired(Mockito.any(AfterMatchFiredEvent.class));
Mockito.reset( ael );
// ---------------- 3rd scenario
@@ -1698,7 +1698,7 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
bob );
ksession.fireAllRules();
- Mockito.verify( ael ).afterActivationFired( cap.capture() );
+ Mockito.verify( ael ).afterMatchFired(cap.capture());
activation = cap.getValue().getMatch();
assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
View
30 drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
@@ -741,13 +741,13 @@ public void testBeforeOperator() throws Exception {
ksession.insert( tick8 );
ArgumentCaptor<MatchCreatedEvent> arg = ArgumentCaptor.forClass( MatchCreatedEvent.class );
- verify( ael ).activationCreated( arg.capture() );
+ verify( ael ).matchCreated(arg.capture());
assertThat( arg.getValue().getMatch().getRule().getName(),
is( "before" ) );
ksession.fireAllRules();
- verify( ael ).afterActivationFired( any( AfterMatchFiredEvent.class ) );
+ verify( ael ).afterMatchFired(any(AfterMatchFiredEvent.class));
}
@Test
@@ -828,7 +828,7 @@ public void testMetByOperator() throws Exception {
ksession.insert( tick8 );
ArgumentCaptor<MatchCreatedEvent> arg = ArgumentCaptor.forClass( MatchCreatedEvent.class );
- verify( ael ).activationCreated( arg.capture() );
+ verify( ael ).matchCreated(arg.capture());
Match activation = arg.getValue().getMatch();
assertThat( activation.getRule().getName(),
is( "metby" ) );
@@ -836,7 +836,7 @@ public void testMetByOperator() throws Exception {
ksession.fireAllRules();
ArgumentCaptor<AfterMatchFiredEvent> aaf = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( aaf.capture() );
+ verify( ael ).afterMatchFired(aaf.capture());
assertThat( (InternalFactHandle) aaf.getValue().getMatch().getFactHandles().toArray()[0],
is( fh2 ) );
}
@@ -1756,7 +1756,7 @@ public void testStreamModeNoSerialization() throws IOException,
ArgumentCaptor<AfterMatchFiredEvent> aafe1 = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
verify( ael1,
- times( 1 ) ).afterActivationFired( aafe1.capture() );
+ times( 1 ) ).afterMatchFired(aafe1.capture());
List<AfterMatchFiredEvent> events1 = aafe1.getAllValues();
assertThat( events1.get( 0 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 10 ) );
@@ -1765,14 +1765,14 @@ public void testStreamModeNoSerialization() throws IOException,
20 ) );
ksession1.fireAllRules();
verify( ael1,
- times( 2 ) ).afterActivationFired( aafe1.capture() );
+ times( 2 ) ).afterMatchFired(aafe1.capture());
assertThat( events1.get( 1 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 15 ) );
ksession1.insert( new Sensor( 30,
30 ) );
ksession1.fireAllRules();
verify( ael1,
- times( 3 ) ).afterActivationFired( aafe1.capture() );
+ times( 3 ) ).afterMatchFired(aafe1.capture());
assertThat( events1.get( 2 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 25 ) );
@@ -1787,7 +1787,7 @@ public void testStreamModeNoSerialization() throws IOException,
10 ) );
ksession2.fireAllRules();
verify( ael2,
- times( 1 ) ).afterActivationFired( aafe2.capture() );
+ times( 1 ) ).afterMatchFired(aafe2.capture());
List<AfterMatchFiredEvent> events2 = aafe2.getAllValues();
assertThat( events2.get( 0 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 10 ) );
@@ -1796,7 +1796,7 @@ public void testStreamModeNoSerialization() throws IOException,
20 ) );
ksession2.fireAllRules();
verify( ael2,
- times( 2 ) ).afterActivationFired( aafe2.capture() );
+ times( 2 ) ).afterMatchFired(aafe2.capture());
assertThat( events2.get( 1 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 15 ) );
@@ -1804,7 +1804,7 @@ public void testStreamModeNoSerialization() throws IOException,
30 ) );
ksession2.fireAllRules();
verify( ael2,
- times( 3 ) ).afterActivationFired( aafe2.capture() );
+ times( 3 ) ).afterMatchFired(aafe2.capture());
assertThat( events2.get( 2 ).getMatch().getDeclarationValue( "$avg" ),
is( (Object) 25 ) );
ksession2.dispose();
@@ -1853,7 +1853,7 @@ public void testIdentityAssertBehaviorOnEntryPoints() throws IOException,
ksession.fireAllRules();
// must have fired 3 times, one for each event identity
verify( ael1,
- times( 3 ) ).afterActivationFired( any( AfterMatchFiredEvent.class ) );
+ times( 3 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
ksession.dispose();
}
@@ -1899,7 +1899,7 @@ public void testEqualityAssertBehaviorOnEntryPoints() throws IOException,
ksession1.fireAllRules();
// must have fired 2 times, one for each event equality
verify( ael1,
- times( 2 ) ).afterActivationFired( any( AfterMatchFiredEvent.class ) );
+ times( 2 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
ksession1.dispose();
}
@@ -2082,7 +2082,7 @@ public void testMultipleSlidingWindows() throws IOException,
ArgumentCaptor<AfterMatchFiredEvent> captor = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
verify( ael,
- times( 7 ) ).afterActivationFired( captor.capture() );
+ times( 7 ) ).afterMatchFired(captor.capture());
List<AfterMatchFiredEvent> values = captor.getAllValues();
// first rule
@@ -2282,7 +2282,7 @@ public void testSalienceWithEventsPseudoClock() throws IOException,
ArgumentCaptor<AfterMatchFiredEvent> captor = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
verify( ael,
- times( 4 ) ).afterActivationFired( captor.capture() );
+ times( 4 ) ).afterMatchFired(captor.capture());
List<AfterMatchFiredEvent> aafe = captor.getAllValues();
Assert.assertThat( aafe.get( 0 ).getMatch().getRule().getName(),
@@ -2357,7 +2357,7 @@ public void testSalienceWithEventsRealtimeClock() throws IOException,
ArgumentCaptor<AfterMatchFiredEvent> captor = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
verify( ael,
- times( 4 ) ).afterActivationFired( captor.capture() );
+ times( 4 ) ).afterMatchFired(captor.capture());
List<AfterMatchFiredEvent> aafe = captor.getAllValues();
Assert.assertThat( aafe.get( 0 ).getMatch().getRule().getName(),
View
8 drools-compiler/src/test/java/org/drools/integrationtests/DeclarativeAgendaTest.java
@@ -642,7 +642,7 @@ public void testCancelActivation() {
ksession.addEventListener( new AgendaEventListener() {
- public void beforeActivationFired(BeforeMatchFiredEvent event) {
+ public void beforeMatchFired(BeforeMatchFiredEvent event) {
}
public void agendaGroupPushed(AgendaGroupPushedEvent event) {
@@ -651,10 +651,10 @@ public void agendaGroupPushed(AgendaGroupPushedEvent event) {
public void agendaGroupPopped(AgendaGroupPoppedEvent event) {
}
- public void afterActivationFired(AfterMatchFiredEvent event) {
+ public void afterMatchFired(AfterMatchFiredEvent event) {
}
- public void activationCreated(MatchCreatedEvent event) {
+ public void matchCreated(MatchCreatedEvent event) {
}
public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) {
@@ -669,7 +669,7 @@ public void beforeRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event)
public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event) {
}
- public void activationCancelled(MatchCancelledEvent event) {
+ public void matchCancelled(MatchCancelledEvent event) {
cancelled.add( event );
}
} );
View
28 drools-compiler/src/test/java/org/drools/integrationtests/DynamicRulesTest.java
@@ -199,27 +199,27 @@ public void testDynamicRuleRemovals() throws Exception {
5 );
workingMemory.insert( cheddar );
- verify( ael, times( 15 ) ).activationCreated( any( MatchCreatedEvent.class ) );
- verify( ael, never() ).activationCancelled( any( MatchCancelledEvent.class ) );
+ verify( ael, times( 15 ) ).matchCreated(any(MatchCreatedEvent.class));
+ verify( ael, never() ).matchCancelled(any(MatchCancelledEvent.class));
kbase.removeRule( "org.drools.test",
"Who likes Stilton" );
- verify( ael, times( 3 ) ).activationCancelled( any( MatchCancelledEvent.class ) );
+ verify( ael, times( 3 ) ).matchCancelled(any(MatchCancelledEvent.class));
kbase.removeRule( "org.drools.test",
"like cheese" );
- verify( ael, times( 7 ) ).activationCancelled( any( MatchCancelledEvent.class ) );
+ verify( ael, times( 7 ) ).matchCancelled(any(MatchCancelledEvent.class));
final Cheese muzzarela = new Cheese( "muzzarela",
5 );
workingMemory.insert( muzzarela );
- verify( ael, times( 16 ) ).activationCreated( any( MatchCreatedEvent.class ) );
+ verify( ael, times( 16 ) ).matchCreated(any(MatchCreatedEvent.class));
kbase.removeKnowledgePackage( "org.drools.test" );
- verify( ael, times( 16 ) ).activationCancelled( any( MatchCancelledEvent.class ) );
+ verify( ael, times( 16 ) ).matchCancelled(any(MatchCancelledEvent.class));
kbase = SerializationHelper.serializeObject( kbase );
}
@@ -334,7 +334,7 @@ public void testRemovePackage() throws Exception {
"genericvalue" ) );
session.fireAllRules();
- KnowledgeBase ruleBaseWM = session.getKnowledgeBase();
+ KnowledgeBase ruleBaseWM = session.getKieBase();
ruleBaseWM.removeKnowledgePackage( packageName );
kpkgs = SerializationHelper.serializeObject( loadKnowledgePackages( "test_RemovePackage.drl" ) );
@@ -834,7 +834,7 @@ public void testRemovePackageSubNetwork() throws Exception {
((List) results.get( 0 )).size() );
results.clear();
- KnowledgeBase ruleBaseWM = workingMemory.getKnowledgeBase();
+ KnowledgeBase ruleBaseWM = workingMemory.getKieBase();
ruleBaseWM.removeKnowledgePackage( packageName );
Collection<KnowledgePackage> kpkgs = loadKnowledgePackages( "test_DynamicRulesWithSubnetwork.drl" );
@@ -1053,17 +1053,17 @@ public void testDynamicRuleRemovalsSubNetworkAndNot() throws Exception {
// pattern does not match, so do not activate
ksession.insert( new Person( "toni" ) );
verify( alistener,
- never() ).activationCreated( any( org.kie.event.rule.MatchCreatedEvent.class ) );
+ never() ).matchCreated(any(org.kie.event.rule.MatchCreatedEvent.class));
// pattern matches, so create activation
ksession.insert( new Person( "bob" ) );
verify( alistener,
- times( 1 ) ).activationCreated( any( org.kie.event.rule.MatchCreatedEvent.class ) );
+ times( 1 ) ).matchCreated(any(org.kie.event.rule.MatchCreatedEvent.class));
// already active, so no new activation should be created
ksession.insert( new Person( "mark" ) );
verify( alistener,
- times( 1 ) ).activationCreated( any( org.kie.event.rule.MatchCreatedEvent.class ) );
+ times( 1 ) ).matchCreated(any(org.kie.event.rule.MatchCreatedEvent.class));
kbase.removeKnowledgePackage( "org.drools" );
@@ -1080,7 +1080,7 @@ public void testDynamicRuleRemovalsSubNetworkAndNot() throws Exception {
// rule should be reactivated, since data is still in the session
verify( alistener,
- times( 2 ) ).activationCreated( any( org.kie.event.rule.MatchCreatedEvent.class ) );
+ times( 2 ) ).matchCreated(any(org.kie.event.rule.MatchCreatedEvent.class));
}
@@ -1142,7 +1142,7 @@ public void testJBRULES_2206() {
addDrlToKBase( kbase, "test_JBRULES_2206_1.drl" );
// two matching rules were added, so 2 activations should have been created
- verify( ael, times( 2 ) ).activationCreated( any( MatchCreatedEvent.class ) );
+ verify( ael, times( 2 ) ).matchCreated(any(MatchCreatedEvent.class));
int fireCount = session.fireAllRules();
// both should have fired
assertEquals( 2, fireCount );
@@ -1150,7 +1150,7 @@ public void testJBRULES_2206() {
addDrlToKBase( kbase, "test_JBRULES_2206_2.drl" );
// one rule was overridden and should activate
- verify( ael, times( 3 ) ).activationCreated( any( MatchCreatedEvent.class ) );
+ verify( ael, times( 3 ) ).matchCreated(any(MatchCreatedEvent.class));
fireCount = session.fireAllRules();
// that rule should fire again
assertEquals( 1, fireCount );
View
30 drools-compiler/src/test/java/org/drools/integrationtests/ExtendsTest.java
@@ -79,8 +79,8 @@ public void testExtends() throws Exception {
//Test Base Fact Type
StatefulKnowledgeSession ksession = genSession("test_Extends.drl");
- FactType person = ksession.getKnowledgeBase().getFactType("defaultpkg","Person");
- FactType eqPair = ksession.getKnowledgeBase().getFactType("defaultpkg","EqualityPair");
+ FactType person = ksession.getKieBase().getFactType("defaultpkg","Person");
+ FactType eqPair = ksession.getKieBase().getFactType("defaultpkg","EqualityPair");
Object p = person.newInstance();
assertNotNull(p);
@@ -100,7 +100,7 @@ public void testExtends() throws Exception {
public void testGeneratedMethods() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_Extends.drl");
- FactType student = ksession.getKnowledgeBase().getFactType("defaultpkg","Student");
+ FactType student = ksession.getKieBase().getFactType("defaultpkg","Student");
Constructor constructor = student.getFactClass().getConstructor(String.class,int.class,String.class);
assertNotNull(constructor);
@@ -146,7 +146,7 @@ public void testGeneratedMethods() throws Exception {
@Test
public void testDeepExt() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_Extends.drl");
- FactType LTstudent = ksession.getKnowledgeBase().getFactType("defaultpkg","LongTermStudent");
+ FactType LTstudent = ksession.getKieBase().getFactType("defaultpkg","LongTermStudent");
Constructor constructor = LTstudent.getFactClass().getConstructor(String.class,int.class,String.class,String.class,int.class);
assertNotNull(constructor);
@@ -172,7 +172,7 @@ public void testIllegalExtendsLegacy() throws Exception {
public void testExtendsLegacy() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_ExtLegacy.drl",0);
- FactType leg = ksession.getKnowledgeBase().getFactType("org.drools","BetterLegacy");
+ FactType leg = ksession.getKieBase().getFactType("org.drools","BetterLegacy");
assertNotNull(leg);
Object b = leg.newInstance();
@@ -195,15 +195,15 @@ public void testExtendsLegacy() throws Exception {
public void testExtendsAcrossFiles() throws Exception {
StatefulKnowledgeSession ksession = genSession(new String[] {"test_Ext1.drl","test_Ext2.drl","test_Ext3.drl","test_Ext4.drl"} ,0);
- FactType person = ksession.getKnowledgeBase().getFactType("org.drools.compiler.test","Person");
+ FactType person = ksession.getKieBase().getFactType("org.drools.compiler.test","Person");
assertNotNull(person);
- FactType student = ksession.getKnowledgeBase().getFactType("org.drools.compiler.test","Student");
+ FactType student = ksession.getKieBase().getFactType("org.drools.compiler.test","Student");
assertNotNull(student);
- FactType worker = ksession.getKnowledgeBase().getFactType("org.drools.compiler.anothertest","Worker");
+ FactType worker = ksession.getKieBase().getFactType("org.drools.compiler.anothertest","Worker");
assertNotNull(worker);
- FactType ltss = ksession.getKnowledgeBase().getFactType("defaultpkg","SubLTStudent");
+ FactType ltss = ksession.getKieBase().getFactType("defaultpkg","SubLTStudent");
assertNotNull(ltss);
Constructor ctor = worker.getFactClass().getConstructor(String.class,int.class,String.class, double.class, int.class);
@@ -222,7 +222,7 @@ public void testExtendsAcrossFiles() throws Exception {
public void testFieldInit() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_ExtFieldInit.drl");
- FactType test = ksession.getKnowledgeBase().getFactType("org.drools.compiler", "MyBean3");
+ FactType test = ksession.getKieBase().getFactType("org.drools.compiler", "MyBean3");
Object x = test.newInstance();
assertNotNull(x);
@@ -251,7 +251,7 @@ public void testFieldInit() throws Exception {
public void testBoxedFieldInit() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_ExtFieldInit.drl");
- FactType test = ksession.getKnowledgeBase().getFactType("org.drools.compiler","MyBoxBean");
+ FactType test = ksession.getKieBase().getFactType("org.drools.compiler","MyBoxBean");
Object x = test.newInstance();
assertNotNull(x);
@@ -275,7 +275,7 @@ public void testBoxedFieldInit() throws Exception {
public void testExpressionFieldInit() throws Exception {
StatefulKnowledgeSession ksession = genSession("test_ExtFieldInit.drl");
- FactType test = ksession.getKnowledgeBase().getFactType("org.drools.compiler","MyBoxExpressionBean");
+ FactType test = ksession.getKieBase().getFactType("org.drools.compiler","MyBoxExpressionBean");
Object x = test.newInstance();
assertNotNull(x);
@@ -296,7 +296,7 @@ public void testExpressionFieldInit() throws Exception {
- FactType test2 = ksession.getKnowledgeBase().getFactType("org.drools.compiler","MySimpleExpressionBean");
+ FactType test2 = ksession.getKieBase().getFactType("org.drools.compiler","MySimpleExpressionBean");
x = test2.newInstance();
assertNotNull(x);
@@ -396,8 +396,8 @@ public void testRedefineDefaults() throws Exception {
//Test Base Fact Type
StatefulKnowledgeSession ksession = genSession("test_Extends.drl");
- FactType person = ksession.getKnowledgeBase().getFactType("defaultpkg","Person");
- FactType student = ksession.getKnowledgeBase().getFactType("defaultpkg","Student");
+ FactType person = ksession.getKieBase().getFactType("defaultpkg","Person");
+ FactType student = ksession.getKieBase().getFactType("defaultpkg","Student");
Object p = person.newInstance();
Object s = student.newInstance();
View
4 drools-compiler/src/test/java/org/drools/integrationtests/FirstOrderLogicTest.java
@@ -1029,7 +1029,7 @@ public void testOrWithVariableResolution() throws Exception {
ksession.fireAllRules();
verify( al,
- times( 6 ) ).afterActivationFired( any( AfterMatchFiredEvent.class ) );
+ times( 6 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
}
// JBRULES-2526
@@ -1057,7 +1057,7 @@ public void testOrWithVariableResolution2() throws Exception {
ksession.fireAllRules();
verify( al,
- times( 8 ) ).afterActivationFired( any( AfterMatchFiredEvent.class ) );
+ times( 8 ) ).afterMatchFired(any(AfterMatchFiredEvent.class));
}
@Test
View
35 drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
@@ -144,6 +144,7 @@
import org.kie.definition.KnowledgePackage;
import org.kie.definition.rule.Rule;
import org.kie.definition.type.FactType;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.io.ResourceFactory;
import org.kie.io.ResourceType;
import org.kie.marshalling.ObjectMarshallingStrategy;
@@ -3110,8 +3111,8 @@ public void testEventModel() throws Exception {
ouc.getValue().getFactHandle() );
wm.retract( stiltonHandle );
- ArgumentCaptor<org.kie.event.rule.ObjectRetractedEvent> orc = ArgumentCaptor.forClass( org.kie.event.rule.ObjectRetractedEvent.class );
- verify( wmel ).objectRetracted( orc.capture() );
+ ArgumentCaptor<ObjectDeletedEvent> orc = ArgumentCaptor.forClass( ObjectDeletedEvent.class );
+ verify( wmel ).objectDeleted(orc.capture());
assertSame( stiltonHandle,
orc.getValue().getFactHandle() );
@@ -3821,7 +3822,7 @@ public void testMapNullConstraint() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> arg = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
verify( ael,
- times( 4 ) ).afterActivationFired( arg.capture() );
+ times( 4 ) ).afterMatchFired(arg.capture());
org.kie.event.rule.AfterMatchFiredEvent aaf = arg.getAllValues().get( 0 );
assertThat( aaf.getMatch().getRule().getName(),
is( "1. home != null" ) );
@@ -6595,10 +6596,10 @@ public void testMVELConsequenceWithoutSemiColon1() throws Exception {
fired );
// capture the arguments and check that the retracts happened
- ArgumentCaptor<org.kie.event.rule.ObjectRetractedEvent> retracts = ArgumentCaptor.forClass( org.kie.event.rule.ObjectRetractedEvent.class );
+ ArgumentCaptor<ObjectDeletedEvent> retracts = ArgumentCaptor.forClass( ObjectDeletedEvent.class );
verify( wml,
- times( 2 ) ).objectRetracted( retracts.capture() );
- List<org.kie.event.rule.ObjectRetractedEvent> values = retracts.getAllValues();
+ times( 2 ) ).objectDeleted(retracts.capture());
+ List<ObjectDeletedEvent> values = retracts.getAllValues();
assertThat( values.get( 0 ).getFactHandle(),
is( personFH ) );
assertThat( values.get( 1 ).getFactHandle(),
@@ -6702,7 +6703,7 @@ public void testRuleChainingWithLogicalInserts() throws Exception {
// capture the arguments and check that the rules fired in the proper sequence
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> actvs = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
verify( ael,
- times( 3 ) ).afterActivationFired( actvs.capture() );
+ times( 3 ) ).afterMatchFired(actvs.capture());
List<org.kie.event.rule.AfterMatchFiredEvent> values = actvs.getAllValues();
assertThat( values.get( 0 ).getMatch().getRule().getName(),
is( "init" ) );
@@ -6712,11 +6713,11 @@ public void testRuleChainingWithLogicalInserts() throws Exception {
is( "r2" ) );
verify( ael,
- never() ).activationCancelled( any( org.kie.event.rule.MatchCancelledEvent.class ) );
+ never() ).matchCancelled(any(org.kie.event.rule.MatchCancelledEvent.class));
verify( wml,
times( 2 ) ).objectInserted( any( org.kie.event.rule.ObjectInsertedEvent.class ) );
verify( wml,
- never() ).objectRetracted( any( org.kie.event.rule.ObjectRetractedEvent.class ) );
+ never() ).objectDeleted(any(ObjectDeletedEvent.class));
}
@Test
@@ -7337,7 +7338,7 @@ public void testAgendaFilter1() {
rules );
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> arg = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( arg.capture() );
+ verify( ael ).afterMatchFired(arg.capture());
assertThat( arg.getValue().getMatch().getRule().getName(),
is( "Bbb" ) );
}
@@ -7361,7 +7362,7 @@ public void testAgendaFilter2() {
rules );
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> arg = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( arg.capture() );
+ verify( ael ).afterMatchFired(arg.capture());
assertThat( arg.getValue().getMatch().getRule().getName(),
is( "Aaa" ) );
}
@@ -7385,7 +7386,7 @@ public void testAgendaFilter3() {
rules );
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> arg = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( arg.capture() );
+ verify( ael ).afterMatchFired(arg.capture());
assertThat( arg.getValue().getMatch().getRule().getName(),
is( "Bbb" ) );
}
@@ -7409,7 +7410,7 @@ public void testAgendaFilter4() {
rules );
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> arg = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( arg.capture() );
+ verify( ael ).afterMatchFired(arg.capture());
assertThat( arg.getValue().getMatch().getRule().getName(),
is( "Aaa" ) );
}
@@ -7758,7 +7759,7 @@ public void testJBRULES3111() {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
verify( ael,
- times( 2 ) ).afterActivationFired( captor.capture() );
+ times( 2 ) ).afterMatchFired(captor.capture());
List<org.kie.event.rule.AfterMatchFiredEvent> aafe = captor.getAllValues();
Assert.assertThat( aafe.get( 0 ).getMatch().getRule().getName(),
@@ -8127,7 +8128,7 @@ public void testNestedAccessors2() throws Exception {
ksession.fireAllRules();
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass( org.kie.event.rule.AfterMatchFiredEvent.class );
- verify( ael, times( 2 ) ).afterActivationFired( captor.capture() );
+ verify( ael, times( 2 ) ).afterMatchFired(captor.capture());
List<org.kie.event.rule.AfterMatchFiredEvent> values = captor.getAllValues();
assertThat( (Cheesery) values.get( 0 ).getMatch().getObjects().get( 0 ), is( c1 ) );
@@ -10043,9 +10044,9 @@ public void noDormantCheckOnModifies() throws Exception {
ksession.fireAllRules();
// both rules should fire exactly once
- verify( ael, times( 2 ) ).afterActivationFired( any( org.kie.event.rule.AfterMatchFiredEvent.class ) );
+ verify( ael, times( 2 ) ).afterMatchFired(any(org.kie.event.rule.AfterMatchFiredEvent.class));
// no cancellations should have happened
- verify( ael, never() ).activationCancelled( any( org.kie.event.rule.MatchCancelledEvent.class ) );
+ verify( ael, never() ).matchCancelled(any(org.kie.event.rule.MatchCancelledEvent.class));
}
@Test
View
8 drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java
@@ -274,16 +274,16 @@ public void testReuseAgendaAfterException() throws Exception {
ksession.setGlobal( "results", res );
AgendaEventListener agendaEventListener = new AgendaEventListener() {
- public void activationCreated(org.kie.event.rule.MatchCreatedEvent event) {
+ public void matchCreated(org.kie.event.rule.MatchCreatedEvent event) {
}
- public void activationCancelled(org.kie.event.rule.MatchCancelledEvent event) {
+ public void matchCancelled(org.kie.event.rule.MatchCancelledEvent event) {
}
- public void beforeActivationFired(org.kie.event.rule.BeforeMatchFiredEvent event) {
+ public void beforeMatchFired(org.kie.event.rule.BeforeMatchFiredEvent event) {
}
- public void afterActivationFired(org.kie.event.rule.AfterMatchFiredEvent event) {
+ public void afterMatchFired(org.kie.event.rule.AfterMatchFiredEvent event) {
}
public void agendaGroupPopped(org.kie.event.rule.AgendaGroupPoppedEvent event) {
View
2  drools-compiler/src/test/java/org/drools/integrationtests/MultithreadTest.java
@@ -582,7 +582,7 @@ public Boolean call() throws Exception {
// session.fireAllRules();
//
// // facts are being expired
-// verify( wmel, atLeastOnce() ).objectRetracted( any( ObjectRetractedEvent.class ) );
+// verify( wmel, atLeastOnce() ).objectDeleted( any( ObjectDeletedEvent.class ) );
// }
View
12 drools-compiler/src/test/java/org/drools/integrationtests/PseudoClockEventsTest.java
@@ -85,8 +85,8 @@ public void testEvenFirePseudoClockRuleA() throws Exception {
evalFirePseudoClockDeclaration + evalFirePseudoClockRuleA);
verify(ael,
- times(evalFirePseudoClockStockCount * (evalFirePseudoClockStockCount - 1) / 2)).afterActivationFired(
- any(AfterMatchFiredEvent.class));
+ times(evalFirePseudoClockStockCount * (evalFirePseudoClockStockCount - 1) / 2)).afterMatchFired(
+ any(AfterMatchFiredEvent.class));
}
@Test(timeout = 6000)
@@ -98,8 +98,8 @@ public void testEvenFirePseudoClockRuleB() throws Exception {
evalFirePseudoClockDeclaration + evalFirePseudoClockRuleB);
verify(ael,
- times(evalFirePseudoClockStockCount - 1)).afterActivationFired(
- any(AfterMatchFiredEvent.class));
+ times(evalFirePseudoClockStockCount - 1)).afterMatchFired(
+ any(AfterMatchFiredEvent.class));
}
@Test//(timeout = 60000)
@@ -113,8 +113,8 @@ public void testEvenFirePseudoClockRulesAB() throws Exception {
final int expectedActivationCount = evalFirePseudoClockStockCount * (evalFirePseudoClockStockCount - 1) / 2
+ evalFirePseudoClockStockCount - 1;
verify(ael,
- times(expectedActivationCount)).afterActivationFired(
- any(AfterMatchFiredEvent.class));
+ times(expectedActivationCount)).afterMatchFired(
+ any(AfterMatchFiredEvent.class));
}
private int processStocks(int stockCount, AgendaEventListener agendaEventListener, String drlContentString)
View
2  drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java
@@ -133,7 +133,7 @@ public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(Sta
boolean dispose,
boolean testRoundTrip ) throws Exception {
- ProtobufMarshaller marshaller = (ProtobufMarshaller) MarshallerFactory.newMarshaller( ksession.getKnowledgeBase(),
+ ProtobufMarshaller marshaller = (ProtobufMarshaller) MarshallerFactory.newMarshaller( ksession.getKieBase(),
(ObjectMarshallingStrategy[])ksession.getEnvironment().get(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES) );
long time = ksession.<SessionClock>getSessionClock().getCurrentTime();
// make sure globas are in the environment of the session
View
12 drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java
@@ -367,7 +367,7 @@ public void testModifyOnEntryPointFacts() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass(org.kie.event.rule.AfterMatchFiredEvent.class);
verify(ael,
- times(3)).afterActivationFired(captor.capture());
+ times(3)).afterMatchFired(captor.capture());
List<org.kie.event.rule.AfterMatchFiredEvent> aafe = captor.getAllValues();
Assert.assertThat(aafe.get(0).getMatch().getRule().getName(),
@@ -408,7 +408,7 @@ public void testEntryPointWithAccumulateAndMVEL() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass(org.kie.event.rule.AfterMatchFiredEvent.class);
verify(ael,
- times(1)).afterActivationFired(captor.capture());
+ times(1)).afterMatchFired(captor.capture());
List<org.kie.event.rule.AfterMatchFiredEvent> aafe = captor.getAllValues();
Assert.assertThat(aafe.get(0).getMatch().getRule().getName(),
@@ -516,7 +516,7 @@ public void testEventExpirationSetToZero() throws Exception {
verify(wml,
times(2)).objectInserted(any(org.kie.event.rule.ObjectInsertedEvent.class));
verify(ael,
- times(2)).activationCreated(any(MatchCreatedEvent.class));
+ times(2)).matchCreated(any(MatchCreatedEvent.class));
assertThat(ksession.getObjects().size(),
equalTo(2));
assertThat(ksession.getObjects(),
@@ -641,7 +641,7 @@ public void testWindowDeclaration() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass(org.kie.event.rule.AfterMatchFiredEvent.class);
verify(ael,
- times(1)).afterActivationFired(captor.capture());
+ times(1)).afterMatchFired(captor.capture());
AfterMatchFiredEvent aafe = captor.getValue();
Assert.assertThat(((Number) aafe.getMatch().getDeclarationValue("$sum")).intValue(),
@@ -687,7 +687,7 @@ public void testWindowDeclaration2() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass(org.kie.event.rule.AfterMatchFiredEvent.class);
verify(ael,
- times(1)).afterActivationFired(captor.capture());
+ times(1)).afterMatchFired(captor.capture());
AfterMatchFiredEvent aafe = captor.getValue();
Assert.assertThat(((Number) aafe.getMatch().getDeclarationValue("$sum")).intValue(),
@@ -724,7 +724,7 @@ public void testMultipleWindows() throws Exception {
ArgumentCaptor<org.kie.event.rule.AfterMatchFiredEvent> captor = ArgumentCaptor.forClass(org.kie.event.rule.AfterMatchFiredEvent.class);
verify(ael,
- times(1)).afterActivationFired(captor.capture());
+ times(1)).afterMatchFired(captor.capture());
AfterMatchFiredEvent aafe = captor.getValue();
Assert.assertThat( (StockTick) aafe.getMatch().getDeclarationValue("f1"),
View
10 drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
@@ -44,8 +44,8 @@
import org.kie.builder.KnowledgeBuilder;
import org.kie.builder.KnowledgeBuilderFactory;
import org.kie.definition.KnowledgePackage;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.event.rule.ObjectInsertedEvent;
-import org.kie.event.rule.ObjectRetractedEvent;
import org.kie.event.rule.WorkingMemoryEventListener;
import org.kie.io.ResourceFactory;
import org.kie.io.ResourceType;
@@ -122,7 +122,7 @@ public void testLogicalInsertionsDynamicRule() throws Exception {
ksession = getSerialisedStatefulKnowledgeSession( ksession,
true );
- kbase = ksession.getKnowledgeBase();
+ kbase = ksession.getKieBase();
// check all now have just one logical assertion each
list = new ArrayList( ksession.getObjects( new ClassObjectFilter( Person.class ) ) );
@@ -1037,9 +1037,9 @@ public void testLogicalInsertOrder() throws Exception {
assertThat( inserts.get( 1 ).getObject(), is( (Object) mark) );
assertThat( inserts.get( 2 ).getObject(), is( (Object) "rule 2" ) );
- ArgumentCaptor<ObjectRetractedEvent> retractsCaptor = ArgumentCaptor.forClass( ObjectRetractedEvent.class );
- verify( wmel, times(1) ).objectRetracted( retractsCaptor.capture() );
- List<ObjectRetractedEvent> retracts = retractsCaptor.getAllValues();
+ ArgumentCaptor<ObjectDeletedEvent> retractsCaptor = ArgumentCaptor.forClass( ObjectDeletedEvent.class );
+ verify( wmel, times(1) ).objectDeleted(retractsCaptor.capture());
+ List<ObjectDeletedEvent> retracts = retractsCaptor.getAllValues();
assertThat( retracts.get( 0 ).getOldObject(), is( (Object) "rule 2" ) );
}
View
18 drools-compiler/src/test/java/org/drools/integrationtests/marshalling/MarshallingTest.java
@@ -555,7 +555,7 @@ public void testSerializeAdd2() throws Exception {
// serialize session and rulebase out
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -647,7 +647,7 @@ public void testSerializeAdd_newRuleNotFiredForNewData() throws Exception {
// serialize session and rulebase out
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -734,7 +734,7 @@ public void testSerializeAdd3() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -787,7 +787,7 @@ public void testSerializeAdd3() throws Exception {
resolver = session.getGlobalResolver();
baos = new ByteArrayOutputStream();
ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -841,7 +841,7 @@ public void testSerializeAdd3() throws Exception {
resolver = session.getGlobalResolver();
baos = new ByteArrayOutputStream();
ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -927,7 +927,7 @@ public void testSerializeAddRemove_NoClassDefFoundError() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -980,7 +980,7 @@ public void testSerializeAddRemove_NoClassDefFoundError() throws Exception {
baos = new ByteArrayOutputStream();
ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -1055,7 +1055,7 @@ public void testSerializeAddRemove_NoClassDefFoundError() throws Exception {
serializedRulebase = null;
baos = new ByteArrayOutputStream();
ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession) session );
- marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
+ marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase() );
marshaller.marshall( baos,
ksession );
baos.close();
@@ -3088,7 +3088,7 @@ private KieSession marsallStatefulKnowledgeSession(KieSession ksession) throws I
ClassNotFoundException {
Globals globals = ksession.getGlobals();
- KieBase kbase = ksession.getKnowledgeBase();
+ KieBase kbase = ksession.getKieBase();
ByteArrayOutputStream out = new ByteArrayOutputStream();
MarshallerFactory.newMarshaller( kbase ).marshall( out,
View
12 drools-compiler/src/test/java/org/drools/integrationtests/sequential/SequentialTest.java
@@ -26,8 +26,8 @@
import org.kie.event.rule.BeforeMatchFiredEvent;
import org.kie.event.rule.MatchCancelledEvent;
import org.kie.event.rule.MatchCreatedEvent;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.event.rule.ObjectInsertedEvent;
-import org.kie.event.rule.ObjectRetractedEvent;
import org.kie.event.rule.ObjectUpdatedEvent;
import org.kie.event.rule.RuleFlowGroupActivatedEvent;
import org.kie.event.rule.RuleFlowGroupDeactivatedEvent;
@@ -181,17 +181,17 @@ public void testEvents() throws Exception {
ksession.addEventListener( new AgendaEventListener() {
- public void activationCancelled(MatchCancelledEvent event) {
+ public void matchCancelled(MatchCancelledEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
- public void activationCreated(MatchCreatedEvent event) {
+ public void matchCreated(MatchCreatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
- public void afterActivationFired(AfterMatchFiredEvent event) {
+ public void afterMatchFired(AfterMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
@@ -206,7 +206,7 @@ public void agendaGroupPushed(AgendaGroupPushedEvent event) {
list.add( event );
}
- public void beforeActivationFired(BeforeMatchFiredEvent event) {
+ public void beforeMatchFired(BeforeMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
@@ -240,7 +240,7 @@ public void objectInserted(ObjectInsertedEvent event) {
list.add( event );
}
- public void objectRetracted(ObjectRetractedEvent event) {
+ public void objectDeleted(ObjectDeletedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
View
2  drools-compiler/src/test/java/org/drools/lang/api/DescrBuilderTest.java
@@ -433,7 +433,7 @@ public void testTopLevelAccumulate() throws InstantiationException,
assertEquals( 1, rules );
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- verify( ael ).afterActivationFired( cap.capture() );
+ verify( ael ).afterMatchFired(cap.capture());
assertThat( ((Number) cap.getValue().getMatch().getDeclarationValue( "$sum" )).intValue(), is( 180 ) );
assertThat( ((Number) cap.getValue().getMatch().getDeclarationValue( "$cnt" )).intValue(), is( 2 ) );
View
6 drools-compiler/src/test/java/org/kie/builder/WireListenerTest.java
@@ -1,8 +1,8 @@
package org.kie.builder;
import org.junit.Test;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.event.rule.ObjectInsertedEvent;
-import org.kie.event.rule.ObjectRetractedEvent;
import org.kie.event.rule.ObjectUpdatedEvent;
import org.kie.event.rule.WorkingMemoryEventListener;
import org.kie.runtime.KieSession;
@@ -19,7 +19,7 @@
private static final List<ObjectInsertedEvent> insertEvents = new ArrayList<ObjectInsertedEvent>();
private static final List<ObjectUpdatedEvent> updateEvents = new ArrayList<ObjectUpdatedEvent>();
- private static final List<ObjectRetractedEvent> retractEvents = new ArrayList<ObjectRetractedEvent>();
+ private static final List<ObjectDeletedEvent> retractEvents = new ArrayList<ObjectDeletedEvent>();
@Test
public void testWireListener() throws Exception {
@@ -87,7 +87,7 @@ public void objectUpdated(ObjectUpdatedEvent event) {
}
@Override
- public void objectRetracted(ObjectRetractedEvent event) {
+ public void objectDeleted(ObjectDeletedEvent event) {
retractEvents.add(event);
}
}
View
2  drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
@@ -572,7 +572,7 @@ public void setNext(RetractTrait next) {
}
protected <T, K> T applyTrait( K core, Class<T> trait, boolean logical ) {
- AbstractRuleBase arb = (AbstractRuleBase) ((KnowledgeBaseImpl) this.getKnowledgeRuntime().getKnowledgeBase() ).getRuleBase();
+ AbstractRuleBase arb = (AbstractRuleBase) ((KnowledgeBaseImpl) this.getKnowledgeRuntime().getKieBase() ).getRuleBase();
TraitFactory builder = arb.getConfiguration().getComponentFactory().getTraitFactory();
boolean needsWrapping = ! ( core instanceof TraitableBean );
View
2  drools-core/src/main/java/org/drools/command/impl/CommandBasedStatefulKnowledgeSession.java
@@ -259,7 +259,7 @@ public void fireUntilHalt(AgendaFilter agendaFilter) {
this.commandService.execute( new FireUntilHaltCommand( agendaFilter ) );
}
- public KnowledgeBase getKnowledgeBase() {
+ public KnowledgeBase getKieBase() {
return this.commandService.execute( new GetKnowledgeBaseCommand() );
}
View
3  drools-core/src/main/java/org/drools/command/runtime/GetKnowledgeBaseCommand.java
@@ -18,7 +18,6 @@
import org.drools.command.impl.GenericCommand;
import org.drools.command.impl.KnowledgeCommandContext;
-import org.kie.KieBase;
import org.kie.KnowledgeBase;
import org.kie.command.Context;
import org.kie.runtime.StatefulKnowledgeSession;
@@ -32,7 +31,7 @@ public GetKnowledgeBaseCommand() {
public KnowledgeBase execute(Context context) {
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
- return ksession.getKnowledgeBase();
+ return ksession.getKieBase();
}
public String toString() {
View
2  drools-core/src/main/java/org/drools/common/ActivationIterator.java
@@ -49,7 +49,7 @@ public static ActivationIterator iterator(InternalWorkingMemory wm) {
public static ActivationIterator iterator(StatefulKnowledgeSession ksession) {
return new ActivationIterator( ((InternalWorkingMemoryEntryPoint) ksession).getInternalWorkingMemory(),
- ksession.getKnowledgeBase() );
+ ksession.getKieBase() );
}
public Object next() {
View
8 ...ols/event/rule/impl/ObjectRetractedEventImpl.java → ...rools/event/rule/impl/ObjectDeletedEventImpl.java
@@ -18,17 +18,17 @@
import org.drools.FactHandle;
import org.drools.common.InternalWorkingMemory;
-import org.kie.event.rule.ObjectRetractedEvent;
+import org.kie.event.rule.ObjectDeletedEvent;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-public class ObjectRetractedEventImpl extends WorkingMemoryEventImpl implements ObjectRetractedEvent {
+public class ObjectDeletedEventImpl extends WorkingMemoryEventImpl implements ObjectDeletedEvent {
private FactHandle factHandle;
private Object oldbOject;
- public ObjectRetractedEventImpl( org.drools.event.ObjectRetractedEvent event) {
+ public ObjectDeletedEventImpl(org.drools.event.ObjectRetractedEvent event) {
super( ((InternalWorkingMemory) event.getWorkingMemory() ).getKnowledgeRuntime(), event.getPropagationContext() );
factHandle = event.getFactHandle();
oldbOject = event.getOldObject();
@@ -57,7 +57,7 @@ public Object getOldObject() {
@Override
public String toString() {
- return "==>[ObjectRetractedEventImpl: getFactHandle()=" + getFactHandle() + ", getOldObject()="
+ return "==>[ObjectDeletedEventImpl: getFactHandle()=" + getFactHandle() + ", getOldObject()="
+ getOldObject() + ", getKnowledgeRuntime()=" + getKieRuntime() + ", getPropagationContext()="
+ getPropagationContext() + "]";
}
View
2  drools-core/src/main/java/org/drools/impl/KnowledgeBaseImpl.java
@@ -136,7 +136,7 @@ public void removeEventListener(KieBaseEventListener listener) {
this.ruleBase.removeEventListener( wrapper );
}
- public Collection<KieBaseEventListener> getKnowledgeBaseEventListeners() {
+ public Collection<KieBaseEventListener> getKieBaseEventListeners() {
return Collections.unmodifiableCollection( this.mappedKnowledgeBaseListeners.keySet() );
}
View
24 drools-core/src/main/java/org/drools/impl/StatefulKnowledgeSessionImpl.java
@@ -57,8 +57,8 @@
import org.drools.event.rule.impl.AgendaGroupPoppedEventImpl;
import org.drools.event.rule.impl.AgendaGroupPushedEventImpl;
import org.drools.event.rule.impl.BeforeActivationFiredEventImpl;
+import org.drools.event.rule.impl.ObjectDeletedEventImpl;
import org.drools.event.rule.impl.ObjectInsertedEventImpl;
-import org.drools.event.rule.impl.ObjectRetractedEventImpl;
import org.drools.event.rule.impl.ObjectUpdatedEventImpl;
import org.drools.event.rule.impl.RuleFlowGroupActivatedEventImpl;
import org.drools.event.rule.impl.RuleFlowGroupDeactivatedEventImpl;
@@ -219,7 +219,7 @@ public void removeEventListener(ProcessEventListener listener) {
getInternalProcessRuntime().removeEventListener( listener );
}
- public KnowledgeBase getKnowledgeBase() {
+ public KnowledgeBase getKieBase() {
if ( this.kbase == null ) {
this.kbase = new KnowledgeBaseImpl( session.getRuleBase() );
}
@@ -577,7 +577,7 @@ public void objectInserted(ObjectInsertedEvent event) {
}
public void objectRetracted(ObjectRetractedEvent event) {
- listener.objectRetracted( new ObjectRetractedEventImpl( event ) );
+ listener.objectDeleted(new ObjectDeletedEventImpl(event));
}
public void objectUpdated(ObjectUpdatedEvent event) {
@@ -631,28 +631,28 @@ public AgendaEventListenerWrapper(AgendaEventListener listener) {
public void activationCancelled(ActivationCancelledEvent event,
WorkingMemory workingMemory) {
- listener.activationCancelled( new ActivationCancelledEventImpl( event.getActivation(),
- ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime(),
- event.getCause() ) );
+ listener.matchCancelled(new ActivationCancelledEventImpl(event.getActivation(),
+ ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime(),
+ event.getCause()));
}
public void activationCreated(ActivationCreatedEvent event,
WorkingMemory workingMemory) {
- listener.activationCreated( new ActivationCreatedEventImpl( event.getActivation(),
- ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime() ) );
+ listener.matchCreated(new ActivationCreatedEventImpl(event.getActivation(),
+ ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime()));
}
public void beforeActivationFired(BeforeActivationFiredEvent event,
WorkingMemory workingMemory) {
- listener.beforeActivationFired( new BeforeActivationFiredEventImpl( event.getActivation(),
- ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime() ) );
+ listener.beforeMatchFired(new BeforeActivationFiredEventImpl(event.getActivation(),
+ ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime()));
}
public void afterActivationFired(AfterActivationFiredEvent event,
WorkingMemory workingMemory) {
- listener.afterActivationFired( new AfterActivationFiredEventImpl( event.getActivation(),
- ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime() ) );
+ listener.afterMatchFired(new AfterActivationFiredEventImpl(event.getActivation(),
+ ((InternalWorkingMemory) workingMemory).getKnowledgeRuntime()));
}
public void agendaGroupPopped(AgendaGroupPoppedEvent event,
View
2  drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java
@@ -94,7 +94,7 @@ public void writeExternal(ObjectOutput out) throws IOException {
// all we do is create marshall to a byte[] and write to the stream
StatefulKnowledgeSession ksession = (StatefulKnowledgeSession) getKnowledgeRuntime();
- Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase(), new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() } );
+ Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKieBase(), new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() } );
ByteArrayOutputStream stream = new ByteArrayOutputStream();
marshaller.marshall( stream, (StatefulKnowledgeSession) getKnowledgeRuntime() );
View
8 drools-core/src/test/java/org/drools/event/WorkingMemoryEventSupportTest.java
@@ -20,13 +20,11 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.kie.KnowledgeBase;
import org.kie.KnowledgeBaseFactory;
import org.kie.event.rule.ObjectInsertedEvent;
-import org.kie.event.rule.ObjectRetractedEvent;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.event.rule.ObjectUpdatedEvent;
import org.kie.event.rule.WorkingMemoryEventListener;
import org.kie.runtime.StatefulKnowledgeSession;
@@ -57,7 +55,7 @@ public void objectUpdated(ObjectUpdatedEvent event) {
wmList.add( event );
}
- public void objectRetracted(ObjectRetractedEvent event) {
+ public void objectDeleted(ObjectDeletedEvent event) {
wmList.add( event );
}
@@ -86,7 +84,7 @@ public void objectRetracted(ObjectRetractedEvent event) {
assertEquals( stilton, ome.getOldObject() );
wm.retract( stiltonHandle );
- final ObjectRetractedEvent ore = (ObjectRetractedEvent) wmList.get( 2 );
+ final ObjectDeletedEvent ore = (ObjectDeletedEvent) wmList.get( 2 );
assertSame( stiltonHandle,
ore.getFactHandle() );
View
8 drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java
@@ -123,19 +123,19 @@ public String getName() {
final List agendaList = new ArrayList();
final AgendaEventListener agendaEventListener = new AgendaEventListener() {
- public void activationCancelled(MatchCancelledEvent event) {
+ public void matchCancelled(MatchCancelledEvent event) {
assertNotNull( event.getKieRuntime() );
agendaList.add( event );
}
- public void activationCreated(MatchCreatedEvent event) {
+ public void matchCreated(MatchCreatedEvent event) {
assertNotNull( event.getKieRuntime() );
agendaList.add( event );
}
- public void afterActivationFired(AfterMatchFiredEvent event) {
+ public void afterMatchFired(AfterMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
agendaList.add( event );
}
@@ -150,7 +150,7 @@ public void agendaGroupPushed(AgendaGroupPushedEvent event) {
agendaList.add( event );
}
- public void beforeActivationFired(BeforeMatchFiredEvent event) {
+ public void beforeMatchFired(BeforeMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
agendaList.add( event );
}
View
15 drools-core/src/test/java/org/drools/event/rule/WorkingMemoryEventSupportTest.java
@@ -16,25 +16,18 @@
package org.drools.event.rule;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.drools.Cheese;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.WorkingMemory;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.kie.KnowledgeBase;
import org.kie.KnowledgeBaseFactory;
import org.kie.event.rule.ObjectInsertedEvent;
-import org.kie.event.rule.ObjectRetractedEvent;
+import org.kie.event.rule.ObjectDeletedEvent;
import org.kie.event.rule.ObjectUpdatedEvent;
import org.kie.event.rule.WorkingMemoryEventListener;
-import org.kie.runtime.KnowledgeRuntime;
import org.kie.runtime.StatefulKnowledgeSession;
import org.kie.runtime.rule.FactHandle;
@@ -58,7 +51,7 @@ public void objectUpdated(ObjectUpdatedEvent event) {
wmList.add( event );
}
- public void objectRetracted(ObjectRetractedEvent event) {
+ public void objectDeleted(ObjectDeletedEvent event) {
wmList.add( event );
}
@@ -84,7 +77,7 @@ public void objectRetracted(ObjectRetractedEvent event) {
ome.getFactHandle() );
ksession.retract( stiltonHandle );
- final ObjectRetractedEvent ore = (ObjectRetractedEvent) wmList.get( 2 );
+ final ObjectDeletedEvent ore = (ObjectDeletedEvent) wmList.get( 2 );
assertSame( stiltonHandle,
ore.getFactHandle() );
@@ -107,7 +100,7 @@ public void objectUpdated(ObjectUpdatedEvent event) {
wmList.add( event );
}
- public void objectRetracted(ObjectRetractedEvent event) {
+ public void objectDeleted(ObjectDeletedEvent event) {
wmList.add( event );
}
View
14 drools-core/src/test/java/org/drools/examples/manners/ReteooMannersTest.java
@@ -39,24 +39,24 @@ public void testManners() throws Exception {
final DefaultAgendaEventListener listener = new DefaultAgendaEventListener() {
private int counter = 0;
- // public void activationCreated(ActivationCreatedEvent event) {
- // super.activationCreated( event );
+ // public void matchCreated(ActivationCreatedEvent event) {
+ // super.matchCreated( event );
// System.out.println( event );
// }
//
- // public void activationCancelled(ActivationCancelledEvent event) {
- // super.activationCancelled( event );
+ // public void matchCancelled(ActivationCancelledEvent event) {
+ // super.matchCancelled( event );
// System.out.println( event );
// }
//
- // public void beforeActivationFired(BeforeActivationFiredEvent event) {
- // super.beforeActivationFired( event );
+ // public void beforeMatchFired(BeforeActivationFiredEvent event) {
+ // super.beforeMatchFired( event );
// System.out.println( event );
// }
public void afterActivationFired(AfterActivationFiredEvent event) {
this.counter++;
- //super.afterActivationFired( event );
+ //super.afterMatchFired( event );
//System.out.println( event );
}
View
3  drools-core/src/test/java/org/drools/reteoo/ReteDumper.java
@@ -6,7 +6,6 @@
import org.drools.impl.KnowledgeBaseImpl;
import org.kie.KnowledgeBase;
import org.kie.runtime.KnowledgeRuntime;
-import org.kie.runtime.StatefulKnowledgeSession;
import java.util.Collection;
@@ -19,7 +18,7 @@ public static void dumpRete(KnowledgeBase kbase) {
}
public static void dumpRete(KnowledgeRuntime session) {
- dumpRete(((KnowledgeBaseImpl)session.getKnowledgeBase()).getRuleBase());
+ dumpRete(((KnowledgeBaseImpl)session.getKieBase()).getRuleBase());
}
public static void dumpRete(RuleBase ruleBase) {
View
4 drools-docs/drools-expert-docs/src/main/docbook/en-US/Chapter-ApiReference/Section-Running.xml
@@ -630,8 +630,8 @@ ksession.setGlobal("list", list); </programlisting>
<title>Adding an AgendaEventListener</title>
<programlisting language="java">ksession.addEventListener( new DefaultAgendaEventListener() {
- public void afterActivationFired(AfterActivationFiredEvent event) {
- super.afterActivationFired( event );
+ public void afterMatchFired(AfterActivationFiredEvent event) {
+ super.afterMatchFired( event );
System.out.println( event );
}
}); </programlisting>
View
20 drools-examples/src/main/java/org/drools/examples/DroolsExamplesApp.java
@@ -16,16 +16,6 @@
package org.drools.examples;
-import java.awt.Container;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
import org.drools.examples.datadriventemplate.DataDrivenTemplateExample;
import org.drools.examples.decisiontable.PricingRuleDTExample;
import org.drools.examples.decisiontable.PricingRuleTemplateExample;
@@ -33,7 +23,6 @@
import org.drools.examples.golfing.GolfingExample;
import org.drools.examples.helloworld.HelloWorldExample;
import org.drools.examples.honestpolitician.HonestPoliticianExample;
-import org.drools.examples.pacman.PacmanExample;
import org.drools.examples.petstore.PetStoreExample;
import org.drools.examples.shopping.ShoppingExample;
import org.drools.examples.state.StateExampleUsingAgendaGroup;
@@ -52,6 +41,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+
public class DroolsExamplesApp extends JFrame {
public static void main(String[] args) {
@@ -83,11 +76,6 @@ public void actionPerformed(ActionEvent e) {
new PetStoreExample().init(false);
}
}));
- contentPane.add(new JButton(new AbstractAction("PacmanExample") {
- public void actionPerformed(ActionEvent e) {
- new PacmanExample().init(false);
- }
- }));
contentPane.add(new JButton(new AbstractAction("TextAdventure") {
public void actionPerformed(ActionEvent e) {
new TextAdventure().init(false);
View
41 drools-examples/src/main/java/org/drools/examples/pacman/Cell.java
@@ -1,41 +0,0 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * 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.examples.pacman;
-
-public class Cell {
- private int row;
- private int col;
-
- public Cell(int row, int col) {
- super();
- this.row = row;
- this.col = col;
- }
-
- public int getRow() {
- return row;
- }
-
- public int getCol() {
- return col;
- }
-
- @Override
- public String toString() {
- return "Cell " + row + ":" + col;
- }
-}
View
45 drools-examples/src/main/java/org/drools/examples/pacman/CellContents.java
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * 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.examples.pacman;
-
-public class CellContents {
- private Cell cell;
- private CellType cellType;
-
- public CellContents(Cell cell,
- CellType cellType) {
- this.cell = cell;
- this.cellType = cellType;
- }
-
- public Cell getCell() {
- return cell;
- }
-
- public CellType getCellType() {
- return cellType;
- }
-
- public void setCellType(CellType cellType) {
- this.cellType = cellType;
- }
-
- @Override
- public String toString() {
- return "CellType " + cellType;
- }
-}
View
24 drools-examples/src/main/java/org/drools/examples/pacman/CellType.java
@@ -1,24 +0,0 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * 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.examples.pacman;
-
-public enum CellType {
- EMPTY,
- FOOD,
- POWER_PILL,
- WALL;
-}
View
44 drools-examples/src/main/java/org/drools/examples/pacman/Character.java
@@ -1,44 +0,0 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * 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.examples.pacman;
-
-public class Character {
- String name;
-
- private int speed;
-
- public Character( String name ) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getSpeed() {
- return speed;
- }
-
- public void setSpeed(int speed) {
- this.speed = speed;
- }
-
- @Override
- public String toString() {
- return this.name + " speed = " + getSpeed();
- }
-}
View
114 drools-examples/src/main/java/org/drools/examples/pacman/Direction.java
@@ -1,114 +0,0 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * 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.examples.pacman;
-
-public class Direction {
- public static final int NONE = 0;
- public static final int LEFT = -1;
- public static final int RIGHT = 1;
- public static final int UP = 1;
- public static final int DOWN = -1;
-
- private Character character;
- private int horizontal;
- private int vertical;
-
- public Direction(Character character,
- int horizontal,
- int vertical) {
- this.character = character;
- this.horizontal = horizontal;
- this.vertical = vertical;
- }
-
- public Character getCharacter() {
- return character;
- }
-
- public int getHorizontal() {
- return horizontal;
- }
-
- public int getVertical() {
- return vertical;
- }
-
- public static Direction newDirection(Character character,
- DirectionEnum directionEnum) {
- switch ( directionEnum ) {
- case LEFT : {
- return new Direction( character,
- -1,
- 0 );
- }
- case RIGHT : {
- return new Direction( character,
- 1,
- 0 );