Package org.drools.guvnor.client.modeldriven.testing

Examples of org.drools.guvnor.client.modeldriven.testing.FieldData


    public void testIntgerationStateful() throws Exception {
        Scenario sc = new Scenario();
        sc.fixtures.add( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "price",
                                                          "1" ) ),
                                       false ) );
        ExecutionTrace ex = new ExecutionTrace();
        sc.fixtures.add( ex );
        sc.fixtures.add( new FactData( "Cheese",
                                       "c2",
                                       ls( new FieldData( "price",
                                                          "2" ) ),
                                       false ) );
        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule1",
View Full Code Here


    public void testIntegrationWithModify() throws Exception {
        Scenario sc = new Scenario();
        sc.fixtures.add( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "price",
                                                          "1" ) ),
                                       false ) );

        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule1",
                                                              "==" ) ) ) );

        sc.fixtures.add( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "price",
                                                          "42" ) ),
                                       true ) );
        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
View Full Code Here

    public void testIntegrationWithRetract() throws Exception {
        Scenario sc = new Scenario();
        sc.fixtures.add( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "price",
                                                          "46" ),
                                           new FieldData( "type",
                                                          "XXX" ) ),
                                       false ) );
        sc.fixtures.add( new FactData( "Cheese",
                                       "c2",
                                       ls( new FieldData( "price",
                                                          "42" ) ),
                                       false ) );
        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
View Full Code Here

    }

  private Expectation[] populateScenarioForFailure(Scenario sc) {
    FactData[] facts = new FactData[]{new FactData( "Cheese",
                                                        "c1",
                                                        ls( new FieldData( "type",
                                                                           "cheddar" ),
                                                            new FieldData( "price",
                                                                           "42" ) ),
                                                        false )

        };
        sc.fixtures.addAll( Arrays.asList( facts ) );
View Full Code Here



  Object populateFields(FactData fact, Map<String, Object> factData, Object factObject) {
    for (int i = 0; i < fact.fieldData.size(); i++) {
      FieldData field = (FieldData) fact.fieldData.get(i);
      Object val;
      if (field.value != null && !field.value.equals("")) {
        if (field.value.startsWith("=")) {
          // eval the val into existence
          val = eval(field.value.substring(1), factData);
View Full Code Here



  Object populateFields(FactData fact, Map<String, Object> factData, Object factObject) {
    for (int i = 0; i < fact.fieldData.size(); i++) {
      FieldData field = (FieldData) fact.fieldData.get(i);
      Object val;
      if (field.value != null && !field.value.equals("")) {
        if (field.value.startsWith("=")) {
          // eval the val into existence
          val = eval(field.value.substring(1), factData);
View Full Code Here



  Object populateFields(FactData fact, Map<String, Object> factData, Object factObject) {
    for (int i = 0; i < fact.fieldData.size(); i++) {
      FieldData field = (FieldData) fact.fieldData.get(i);
      Object val;
      if (field.value != null && !field.value.equals("")) {
        if (field.value.startsWith("=")) {
          // eval the val into existence
          val = eval(field.value.substring(1), factData);
View Full Code Here

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

    public void testPopulateFacts() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "price",
                                                          "42" ) ),
                                       false ),
                         new FactData( "Person",
                                       "p1",
                                       ls( new FieldData( "name",
                                                          "mic" ),
                                           new FieldData( "age",
                                                          "=30 + 3" ) ),
                                       false ) );

        sc.fixtures.addAll( facts );
        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
View Full Code Here

    public void testPopulateNested() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "type",
                                                          "cheddar" ),
                                           new FieldData( "price",
                                                          "42" ) ),
                                       false ),
                         new FactData( "OuterFact",
                                       "p1",
                                       ls( new FieldData( "name",
                                                          "mic" ),
                                           new FieldData( "innerFact",
                                                          "=c1" ) ),
                                       false ) );

        sc.fixtures.addAll( facts );
        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.testing.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.