Package org.drools.runtime

Examples of org.drools.runtime.StatefulKnowledgeSession.retract()


        assertEquals( 1,
                      list.size() );
        assertTrue( list.contains( "rule1-V2" ) );
        list.clear();

        ksession.retract( h1 );
        ksession.insert( "String2" );

        ksession.fireAllRules();

        assertEquals( 2,
View Full Code Here


       
        assertTrue( list.contains( "rule1-V2" ) );
        list.clear();

        // Check all rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String2" );
        ksession.fireAllRules();
        assertEquals( 3,
                      list.size() );
        assertTrue( list.contains( "rule1-V2" ) );
View Full Code Here

                      list.size() );
        assertTrue( list.contains( "rule4" ) );
        list.clear();

        // Check all rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String3" );
        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );
        assertTrue( list.contains( "rule1-V2" ) );
View Full Code Here

                      list.size() );
        assertTrue( list.contains( "rule3-V2" ) );
        list.clear();

        // Check all rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String4" );
        ksession.fireAllRules();
        assertEquals( 3,
                      list.size() );
        assertTrue( list.contains( "rule2" ) );
View Full Code Here

        this.fileManager.deleteFile( f3 );
        scan( kagent );

        // Check remaining rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String5" );
        ksession.fireAllRules();
        assertEquals( 2,
                      list.size() );
        assertTrue( list.contains( "rule2" ) );
View Full Code Here

        f2 = fileManager.write( "rule2.drl",
                                str );
        scan( kagent );

        // Check remaining rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String6" );
        ksession.fireAllRules();
        assertEquals( 3,
                      list.size() );
        assertTrue( list.contains( "rule1-V3" ) );
View Full Code Here

        //rule3.drl was removed, so we need to force the agent to start
        //monitoring it again.
        applyChangeSet(kagent, ResourceFactory.newUrlResource( fxml.toURI().toURL() ));        
       
        // Check remaining rules are still there with new data
        ksession.retract( h1 );
        h1 = ksession.insert( "String7" );
        ksession.fireAllRules();
       
        assertEquals( 3,
                      list.size() );
View Full Code Here

        assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
                    is( 16 ) );

        Mockito.reset( ael );
        // ---------------- 4th scenario
        ksession.retract( cheeseHandles[3] );
        ksession.fireAllRules();

        Mockito.verify( ael ).afterActivationFired( cap.capture() );

        activation = cap.getValue().getActivation();
View Full Code Here

                handles[j] = getFactHandle( handles[j],
                                            ksession );
                Object o = handles[j].getObject();

                // first retract + assert
                ksession.retract( handles[j] );
                ksession = getSerialisedStatefulKnowledgeSession( ksession,
                                                                  true,
                                                                  false );

                handles[j] = (InternalFactHandle) ksession.insert( o );
View Full Code Here

                                                              true,
                                                              false );

            fh = getFactHandle( fh,
                                ksession );
            ksession.retract( fh );
            ksession.dispose();
        }
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.