/** * Tests ObjectTypeNodes are correctly added to the Rete object * * @throws Exception */ @Test public void testObjectTypeNodes() throws Exception { final Rete rete = kBase.getRete(); final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(Object.class), buildContext); objectTypeNode.attach(buildContext); final ObjectTypeNode stringTypeNode = new ObjectTypeNode(2, this.entryPoint, new ClassObjectType(String.class), buildContext); stringTypeNode.attach(buildContext); final List<ObjectTypeNode> list = rete.getObjectTypeNodes(); // Check the ObjectTypeNodes are correctly added to Rete assertEquals(3, list.size()); assertTrue(list.contains(objectTypeNode)); assertTrue(list.contains(stringTypeNode)); }
final ObjectTypeNode listOtn = new ObjectTypeNode(idGenerator.getNextId(), this.entryPoint, new ClassObjectType(List.class), final ObjectTypeNode collectionOtn = new ObjectTypeNode(idGenerator.getNextId(), this.entryPoint, new ClassObjectType(Collection.class),
@Test public void test1() { StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); final ObjectTypeNode objectTypeNode = new ObjectTypeNode( 1, this.entryPoint, new ClassObjectType( State.class ), buildContext ); objectTypeNode.attach(buildContext); final MockObjectSink sink = new MockObjectSink(); objectTypeNode.addObjectSink( sink ); final State a = new State( "go" ); ksession.insert( a, true ); ksession.fireAllRules(); assertEquals( 1, sink.getAsserted().size() ); a.setState( "stop" ); }
ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(List.class), objectTypeNode.addObjectSink(sink); objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(Collection.class), objectTypeNode.addObjectSink(sink); objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(ArrayList.class),
entryPoint.attach(buildContext); final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, entryPoint, new ClassObjectType(Cheese.class),
@Test public void testIsShadowed() { StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); // Create a Rete network with ObjectTypeNodes for List, Collection and ArrayList final Rete rete = kBase.getRete(); final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(Cheese.class), buildContext); objectTypeNode.attach(buildContext); final MockObjectSink sink1 = new MockObjectSink(); objectTypeNode.addObjectSink(sink1); // There are no String ObjectTypeNodes, make sure its not propagated final Cheese cheese = new Cheese("brie", 15); final DefaultFactHandle h1 = new DefaultFactHandle(1, cheese); rete.assertObject(h1, pctxFactory.createPropagationContext(0, PropagationContext.Type.INSERTION, null, null, null), ksession); ksession.fireAllRules(); final Object[] results = (Object[]) sink1.getAsserted().get(0); }
final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(List.class),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode(1, this.entryPoint, new ClassObjectType(List.class),
context = pctxFactory.createPropagationContext(0, PropagationContext.Type.INSERTION, null, null, null); ObjectTypeNode otn = new ObjectTypeNode( 4, null, new ClassObjectType( String.class ), buildContext ); lian = new LeftInputAdapterNode(5, otn, buildContext );
context = pctxFactory.createPropagationContext(0, PropagationContext.Type.INSERTION, null, null, null); ObjectTypeNode otn = new ObjectTypeNode( 4, null, new ClassObjectType( String.class ), buildContext ); liaNode = new LeftInputAdapterNode( 5, otn, buildContext );
rule3 = new RuleImpl( "rule3" ); ObjectTypeNode otn = new ObjectTypeNode( 3, null, new ClassObjectType( String.class ), buildContext ); liaNode = new LeftInputAdapterNode(4, otn, buildContext );
ObjectTypeNode otn = new ObjectTypeNode( 2, null, new ClassObjectType( String.class ), buildContext ); BetaNode n1 = new JoinNode( 10, new LeftInputAdapterNode(3, otn, buildContext ), mockObjectSource, new EmptyBetaConstraints(), buildContext );
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode(idGenerator.getNextId(), this.entryPoint, new ClassObjectType(String.class),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),
final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(), this.entryPoint, new ClassObjectType( String.class ),