/** * Tests the assertion of objects into LeftInputAdapterNode * * @throws Exception */ @Test public void testAssertObjectWithoutMemory() throws Exception { PropagationContextFactory pctxFactory = kBase.getConfiguration().getComponentFactory().getPropagationContextFactory(); final PropagationContext pcontext = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null); BuildContext context = new BuildContext(kBase, kBase.getReteooBuilder().getIdGenerator()); final EntryPointNode entryPoint = new EntryPointNode(-1, kBase.getRete(), context); entryPoint.attach(context); final ObjectTypeNode objectTypeNode = new ObjectTypeNode(0, entryPoint, new ClassObjectType(Object.class), context); objectTypeNode.attach(context); final LeftInputAdapterNode liaNode = new LeftInputAdapterNode(23, objectTypeNode, buildContext); liaNode.attach(context); final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl(1L, kBase); final MockLeftTupleSink sink = new MockLeftTupleSink(); liaNode.addTupleSink(sink); final Object string1 = "cheese"; // assert object final DefaultFactHandle f0 = (DefaultFactHandle) workingMemory.insert(string1); liaNode.assertObject(f0, pcontext, workingMemory); final List asserted = sink.getAsserted(); assertLength(1, asserted); final LeftTuple tuple0 = (LeftTuple) ((Object[]) asserted.get(0))[0]; assertSame(string1, workingMemory.getObject(tuple0.get(0))); }