Examples of RuleModel


Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      asf1f1Clone.value );
    }

    @Test
    public void testActionUpdateField() {
        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionUpdateField auf0 = new ActionUpdateField();
        auf0.variable = "$t0";
        ActionFieldValue auf0f0 = new ActionFieldValue( "AUF0F0",
                                                        "AUF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf0.addFieldValue( auf0f0 );
        ActionFieldValue auf0f1 = new ActionFieldValue( "AUF0F1",
                                                        "AUF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf0.addFieldValue( auf0f1 );
        model.rhs[0] = auf0;

        ActionUpdateField auf1 = new ActionUpdateField();
        auf1.variable = "$t1";
        ActionFieldValue auf1f0 = new ActionFieldValue( "AUF1F0",
                                                        "AUF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf1.addFieldValue( auf1f0 );
        ActionFieldValue auf1f1 = new ActionFieldValue( "AUF1F1",
                                                        "AUF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf1.addFieldValue( auf1f1 );
        model.rhs[1] = auf1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      auf1f1Clone.value );
    }

    @Test
    public void testActionRetractFact() {
        RuleModel model = new RuleModel();

        model.rhs = new IAction[1];
        ActionRetractFact arf = new ActionRetractFact();
        arf.variableName = "$arf";
        model.rhs[0] = arf;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      arfClone.variableName );
    }

    @Test
    public void testDSLSentence() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[2];
        DSLSentence dsl0 = new DSLSentence();
        dsl0.setDefinition( "DSL Sentence 0" );
        dsl0.getValues().add( new DSLVariableValue( "dsl0v0" ) );
        dsl0.getValues().add( new DSLVariableValue( "dsl0v1" ) );
        model.lhs[0] = dsl0;
        DSLSentence dsl1 = new DSLSentence();
        dsl1.setDefinition( "DSL Sentence 1" );
        dsl1.getValues().add( new DSLVariableValue( "dsl1v0" ) );
        dsl1.getValues().add( new DSLVariableValue( "dsl1v1" ) );
        model.lhs[1] = dsl1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.lhs.length );

        assertNotSame( model.lhs[0],
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      dsl1v1Clone.getValue() );
    }

    @Test
    public void testFactPattern_Basics() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );
        fp0.setNegated( true );
        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      fp0Clone.isNegated() );
    }

    @Test
    public void testFactPattern_CEPWindow() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );
        fp0.setNegated( true );
        CEPWindow cepWindow0 = new CEPWindow();
        cepWindow0.setOperator( SuggestionCompletionEngine.getCEPWindowOperators().get( 0 ) );
        cepWindow0.setParameter( "cepWindow0P0",
                                 "cepWindow0P0Value" );
        cepWindow0.setParameter( "cepWindow0P1",
                                 "cepWindow0P1Value" );
        fp0.setWindow( cepWindow0 );
        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      cepWindow0Clone.getParameter( "cepWindow0P1" ) );
    }

    @Test
    public void testFactPattern_SingleFieldConstraints() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        fp0.addConstraint( sfc0 );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setFieldName( "sfc1" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc1.setOperator( "==" );
        sfc1.setParameter( "sfc1p0",
                           "sfc1p0Value" );
        sfc1.setValue( "sfc1Value" );
        fp0.addConstraint( sfc1 );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      sfc1Clone.getValue() );
    }

    @Test
    public void testFactPattern_ConnectiveConstraints() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        fp0.addConstraint( sfc0 );

        sfc0.addNewConnective();
        ConnectiveConstraint sfc0cc0 = sfc0.connectives[0];
        sfc0cc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0cc0.setFieldName( "sfc0" );
        sfc0cc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0cc0.setOperator( "|| ==" );
        sfc0cc0.setParameter( "sfc0cc0p0",
                              "sfc0cc0p0Value" );
        sfc0cc0.setValue( "sfc0cc0Value" );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      sfc0cc0Clone.getValue() );
    }

    @Test
    public void testFactPattern_CompositeFieldConstraints() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        CompositeFieldConstraint cfc0 = new CompositeFieldConstraint();
        cfc0.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_OR;

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        cfc0.addConstraint( sfc0 );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setFieldName( "sfc1" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc1.setOperator( "==" );
        sfc1.setParameter( "sfc1p0",
                           "sfc1p0Value" );
        sfc1.setValue( "sfc1Value" );
        cfc0.addConstraint( sfc1 );

        fp0.addConstraint( cfc0 );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      sfc1Clone.getValue() );
    }

    @Test
    public void testFactPattern_ExpressionFormLine() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        ExpressionFormLine efl0 = new ExpressionFormLine();
        efl0.setBinding( "$efl0" );
        ExpressionText efl0p0 = new ExpressionText( "efl0p0" );
        efl0.appendPart( efl0p0 );
        sfc0.setExpressionValue( efl0 );
        fp0.addConstraint( sfc0 );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.brl.RuleModel

                      efl0Clone.getCurrentName() );
    }

    @Test
    public void testFactPattern_SingleFieldConstraintEBLeftSide() {
        RuleModel model = new RuleModel();

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraintEBLeftSide sfc0 = new SingleFieldConstraintEBLeftSide();

        ExpressionFormLine eflhs0 = new ExpressionFormLine();
        eflhs0.setBinding( "$eflhs0" );
        ExpressionText eflhs0p0 = new ExpressionText( "eflhs0p0" );
        eflhs0.appendPart( eflhs0p0 );
        sfc0.setExpressionLeftSide( eflhs0 );

        ExpressionFormLine efl0 = new ExpressionFormLine();
        efl0.setBinding( "$efl0" );
        ExpressionText efl0p0 = new ExpressionText( "efl0p0" );
        efl0.appendPart( efl0p0 );
        sfc0.setExpressionValue( efl0 );

        fp0.addConstraint( sfc0 );

        model.lhs[0] = fp0;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
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.