Package org.drools.ide.common.client.modeldriven.testing

Examples of org.drools.ide.common.client.modeldriven.testing.FactData


    }
    @SuppressWarnings("unchecked")
    @Test
    public void testGlobals() {
        List l = new ArrayList();
        l.add(new FactData("X", "d", new ArrayList(), true));
        l.add(new FactData("X", "c", new ArrayList(), true));
        l.add(new FactData("Q", "a", new ArrayList(), true));
        l.add(new FactData("Q", "b", new ArrayList(), true));

        ScenarioHelper hlp = new ScenarioHelper();
        Map m = hlp.lumpyMapGlobals(l);
        assertEquals(2, m.size());
        List fd = (List) m.get("X");
View Full Code Here


    @Test
    public void testRemoveField() {
        List fieldData = new ArrayList();
        fieldData.add(new FieldData("q", "1"));
        fieldData.add(new FieldData("w", "2"));
        FactData fd = new FactData("X", "x", fieldData, false);

        List fieldData2 = new ArrayList();
        fieldData2.add(new FieldData("q", "3"));
        fieldData2.add(new FieldData("w", "4"));
        fieldData2.add(new FieldData("x", "5"));
        FactData fd2 = new FactData("X", "x", fieldData2, false);

        List factData = new ArrayList();
        factData.add(fd);
        factData.add(fd2);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testEmptyMap() {
        //this should check that there is always a map present to force the GUI to show a "GIVEN" section.
        List<Fixture> fl = new ArrayList<Fixture>();
        fl.add(new FactData());
        fl.add(new ExecutionTrace());
        fl.add(new ExecutionTrace());

        ScenarioHelper hlp = new ScenarioHelper();
        List r = hlp.lumpyMap(fl);
View Full Code Here

  //want it in chunks

  public void testChunks() {
    List l = new ArrayList();
    l.add(new FactData("Q", "x", new ArrayList(), false));
    l.add(new FactData("Q", "y", new ArrayList(), false));
    l.add(new FactData("X", "a", new ArrayList(), false));
    l.add(new FactData("X", "b", new ArrayList(), false));
    ExecutionTrace ex1 = new ExecutionTrace();
    l.add(ex1);

    l.add(new FactData("Z", "z", new ArrayList(), false));
    l.add(new FactData("Q", "x", new ArrayList(), true));
    l.add(new FactData("Q", "y", new ArrayList(), true));
    l.add(new RetractFact("y"));

    VerifyFact vf1 = new VerifyFact();
    VerifyFact vf2 = new VerifyFact();
    VerifyRuleFired vr1 = new VerifyRuleFired();
    VerifyRuleFired vr2 = new VerifyRuleFired();
    l.add(vf1);
    l.add(vf2);
    l.add(vr1);
    l.add(vr2);

    ExecutionTrace ex2 = new ExecutionTrace();
    l.add(ex2);

    VerifyFact vf3 = new VerifyFact();
    l.add(vf3);

    ScenarioHelper hlp = new ScenarioHelper();

    List fx = hlp.lumpyMap(l);
    assertEquals(7, fx.size());

    Map first  = (Map) fx.get(0);
    assertEquals(2, first.size());
    List fdl = (List) first.get("Q");
    assertEquals(2, fdl.size());
    FactData fd = (FactData) fdl.get(0);
    assertEquals("x", fd.name);
    fd = (FactData) fdl.get(1);
    assertEquals("y", fd.name);

    fdl = (List) first.get("X");
View Full Code Here

  }

  public void testGlobals() {
    List l = new ArrayList();
    l.add(new FactData("X", "d", new ArrayList(), true));
    l.add(new FactData("X", "c", new ArrayList(), true));
    l.add(new FactData("Q", "a", new ArrayList(), true));
    l.add(new FactData("Q", "b", new ArrayList(), true));

    ScenarioHelper hlp = new ScenarioHelper();
    Map m = hlp.lumpyMapGlobals(l);
    assertEquals(2, m.size());
    List fd = (List) m.get("X");
View Full Code Here

  public void testRemoveField() {
    List fieldData = new ArrayList();
    fieldData.add(new FieldData("q", "1"));
    fieldData.add(new FieldData("w", "2"));
    FactData fd = new FactData("X", "x", fieldData, false);



    List fieldData2 = new ArrayList();
    fieldData2.add(new FieldData("q", "3"));
    fieldData2.add(new FieldData("w", "4"));
    fieldData2.add(new FieldData("x", "5"));
    FactData fd2 = new FactData("X", "x", fieldData2, false);

    List factData = new ArrayList();
    factData.add(fd);
    factData.add(fd2);
View Full Code Here

  }

  public void testEmptyMap() {
    //this should check that there is always a map present to force the GUI to show a "GIVEN" section.
    List<Fixture> fl = new ArrayList<Fixture>();
    fl.add(new FactData());
    fl.add(new ExecutionTrace());
    fl.add(new ExecutionTrace());

    ScenarioHelper hlp = new ScenarioHelper();
    List r = hlp.lumpyMap(fl);
View Full Code Here

            box.addItem( constants.Choose() );
        }
        int j = 0;
        for ( int i = 0; i < vars.size(); i++ ) {
            String var = vars.get( i );
            FactData f = (FactData) scenario.getFactTypes().get( var );
            String fieldType = sce.getFieldType( this.factType,
                                                 field.getFieldName() );
            if ( f.getType().equals( fieldType ) ) {
                if ( box.getItemCount() == 0 ) {
                    box.addItem( "..." );
                    j++;
                }
                box.addItem( "=" + var );
View Full Code Here

        List<String> vars = this.scenario.getFactNamesInScope( executionTrace,
                                                               true );
        if ( vars.size() > 0 ) {
            for ( int i = 0; i < vars.size(); i++ ) {
                String var = (String) vars.get( i );
                FactData f = (FactData) scenario.getFactTypes().get( var );
                String fieldType = sce.getFieldType( this.factType,
                                                     field.getFieldName() );
                if ( f.getType().equals( fieldType ) ) {
                    retour = true;
                    break;
                }
            }
        }
View Full Code Here

            box.addItem( constants.Choose() );
        }
        int j = 0;
        for ( int i = 0; i < vars.size(); i++ ) {
            String var = (String) vars.get( i );
            FactData f = (FactData) this.scenario.getFactTypes().get( var );
            String fieldType = null;
            if ( field.collectionType == null ) {
                fieldType = sce.getFieldType( this.factType,
                                              field.getName() );
            } else {
                fieldType = field.collectionType;
            }

            if ( f.getType().equals( fieldType ) ) {
                if ( box.getItemCount() == 0 ) {
                    box.addItem( "..." );
                    j++;
                }
                box.addItem( "=" + var );
View Full Code Here

TOP

Related Classes of org.drools.ide.common.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.