Package org.drools.core.command.runtime

Examples of org.drools.core.command.runtime.BatchExecutionCommandImpl


    }

    @Test
    public void testSessionInsert() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "lucaz",
                                                                    25 ),
                                                        "person1" ) );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "hadrian",
                                                                    25 ),
                                                        "person2" ) );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "baunax",
                                                                    21 ),
                                                        "person3" ) );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
View Full Code Here


    }

    @Test
    public void testSessionGetObject() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        cmd.getCommands().add( new GetObjectCommand( new DefaultFactHandle( handle ),
                                                     "hadrian" ) );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
View Full Code Here

    }

    @Test
    public void testInsertElements() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        InsertElementsCommand elems = new InsertElementsCommand( "elems" );
        elems.getObjects().add( new Person( "lucaz",
                                            25 ) );
        elems.getObjects().add( new Person( "hadrian",
                                            25 ) );
        elems.getObjects().add( new Person( "baunax",
                                            21 ) );
        elems.getObjects().add( "xxx" );

        cmd.getCommands().add( elems );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
View Full Code Here

    }

    @Test
    public void testQuery() throws Exception {
        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "lucaz" ) ) );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "hadrian" ) ) );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "baunax",
                                                                    43 ) ) );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "baunax",
                                                                    21 ) ) );
        cmd.getCommands().add( new QueryCommand( "persons",
                                                 "persons",
                                                 null ) );
        cmd.getCommands().add( new QueryCommand( "person",
                                                 "personWithName",
                                                 new String[]{"baunax"} ) );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
View Full Code Here

    }

    @Test
    public void testProcess() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );

        StartProcessCommand start = new StartProcessCommand( "org.drools.actions" , "process-instance-id" );
        start.putParameter( "person",
                            new Person( "lucaz",
                                        25 ) );
        start.putParameter( "person2",
                            new Person( "hadrian",
                                        25 ) );
        start.putParameter( "person3",
                            new Person( "baunax",
                                        21 ) );

        cmd.getCommands().add( start );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
View Full Code Here

        StatefulKnowledgeSession ksession = registerKnowledgeRuntime( "ksession1",
                                                                      rule );
        InsertObjectCommand cmd = new InsertObjectCommand( me );
        cmd.setOutIdentifier( "camel-rider" );
        cmd.setReturnObject( false );
        BatchExecutionCommandImpl script = new BatchExecutionCommandImpl( Arrays.asList( new GenericCommand< ? >[]{cmd} ) );

        ExecutionResults results = ksession.execute( script );
        handle = ((FactHandle) results.getFactHandle( "camel-rider" )).toExternalForm();
    }
View Full Code Here

        setAddress.invoke( lucaz,
                           lucazAddress );
        setAddress.invoke( baunax,
                           baunaxAddress );

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );
        cmd.getCommands().add( new InsertObjectCommand( lucaz,
                                                        "lucaz" ) );
        cmd.getCommands().add( new InsertObjectCommand( baunax,
                                                        "baunax" ) );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
View Full Code Here

        StatefulKnowledgeSession ksession = registerKnowledgeRuntime( "ksession1",
                                                                      null );
        InsertObjectCommand cmd = new InsertObjectCommand( me );
        cmd.setOutIdentifier( "camel-rider" );
        cmd.setReturnObject( false );
        BatchExecutionCommandImpl script = new BatchExecutionCommandImpl( Arrays.asList( new GenericCommand< ? >[]{cmd} ) );

        ExecutionResults results = ksession.execute( script );
        handle = ((FactHandle) results.getFactHandle( "camel-rider" )).toExternalForm();
    }
View Full Code Here

    private RouteBuilder routeBuilder;

    @Test
    public void testWorkingSetGlobalTestSessionSetAndGetGlobal() throws Exception {

        BatchExecutionCommandImpl cmd = new BatchExecutionCommandImpl();
        cmd.setLookup( "ksession1" );

        SetGlobalCommand setGlobal = new SetGlobalCommand( "list",
                                                           new WrappedList() );
        setGlobal.setOutIdentifier( "list" );

        cmd.getCommands().add( setGlobal );
        cmd.getCommands().add( new InsertObjectCommand( new Person( "baunax" ) ) );
        cmd.getCommands().add( new FireAllRulesCommand() );
        cmd.getCommands().add( new GetGlobalCommand( "list" ) );

        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
        StringWriter xml = new StringWriter();
View Full Code Here

        StatefulKnowledgeSession ksession = registerKnowledgeRuntime( "ksession1",
                                                                      rule );
        InsertObjectCommand cmd = new InsertObjectCommand( me );
        cmd.setOutIdentifier( "camel-rider" );
        cmd.setReturnObject( false );
        BatchExecutionCommandImpl script = new BatchExecutionCommandImpl( Arrays.asList( new GenericCommand< ? >[]{cmd} ) );

        ExecutionResults results = ksession.execute( script );
        handle = ((FactHandle) results.getFactHandle( "camel-rider" )).toExternalForm();
    }
View Full Code Here

TOP

Related Classes of org.drools.core.command.runtime.BatchExecutionCommandImpl

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.