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

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


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

        final TypeNode type = new TypeNodeImpl( "Person" );
        final ConstraintNode c1 = new ConstraintNodeImpl( "Person",
                                                          "bigIntegerField",
                                                          "==",
                                                          new BigIntegerValue( new BigInteger( "1000000" ) ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "bigIntegerField",
                       BigInteger.class.getName(),
                       DataType.TYPE_NUMERIC_BIGINTEGER );

        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",
                                                          "booleanField",
                                                          "==",
                                                          new BooleanValue( true ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "booleanField",
                       Boolean.class.getName(),
                       DataType.TYPE_BOOLEAN );

        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",
                                                          "byteField",
                                                          "==",
                                                          new ByteValue( new Byte( "100" ) ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "byteField",
                       Byte.class.getName(),
                       DataType.TYPE_NUMERIC_BYTE );

        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",
                                                          "dateField",
                                                          "==",
                                                          new DateValue( new Date( 84, 6, 15 ) ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "dateField",
                       Date.class.getName(),
                       DataType.TYPE_DATE );

        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",
                                                          "doubleField",
                                                          "==",
                                                          new DoubleValue( 1000.56 ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "doubleField",
                       Double.class.getName(),
                       DataType.TYPE_NUMERIC_DOUBLE );

        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",
                                                          "floatField",
                                                          "==",
                                                          new FloatValue( 1000.56f ) );
        expected.setRoot( type );
        type.addChild( c1 );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "floatField",
                       Float.class.getName(),
                       DataType.TYPE_NUMERIC_FLOAT );

        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

        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( "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() );
        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" );
        expected.setRoot( type );
        type.addChild( c1 );

        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() );
        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() );
        assertNull( _c1.getOperator() );
        assertNull( _c1.getValue() );
    }
View Full Code Here

TOP

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

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.