Package org.drools.core

Examples of org.drools.core.RuleBase


    }

    @Test
    public void testEventGenerationMaxTime() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate events for 1 min, starting from the session clock
View Full Code Here


    }

    @Test
    public void testEventGenerationMaxTimeAndMaxItems() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate at most 10 events not exceeding 1 min, starting from the session clock
View Full Code Here

    }

    @Test
    public void testEventGenerationDelayedMaxItems() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate 10 events, delayed by 2 minutes from start session clock
View Full Code Here

    }

    @Test
    public void testEventGenerationDelayedMaxTime() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate events for 1 min, delayed by 2 minutes from start session clock
View Full Code Here

    }

    @Test
    public void testEventGenerationDelayedMaxTimeAndMaxItems() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate at most 10 events not exceeding 1 min, delayed by 2 minutes from start session clock
View Full Code Here

    }

    @Test
    public void testEventGenerationGlobalMaxTime() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm), PseudoSessionClock.timeInMinutes(1));
        // generate events for 1 min, starting from the session clock
View Full Code Here

    }

    @Test
    public void testEventGenerationMultipleSources() throws DroolsParserException, IOException, Exception{
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( TEST_RULE_FILE ) );
        final RuleBase ruleBase = loadRuleBase( reader );
        final WorkingMemory wm = ruleBase.newStatefulSession();
        final SimpleEventGenerator myGenerator;

        // create unrestricted event generator
        myGenerator = new SimpleEventGenerator(wm , new SimpleEventListener(wm));
        // generate 15 events with parent resource A and 20 events with parent resource B
View Full Code Here

* Normally this test will be XXX'ed out, as when running it will not terminate.
*/
public class StatelessStressTest {

    private static RuleBase getRuleBase(Package pkg) throws IOException, ClassNotFoundException {
        RuleBase ruleBase    = RuleBaseFactory.newRuleBase();

        ruleBase.addPackage( pkg );
        return SerializationHelper.serializeObject(ruleBase);
    }
View Full Code Here

        assertFalse(builder.hasErrors());

       
       

        final RuleBase rb  = getRuleBase( builder.getPackage() );

        int numThreads = 100;
        Thread[] ts = new Thread[numThreads];
       
       
            for (int i=0; i<numThreads; i++) {
                Runnable run = new Runnable() {
   
                    public void run() {
                       
                        long start = 0;
                        long previous = 0;
                       
                        while (true) {
                            start = System.currentTimeMillis();
                            StatelessSession sess = rb.newStatelessSession();
                            try {
                                sess    = SerializationHelper.serializeObject(sess);
                            } catch (Exception ex) {
                                throw new RuntimeException(ex);
                            }
View Full Code Here

    @Test
    public void testUpdateActivationCreationNoLoop() throws Exception {
        // JBRULES-787, no-loop blocks all dependant tuples for update
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_UpdateActivationCreationNoLoop.drl" ) );
        RuleBase ruleBase = loadRuleBase( reader );

        ruleBase = SerializationHelper.serializeObject(ruleBase);
        final InternalWorkingMemoryActions wm = (InternalWorkingMemoryActions) ruleBase.newStatefulSession();
        final List created = new ArrayList();
        final List cancelled = new ArrayList();
        final AgendaEventListener l = new DefaultAgendaEventListener() {
            @Override
            public void activationCreated(ActivationCreatedEvent event,
View Full Code Here

TOP

Related Classes of org.drools.core.RuleBase

Copyright © 2018 www.massapicom. 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.