use of org.drools.workbench.models.testscenarios.shared.ExecutionTrace in project drools-wb by kiegroup.
the class FixtureLayoutTest method testDeleteExecutionTraceButtonSomeExecutionTraceRenderedAlready.
@Test
public void testDeleteExecutionTraceButtonSomeExecutionTraceRenderedAlready() throws Exception {
final Scenario scenario = mock(Scenario.class);
final ExecutionTrace executionTrace = mock(ExecutionTrace.class);
final ScenarioParentWidget parentWidgetToRender = mock(ScenarioParentWidget.class);
testedLayout.addDeleteExecutionTraceButtonIfNotNull(scenario, executionTrace, parentWidgetToRender);
verify(testedLayout).setWidget(eq(0), eq(0), eq(deleteExecutionTraceButton));
verify(deleteExecutionTraceButton).init(scenario, executionTrace, parentWidgetToRender);
}
use of org.drools.workbench.models.testscenarios.shared.ExecutionTrace in project drools-wb by kiegroup.
the class AuditPageTest method testShowFiredRules.
@Test
public void testShowFiredRules() {
final ExecutionTrace executionTrace = mock(ExecutionTrace.class);
auditPage.showFiredRules(executionTrace);
verify(auditPageView).showFiredRules(executionTrace);
}
use of org.drools.workbench.models.testscenarios.shared.ExecutionTrace in project drools-wb by kiegroup.
the class FixtureLayout method render.
private void render(final Scenario scenario, final ScenarioParentWidget parentWidgetToRender) {
layoutRow = 1;
executionTraceLine = 0;
previousExecutionTrace = null;
for (final Fixture fixture : fixtures) {
if (fixture instanceof ExecutionTrace) {
ExecutionTrace currentExecutionTrace = (ExecutionTrace) fixture;
addExecutionTrace(currentExecutionTrace);
previousExecutionTrace = currentExecutionTrace;
} else if (fixture instanceof FixturesMap) {
// add delete execution trace button if scenario has more parts
addDeleteExecutionTraceButtonIfNotNull(scenario, previousExecutionTrace, parentWidgetToRender);
layoutRow = addGiven((FixturesMap) fixture);
} else if (fixture instanceof CallFixtureMap) {
layoutRow = addCallFixture((CallFixtureMap) fixture);
} else {
addFixtureList((FixtureList) fixture);
}
layoutRow++;
}
// add the last delete execution trace button
addDeleteExecutionTraceButtonIfNotNull(scenario, previousExecutionTrace, parentWidgetToRender);
addFooter();
}
use of org.drools.workbench.models.testscenarios.shared.ExecutionTrace in project drools by kiegroup.
the class ScenarioRunner method applyFixtures.
private void applyFixtures(final List<Fixture> fixtures, final ScenarioSettings scenarioSettings) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InvalidClockTypeException {
for (Iterator<Fixture> iterator = fixtures.iterator(); iterator.hasNext(); ) {
Fixture fixture = iterator.next();
if (fixture instanceof FactData) {
factPopulator.add(factPopulatorFactory.createFactPopulator((FactData) fixture));
} else if (fixture instanceof RetractFact) {
factPopulator.retractFact(((RetractFact) fixture).getName());
} else if (fixture instanceof CallMethod) {
workingMemoryWrapper.executeMethod((CallMethod) fixture);
} else if (fixture instanceof ActivateRuleFlowGroup) {
workingMemoryWrapper.activateRuleFlowGroup(((ActivateRuleFlowGroup) fixture).getName());
} else if (fixture instanceof ExecutionTrace) {
factPopulator.populate();
workingMemoryWrapper.executeSubScenario((ExecutionTrace) fixture, scenarioSettings);
} else if (fixture instanceof Expectation) {
factPopulator.populate();
workingMemoryWrapper.verifyExpectation((Expectation) fixture);
} else {
throw new IllegalArgumentException("Not sure what to do with " + fixture);
}
}
factPopulator.populate();
}
use of org.drools.workbench.models.testscenarios.shared.ExecutionTrace in project drools by kiegroup.
the class ScenarioRunnerTest method testIntegrationWithModify.
@Test
public void testIntegrationWithModify() throws Exception {
Scenario sc = new Scenario();
sc.getImports().addImport(new Import("org.drools.workbench.models.testscenarios.backend.Cheese"));
sc.getFixtures().add(new FactData("Cheese", "c1", Arrays.<Field>asList(new FieldData("price", "1")), false));
sc.getFixtures().add(new ExecutionTrace());
sc.getFixtures().add(new VerifyFact("c1", ls(new VerifyField("type", "rule1", "=="))));
sc.getFixtures().add(new FactData("Cheese", "c1", Arrays.<Field>asList(new FieldData("price", "42")), true));
sc.getFixtures().add(new ExecutionTrace());
sc.getFixtures().add(new VerifyFact("c1", ls(new VerifyField("type", "rule3", "=="))));
KieSession ksession = getKieSession("test_stateful.drl");
ScenarioRunner run = new ScenarioRunner(ksession);
run.run(sc);
assertTrue(sc.wasSuccessful());
}
Aggregations