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

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


    @Test
    public void testIntegrationWithRetract() 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",
                        "46"),
                        new FieldData("type",
                                "XXX")),
                false));
        sc.getFixtures().add(new FactData("Cheese",
                "c2",
                Arrays.<Field>asList(new FieldData("price",
                        "42")),
                false));
        sc.getFixtures().add(new ExecutionTrace());
View Full Code Here


        run.run(scenario);

    }

    private Expectation[] populateScenarioForFailure(Scenario sc) {
        FactData[] facts = new FactData[]{new FactData("Cheese",
                "c1",
                Arrays.<Field>asList(new FieldData("type",
                        "cheddar"),
                        new FieldData("price",
                                "42")),
                false)

        };
        sc.getFixtures().addAll(Arrays.asList(facts));
        sc.getGlobals().add(new FactData("Person",
                "p",
                new ArrayList(),
                false));

        ExecutionTrace executionTrace = new ExecutionTrace();
View Full Code Here

            @Override
            public Fixture getFixture() {
                String factName = valueWidget.getItemText( valueWidget.getSelectedIndex() );
                String type = scenario.getVariableTypes().get( factName );

                return new FactData( type,
                                     factName,
                                     true );

            }
View Full Code Here

            }

            @Override
            public Fixture getFixture() {
                String factType = valueWidget.getItemText( valueWidget.getSelectedIndex() );
                FactData factData = new FactData(
                        factType,
                        factNameTextBox.getText(),
                        false );

                //Create new Field objects for new Fixture based upon the first existing of the same data-type
                //Only the "first" existing of the same data-type is checked as second, third etc should have been
                //based upon the first if they were all created after this fix for GUVNOR-1139 was implemented.
                List<FactData> existingFactData = scenario.getFactTypesToFactData().get( factType );
                if ( existingFactData != null && existingFactData.size() > 0 ) {
                    for ( Field field : existingFactData.get( 0 ).getFieldData() ) {
                        factData.getFieldData().add(
                                new FieldPlaceHolder( field.getName() ) );
                    }
                }

                return factData;
View Full Code Here

                                                                 CallMethodWidget.this.variableClass = (String) CallMethodWidget.this.oracle.getGlobalVariable( mCall.getVariable() );
                                                             }
                                                         } );
        } else {

            final FactData pattern = (FactData) scenario.getFactTypes().get( mCall.getVariable() );
            if ( pattern != null ) {
                this.oracle.getMethodInfos( pattern.getType(),
                                            new Callback<List<MethodInfo>>() {
                                                @Override
                                                public void callback( final List<MethodInfo> methodInfos ) {
                                                    CallMethodWidget.this.fieldCompletionTexts = new String[ methodInfos.size() ];
                                                    CallMethodWidget.this.fieldCompletionValues = new String[ methodInfos.size() ];
                                                    int i = 0;
                                                    for ( MethodInfo methodInfo : methodInfos ) {
                                                        CallMethodWidget.this.fieldCompletionTexts[ i ] = methodInfo.getName();
                                                        CallMethodWidget.this.fieldCompletionValues[ i ] = methodInfo.getNameWithParameters();
                                                        i++;
                                                    }
                                                    CallMethodWidget.this.variableClass = pattern.getType();
                                                    CallMethodWidget.this.isBoundFact = true;
                                                }
                                            } );
            }
        }
View Full Code Here

            box.addItem( CommonConstants.INSTANCE.Choose() );
        }
        int j = 0;
        for ( int i = 0; i < vars.size(); i++ ) {
            String var = vars.get( i );
            FactData f = scenario.getFactTypes().get( var );
            String fieldType = oracle.getFieldType( this.factType,
                                                    field.getFieldName() );
            if ( f.getType().equals( fieldType ) ) {
                if ( box.getItemCount() == 0 ) {
                    box.addItem( "..." );
                    j++;
                }
                box.addItem( "=" + var );
View Full Code Here

        List<String> vars = this.scenario.getFactNamesInScope( executionTrace,
                                                               true );
        if ( vars.size() > 0 ) {
            for ( int i = 0; i < vars.size(); i++ ) {
                String var = vars.get( i );
                FactData f = scenario.getFactTypes().get( var );
                String fieldType = oracle.getFieldType( this.factType,
                                                        field.getFieldName() );
                if ( f.getType().equals( fieldType ) ) {
                    retour = true;
                    break;
                }
            }
        }
View Full Code Here

    public void build( final String headerText,
                       final Fact fact ) {

        if ( fact instanceof FactData ) {
            FactData factData = (FactData) fact;
            widget.setWidget( 0,
                              ++col,
                              new SmallLabel( "[" + factData.getName() + "]" ) );
        } else {
            col++;
        }

        widget.setWidget(
View Full Code Here

         */
        final ListBox listVariable = new ListBox();
        List<String> vars = model.getFactNamesInScope( ex,
                                                       true );
        for ( String v : vars ) {
            FactData factData = (FactData) model.getFactTypes().get( v );
            if ( factData.getType().equals( this.methodParameter.type ) ) {
                // First selection is empty
                if ( listVariable.getItemCount() == 0 ) {
                    listVariable.addItem( "..." );
                }

View Full Code Here

        List<String> vars = model.getFactNamesInScope( ex,
                                                       true );
        for ( String v : vars ) {
            boolean createButton = false;
            Button variable = new Button( TestScenarioConstants.INSTANCE.BoundVariable() );
            FactData factData = (FactData) model.getFactTypes().get( v );
            if ( factData.getType().equals( this.parameterType ) ) {
                createButton = true;
            }
            if ( createButton == true ) {
                form.addAttribute( TestScenarioConstants.INSTANCE.BoundVariable() + ":",
                                   variable );
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.testscenarios.shared.FactData

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.