Examples of ExecutionResults


Examples of org.apache.hadoop.hbase.hbql.client.ExecutionResults

                          "select keyval, val1+val1, val2+1 FROM tab3 ";
        showValues();

        HPreparedStatement stmt = connection.prepareStatement(q1);

        ExecutionResults executionResults = stmt.execute();

        System.out.println(executionResults);

        showValues();
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        setExec( ksession );

        String outXml = execContent( "testListenForChanges.in.1" );

        outXml = execContent( "testListenForChanges.in.2" );
        ExecutionResults result = unmarshalOutXml( outXml,
                                                   ExecutionResults.class );

        assertXMLEqual( getContent( "testListenForChanges.expected.1",
                                    ((FactHandle) result.getFactHandle( "changes" )).toExternalForm(),
                                    ((FactHandle) result.getFactHandle( "person" )).toExternalForm() ),
                        outXml );

        ChangeCollector collector = (ChangeCollector) result.getValue( "changes" );
        Cheese c = (Cheese) collector.getChanges().get( 0 );
        assertEquals( 42,
                      c.getPrice() );

        result = execContent( "testListenForChanges.in.3",
                              ExecutionResults.class );

        collector = (ChangeCollector) result.getValue( "changes" );
        assertEquals( "stilton",
                      collector.getRetracted().get( 0 ) );

    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        setExec( ksession );

        String outXml = execContent( "testInsertWithDefaults.in.1" );

        ExecutionResults result = unmarshalOutXml( outXml,
                                                   ExecutionResults.class );

        Cheese stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );

        FactHandle factHandle = (FactHandle) result.getFactHandle( "outStilton" );
        stilton = (Cheese) ksession.getObject( factHandle );
        assertEquals( 30,
                      stilton.getPrice() );

        String expectedXml = getContent( "testInsertWithDefaults.expected.1",
                                         ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() );

        assertXMLEqual( expectedXml,
                        outXml );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        setExec( ksession );

        String outXml = execContent( "testInsertWithReturnObjectFalse.in.1" );
        ExecutionResults result = unmarshalOutXml( outXml,
                                                   ExecutionResults.class );

        String expectedXml = getContent( "testInsertWithReturnObjectFalse.expected.1",
                                         ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() );

        assertXMLEqual( expectedXml,
                        outXml );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        assertXMLEqual( getContent( "testFactHandleReturn.expected.1",
                                    fh.toExternalForm() ),
                        outXml );

        ExecutionResults result = unmarshalOutXml( outXml,
                                                   ExecutionResults.class );

        List outList = (List) result.getValue( "out-list" );
        assertEquals( 1,
                      outList.size() );
        assertEquals( fh.toExternalForm(),
                      ((FactHandle) outList.get( 0 )).toExternalForm() );
        assertNotSame( fh,
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        str += "end\n";

        StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        setExec( ksession );

        ExecutionResults result = execContent( "testGetObject.in.1",
                                               ExecutionResults.class );

        Cheese stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );

        String outXml = execContent( "testGetObject.in.2",
                                     ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() );
        result = unmarshalOutXml( outXml,
                                  ExecutionResults.class );

        stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        str += "end\n";

        StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        setExec( ksession );

        ExecutionResults result = execContent( "testRetractObject.in.1",
                                               ExecutionResults.class );

        Cheese stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );

        String outXml = execContent( "testRetractObject.in.2",
                                     ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() );

        outXml = execContent( "testRetractObject.in.3",
                              ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() );
        result = unmarshalOutXml( outXml,
                                  ExecutionResults.class );

        assertNull( result.getValue( "outStilton" ) );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        StatefulKnowledgeSession ksession = getStatefulKnowledgeSession( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        setExec( ksession );

        String outXml = execContent( "testModifyObject.in.1" );
        ExecutionResults result = unmarshalOutXml( outXml,
                                                   ExecutionResults.class );

        String stiltonfh = ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm();

        Cheese stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );

        String expectedXml = getContent( "testModifyObject.expected.1",
                                         stiltonfh );

        assertXMLEqual( expectedXml,
                        outXml );

        execContent( "testModifyObject.in.2",
                     ExecutionResults.class,
                     stiltonfh );

        result = execContent( "testModifyObject.in.3",
                              ExecutionResults.class,
                              stiltonfh );

        stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( 42,
                      stilton.getOldPrice() );
        assertEquals( 55,
                      stilton.getPrice() );

        //now test for code injection:
        ModifyCommand.ALLOW_MODIFY_EXPRESSIONS = false;

        execContent( "testModifyObject.in.4",
                     ExecutionResults.class,
                     stiltonfh );

        ModifyCommand.ALLOW_MODIFY_EXPRESSIONS = true;

        // should be the same as before
        result = execContent( "testModifyObject.in.5",
                              ExecutionResults.class,
                              stiltonfh );

        // The value gets turned into a literal to avoid injection
        stilton = (Cheese) result.getValue( "outStilton" );
        assertEquals( "throwException()",
                      stilton.getType() );

    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session",
                                                        xmlReq.toString() );
        assertNotNull( xmlResp );
        System.out.println( new String( xmlResp ) );

        ExecutionResults resp = (ExecutionResults) getJaxbContext().createUnmarshaller().unmarshal( new ByteArrayInputStream( xmlResp ) );
        assertNotNull( resp );

        assertEquals( 3,
                      resp.getIdentifiers().size() );
        assertNotNull( resp.getValue( "person1" ) );
        assertNotNull( resp.getValue( "person2" ) );
        assertNotNull( resp.getValue( "person3" ) );

        assertNotNull( resp.getFactHandle( "person1" ) );
        assertNotNull( resp.getFactHandle( "person2" ) );
        assertNotNull( resp.getFactHandle( "person3" ) );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        System.out.println( xmlReq.toString() );

        byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session",
                                                        xmlReq.toString() );

        ExecutionResults resp = (ExecutionResults) getJaxbContext().createUnmarshaller().unmarshal( new ByteArrayInputStream( xmlResp ) );
        assertNotNull( resp );

        assertEquals( 1,
                      resp.getIdentifiers().size() );

        assertNotNull( resp.getValue( "hadrian" ) );
    }
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.