Examples of FactData


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

    DroolsMVELFactory d = new DroolsMVELFactory();
  }

    public void testPopulateFactsWithInterfaces() throws Exception {
        Scenario sc = new Scenario();
        List facts = ls( new FactData( "List",
                                       "ls",
                                       new ArrayList(),
                                       false ) );

       List globals = ls( new FactData( "List",
                                       "ls",
                                       new ArrayList(),
                                       false ) );
        sc.fixtures.addAll( facts );
        sc.globals.addAll( globals );
View Full Code Here

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

    @Test
    public void testExecutionTrace() {
        Scenario sc = new Scenario();

        sc.getGlobals().add( new FactData( "A",
                                           "A",
                                           new ArrayList(),
                                           false ) );
        sc.getFixtures().add( new FactData( "B",
                                            "B",
                                            new ArrayList(),
                                            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 );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

            @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

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

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

                //Create new FieldData 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 ) {
                    if ( existingFactData.size() > 0 ) {
                        for ( FieldData fieldData : existingFactData.get( 0 ).getFieldData() )
                            fd.getFieldData().add( new FieldData( fieldData.getName(),
                                                                  "" ) );
                    }
                }

                return fd;
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

                i++;
            }

            this.variableClass = (String) suggestionCompletionEngine.getGlobalVariable( mCall.getVariable() );
        } else {
            FactData pattern = (FactData) scenario.getFactTypes().get( mCall.getVariable() );
            if ( pattern != null ) {
                List<String> methodList = suggestionCompletionEngine.getMethodNames( pattern.getType() );
                fieldCompletionTexts = new String[methodList.size()];
                fieldCompletionValues = new String[methodList.size()];
                int i = 0;
                for ( String methodName : methodList ) {
                    fieldCompletionTexts[i] = methodName;
                    fieldCompletionValues[i] = methodName;
                    i++;
                }
                this.variableClass = pattern.getType();
                this.isBoundFact = true;
            }
        }

        doLayout();
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

                    public void onClick(ClickEvent event) {
                        String text = factTypes.getItemText( factTypes.getSelectedIndex() );
                        if ( scenario.isFactNameReserved( text ) ) {
                            Window.alert( constants.TheName0IsAlreadyInUsePleaseChooseAnotherName( text ) );
                        } else {
                            FactData factData = new FactData( suggestionCompletionEngine.getGlobalVariable( text ),
                                                              text,
                                                              false );
                            scenario.getGlobals().add( factData );
                            parent.renderEditor();
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

         */
        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

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

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

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

            public void onClick(ClickEvent event) {
                //build up a list of what we have got, don't want to add it twice
                HashSet<String> existingFields = new HashSet<String>();
                if ( definitionList.size() > 0 ) {
                    FactData factData = (FactData) definitionList.get( 0 );
                    for ( FieldData fieldData : factData.getFieldData() ) {
                        existingFields.add( fieldData.getName() );
                    }

                }
                String[] fields = (String[]) suggestionCompletionEngine.getModelFields( type );
                final FormStylePopup pop = new FormStylePopup(); //NON-NLS
                pop.setTitle( constants.ChooseDotDotDot() );
                final ListBox fieldsListBox = new ListBox();
                for ( int i = 0; i < fields.length; i++ ) {
                    String field = fields[i];
                    if ( !existingFields.contains( field ) ) fieldsListBox.addItem( field );
                }

                Button ok = new Button( constants.OK() );
                ok.addClickHandler( new ClickHandler() {

                    public void onClick(ClickEvent event) {
                        String field = fieldsListBox.getItemText( fieldsListBox.getSelectedIndex() );
                        for ( Fixture fixture : definitionList ) {
                            if ( fixture instanceof FactData ) {
                                FactData factData = (FactData) fixture;
                                factData.getFieldData().add( new FieldData( field,
                                                                            "" ) );
                            }
                        }
                        render();
                        pop.hide();
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.testing.FactData

        RowIndexByFieldName rowIndexByFieldName = new RowIndexByFieldName();
        int col = 0;
        int totalCols = definitionList.size();
        for ( Fixture fixture : definitionList ) {
            if ( fixture instanceof FactData ) {
                final FactData factData = (FactData) fixture;

                // Set Header
                setWidget( 0,
                           ++col,
                           new SmallLabel( "[" + factData.getName() + "]" ) );

                Map<String, Integer> presentFields = new HashMap<String, Integer>();

                // Sets row name and delete button.
                for ( final FieldData fieldData : factData.getFieldData() ) {
                    // Avoid duplicate field rows, only one for each name.
                    if ( rowIndexByFieldName.doesNotContain( fieldData.getName() ) ) {
                        newRow( rowIndexByFieldName,
                                totalCols,
                                factData.getName(),
                                fieldData.getName() );
                    }

                    // Sets row data
                    int fieldRowIndex = rowIndexByFieldName.getRowIndex( fieldData.getName() );
                    setWidget( fieldRowIndex,
                               col,
                               editableCell( fieldData,
                                             factData,
                                             factData.getType(),
                                             this.executionTrace ) );
                    presentFields.remove( fieldData.getName() );
                }

                //
                for ( Map.Entry<String, Integer> entry : presentFields.entrySet() ) {
                    int fieldRow = ((Integer) entry.getValue()).intValue();
                    FieldData fieldData = new FieldData( (String) entry.getKey(),
                                                         "" );
                    factData.getFieldData().add( fieldData );
                    setWidget( fieldRow,
                               col,
                               editableCell( fieldData,
                                             factData,
                                             factData.getType(),
                                             this.executionTrace ) );
                }

                // Set Delete
                setWidget( rowIndexByFieldName.amountOrRows() + 1,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.