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

Examples of org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree


                "modify( $p ) { \n" +
                "  setAge( 25 + 10 ) \n" +
                "} \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

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

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

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof UnsupportedFieldNatureTypeParserMessage );

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


                "modify( $p2 ) { \n" +
                "  setAge( 25 + 10 ) \n" +
                "} \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

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

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

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof BindingNotFoundParserMessage );

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

                "  $p : Person()\n" +
                "then \n" +
                "  $p2.setAge( 25 + 10 ); \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

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

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

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof BindingNotFoundParserMessage );

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

                "when \n" +
                "  Person( name == \"Michael\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );

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

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeNotFoundParserMessage );

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

                "when \n" +
                "  Person( bigDecimalField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        addModelField( "Person",
                       "this",
                       "Person",
                       DataType.TYPE_THIS );
        addModelField( "Person",
                       "bigDecimalField",
                       BigDecimal.class.getName(),
                       DataType.TYPE_NUMERIC_BIGDECIMAL );

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

        assertNotNull( model );
        assertEquals( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

                "when \n" +
                "  Person( bigIntegerField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        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( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

                "when \n" +
                "  Person( booleanField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        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( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

                "when \n" +
                "  Person( byteField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        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( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

                "when \n" +
                "  Person( dateField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        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( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

                "when \n" +
                "  Person( doubleField == \"abc\" )\n" +
                "then \n" +
                "end";

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

        final TypeNode type = new TypeNodeImpl( "Person" );
        expected.setRoot( type );

        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( expected.getTreeName(),
                      model.getTreeName() );

        assertNull( model.getRoot() );

        assertEquals( 1,
                      model.getParserErrors().size() );
        assertEquals( "test_0",
                      model.getParserErrors().get( 0 ).getOriginalRuleName() );
        assertEqualsIgnoreWhitespace( drl,
                                      model.getParserErrors().get( 0 ).getOriginalDrl() );
        assertNotNull( model.getParserErrors().get( 0 ).getMessages() );
        assertEquals( 1,
                      model.getParserErrors().get( 0 ).getMessages().size() );
        assertTrue( model.getParserErrors().get( 0 ).getMessages().get( 0 ) instanceof DataTypeConversionErrorParserMessage );

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

TOP

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

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.