Search in sources :

Example 11 with Fixture

use of org.drools.workbench.models.testscenarios.shared.Fixture in project drools-wb by kiegroup.

the class RetractWidget method render.

private void render() {
    clear();
    getCellFormatter().setStyleName(0, 0, "modeller-fact-TypeHeader");
    getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
    setStyleName("modeller-fact-pattern-Widget");
    setWidget(0, 0, new SmallLabel(TestScenarioConstants.INSTANCE.DeleteFacts()));
    getFlexCellFormatter().setColSpan(0, 0, 2);
    int row = 1;
    for (Fixture fixture : retractList) {
        if (fixture instanceof RetractFact) {
            final RetractFact retractFact = (RetractFact) fixture;
            setWidget(row, 0, new SmallLabel(retractFact.getName()));
            setWidget(row, 1, new DeleteButton(retractFact));
            row++;
        }
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(this);
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) Fixture(org.drools.workbench.models.testscenarios.shared.Fixture) RetractFact(org.drools.workbench.models.testscenarios.shared.RetractFact)

Example 12 with Fixture

use of org.drools.workbench.models.testscenarios.shared.Fixture in project drools-wb by kiegroup.

the class ScenarioHelper method lumpyMap.

/**
 * Called lumpy map - as this takes a flat list of fixtures, and groups
 * things together. It will return a list - of which each element will
 * either be a list - or a map. If its a map - then its a map of FactData to
 * the fact type. If its a list, then it will be expectations or
 * retractions.
 * <p/>
 * Man, this will be so much nicer with generics.
 * @return List<List<VeryifyRuleFired or VerifyFact or RetractFact> OR
 *         Map<String, List<FactData>> OR ExecutionTrace>
 */
public List<Fixture> lumpyMap(final List<Fixture> fixtures) {
    List<Fixture> output = new ArrayList<Fixture>();
    FixturesMap dataInput = new FixturesMap();
    CallFixtureMap callOnDataInput = new CallFixtureMap();
    FixtureList verifyFact = new FixtureList();
    FixtureList verifyRule = new FixtureList();
    FixtureList retractFacts = new FixtureList();
    for (Fixture fixture : fixtures) {
        if (fixture instanceof FactData) {
            accumulateDataForFactData(dataInput, (FactData) fixture);
        } else if (fixture instanceof CallMethod) {
            accumulateCallMethod(callOnDataInput, (CallMethod) fixture);
        } else if (fixture instanceof ActivateRuleFlowGroup) {
            accumulateDataForActivateRuleFlowGroup(dataInput, fixture);
        } else if (fixture instanceof RetractFact) {
            retractFacts.add(fixture);
        } else if (fixture instanceof VerifyRuleFired) {
            verifyRule.add(fixture);
        } else if (fixture instanceof VerifyFact) {
            verifyFact.add(fixture);
        } else if (fixture instanceof ExecutionTrace) {
            gatherFixtures(output, dataInput, callOnDataInput, verifyFact, verifyRule, retractFacts, false);
            output.add(fixture);
            verifyRule = new FixtureList();
            verifyFact = new FixtureList();
            retractFacts = new FixtureList();
            callOnDataInput = new CallFixtureMap();
            dataInput = new FixturesMap();
        }
    }
    gatherFixtures(output, dataInput, callOnDataInput, verifyFact, verifyRule, retractFacts, true);
    return output;
}
Also used : VerifyRuleFired(org.drools.workbench.models.testscenarios.shared.VerifyRuleFired) ArrayList(java.util.ArrayList) ExecutionTrace(org.drools.workbench.models.testscenarios.shared.ExecutionTrace) ActivateRuleFlowGroup(org.drools.workbench.models.testscenarios.shared.ActivateRuleFlowGroup) CallMethod(org.drools.workbench.models.testscenarios.shared.CallMethod) CallFixtureMap(org.drools.workbench.models.testscenarios.shared.CallFixtureMap) FactData(org.drools.workbench.models.testscenarios.shared.FactData) FixturesMap(org.drools.workbench.models.testscenarios.shared.FixturesMap) Fixture(org.drools.workbench.models.testscenarios.shared.Fixture) VerifyFact(org.drools.workbench.models.testscenarios.shared.VerifyFact) FixtureList(org.drools.workbench.models.testscenarios.shared.FixtureList) RetractFact(org.drools.workbench.models.testscenarios.shared.RetractFact)

Aggregations

Fixture (org.drools.workbench.models.testscenarios.shared.Fixture)12 ArrayList (java.util.ArrayList)5 FactData (org.drools.workbench.models.testscenarios.shared.FactData)5 Test (org.junit.Test)5 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)5 HashMap (java.util.HashMap)4 ActivateRuleFlowGroup (org.drools.workbench.models.testscenarios.shared.ActivateRuleFlowGroup)4 ExecutionTrace (org.drools.workbench.models.testscenarios.shared.ExecutionTrace)4 Import (org.kie.soup.project.datamodel.imports.Import)4 Imports (org.kie.soup.project.datamodel.imports.Imports)4 Mockito.anyString (org.mockito.Mockito.anyString)4 FixturesMap (org.drools.workbench.models.testscenarios.shared.FixturesMap)3 RetractFact (org.drools.workbench.models.testscenarios.shared.RetractFact)3 VerifyFact (org.drools.workbench.models.testscenarios.shared.VerifyFact)3 VerifyRuleFired (org.drools.workbench.models.testscenarios.shared.VerifyRuleFired)3 CallFixtureMap (org.drools.workbench.models.testscenarios.shared.CallFixtureMap)2 CallMethod (org.drools.workbench.models.testscenarios.shared.CallMethod)2 Expectation (org.drools.workbench.models.testscenarios.shared.Expectation)2 Field (org.drools.workbench.models.testscenarios.shared.Field)2 FixtureList (org.drools.workbench.models.testscenarios.shared.FixtureList)2