Package org.drools.workbench.models.guided.dtree.shared.model.nodes.impl

Examples of org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ConstraintNodeImpl


        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        model.setRoot( type );
        type.addChild( c1 );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here


        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name",
                                                          "==",
                                                          new EnumValue( "Names.FRED" ) );
        model.setRoot( type );
        type.addChild( c1 );
View Full Code Here

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        model.setRoot( type );
        type.addChild( c1 );

        final ActionRetractNode action = new ActionRetractNodeImpl( type );
        c1.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
    }
View Full Code Here

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        model.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
    }
View Full Code Here

        final GuidedDecisionTree model = new GuidedDecisionTree();
        model.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        model.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
                                      drl );
    }
View Full Code Here

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        expected.setRoot( type );
        type.addChild( c1 );

        final ActionRetractNode action = new ActionRetractNodeImpl( type );
        c1.addChild( action );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( 0,
                      model.getParserErrors().size() );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNotNull( model.getRoot() );
        assertEquals( type.getClassName(),
                      model.getRoot().getClassName() );
        assertTrue( model.getRoot().isBound() );
        assertEquals( type.getBinding(),
                      model.getRoot().getBinding() );

        assertEquals( 1,
                      model.getRoot().getChildren().size() );
        assertNotNull( model.getRoot().getChildren().get( 0 ) );
        assertTrue( model.getRoot().getChildren().get( 0 ) instanceof ConstraintNode );

        final ConstraintNode _c1 = (ConstraintNode) model.getRoot().getChildren().get( 0 );

        assertEquals( c1.getClassName(),
                      _c1.getClassName() );
        assertEquals( c1.getFieldName(),
                      _c1.getFieldName() );
        assertEquals( c1.getOperator(),
                      _c1.getOperator() );
        assertNull( _c1.getValue() );

        assertEquals( 1,
                      _c1.getChildren().size() );
View Full Code Here

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        expected.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );
        addModelField( "Person",
                       "age",
                       Integer.class.getName(),
                       DataType.TYPE_NUMERIC_INTEGER );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( 0,
                      model.getParserErrors().size() );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNotNull( model.getRoot() );
        assertEquals( type.getClassName(),
                      model.getRoot().getClassName() );
        assertTrue( model.getRoot().isBound() );
        assertEquals( type.getBinding(),
                      model.getRoot().getBinding() );

        assertEquals( 1,
                      model.getRoot().getChildren().size() );
        assertNotNull( model.getRoot().getChildren().get( 0 ) );
        assertTrue( model.getRoot().getChildren().get( 0 ) instanceof ConstraintNode );

        final ConstraintNode _c1 = (ConstraintNode) model.getRoot().getChildren().get( 0 );

        assertEquals( c1.getClassName(),
                      _c1.getClassName() );
        assertEquals( c1.getFieldName(),
                      _c1.getFieldName() );
        assertNull( _c1.getOperator() );
        assertNull( _c1.getValue() );
        assertTrue( _c1.isBound() );
        assertEquals( c1.getBinding(),
                      _c1.getBinding() );

        assertEquals( 1,
                      _c1.getChildren().size() );
        assertNotNull( _c1.getChildren().get( 0 ) );
View Full Code Here

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        type.setBinding( "$p" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name" );
        c1.setBinding( "$n" );
        expected.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );
        addModelField( "Person",
                       "age",
                       Integer.class.getName(),
                       DataType.TYPE_NUMERIC_INTEGER );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( 0,
                      model.getParserErrors().size() );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNotNull( model.getRoot() );
        assertEquals( type.getClassName(),
                      model.getRoot().getClassName() );
        assertTrue( model.getRoot().isBound() );
        assertEquals( type.getBinding(),
                      model.getRoot().getBinding() );

        assertEquals( 1,
                      model.getRoot().getChildren().size() );
        assertNotNull( model.getRoot().getChildren().get( 0 ) );
        assertTrue( model.getRoot().getChildren().get( 0 ) instanceof ConstraintNode );

        final ConstraintNode _c1 = (ConstraintNode) model.getRoot().getChildren().get( 0 );

        assertEquals( c1.getClassName(),
                      _c1.getClassName() );
        assertEquals( c1.getFieldName(),
                      _c1.getFieldName() );
        assertNull( _c1.getOperator() );
        assertNull( _c1.getValue() );
        assertTrue( _c1.isBound() );
        assertEquals( c1.getBinding(),
                      _c1.getBinding() );

        assertEquals( 1,
                      _c1.getChildren().size() );
        assertNotNull( _c1.getChildren().get( 0 ) );
View Full Code Here

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name",
                                                          "==",
                                                          new StringValue( "Michael" ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "org.drools.workbench.models.guided.dtree.backend.Person",
                       "this",
                       "org.drools.workbench.models.guided.dtree.backend.Person",
                       DataType.TYPE_THIS );
        addModelField( "org.drools.workbench.models.guided.dtree.backend.Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( 0,
                      model.getParserErrors().size() );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNotNull( model.getRoot() );
        assertEquals( type.getClassName(),
                      model.getRoot().getClassName() );
        assertFalse( model.getRoot().isBound() );

        assertEquals( 1,
                      model.getRoot().getChildren().size() );
        assertNotNull( model.getRoot().getChildren().get( 0 ) );
        assertTrue( model.getRoot().getChildren().get( 0 ) instanceof ConstraintNode );

        final ConstraintNode _c1 = (ConstraintNode) model.getRoot().getChildren().get( 0 );

        assertEquals( c1.getClassName(),
                      _c1.getClassName() );
        assertEquals( c1.getFieldName(),
                      _c1.getFieldName() );
        assertEquals( c1.getOperator(),
                      _c1.getOperator() );
        assertEquals( c1.getValue().getValue().toString(),
                      _c1.getValue().getValue().toString() );
    }
View Full Code Here

        final GuidedDecisionTree expected = new GuidedDecisionTree();
        expected.setTreeName( "test" );

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "name",
                                                          "==",
                                                          new StringValue( "Michael" ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "org.drools.workbench.models.guided.dtree.backend.Person",
                       "this",
                       "org.drools.workbench.models.guided.dtree.backend.Person",
                       DataType.TYPE_THIS );
        addModelField( "org.drools.workbench.models.guided.dtree.backend.Person",
                       "name",
                       String.class.getName(),
                       DataType.TYPE_STRING );

        final GuidedDecisionTree model = GuidedDecisionTreeDRLPersistence.getInstance().unmarshal( drl,
                                                                                                   "test",
                                                                                                   dmo );

        assertNotNull( model );
        assertEquals( 0,
                      model.getParserErrors().size() );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNotNull( model.getRoot() );
        assertEquals( type.getClassName(),
                      model.getRoot().getClassName() );
        assertFalse( model.getRoot().isBound() );

        assertEquals( 1,
                      model.getRoot().getChildren().size() );
        assertNotNull( model.getRoot().getChildren().get( 0 ) );
        assertTrue( model.getRoot().getChildren().get( 0 ) instanceof ConstraintNode );

        final ConstraintNode _c1 = (ConstraintNode) model.getRoot().getChildren().get( 0 );

        assertEquals( c1.getClassName(),
                      _c1.getClassName() );
        assertEquals( c1.getFieldName(),
                      _c1.getFieldName() );
        assertEquals( c1.getOperator(),
                      _c1.getOperator() );
        assertEquals( c1.getValue().getValue().toString(),
                      _c1.getValue().getValue().toString() );
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ConstraintNodeImpl

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.