Package org.drools.workbench.models.testscenarios.shared

Examples of org.drools.workbench.models.testscenarios.shared.ExecutionTrace


                      sc.getFixtures().indexOf( vf5 ) );

        sc = new Scenario();

        sc.getFixtures().add( vf );
        ExecutionTrace ex = new ExecutionTrace();
        sc.getFixtures().add( ex );
        sc.insertBetween( null,
                          vf2 );
        assertEquals( 0,
                      sc.getFixtures().indexOf( vf ) );
        assertEquals( 1,
                      sc.getFixtures().indexOf( vf2 ) );
        assertEquals( 2,
                      sc.getFixtures().indexOf( ex ) );
        assertEquals( 3,
                      sc.getFixtures().size() );

        sc.insertBetween( ex,
                          vf3 );
        assertEquals( 4,
                      sc.getFixtures().size() );
        assertEquals( 0,
                      sc.getFixtures().indexOf( vf ) );
        assertEquals( 1,
                      sc.getFixtures().indexOf( vf2 ) );
        assertEquals( 2,
                      sc.getFixtures().indexOf( ex ) );
        assertEquals( 3,
                      sc.getFixtures().indexOf( vf3 ) );

        ExecutionTrace ex2 = new ExecutionTrace();
        sc.getFixtures().add( ex2 );
        sc.insertBetween( ex,
                          vf4 );
        assertEquals( 6,
                      sc.getFixtures().size() );
View Full Code Here


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

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

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

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

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

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

        FactData fd3 = new FactData( "Z",
                                     "z",
                                     new ArrayList(),
                                     false );
        sc.getFixtures().add( fd3 );
        ExecutionTrace ex1 = new ExecutionTrace();
        FactData fd4 = new FactData( "I",
                                     "i",
                                     new ArrayList(),
                                     false );
        sc.getGlobals().add( fd4 );
View Full Code Here

                                           false ) );
        sc.getFixtures().add( new FactData( "Q",
                                            "q",
                                            null,
                                            false ) );
        sc.getFixtures().add( new ExecutionTrace() );

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

    @Test
    public void testCountSuccessFailures() {
        Scenario sc = new Scenario();
        sc.getFixtures().add( new FactData() );
        sc.getFixtures().add( new ExecutionTrace() );
        VerifyRuleFired vr = new VerifyRuleFired();
        vr.setSuccessResult( false );
        sc.getFixtures().add( vr );

        VerifyField vf = new VerifyField();
View Full Code Here

    @Test
    public void testTestingEventListener() throws Exception {
        Scenario sc = new Scenario();
        sc.getRules().add("foo");
        sc.getRules().add("bar");
        ExecutionTrace ext = new ExecutionTrace();

        sc.getFixtures().add(ext);

        PseudoClockScheduler clock = new PseudoClockScheduler();
        long time = new Date().getTime();
View Full Code Here

        run.run(sc);

        assertEquals(time,
                ksession.getSessionClock().getCurrentTime());

        ExecutionTrace ext = new ExecutionTrace();
        ext.setScenarioSimulatedDate(new Date("10-Jul-1974"));
        sc.getFixtures().add(ext);
        run = new ScenarioRunner(ksession);
        run.run(sc);

        long expected = ext.getScenarioSimulatedDate().getTime();
        assertEquals(expected,
                ksession.getSessionClock().getCurrentTime());
    }
View Full Code Here

                "p",
                new ArrayList(),
                false));
        sc.getFixtures().addAll(Arrays.asList(facts));

        ExecutionTrace executionTrace = new ExecutionTrace();

        sc.getRules().add("rule1");
        sc.getRules().add("rule2");
        sc.setInclusive(true);
        sc.getFixtures().add(executionTrace);

        Expectation[] assertions = new Expectation[5];

        assertions[0] = new VerifyFact("c1",
                ls(new VerifyField("type",
                        "cheddar",
                        "==")

                ));

        assertions[1] = new VerifyFact("p",
                ls(new VerifyField("name",
                        "rule1",
                        "=="),
                        new VerifyField("status",
                                "rule2",
                                "=="))

        );

        assertions[2] = new VerifyRuleFired("rule1",
                1,
                null);
        assertions[3] = new VerifyRuleFired("rule2",
                1,
                null);
        assertions[4] = new VerifyRuleFired("rule3",
                0,
                null);

        sc.getFixtures().addAll(Arrays.asList(assertions));

        KieSession ksession = getKieSession("test_rules2.drl");

        ScenarioRunner run = new ScenarioRunner(ksession);
        run.run(sc);

        assertEquals(2,
                executionTrace.getNumberOfRulesFired().intValue());

        assertTrue(sc.wasSuccessful());

        Thread.sleep(50);

        assertTrue((new Date()).after(sc.getLastRunResult()));
        assertTrue(executionTrace.getExecutionTimeResult() != null);

        assertTrue(executionTrace.getRulesFired().length > 0);
    }
View Full Code Here

                "p",
                new ArrayList(),
                false));
        sc.getFixtures().addAll(Arrays.asList(facts));

        ExecutionTrace executionTrace = new ExecutionTrace();

        sc.getRules().add("rule1");
        sc.getRules().add("rule2");
        sc.setInclusive(true);
        sc.getFixtures().add(executionTrace);

        Expectation[] assertions = new Expectation[5];

        assertions[0] = new VerifyFact("c1",
                ls(new VerifyField("type",
                        "cheddar",
                        "==")

                ));

        assertions[1] = new VerifyFact("p",
                ls(new VerifyField("name",
                        "rule1",
                        "=="),
                        new VerifyField("status",
                                "rule2",
                                "=="))

        );

        assertions[2] = new VerifyRuleFired("rule1",
                1,
                null);
        assertions[3] = new VerifyRuleFired("rule2",
                1,
                null);
        assertions[4] = new VerifyRuleFired("rule3",
                0,
                null);

        sc.getFixtures().addAll(Arrays.asList(assertions));

        KieSession ksession = getKieSession("test_rules_infinite_loop.drl");

        ScenarioRunner run = new ScenarioRunner(ksession);
        run.run(sc);

        assertEquals(sc.getMaxRuleFirings(),
                executionTrace.getNumberOfRulesFired().intValue());

    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.testscenarios.shared.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.