private StatefulKnowledgeSessionImpl createWorkingMemory(InternalKnowledgeBase kBase) { // WorkingMemoryEntryPoint KieSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); ksconf.setOption( ClockTypeOption.get( "pseudo" ) ); SessionConfiguration sessionConf = ((SessionConfiguration) ksconf); StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl(1L, kBase, true, sessionConf, EnvironmentFactory.newEnvironment()); return wm; }
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(conf); buildContext = new BuildContext(kBase); final StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl(1L, kBase);
StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase );
StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase );
@Test public void testRuleSegmentsAllLinkedTestMasks() { setUp( JOIN_NODE ); KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(kconf); StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase ); PathMemory rs = (PathMemory) wm.getNodeMemory( rtn1 ); assertFalse( rs.isRuleLinked() ); assertEquals( 1, rs.getAllLinkedMaskTest() ); rs = (PathMemory) wm.getNodeMemory( rtn2 ); assertFalse( rs.isRuleLinked() ); assertEquals( 3, rs.getAllLinkedMaskTest() ); rs = (PathMemory) wm.getNodeMemory( rtn3 ); assertFalse( rs.isRuleLinked() ); assertEquals( 7, rs.getAllLinkedMaskTest() ); }
@Test public void testRuleSegmentsAllLinkedTestMasks() { setUp( JOIN_NODE ); KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(kconf); StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase ); PathMemory rs = (PathMemory) wm.getNodeMemory( rtn1 ); assertFalse( rs.isRuleLinked() ); assertEquals( 1, rs.getAllLinkedMaskTest() ); rs = (PathMemory) wm.getNodeMemory( rtn2 ); assertFalse( rs.isRuleLinked() ); assertEquals( 3, rs.getAllLinkedMaskTest() ); rs = (PathMemory) wm.getNodeMemory( rtn3 ); assertFalse( rs.isRuleLinked() ); assertEquals( 7, rs.getAllLinkedMaskTest() ); }
private InternalKnowledgeRuntime createRuntime(Long id, String containerId) { InternalKnowledgeBase kBase2 = KnowledgeBaseFactory.newKnowledgeBase(); StatefulKnowledgeSessionImpl knowledge = new StatefulKnowledgeSessionImpl(id, kBase2); knowledge.getEnvironment().set(EnvironmentName.DEPLOYMENT_ID, containerId); return knowledge; } }
private StatefulKnowledgeSessionImpl createWorkingMemory(InternalKnowledgeBase kBase) { // WorkingMemoryEntryPoint KieSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); ksconf.setOption( ClockTypeOption.get( "pseudo" ) ); SessionConfiguration sessionConf = ((SessionConfiguration) ksconf); StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl(1L, kBase, true, sessionConf, EnvironmentFactory.newEnvironment()); return wm; }
@Test public void testMemory() { when( constraint.isAllowedCachedLeft( any( ContextEntry.class ), any( InternalFactHandle.class ) ) ).thenReturn( true ); when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ), any( ContextEntry.class ) ) ).thenReturn( true ); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase()); final MockObjectSource objectSource = new MockObjectSource( 1 ); final MockTupleSource tupleSource = new MockTupleSource( 1 ); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(); BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() ); final JoinNode joinNode = new JoinNode( 2, tupleSource, objectSource, EmptyBetaConstraints.getInstance(), buildContext ); final BetaMemory memory = (BetaMemory) workingMemory .getNodeMemory( joinNode ); assertNotNull( memory ); }
@Test public void testMemory() { final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase() ); final MockTupleSource source = new MockTupleSource( 12 ); final EvalConditionNode node = new EvalConditionNode( 18, source, new MockEvalCondition( true ), buildContext ); final EvalMemory memory = (EvalMemory) workingMemory.getNodeMemory( node ); assertNotNull( memory ); }
any( ContextEntry.class ) ) ).thenReturn( true ); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase() );
StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase );
StatefulKnowledgeSessionImpl wm = new StatefulKnowledgeSessionImpl( 1L, kBase );
@Test public void testAssignable() { final PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, kBase );
conf.setSequential( true ); this.workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(conf) );
pctxFactory = kBase.getConfiguration().getComponentFactory().getPropagationContextFactory(); this.context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); this.workingMemory = new StatefulKnowledgeSessionImpl(1L, kBase);
when( constraint.isAllowedCachedRight(any(LeftTupleImpl.class), any(ContextEntry.class))).thenReturn(true); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl(1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase());
@Test public void testAlphaNode() { final PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl(1L, kBase);
final PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase() );
@Test public void testRestract() { final PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1L, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase() ); final ClassFieldReader extractor = store.getReader( Cheese.class, "type" );