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

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


        l.add(new FactData("X", "a", new ArrayList(), false));
        l.add(new FactData("X", "b", new ArrayList(), false));
        l.add(new CallMethod("x","hello"));
        l.add(new CallMethod("x","helloItherWay"));
        l.add(new CallMethod("v","helloAgain"));
        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"));
        l.add(new CallMethod("x","hello"));


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


    @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);
        assertEquals(6, r.size());
        assertTrue(r.get(0) instanceof Map);
View Full Code Here

    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);
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);
    assertEquals(4, r.size());
    assertTrue(r.get(0) instanceof Map);
View Full Code Here

                    panel.add( new SmallLabel( verifyField.getExplanation() ) );
                    resultsDetail.add( panel );
                }

            } else if ( fixture instanceof ExecutionTrace ) {
                ExecutionTrace ex = (ExecutionTrace) fixture;
                if ( ex.getNumberOfRulesFired() == data.result.getScenario().getMaxRuleFirings() ) {
                    Window.alert( constants.MaxRuleFiringsReachedWarning(
                            data.result.getScenario().getMaxRuleFirings() ) );
                }
            }
View Full Code Here

    }

    private void ifFixturesSizeZeroThenAddExecutionTrace() {
        if ( getScenario().getFixtures().size() == 0 ) {
            getScenario().getFixtures().add( new ExecutionTrace() );
        }
    }
View Full Code Here

        List<Fixture> fixtures = scenarioHelper.lumpyMap( getScenario().getFixtures() );
        List<ExecutionTrace> listExecutionTrace = scenarioHelper.getExecutionTraceFor( fixtures );

        int layoutRow = 1;
        int executionTraceLine = 0;
        ExecutionTrace previousExecutionTrace = null;
        for ( final Fixture fixture : fixtures ) {
            if ( fixture instanceof ExecutionTrace ) {
                ExecutionTrace currentExecutionTrace = (ExecutionTrace) fixture;
                createWidgetForEditorLayout( editorLayout,
                                             layoutRow,
                                             0,
                                             scenarioWidgetComponentCreator.createExpectPanel( currentExecutionTrace ) );
View Full Code Here

                                             "40" ) );
        person.fieldData.add( new FieldData( "name",
                                             "michael" ) );

        sc.fixtures.add( person );
        sc.fixtures.add( new ExecutionTrace() );
        VerifyRuleFired vr = new VerifyRuleFired( "rule1",
                                                  1,
                                                  null );
        sc.fixtures.add( vr );

        VerifyFact vf = new VerifyFact();
        vf.name = "p";
        vf.fieldValues.add( new VerifyField( "name",
                                             "michael",
                                             "==" ) );
        vf.fieldValues.add( new VerifyField( "age",
                                             "42",
                                             "==" ) );
        sc.fixtures.add( vf );

        FactData cheese = new FactData();
        cheese.name = "cheese";
        cheese.type = "Cheese";
        cheese.fieldData.add( new FieldData( "price",
                                             "42" ) );
        sc.globals.add( cheese );

        ScenarioRunResult res = impl.runScenario( pkg.getName(),
                                                  sc ).result;
        assertEquals( null,
                      res.errors );
        assertNotNull( res.scenario );
        assertTrue( vf.wasSuccessful() );
        assertTrue( vr.wasSuccessful() );

        res = impl.runScenario( pkg.getName(),
                                sc ).result;
        assertEquals( null,
                      res.errors );
        assertNotNull( res.scenario );
        assertTrue( vf.wasSuccessful() );
        assertTrue( vr.wasSuccessful() );

        impl.ruleBaseCache.clear();
        res = impl.runScenario( pkg.getName(),
                                sc ).result;
        assertEquals( null,
                      res.errors );
        assertNotNull( res.scenario );
        assertTrue( vf.wasSuccessful() );
        assertTrue( vr.wasSuccessful() );

        //BuilderResult[] results = impl.buildPackage(pkg.getUUID(), null, true);
        //assertNull(results);

        rule1.updateContent( "Junk" );
        rule1.checkin( "" );

        impl.ruleBaseCache.clear();
        pkg.updateBinaryUpToDate( false );
        repo.save();
        res = impl.runScenario( pkg.getName(),
                                sc ).result;
        assertNotNull( res.errors );
        assertNull( res.scenario );

        assertTrue( res.errors.length > 0 );

        impl.createCategory( "/",
                             "sc",
                             "" );

        String scenarioId = impl.createNewRule( "sc1",
                                                "s",
                                                "sc",
                                                pkg.getName(),
                                                AssetFormats.TEST_SCENARIO );

        RuleAsset asset = impl.loadRuleAsset( scenarioId );
        assertNotNull( asset.content );
        assertTrue( asset.content instanceof Scenario );

        Scenario sc_ = (Scenario) asset.content;
        sc_.fixtures.add( new ExecutionTrace() );
        impl.checkinVersion( asset );
        asset = impl.loadRuleAsset( scenarioId );
        assertNotNull( asset.content );
        assertTrue( asset.content instanceof Scenario );
        sc_ = (Scenario) asset.content;
View Full Code Here

                                             "40" ) );
        person.fieldData.add( new FieldData( "name",
                                             "mic" ) );

        sc.fixtures.add( person );
        sc.fixtures.add( new ExecutionTrace() );
        VerifyRuleFired vr = new VerifyRuleFired( "rule1",
                                                  1,
                                                  null );
        sc.fixtures.add( vr );
View Full Code Here

                                             "40" ) );
        person.fieldData.add( new FieldData( "name",
                                             "michael" ) );

        sc.fixtures.add( person );
        sc.fixtures.add( new ExecutionTrace() );
        VerifyRuleFired vr = new VerifyRuleFired( "rule1",
                                                  1,
                                                  null );
        sc.fixtures.add( vr );

        VerifyFact vf = new VerifyFact();
        vf.name = "p";
        vf.fieldValues.add( new VerifyField( "name",
                                             "michael",
                                             "==" ) );
        vf.fieldValues.add( new VerifyField( "age",
                                             "42",
                                             "==" ) );
        sc.fixtures.add( vf );

        AssetItem scenario1 = pkg.addAsset( "scen1",
                                            "" );
        scenario1.updateFormat( AssetFormats.TEST_SCENARIO );
        scenario1.updateContent( ScenarioXMLPersistence.getInstance().marshal( sc ) );
        scenario1.checkin( "" );

        //now the bad scenario
        sc = new Scenario();
        person = new FactData();
        person.name = "p";
        person.type = "Wang";
        person.fieldData.add( new FieldData( "age",
                                             "40" ) );
        person.fieldData.add( new FieldData( "name",
                                             "michael" ) );

        sc.fixtures.add( person );
        sc.fixtures.add( new ExecutionTrace() );
        vr = new VerifyRuleFired( "rule2",
                                  1,
                                  null );
        sc.fixtures.add( vr );
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.testing.ExecutionTrace

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.