Package org.drools.spi

Examples of org.drools.spi.Tuple


    void removeFromAgenda(TupleKey key,
                          Rule rule)
    {
       
        AgendaItem eachItem;
        Tuple tuple;
        Iterator itemIter = this.activationQueue.iterator( );

        while ( itemIter.hasNext( ) )
        {
            eachItem = (AgendaItem) itemIter.next( );
View Full Code Here


        {
            return;
        }
       
        AgendaItem eachItem;
        Tuple tuple;
        Iterator itemIter = this.activationQueue.iterator();

        while ( itemIter.hasNext( ) )
        {
            eachItem = (AgendaItem) itemIter.next();
View Full Code Here

        Argument mockFactArgument = (Argument) controlFactArgument.getMock();
        MockControl controlApplicationDataArgument = mocks.createControl(Argument.class);
        Argument mockApplicationDataArgument = (Argument) controlApplicationDataArgument.getMock();

        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlKnowledgeHelper = mocks.createControl(KnowledgeHelper.class);
        KnowledgeHelper mockKnowledgeHelper = (KnowledgeHelper) controlKnowledgeHelper.getMock();
        String p1 = "p1";
        Object a1 = new Object();
View Full Code Here

        mocks.verify();
    }

    public void testIsAllowed() throws Exception {
        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlRuleMethod = newMockRuleMethod();
        RuleReflectMethod mockRuleMethod = (RuleReflectMethod) controlRuleMethod.getMock();
        controlRuleMethod.expectAndReturn(mockRuleMethod.getArguments(), new Argument[] {});
        controlRuleMethod.expectAndReturn(mockRuleMethod.invokeMethod(mockTuple), Boolean.TRUE);
View Full Code Here

                new Object[] {null, null, null, null});
    }

    public void testPojoMethodThrowsException() throws Exception {
        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlRuleMethod = newMockRuleMethod();
        RuleReflectMethod mockRuleMethod = (RuleReflectMethod) controlRuleMethod.getMock();
        controlRuleMethod.expectAndThrow(mockRuleMethod.invokeMethod(mockTuple),
                new RuntimeException("test-exception"));
        RuleReflectMethod[] mockRuleMethods = new RuleReflectMethod[]{mockRuleMethod};
View Full Code Here

        mocks.verify();
    }

    public void testInvoke() throws Exception {
        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlRuleMethod = newMockRuleMethod();
        RuleReflectMethod mockRuleMethod = (RuleReflectMethod) controlRuleMethod.getMock();
        controlRuleMethod.expectAndReturn(mockRuleMethod.invokeMethod(mockTuple), null);
        RuleReflectMethod[] mockRuleMethods = new RuleReflectMethod[]{mockRuleMethod};
View Full Code Here

        mocks.verify();
    }

    public void testInvokeMulti() throws Exception {
        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlRuleMethod_1 = newMockRuleMethod();
        RuleReflectMethod mockRuleMethod_1 = (RuleReflectMethod) controlRuleMethod_1.getMock();
        controlRuleMethod_1.expectAndReturn(mockRuleMethod_1.invokeMethod(mockTuple), null);
        MockControl controlRuleMethod_2 = newMockRuleMethod();
        RuleReflectMethod mockRuleMethod_2 = (RuleReflectMethod) controlRuleMethod_2.getMock();
View Full Code Here

        List asserted = sink.getAssertedTuples( );

        assertEquals( 1, asserted.size( ) );

        Tuple tuple = ( Tuple ) asserted.get( 0 );

        assertSame( object1, tuple.get( paramDecl ) );
    }
View Full Code Here

    void removeFromAgenda(TupleKey key,
                          PropagationContext context,
                          Rule rule) throws FactException
    {
        AgendaItem eachItem;
        Tuple tuple;
        ModuleImpl module = (ModuleImpl) modules.get( rule.getModule( ) );
        Iterator itemIter = module.getActivationQueue( ).iterator( );            

        while ( itemIter.hasNext( ) )
        {
View Full Code Here

     * @param activation The activation from which the declarations should be extracted
     * @return A String represetation of the declarations of the activation.
     */
    private String extractDeclarations(final Activation activation,  final WorkingMemory workingMemory) {
        final StringBuilder result = new StringBuilder();
        final Tuple tuple = activation.getTuple();
        final Map<?, ?> declarations = activation.getSubRule().getOuterDeclarations();
        for ( Iterator<?> it = declarations.values().iterator(); it.hasNext(); ) {
            final Declaration declaration = (Declaration) it.next();
            final FactHandle handle = tuple.get( declaration );
            if ( handle instanceof InternalFactHandle ) {
                final InternalFactHandle handleImpl = (InternalFactHandle) handle;
                if ( handleImpl.getId() == -1 ) {
                    // This handle is now invalid, probably due to an fact retraction
                    continue;
View Full Code Here

TOP

Related Classes of org.drools.spi.Tuple

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.