Package org.drools

Examples of org.drools.StatefulSession.dispose()


        serializedRulebase = null;
       
        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );
       
        session.dispose();
       
        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
        session = ruleBase.newStatefulSession( new ByteArrayInputStream( serializedSession ) );
        results = (List) session.getGlobal( "results" );
View Full Code Here


        serializedRulebase = null;
       
        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );
       
        session.dispose();
       
        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
        session = ruleBase.newStatefulSession( new ByteArrayInputStream( serializedSession ) );
        results = (List) session.getGlobal( "results" );
View Full Code Here

        serializedRulebase = null;
       
        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );
       
        session.dispose();
      
    }
   
    /*
     * I have tried both the scenarios
View Full Code Here

        session.fireAllRules();

        byte[] serializedSession = serializeOut( session );
        byte[] serializedRulebase = serializeOut( ruleBase );

        session.dispose();

        assertEquals( 1,
                      results.size() );
        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );
View Full Code Here

        serializedRulebase = null;
       
        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );
       
        session.dispose();
       
        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
        session = ruleBase.newStatefulSession( new ByteArrayInputStream( serializedSession ) );
        results = (List) session.getGlobal( "results" );
View Full Code Here

        serializedRulebase = null;
       
        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );
       
        session.dispose();
      
    }
   
    protected RuleBase getRuleBase() throws Exception {
View Full Code Here

                                if ( k + 1 != session2.getAgenda().agendaSize() ) {
                                    errorList.add( "THREAD-" + count + " ERROR: expected agenda size=" + (k + 1) + " but was " + session2.getAgenda().agendaSize() );
                                }
                            }
                            session2.fireAllRules();
                            session2.dispose();
                            if ( results.size() != iterations ) {
                                errorList.add( "THREAD-" + count + " ERROR: expected fire count=" + iterations + " but was " + results.size() );
                            }
                        } catch ( Exception e ) {
                            errorList.add( "THREAD-" + count + " EXCEPTION: " + e.getMessage() );
View Full Code Here

                                session.setGlobal( "results", results );
                                for( int k = 0; k < ITERATIONS; k++ ) {
                                    session.insert( new Order() );
                                }
                                session.fireAllRules();
                                session.dispose();
                                if( results.size() != ITERATIONS ) {
                                    errors.add( "Rules did not fired correctly. Expected: "+ITERATIONS+". Actual: "+results.size() );
                                }
                            } catch( Exception ex ) {
                                ex.printStackTrace();
View Full Code Here

                    session2.insert( parent );
                    session2.insert( child );
                }

                session2.fireAllRules();
                session2.dispose();

            } catch ( Exception e ) {
                this.status = Status.FAIL;
                System.out.println( Thread.currentThread().getName() + " failed: " + e.getMessage() );
                e.printStackTrace();
View Full Code Here

        for (Object fact : workingSolution.getFacts()) {
            tmpWorkingMemory.insert(fact);
        }
        tmpWorkingMemory.fireAllRules();
        Score realScore = tmpScoreCalculator.calculateScore();
        tmpWorkingMemory.dispose();
        if (!presumedScore.equals(realScore)) {
            throw new IllegalStateException(
                    "The presumedScore (" + presumedScore + ") is corrupted because it is not the realScore  ("
                            + realScore + ").\n"
                            + "Presumed workingMemory:\n" + buildConstraintOccurrenceSummary(workingMemory)
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.