Package org.drools.guvnor.models.testscenarios.shared

Examples of org.drools.guvnor.models.testscenarios.shared.FieldData


    public FieldPopulator getFieldPopulator(Field field) throws ClassNotFoundException,
            InstantiationException,
            IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        if (field instanceof FieldData) {
            FieldData fieldData = (FieldData) field;
            if (fieldData.getValue() == null) {
                throw new IllegalArgumentException("Field value can not be null");
            } else {
                return getFieldDataPopulator(factObject,
                        fieldData);
            }
View Full Code Here


    @Test
    public void testDummyRunNoRules() throws Exception {
        typeResolver.addImport( "org.drools.guvnor.models.testscenarios.backend.Cheese" );

        List<Field> fieldData = new ArrayList<Field>();
        fieldData.add( new FieldData( "type",
                                      "cheddar" ) );
        fieldData.add( new FieldData( "price",
                                      "42" ) );
        FactData fact = new FactData( "Cheese",
                                      "c1",
                                      fieldData,
                                      false );
View Full Code Here

public class FactDataTest {
    @Test
    public void testAdd() {
        FactData fd = new FactData("x", "y", new ArrayList(), false );
        assertEquals(0, fd.getFieldData().size());
        fd.getFieldData().add(new FieldData("x", "y"));
        assertEquals(1, fd.getFieldData().size());
        fd.getFieldData().add(new FieldData("q", "x"));
        assertEquals(2, fd.getFieldData().size());
    }
View Full Code Here

    public void testPopulateFacts() throws Exception {
        FactData factData = new FactData(
                "Person",
                "p1",
                Arrays.<Field>asList(
                        new FieldData(
                                "name",
                                "mic" ),
                        new FieldData(
                                "age",
                                "=30 + 3" ) ),
                false );

        factPopulator.add( new NewFactPopulator( populatedData, getTypeResolver(), getClassLoader(), factData ) );
View Full Code Here

    }

    @Test
    public void testPopulateEnum() throws Exception {

        FieldData fieldData = new FieldData(
                "cheeseType",
                "CheeseType.CHEDDAR" );
        fieldData.setNature( FieldData.TYPE_ENUM );
        FactData factData = new FactData( "Cheese",
                                          "c1",
                                          asList( (Field) fieldData ),
                                          false );
View Full Code Here

        FactData cheeseFactData = new FactData(
                "Cheese",
                "c1",
                Arrays.<Field>asList(
                        new FieldData(
                                "type",
                                "cheddar" ),
                        new FieldData(
                                "price",
                                "42" ) ),
                false );

        factPopulator.add( new NewFactPopulator( populatedData, typeResolver, getClassLoader(), cheeseFactData ) );

        FactData outerFactData = new FactData(
                "OuterFact",
                "p1",
                Arrays.<Field>asList(
                        new FieldData(
                                "name",
                                "mic" ),
                        new FieldData(
                                "innerFact",
                                "=c1" ) ),
                false );

        factPopulator.add( new NewFactPopulator( populatedData, typeResolver, getClassLoader(), outerFactData ) );
View Full Code Here

        FactData outerFactData = new FactData(
                "OuterFact",
                "p1",
                Arrays.<Field>asList(
                        new FieldData(
                                "name",
                                "mic" ),
                        new FieldData(
                                "innerFact",
                                "=c1" ) ),
                false );

        factPopulator.add( new NewFactPopulator( populatedData, typeResolver, getClassLoader(), outerFactData ) );

        FactData cheeseFactData = new FactData(
                "Cheese",
                "c1",
                Arrays.<Field>asList(
                        new FieldData(
                                "type",
                                "cheddar" ),
                        new FieldData(
                                "price",
                                "42" ) ),
                false );

        factPopulator.add( new NewFactPopulator( populatedData, typeResolver, getClassLoader(), cheeseFactData ) );
View Full Code Here

                        getTypeResolver(),
                        getClassLoader(),
                        new FactData( "Cheese",
                                      "c1",
                                      Arrays.<Field>asList(
                                              new FieldData(
                                                      "price",
                                                      "" ) ),
                                      false ) ) );

        factPopulator.populate();
View Full Code Here

                        getClassLoader(),
                        new FactData(
                                "Cheese",
                                "x",
                                Arrays.<Field>asList(
                                        new FieldData(
                                                "type",
                                                null ),
                                        new FieldData(
                                                "price",
                                                "42" ) ),
                                false ) ) );

        factPopulator.populate();
View Full Code Here

                        getClassLoader(),
                        new FactData(
                                "Cheese",
                                "c1",
                                Arrays.<Field>asList(
                                        new FieldData(
                                                "type",
                                                "cheddar" ),
                                        new FieldData(
                                                "usedBy",
                                                "10-Jul-2008" ) ),
                                false ) ) );
        factPopulator.add(
                new NewFactPopulator(
                        populatedData,
                        getTypeResolver(),
                        getClassLoader(),
                        new FactData(
                                "OuterFact",
                                "p1",
                                Arrays.<Field>asList(
                                        new FieldData(
                                                "name",
                                                "mic" ),
                                        new FieldData(
                                                "innerFact",
                                                "=c1" ) ),
                                false ) ) );

        factPopulator.populate();
View Full Code Here

TOP

Related Classes of org.drools.guvnor.models.testscenarios.shared.FieldData

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.