Examples of ExecutionResults


Examples of org.drools.runtime.ExecutionResults

        expectedXml += "</execution-results>\n";

        assertXMLEqual( expectedXml,
                        outXml );

        ExecutionResults result = (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML( outXml );

        List list = (List) result.getValue( "list" );
        Cheese stilton25 = new Cheese( "stilton",
                                       30 );
        Cheese stilton30 = new Cheese( "stilton",
                                       35 );
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        expectedXml += "</execution-results>\n";

        assertXMLEqual( expectedXml,
                        outXml );

        ExecutionResults result = (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML( outXml );
        Cheese stilton = new Cheese( "stilton",
                                     30 );

        assertNull( result.getValue( "list1" ) );

        List list2 = (List) result.getValue( "list2" );
        assertEquals( 1,
                      list2.size() );
        assertEquals( stilton,
                      list2.get( 0 ) );

        List list3 = (List) result.getValue( "outList3" );
        assertEquals( 1,
                      list3.size() );
        assertEquals( stilton,
                      list3.get( 0 ) );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        expectedXml += "</execution-results>\n";

        assertXMLEqual( expectedXml,
                outXml );

        ExecutionResults batchResult = (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML( outXml );

        Cheese stilton1 = new Cheese( "stilton",
                1 );
        Cheese cheddar1 = new Cheese( "cheddar",
                1 );
        Cheese stilton2 = new Cheese( "stilton",
                2 );
        Cheese cheddar2 = new Cheese( "cheddar",
                2 );

        Set set = new HashSet();
        List list = new ArrayList();
        list.add( stilton1 );
        list.add( cheddar1 );
        set.add( list );

        list = new ArrayList();
        list.add( stilton2 );
        list.add( cheddar2 );
        set.add( list );

        org.drools.runtime.rule.QueryResults results = (org.drools.runtime.rule.QueryResults) batchResult.getValue( "cheeses" );
        assertEquals( 2,
                results.size() );
        assertEquals( 2,
                results.getIdentifiers().length );
        Set newSet = new HashSet();
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        expectedXml += "</execution-results>";

        assertXMLEqual( expectedXml,
                        outXml );

        ExecutionResults result = (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML( outXml );
        List list = (List) result.getValue( "list" );
        Cheese stilton25 = new Cheese( "stilton",
                                       30 );
        Cheese stilton30 = new Cheese( "stilton",
                                       35 );
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        expectedXml += "  <fact-handle identifier=\"outBrie\" external-form=\"" + factHandle.toExternalForm() + "\" /> \n";
        expectedXml += "</execution-results>\n";
        assertXMLEqual( expectedXml,
                        outXml );

        ExecutionResults result = (ExecutionResults) BatchExecutionHelper.newXStreamMarshaller().fromXML( outXml );

        // brie should not have been added to the list
        List list = (List) result.getValue( "list" );
        Cheese stilton25 = new Cheese( "stilton",
                                       30 );
        Cheese stilton30 = new Cheese( "stilton",
                                       35 );

        Set expectedList = new HashSet();
        expectedList.add( stilton25 );
        expectedList.add( stilton30 );

        assertEquals( expectedList,
                      new HashSet( list ) );

        // brie should not have changed
        Cheese brie10 = new Cheese( "brie",
                                    10 );
        brie10.setOldPrice( 5 );
        assertEquals( brie10,
                      result.getValue( "outBrie" ) );
    }
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        setExec( ksession );

        String outXml = template.requestBody( "direct:exec",
                                              inXml,
                                              String.class );
        ExecutionResults result = template.requestBody( "direct:unmarshal",
                                                        outXml,
                                                        ExecutionResults.class );

        outXml = template.requestBody( "direct:exec",
                                       "<batch-execution><query out-identifier='matchingthings' name='results'/></batch-execution>",
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

                                              inXml,
                                              String.class );
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
       
        Thread.currentThread().setContextClassLoader( getClassLoader(ksession) );
        ExecutionResults result = template.requestBody( "direct:unmarshal",
                                                        outXml,
                                                        ExecutionResults.class );
        org.drools.definition.type.FactType fT = ksession.getKnowledgeBase().getFactType("org.drools.camel.testdomain","Cheese1");
       
        int price = (Integer)fT.get(result.getValue( "outStilton" ), "price");
        assertEquals( 30,
                      price );

        FactHandle factHandle = (FactHandle) result.getFactHandle( "outStilton" );
//        stilton = (Cheese) ksession.getObject( factHandle );
//        assertEquals( 30,
//                      stilton.getPrice() );
       
        String outXml2 = template.requestBody( "direct:execWithLookup",
                                              inXml2,
                                              String.class );
       
       
        Thread.currentThread().setContextClassLoader( getClassLoader(ksession2) );
        ExecutionResults result2 = template.requestBody( "direct:unmarshal",
                                                        outXml2,
                                                        ExecutionResults.class );
       
        org.drools.definition.type.FactType fT2 = ksession2.getKnowledgeBase().getFactType("org.drools.camel.testdomain","Cheese2");
       
        int price2 = (Integer)fT2.get(result2.getValue( "outStilton" ), "price");
        assertEquals( 35, price2 );
       
//        Cheese2 stilton2 = (Cheese2) result2.getValue( "outStilton" );
//        assertEquals( 35,
//                      stilton2.getPrice() );
//
          factHandle = (FactHandle) result2.getFactHandle( "outStilton" );
//        stilton2 = (Cheese2) ksession2.getObject( factHandle );
//        assertEquals( 35,
//                      stilton2.getPrice() );
       
       
        Thread.currentThread().setContextClassLoader( originalClassLoader );
       
        String expectedXml = "";
        expectedXml += "<execution-results>\n";
        expectedXml += "  <result identifier=\"outStilton\">\n";
        expectedXml += "    <org.drools.camel.testdomain.Cheese1>\n";
        expectedXml += "      <type>stilton</type>\n";
        expectedXml += "      <oldPrice>0</oldPrice>\n";
        expectedXml += "      <price>30</price>\n";
        expectedXml += "    </org.drools.camel.testdomain.Cheese1>\n";
        expectedXml += "  </result>\n";
        expectedXml += "  <fact-handle identifier=\"outStilton\" external-form=\"" + ((InternalFactHandle) result.getFactHandle( "outStilton" )).toExternalForm() + "\" /> \n";
        expectedXml += "</execution-results>\n";
       
        String expectedXml2 = "";
        expectedXml2 += "<execution-results>\n";
        expectedXml2 += "  <result identifier=\"outStilton\">\n";
        expectedXml2 += "    <org.drools.camel.testdomain.Cheese2>\n";
        expectedXml2 += "      <type>stilton</type>\n";
        expectedXml2 += "      <oldPrice>0</oldPrice>\n";
        expectedXml2 += "      <price>35</price>\n";
        expectedXml2 += "    </org.drools.camel.testdomain.Cheese2>\n";
        expectedXml2 += "  </result>\n";
        expectedXml2 += "  <fact-handle identifier=\"outStilton\" external-form=\"" + ((InternalFactHandle) result2.getFactHandle( "outStilton" )).toExternalForm() + "\" /> \n";
        expectedXml2 += "</execution-results>\n";

        assertXMLEqual( expectedXml,
                        outXml );
       
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        byte[] response = (byte[]) template.requestBody( "direct:test-with-session",
                                                         xml.toString() );
        assertNotNull( response );
        System.out.println( "response:\n" + new String( response ) );
        Unmarshaller unmarshaller = getJaxbContext().createUnmarshaller();
        ExecutionResults res = (ExecutionResults) unmarshaller.unmarshal( new ByteArrayInputStream( response ) );
        WrappedList resp = (WrappedList) res.getValue( "list" );
        assertNotNull( resp );

        assertEquals( resp.size(),
                      2 );
        assertEquals( "baunax",
View Full Code Here

Examples of org.drools.runtime.ExecutionResults

        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

Examples of org.drools.runtime.ExecutionResults

        setExec( ksession );

        String outXml = template.requestBody( "direct:exec",
                                              inXml,
                                              String.class );
        ExecutionResults result = template.requestBody( "direct:unmarshal",
                                                        outXml,
                                                        ExecutionResults.class );

        inXml = "";
        inXml += "<batch-execution>";
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.