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

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



  public void testExecutionTrace() {
        Scenario sc = new Scenario();

        sc.globals.add(new FactData("A", "A", new ArrayList(), false));
        sc.fixtures.add(new FactData("B", "B", new ArrayList(), true));
        sc.fixtures.add(new FactData("C", "C", new ArrayList(), true));
        ExecutionTrace ex1 = new ExecutionTrace();
        sc.fixtures.add(ex1);
        sc.fixtures.add(new VerifyFact());
        sc.fixtures.add(new RetractFact());
        sc.fixtures.add(new FactData("D", "D", new ArrayList(), false));
        sc.fixtures.add(new FactData("E", "E", new ArrayList(), false));
        ExecutionTrace ex2 = new ExecutionTrace();
        sc.fixtures.add(ex2);
        sc.fixtures.add(new VerifyFact());
        sc.fixtures.add(new FactData("F", "F", new ArrayList(), false));
        ExecutionTrace ex3 = new ExecutionTrace();
        sc.fixtures.add(ex3);

        assertEquals( 11,
                      sc.fixtures.size() );
View Full Code Here


    VerifyRuleFired vf1 = new VerifyRuleFired();
    VerifyRuleFired vf2 = new VerifyRuleFired();
    VerifyRuleFired vf3 = new VerifyRuleFired();

    FactData fd = new FactData();

    sc.fixtures.add(vf1);
    sc.fixtures.add(vf2);
    sc.fixtures.add(vf3);
    sc.globals.add(fd);
View Full Code Here

  }

  public void testMapFactTypes() {
    Scenario sc = new Scenario();
    sc.fixtures.add(new FactData("X", "q", null, false));
    sc.globals.add(new FactData("Q", "x", null, false));

    Map r = sc.getVariableTypes();
    assertEquals(2, r.size());

    assertEquals("X", r.get("q"));
View Full Code Here

  }

  public void testVariablesInScope() {
    Scenario sc = new Scenario();
    sc.globals.add(new FactData("X", "x", new ArrayList(), false));

    sc.fixtures.add(new FactData("Q", "q", new ArrayList(), true));
    sc.fixtures.add(new FactData("Z", "z", new ArrayList(), false));
    ExecutionTrace ex1 = new ExecutionTrace();

    sc.fixtures.add(ex1);
    sc.fixtures.add(new RetractFact("z"));
    sc.fixtures.add(new FactData("Y", "y", new ArrayList(), false));

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

    List l = sc.getFactNamesInScope(ex1, true);
View Full Code Here

  }

  public void testAllowRemoveFact() {
    Scenario sc = new Scenario();

    FactData fd1 = new FactData("X", "x", new ArrayList(), false);
    sc.fixtures.add(fd1);
    FactData fd2 = new FactData("Q", "q", new ArrayList(), false);
    sc.fixtures.add(fd2);
    FactData fd3 = new FactData("Z", "z", new ArrayList(), false);
    sc.fixtures.add(fd3);
    ExecutionTrace ex1 = new ExecutionTrace();
    FactData fd4 = new FactData("I", "i", new ArrayList(), false);
    sc.globals.add(fd4);

    sc.fixtures.add(ex1);
    sc.fixtures.add(new RetractFact("z"));
    sc.fixtures.add(new FactData("Z", "z", new ArrayList(), true));
    sc.fixtures.add(new VerifyFact("q", new ArrayList()));

    assertFalse(sc.isFactNameUsed(fd1));
    assertTrue(sc.isFactNameUsed(fd2));
    assertTrue(sc.isFactNameUsed(fd3));
View Full Code Here

    assertFalse(sc.isFactNameUsed(fd4));
  }

  public void testIsFactNameUsed() {
    Scenario sc = new Scenario();
    sc.globals.add(new FactData("X", "x", null, false));
    sc.fixtures.add(new FactData("Q", "q", null, false));
    sc.fixtures.add(new ExecutionTrace());

    assertTrue(sc.isFactNameExisting("x"));
    assertTrue(sc.isFactNameExisting("q"));
    assertFalse(sc.isFactNameExisting("w"));
View Full Code Here

    assertFalse(sc.isFactNameExisting("w"));
  }

  public void testCountSuccessFailures() {
    Scenario sc = new Scenario();
    sc.fixtures.add(new FactData());
    sc.fixtures.add(new ExecutionTrace());
    VerifyRuleFired vr = new VerifyRuleFired();
    vr.successResult = false;
    sc.fixtures.add(vr);
View Full Code Here

    DroolsMVELFactory d = new DroolsMVELFactory();
  }

    public void testPopulateFactsWithInterfaces() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "List",
                                       "ls",
                                       new ArrayList(),
                                       false ) );

       List globals = ls( new FactData( "List",
                                       "ls",
                                       new ArrayList(),
                                       false ) );
        sc.fixtures.addAll( facts );
        sc.globals.addAll( globals );
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" ) ),
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" ) ),
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.testing.FactData

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.