Package org.drools.camel.testdomain

Examples of org.drools.camel.testdomain.Cheese


        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,
View Full Code Here


        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

        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",
View Full Code Here

        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

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

        List list = (List) result.getValue( "list1" );
        Cheese stilton25 = new Cheese( "stilton",
                                       30 );
        Cheese stilton30 = new Cheese( "stilton",
                                       35 );

        Set expectedList = new HashSet();
        expectedList.add( stilton25 );
        expectedList.add( stilton30 );
View Full Code Here

                                                   ExecutionResults.class );

        List list1 = (List) result.getValue( "list1" );
        assertEquals( 2,
                      list1.size() );
        assertTrue( list1.contains( new Cheese( "stilton",
                                                35 ) ) );
        assertTrue( list1.contains( new Cheese( "stilton",
                                                30 ) ) );

        List myFacts = (List) result.getValue( "myfacts" );
        assertEquals( 2,
                      list1.size() );
        assertTrue( myFacts.contains( new Cheese( "stilton",
                                                  35 ) ) );
        assertTrue( myFacts.contains( new Cheese( "stilton",
                                                  30 ) ) );

        List<FactHandle> factHandles = (List<FactHandle>) result.getFactHandle( "myfacts" );
        List list = new ArrayList();
        list.add( ksession.getObject( ((InternalFactHandle) factHandles.get( 0 )) ) );
        list.add( ksession.getObject( ((InternalFactHandle) factHandles.get( 1 )) ) );
        assertTrue( list.contains( new Cheese( "stilton",
                                               35 ) ) );
        assertTrue( list.contains( new Cheese( "stilton",
                                               30 ) ) );

        assertXMLEqual( getContent( "testInsertElementsWithReturnObjects.expected.1",
                                    factHandles.get( 0 ).toExternalForm(),
                                    factHandles.get( 1 ).toExternalForm() ),
View Full Code Here

        assertXMLEqual( getContent( "testSetGlobal.expected.1",
                                    ((FactHandle) result.getFactHandle( "outStilton" )).toExternalForm() ),
                        outXml );

        Cheese stilton = new Cheese( "stilton",
                                     30 );

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

        List list2 = (List) result.getValue( "list2" );
View Full Code Here

                        outXml );

        List resultsList = (List) result.getValue( "out-list" );
        assertEquals( 1,
                      resultsList.size() );
        assertEquals( new Cheese( "stilton",
                                  25 ),
                      resultsList.get( 0 ) );

    }
View Full Code Here

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

        List list = (List) result.getValue( "list1" );
        Cheese stilton25 = new Cheese( "stilton",
                                       30 );
        Cheese stilton30 = new Cheese( "stilton",
                                       35 );

        Set expectedList = new HashSet();
        expectedList.add( stilton25 );
        expectedList.add( stilton30 );
View Full Code Here

        getContent( "testQuery.expected.1" ); // just to force a tostring for comparison

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

        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 );
View Full Code Here

TOP

Related Classes of org.drools.camel.testdomain.Cheese

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.