Permalink
Browse files

Renaming getWorkingMemoryEntryPoint() methods to getEntryPoint()

  • Loading branch information...
1 parent b3da984 commit f8ef764a03103499d631038dbfc4e672ee80bdb5 @etirelli etirelli committed Dec 13, 2012
Showing with 88 additions and 173 deletions.
  1. +25 −25 drools-compiler/src/test/java/org/drools/beliefsystem/jtms/JTMSTest.java
  2. +2 −2 drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java
  3. +6 −6 drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
  4. +1 −1 drools-compiler/src/test/java/org/drools/integrationtests/DynamicRulesTest.java
  5. +2 −2 drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
  6. +1 −1 drools-compiler/src/test/java/org/drools/integrationtests/MultithreadTest.java
  7. +16 −16 drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java
  8. +18 −18 drools-compiler/src/test/java/org/drools/integrationtests/marshalling/MarshallingTest.java
  9. +1 −1 drools-compiler/src/test/java/org/drools/lang/api/DescrBuilderTest.java
  10. +6 −6 drools-core/src/main/java/org/drools/command/impl/CommandBasedStatefulKnowledgeSession.java
  11. +1 −1 drools-core/src/main/java/org/drools/command/runtime/rule/DeleteCommand.java
  12. +0 −43 drools-core/src/main/java/org/drools/command/runtime/rule/GetWorkingMemoryEntryPointCommand.java
  13. +0 −42 drools-core/src/main/java/org/drools/command/runtime/rule/GetWorkingMemoryEntryPointsCommand.java
  14. +1 −1 drools-core/src/main/java/org/drools/command/runtime/rule/InsertElementsCommand.java
  15. +1 −1 drools-core/src/main/java/org/drools/command/runtime/rule/InsertObjectCommand.java
  16. +1 −1 drools-core/src/main/java/org/drools/command/runtime/rule/ModifyCommand.java
  17. +1 −1 drools-core/src/main/java/org/drools/command/runtime/rule/UpdateCommand.java
  18. +2 −2 drools-core/src/main/java/org/drools/impl/StatefulKnowledgeSessionImpl.java
  19. +1 −1 drools-core/src/test/java/org/drools/reteoo/ReteooWorkingMemoryTest.java
  20. +1 −1 drools-examples/src/main/java/org/drools/games/pong/PongUI.java
  21. +1 −1 drools-persistence-jpa/src/test/java/org/drools/timer/integrationtests/TimerAndCalendarTest.java
@@ -130,30 +130,30 @@ public void testPosNegNonConflictingInsertions() {
kSession.fireAllRules();
assertTrue( list.contains( "-neg" ) );
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() ); // neg
+ assertEquals( 1, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
+ assertEquals( 1, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
FactHandle fhGo2 = kSession.insert( "go2" );
kSession.fireAllRules();
assertTrue( list.contains( "-neg" ) );
assertTrue( list.contains( "+pos" ) );
- assertEquals( 3, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() ); //go1, go2, pos
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() ); // neg
+ assertEquals( 3, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //go1, go2, pos
+ assertEquals( 1, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
kSession.retract( fhGo1 );
kSession.fireAllRules();
assertFalse( list.contains( "-neg" ) );
assertTrue( list.contains( "+pos" ) );
- assertEquals( 2, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() ); //go2, pos
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() );
+ assertEquals( 2, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //go2, pos
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getObjects().size() );
kSession.retract( fhGo2 );
kSession.fireAllRules();
assertFalse( list.contains( "-neg" ) );
assertFalse( list.contains( "+pos" ) );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() );
+ assertEquals( 0, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getObjects().size() );
}
@Test
@@ -204,7 +204,7 @@ public void testChangeInPositivePrime() {
FactHandle fhGo3 = kSession.insert( "go3" );
kSession.fireAllRules();
- NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getWorkingMemoryEntryPoint( "DEFAULT" );
+ NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
assertEquals( 4, ep.getObjects().size() ); //just go1, go2, go3, Person(darth)
int count = 0;
@@ -303,10 +303,10 @@ public void testChangeInNegativePrime() {
FactHandle fhGo3 = kSession.insert( "go3" );
kSession.fireAllRules();
- NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getWorkingMemoryEntryPoint( "DEFAULT" );
+ NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
assertEquals( 3, ep.getObjects().size() ); //just go1, go2, go3
- NamedEntryPoint negEp = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getWorkingMemoryEntryPoint( "neg" );
+ NamedEntryPoint negEp = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "neg" );
assertEquals( 1, negEp.getObjects().size() ); //just Person(darth)
int count = 0;
@@ -403,10 +403,10 @@ public void testRetractHandleWhenOnlyNeg() {
kSession.fireAllRules();
assertTrue( list.contains( "-neg" ) );
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() ); // neg
+ assertEquals( 1, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
+ assertEquals( 1, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
- NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getWorkingMemoryEntryPoint( "DEFAULT" );
+ NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
ObjectHashMap equalityMap = ep.getTruthMaintenanceSystem().getEqualityKeyMap();
assertEquals( 2, equalityMap.size() ); // go1, neg are two different strings.
org.drools.core.util.Iterator it = equalityMap.iterator();
@@ -419,8 +419,8 @@ public void testRetractHandleWhenOnlyNeg() {
kSession.retract( key.getBeliefSet().getFactHandle() );
assertEquals( 0, key.getBeliefSet().size() );
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getObjects().size() ); // neg
+ assertEquals( 1, kSession.getEntryPoint( "DEFAULT" ).getObjects().size() ); //just go1
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getObjects().size() ); // neg
assertEquals( 0, key.getBeliefSet().size() );
assertEquals( 1, ep.getTruthMaintenanceSystem().getEqualityKeyMap().size() );
}
@@ -433,7 +433,7 @@ public void testConflictStrict() {
kSession.setGlobal( "list", list );
- NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getWorkingMemoryEntryPoint( "DEFAULT" );
+ NamedEntryPoint ep = ( NamedEntryPoint ) ((StatefulKnowledgeSessionImpl)kSession).getEntryPoint( "DEFAULT" );
JTMSBeliefSystem bs = ( JTMSBeliefSystem ) ep.getTruthMaintenanceSystem().getBeliefSystem();
bs.STRICT = true;
@@ -462,56 +462,56 @@ public void testConflictTMS() {
kSession.fireAllRules();
assertEquals( 4, kSession.getFactCount() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 0, list.size() );
kSession.retract( a );
kSession.fireAllRules();
assertEquals( 3, kSession.getFactCount() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 0, list.size() );
kSession.retract( b );
kSession.fireAllRules();
assertEquals( 2, kSession.getFactCount() );
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 1, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 1, list.size() );
a = kSession.insert( "a" );
kSession.fireAllRules();
assertEquals( 3, kSession.getFactCount());
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 1, list.size() );
kSession.retract( c );
kSession.fireAllRules();
assertEquals( 2, kSession.getFactCount() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 1, list.size() );
kSession.retract( d );
kSession.fireAllRules();
assertEquals( 2, kSession.getFactCount() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 2, list.size() );
kSession.retract( a );
kSession.fireAllRules();
assertEquals( 0, kSession.getFactCount() );
- assertEquals( 0, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 0, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 2, list.size() );
c = kSession.insert( "c" );
kSession.fireAllRules();
assertEquals( 1, kSession.getFactCount() );
- assertEquals( 1, kSession.getWorkingMemoryEntryPoint( "neg" ).getFactCount() );
+ assertEquals( 1, kSession.getEntryPoint( "neg" ).getFactCount() );
assertEquals( 3, list.size() );
@@ -2125,7 +2125,7 @@ public void testAccumulateWithEntryPoint() {
ksession.fireAllRules();
for ( int j = 0; j < 33; j++ ) {
- ksession.getWorkingMemoryEntryPoint( "data" ).insert(1.0 * j);
+ ksession.getEntryPoint( "data" ).insert(1.0 * j);
ksession.fireAllRules();
}
}
@@ -2161,7 +2161,7 @@ public void testAccumulateWithWindowAndEntryPoint() {
ksession.fireAllRules();
for ( int j = 0; j < 33; j++ ) {
- ksession.getWorkingMemoryEntryPoint( "data" ).insert(1.0 * j);
+ ksession.getEntryPoint( "data" ).insert(1.0 * j);
ksession.fireAllRules();
}
}
@@ -427,7 +427,7 @@ public void testEventExpiration4() throws Exception {
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase, sconf);
- SessionEntryPoint eventStream = ksession.getWorkingMemoryEntryPoint( "Event Stream" );
+ SessionEntryPoint eventStream = ksession.getEntryPoint( "Event Stream" );
SessionPseudoClock clock = (SessionPseudoClock) ksession.<SessionClock>getSessionClock();
@@ -1834,7 +1834,7 @@ public void testIdentityAssertBehaviorOnEntryPoints() throws IOException,
final StatefulKnowledgeSession ksession = kbase1.newStatefulKnowledgeSession();
AgendaEventListener ael1 = mock( AgendaEventListener.class );
ksession.addEventListener( ael1 );
- SessionEntryPoint ep1 = ksession.getWorkingMemoryEntryPoint( "stocktick stream" );
+ SessionEntryPoint ep1 = ksession.getEntryPoint( "stocktick stream" );
FactHandle fh1 = ep1.insert( st1 );
FactHandle fh1_2 = ep1.insert( st1 );
@@ -1882,7 +1882,7 @@ public void testEqualityAssertBehaviorOnEntryPoints() throws IOException,
final StatefulKnowledgeSession ksession1 = kbase1.newStatefulKnowledgeSession();
AgendaEventListener ael1 = mock( AgendaEventListener.class );
ksession1.addEventListener( ael1 );
- SessionEntryPoint ep1 = ksession1.getWorkingMemoryEntryPoint( "stocktick stream" );
+ SessionEntryPoint ep1 = ksession1.getEntryPoint( "stocktick stream" );
FactHandle fh1 = ep1.insert( st1 );
FactHandle fh1_2 = ep1.insert( st1 );
@@ -1967,7 +1967,7 @@ public void testTemporalOperators2() throws Exception {
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase, sconf);
SessionPseudoClock clock = (SessionPseudoClock) ksession.<SessionClock>getSessionClock();
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "X" );
+ SessionEntryPoint ep = ksession.getEntryPoint( "X" );
clock.advanceTime( 1000,
TimeUnit.SECONDS );
@@ -2008,7 +2008,7 @@ public void testTemporalOperatorsInfinity() throws Exception {
null );
SessionPseudoClock clock = (SessionPseudoClock) ksession.<SessionClock>getSessionClock();
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "X" );
+ SessionEntryPoint ep = ksession.getEntryPoint( "X" );
clock.advanceTime( 1000,
TimeUnit.SECONDS );
@@ -2179,7 +2179,7 @@ public void testCloudModeExpiration() throws IOException,
KnowledgeBase kbase = loadKnowledgeBaseFromString( config, str );
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "X" );
+ SessionEntryPoint ep = ksession.getEntryPoint( "X" );
ep.insert( new StockTick( 1,
"RHT",
@@ -911,7 +911,7 @@ public void testDynamicRuleAdditionsWithEntryPoints() throws Exception {
ksession.setGlobal( "results",
results );
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "in-channel" );
+ SessionEntryPoint ep = ksession.getEntryPoint( "in-channel" );
ep.insert( new StockTick( 1,
"RHT",
20,
@@ -6127,7 +6127,7 @@ public void testFireUntilHaltFailingAcrossEntryPoints() throws Exception {
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
final StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
- final SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "testep2" );
+ final SessionEntryPoint ep = ksession.getEntryPoint( "testep2" );
List list = new ArrayList();
ksession.setGlobal( "list",
@@ -6193,7 +6193,7 @@ public void testNetworkBuildErrorAcrossEntryPointsAndFroms() throws Exception {
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
final StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
- final SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "testep" );
+ final SessionEntryPoint ep = ksession.getEntryPoint( "testep" );
List list = new ArrayList();
ksession.setGlobal( "list",
@@ -150,7 +150,7 @@ public void testSlidingTimeWindows() {
kbconf.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = loadKnowledgeBaseFromString(kbconf, str);
final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
- final SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint("X");
+ final SessionEntryPoint ep = ksession.getEntryPoint("X");
Executor executor = Executors.newCachedThreadPool(new ThreadFactory() {
public Thread newThread(Runnable r) {
@@ -168,7 +168,7 @@ public void testEventAssertion() throws Exception {
50,
System.currentTimeMillis());
- SessionEntryPoint entry = session.getWorkingMemoryEntryPoint("StockStream");
+ SessionEntryPoint entry = session.getEntryPoint("StockStream");
InternalFactHandle handle5 = (InternalFactHandle) entry.insert(tick5);
InternalFactHandle handle6 = (InternalFactHandle) entry.insert(tick6);
@@ -221,7 +221,7 @@ public void testEntryPointReference() throws Exception {
50,
System.currentTimeMillis());
- SessionEntryPoint entry = session.getWorkingMemoryEntryPoint("stream1");
+ SessionEntryPoint entry = session.getEntryPoint("stream1");
InternalFactHandle handle5 = (InternalFactHandle) entry.insert(tick5);
InternalFactHandle handle6 = (InternalFactHandle) entry.insert(tick6);
@@ -274,7 +274,7 @@ public void testModifyRetracOnEntryPointFacts() throws Exception {
50,
System.currentTimeMillis() );
- SessionEntryPoint entry = session.getWorkingMemoryEntryPoint( "stream1" );
+ SessionEntryPoint entry = session.getEntryPoint( "stream1" );
InternalFactHandle handle5 = (InternalFactHandle) entry.insert( tick5 );
InternalFactHandle handle6 = (InternalFactHandle) entry.insert( tick6 );
@@ -345,9 +345,9 @@ public void testModifyOnEntryPointFacts() throws Exception {
org.kie.event.rule.AgendaEventListener ael = mock(org.kie.event.rule.AgendaEventListener.class);
ksession.addEventListener(ael);
- SessionEntryPoint ep1 = ksession.getWorkingMemoryEntryPoint("ep1");
- SessionEntryPoint ep2 = ksession.getWorkingMemoryEntryPoint("ep2");
- SessionEntryPoint ep3 = ksession.getWorkingMemoryEntryPoint("ep3");
+ SessionEntryPoint ep1 = ksession.getEntryPoint("ep1");
+ SessionEntryPoint ep2 = ksession.getEntryPoint("ep2");
+ SessionEntryPoint ep3 = ksession.getEntryPoint("ep3");
ep1.insert(new StockTick(1,
"RHT",
@@ -396,7 +396,7 @@ public void testEntryPointWithAccumulateAndMVEL() throws Exception {
org.kie.event.rule.AgendaEventListener ael = mock(org.kie.event.rule.AgendaEventListener.class);
ksession.addEventListener(ael);
- SessionEntryPoint ep1 = ksession.getWorkingMemoryEntryPoint("ep1");
+ SessionEntryPoint ep1 = ksession.getEntryPoint("ep1");
ep1.insert(new StockTick(1,
"RHT",
@@ -421,11 +421,11 @@ public void testGetEntryPointList() throws Exception {
KnowledgeBase kbase = loadKnowledgeBase("test_EntryPointReference.drl");
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
- SessionEntryPoint def = session.getWorkingMemoryEntryPoint(EntryPoint.DEFAULT.getEntryPointId());
- SessionEntryPoint s1 = session.getWorkingMemoryEntryPoint("stream1");
- SessionEntryPoint s2 = session.getWorkingMemoryEntryPoint( "stream2" );
- SessionEntryPoint s3 = session.getWorkingMemoryEntryPoint( "stream3" );
- Collection<? extends SessionEntryPoint> eps = session.getWorkingMemoryEntryPoints();
+ SessionEntryPoint def = session.getEntryPoint(EntryPoint.DEFAULT.getEntryPointId());
+ SessionEntryPoint s1 = session.getEntryPoint("stream1");
+ SessionEntryPoint s2 = session.getEntryPoint( "stream2" );
+ SessionEntryPoint s3 = session.getEntryPoint( "stream3" );
+ Collection<? extends SessionEntryPoint> eps = session.getEntryPoints();
assertEquals( 4,
eps.size() );
@@ -595,8 +595,8 @@ public void testDeclaredEntryPoint() {
KnowledgeBase kbase = loadKnowledgeBaseFromString( (KieBaseConfiguration)null, drl );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
- assertNotNull(ksession.getWorkingMemoryEntryPoint("UsedEntryPoint"));
- assertNotNull(ksession.getWorkingMemoryEntryPoint("UnusedEntryPoint"));
+ assertNotNull(ksession.getEntryPoint("UsedEntryPoint"));
+ assertNotNull(ksession.getEntryPoint("UnusedEntryPoint"));
ksession.dispose();
}
@@ -627,7 +627,7 @@ public void testWindowDeclaration() throws Exception {
AgendaEventListener ael = mock(AgendaEventListener.class);
ksession.addEventListener(ael);
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint("ticks");
+ SessionEntryPoint ep = ksession.getEntryPoint("ticks");
ep.insert(new StockTick(1, "ACME", 20, 1000)); // not in the window
ep.insert(new StockTick(2, "RHT", 20, 1000)); // not > 20
ep.insert(new StockTick(3, "RHT", 30, 1000));
@@ -678,7 +678,7 @@ public void testWindowDeclaration2() throws Exception {
AgendaEventListener ael = mock(AgendaEventListener.class);
ksession.addEventListener(ael);
- SessionEntryPoint ep = ksession.getWorkingMemoryEntryPoint("data");
+ SessionEntryPoint ep = ksession.getEntryPoint("data");
ep.insert(Double.valueOf( 10 ));
ep.insert(Double.valueOf( 11 ));
ep.insert(Double.valueOf( 12 ));
Oops, something went wrong.

0 comments on commit f8ef764

Please sign in to comment.