@Test(timeout=10000) public void testLogicalWithDeleteException() { String droolsSource = "package org.drools.tms.test; \n" + "global java.util.List list; \n" + "rule Justify \n" + "when \n" + " String( this == 'go1' ) " + "then \n" + " insertLogical( 'f1' ); \n" + "end \n" + "" ; KieBaseConfiguration kieConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); kieConf.setOption( EqualityBehaviorOption.IDENTITY ); KieBase kbase = loadKnowledgeBaseFromString( kieConf, droolsSource ); KieSession session = kbase.newKieSession(); try { List list = new ArrayList(); session.setGlobal("list", list); session.insert( "go1" ); session.fireAllRules(); TruthMaintenanceSystem tms = ((StatefulKnowledgeSessionImpl)session).getTruthMaintenanceSystem(); InternalFactHandle jfh1 = tms.get( "f1" ).getLogicalFactHandle(); assertSame( jfh1, session.getFactHandle( "f1" ) ); } finally { session.dispose(); } }
InternalFactHandle jfh1 = tms.get( "f1" ).getLogicalFactHandle(); assertEquals(EqualityKey.JUSTIFIED, jfh1.getEqualityKey().getStatus() );
InternalFactHandle jfh1 = ((StatefulKnowledgeSessionImpl)session).getTruthMaintenanceSystem().get( "f1" ).getLogicalFactHandle(); assertEquals( EqualityKey.JUSTIFIED, jfh1.getEqualityKey().getStatus());
InternalFactHandle jfh1 = tms.get( "f1" ).getLogicalFactHandle(); assertEquals(EqualityKey.JUSTIFIED, jfh1.getEqualityKey().getStatus() );
InternalFactHandle jfh1 = tms.get( "f1" ).getLogicalFactHandle(); assertEquals(EqualityKey.JUSTIFIED, jfh1.getEqualityKey().getStatus() );
InternalFactHandle jfh1 = tms.get( "f1" ).getLogicalFactHandle(); EqualityKey key = jfh1.getEqualityKey(); assertSame( fh1.getEqualityKey(), key );