ResourceChangeScannerImpl scanner = (ResourceChangeScannerImpl) ResourceFactory.getResourceChangeScannerService();
assertEquals( 5,
scanner.getInterval() );
KnowledgeBaseImpl kbase1 = (KnowledgeBaseImpl) context.getBean( "kbase1" );
KnowledgeBaseImpl kbase2 = (KnowledgeBaseImpl) context.getBean( "kbase2" );
KnowledgeAgentImpl kagent1 = (KnowledgeAgentImpl) context.getBean( "kagent1" );
assertSame( kagent1.getKnowledgeBase(),
kbase1 );
assertEquals( 0,
kagent1.getResourceDirectories().size() );
assertFalse( kagent1.isNewInstance() );
KnowledgeAgentImpl kagent2 = (KnowledgeAgentImpl) context.getBean( "kagent2" );
assertSame( kagent2.getKnowledgeBase(),
kbase2 );
assertEquals( 1,
kagent2.getResourceDirectories().size() );
assertFalse( kagent2.isNewInstance() );
KnowledgeAgentImpl kagent3 = (KnowledgeAgentImpl) context.getBean( "kagent3" );
assertTrue( kagent3.isNewInstance() );
StatelessKnowledgeSessionImpl ksession1 = (StatelessKnowledgeSessionImpl) context.getBean( "ksession1" );
assertSame( kbase1.getRuleBase(),
ksession1.getRuleBase() );
assertSame( kagent1,
ksession1.getKnowledgeAgent() );
StatefulKnowledgeSessionImpl ksession2 = (StatefulKnowledgeSessionImpl) context.getBean( "ksession2" );
assertSame( kbase1.getRuleBase(),
ksession2.getRuleBase() );
StatelessKnowledgeSessionImpl ksession3 = (StatelessKnowledgeSessionImpl) context.getBean( "ksession3" );
assertSame( kagent2,
ksession3.getKnowledgeAgent() );
assertSame( kbase2.getRuleBase(),
ksession3.getRuleBase() );
}