Package org.drools.runtime.pipeline

Examples of org.drools.runtime.pipeline.Callable


public class MvelExpressionTest extends TestCase {
    public void testExpression() {
        MockClass mock = new MockClass();
              
        Callable callable = new CallableImpl();
        Action action = PipelineFactory.newMvelAction( "this.setValues( [0, 1, 2, 3, 4] ) " );
        callable.setReceiver( action );
        Expression expr = PipelineFactory.newMvelExpression( "this.values" );
        action.setReceiver( expr );
        expr.setReceiver( callable );         
       
        assertNull( mock.getValues() );
        List<Integer> list = ( List<Integer> ) callable.call( mock, new BasePipelineContext( Thread.currentThread().getContextClassLoader() ) );

       
        System.out.println( list.get( 0 ));
        assertEquals( 5, list.size());
        assertEquals( 0,list.get( 0 ).intValue() );
View Full Code Here


import org.drools.runtime.pipeline.PipelineFactory;

public class CallableTest extends TestCase {
    public void testCallable() {
        MockClass mock = new MockClass();
        Callable callable = new CallableImpl();
        Action action = PipelineFactory.newMvelAction( "this.set = true" );
        callable.setReceiver( action );
        action.setReceiver( callable );
        assertFalse( mock.isSet() );
        callable.call( mock,
                       new BasePipelineContext( Thread.currentThread().getContextClassLoader() ) );
        assertTrue( mock.isSet() );
    }
View Full Code Here

        InputStream inputXLS = new BufferedInputStream(getClass().getResourceAsStream( "departmentData.xls"));
       
        XLSReader mainReader = ReaderBuilder.buildFromXML( ResourceFactory.newClassPathResource( "departments.xml", getClass() ).getInputStream() );
        Transformer transformer = PipelineFactory.newJxlsTransformer(mainReader, "[ 'departments' : new java.util.ArrayList(), 'company' : new org.drools.runtime.pipeline.impl.Company() ]");
       
        Callable callable = new CallableImpl();

        callable.setReceiver( transformer );
        transformer.setReceiver( callable );
        BasePipelineContext context = new BasePipelineContext( Thread.currentThread().getContextClassLoader() );
       
        Map<String, Object> beans = ( Map<String, Object> ) callable.call( inputXLS, context );

        assertEquals( Company.class.getName(), beans.get( "company" ).getClass().getName());
        assertEquals( ArrayList.class.getName(), beans.get( "departments" ).getClass().getName());
       
        Company company = ( Company beans.get( "company" );
View Full Code Here

        InputStream inputXLS = new BufferedInputStream(getClass().getResourceAsStream( "departmentData.xls"));
       
        XLSReader mainReader = ReaderBuilder.buildFromXML( ResourceFactory.newClassPathResource( "departments.xml", getClass() ).getInputStream() );
        Transformer transformer = PipelineFactory.newJxlsTransformer(mainReader, "[ 'departments' : new java.util.ArrayList(), 'company' : new org.drools.runtime.pipeline.impl.Company() ]");
       
        Callable callable = new CallableImpl();

        callable.setReceiver( transformer );
        transformer.setReceiver( callable );
        BasePipelineContext context = new BasePipelineContext( Thread.currentThread().getContextClassLoader() );
       
        Map<String, Object> beans = ( Map<String, Object> ) callable.call( inputXLS, context );

        assertEquals( Company.class.getName(), beans.get( "company" ).getClass().getName());
        assertEquals( ArrayList.class.getName(), beans.get( "departments" ).getClass().getName());
       
        Company company = ( Company beans.get( "company" );
View Full Code Here

public class CallableTest {
    @Test
    public void testCallable() {
        MockClass mock = new MockClass();
        Callable callable = new CallableImpl();
        Action action = PipelineFactory.newMvelAction( "this.set = true" );
        callable.setReceiver( action );
        action.setReceiver( callable );
        assertFalse( mock.isSet() );
        callable.call( mock,
                       new BasePipelineContext( Thread.currentThread().getContextClassLoader() ) );
        assertTrue( mock.isSet() );
    }
View Full Code Here

public class MvelExpressionTest {
    @Test
    public void testExpression() {
        MockClass mock = new MockClass();
              
        Callable callable = new CallableImpl();
        Action action = PipelineFactory.newMvelAction( "this.setValues( [0, 1, 2, 3, 4] ) " );
        callable.setReceiver( action );
        Expression expr = PipelineFactory.newMvelExpression( "this.values" );
        action.setReceiver( expr );
        expr.setReceiver( callable );
       
        assertNull( mock.getValues() );
        List<Integer> list = ( List<Integer> ) callable.call( mock, new BasePipelineContext( Thread.currentThread().getContextClassLoader() ) );

       
        System.out.println( list.get( 0 ));
        assertEquals( 5, list.size());
        assertEquals( 0,list.get( 0 ).intValue() );
View Full Code Here

        InputStream inputXLS = new BufferedInputStream(getClass().getResourceAsStream( "departmentData.xls"));
       
        XLSReader mainReader = ReaderBuilder.buildFromXML( ResourceFactory.newClassPathResource( "departments.xml", getClass() ).getInputStream() );
        Transformer transformer = PipelineFactory.newJxlsTransformer(mainReader, "[ 'departments' : new java.util.ArrayList(), 'company' : new org.drools.runtime.pipeline.impl.Company() ]");
       
        Callable callable = new CallableImpl();

        callable.setReceiver( transformer );
        transformer.setReceiver( callable );       
        BasePipelineContext context = new BasePipelineContext( Thread.currentThread().getContextClassLoader() );
       
        Map<String, Object> beans = ( Map<String, Object> ) callable.call( inputXLS, context );

        assertEquals( Company.class.getName(), beans.get( "company" ).getClass().getName());
        assertEquals( ArrayList.class.getName(), beans.get( "departments" ).getClass().getName());
       
        Company company = ( Company beans.get( "company" );
View Full Code Here

TOP

Related Classes of org.drools.runtime.pipeline.Callable

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.