Package org.drools.guvnor.client.modeldriven.testing

Examples of org.drools.guvnor.client.modeldriven.testing.ExecutionTrace


      this.sce = SuggestionCompletionCache.getInstance().getEngineFromCache(asset.metaData.packageName);

      Scenario scenario = (Scenario) asset.content;
      if (scenario.fixtures.size() == 0) {
        scenario.fixtures.add(new ExecutionTrace());
      }

      if (!asset.isreadonly) {
//        layout.setWidget(0, 0, new TestRunnerWidget(this, asset.metaData.packageName));
        layout.add(new TestRunnerWidget(this, asset.metaData.packageName));
View Full Code Here


    ScenarioHelper hlp = new ScenarioHelper();
    List fixtures = hlp.lumpyMap(scenario.fixtures);


        int layoutRow = 1;
        ExecutionTrace previousEx = null;
        for (int i = 0; i < fixtures.size(); i++) {
      final Object f = fixtures.get(i);
      if (f instanceof ExecutionTrace) {
        previousEx = (ExecutionTrace) f;
        HorizontalPanel h = new HorizontalPanel();
        h.add(getNewExpectationButton(previousEx, scenario));
        h.add(new SmallLabel(constants.EXPECT()));
        editorLayout.setWidget(layoutRow, 0, h);

                final ExecutionTrace et = (ExecutionTrace) previousEx;
                Image del = new ImageButton("images/delete_item_small.gif", constants.DeleteItem(), new ClickListener() {
                    public void onClick(Widget w) {
                         if ( Window.confirm(constants.AreYouSureYouWantToRemoveThisItem()) ) {
                             scenario.removeExecutionTrace( et );
                             renderEditor();
                         }
                    }
                });
                h.add(del);

        editorLayout.setWidget(layoutRow, 1, new ExecutionWidget(previousEx, showResults));
        //layout.setWidget(layoutRow, 2, getNewExpectationButton(previousEx, scenario, availableRules));
        editorLayout.getFlexCellFormatter().setHorizontalAlignment(layoutRow, 2, HasHorizontalAlignment.ALIGN_LEFT);

      } else if (f instanceof Map) {
        HorizontalPanel h = new HorizontalPanel();
        h.add(getNewDataButton(previousEx, scenario));
        h.add(new SmallLabel(constants.GIVEN()));


        editorLayout.setWidget(layoutRow, 0, h);

        layoutRow++;
        Map facts = (Map) f;
        VerticalPanel vert = new VerticalPanel();
            for (Iterator iterator = facts.entrySet().iterator(); iterator.hasNext();) {
                Map.Entry e = (Map.Entry) iterator.next();
                List factList = (List) facts.get(e.getKey());
                if (e.getKey().equals(ScenarioHelper.RETRACT_KEY)) {
                  vert.add(new RetractWidget(factList, scenario));
                } else {
                  vert.add(new DataInputWidget((String)e.getKey(), factList, false, scenario, sce, this));
                }
            }

            if (facts.size() > 0) {
              editorLayout.setWidget(layoutRow, 1, vert);
            } else {
              editorLayout.setWidget(layoutRow, 1, new HTML("<i><small>" + constants.AddInputDataAndExpectationsHere() + "</small></i>"));
            }
      } else {
        List l = (List) f;
        Fixture first = (Fixture) l.get(0);
        if (first instanceof VerifyFact) {
          doVerifyFacts(l, editorLayout, layoutRow, scenario);
        } else if (first instanceof VerifyRuleFired) {
          editorLayout.setWidget(layoutRow, 1, new VerifyRulesFiredWidget(l, scenario, showResults));
        }

      }
      layoutRow++;
    }

        //add more execution sections.
    Button addExecute = new Button(constants.MoreDotDot());
    addExecute.setTitle(constants.AddAnotherSectionOfDataAndExpectations());
    addExecute.addClickListener(new ClickListener() {
      public void onClick(Widget w) {
        scenario.fixtures.add(new ExecutionTrace());
        renderEditor();
      }
    });
        editorLayout.setWidget(layoutRow, 0, addExecute);
        //layout.getFlexCellFormatter().setHorizontalAlignment(layoutRow, 1, HasHorizontalAlignment.ALIGN_CENTER);
View Full Code Here

      } else if (fx instanceof RetractFact) {
        RetractFact f = (RetractFact)fx;
        this.workingMemory.retract(this.factHandles.get(f.name));
        this.populatedData.remove(f.name);
      } else if (fx instanceof ExecutionTrace) {
        ExecutionTrace executionTrace = (ExecutionTrace)fx;
        //create the listener to trace rules

        if (listener != null) wm.removeEventListener(listener); //remove the old
        listener = new TestingEventListener();
View Full Code Here

TOP

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