Package org.drools.reteoo.test.dsl

Examples of org.drools.reteoo.test.dsl.NodeTestCase


    @Test
    public void testDslCommandBuilder() {
        InputStream stream = getClass().getResourceAsStream( "DslTestBuilder.testCase" );
        assertNotNull( stream );
        NodeTestCase test = null;
        try {
            test = ReteDslTestEngine.compile( stream );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( "Unexpected Exception: " + e.getMessage() );
        }
        assertEquals( "Test Case Name",
                      test.getName() );

        checkSetup( test );

        assertEquals( 0,
                      test.getTearDown().size() );

        List<NodeTestDef> tests = test.getTests();
        assertEquals( 2,
                      tests.size() );

        NodeTestDef test1 = tests.get( 0 );
        assertEquals( "test 1",
View Full Code Here


            System.out.println( command );
        }
    }

    private NodeTestResult executeTest(String str) throws IOException {
        NodeTestCase testCase = ReteDslTestEngine.compile( str );
        if( testCase.hasErrors() ) {
            fail( testCase.getErrors().toString() );
        }

        ReteDslTestEngine tester = new ReteDslTestEngine();
        NodeTestCaseResult testCaseResult = tester.run( testCase, null );
       
View Full Code Here

    @Test
    public void testDslCommandBuilder() {
        InputStream stream = getClass().getResourceAsStream( "DslTestBuilder.testCase" );
        assertNotNull( stream );
        NodeTestCase test = null;
        try {
            test = ReteDslTestEngine.compile( stream );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( "Unexpected Exception: " + e.getMessage() );
        }
        assertEquals( "Test Case Name",
                      test.getName() );

        checkSetup( test );

        assertEquals( 0,
                      test.getTearDown().size() );

        List<NodeTestDef> tests = test.getTests();
        assertEquals( 2,
                      tests.size() );

        NodeTestDef test1 = tests.get( 0 );
        assertEquals( "test 1",
View Full Code Here

            System.out.println( command );
        }
    }

    private NodeTestResult executeTest(String str) throws IOException {
        NodeTestCase testCase = ReteDslTestEngine.compile( str );
        if( testCase.hasErrors() ) {
            fail( testCase.getErrors().toString() );
        }

        ReteDslTestEngine tester = new ReteDslTestEngine();
        NodeTestCaseResult testCaseResult = tester.run( testCase, null );
       
View Full Code Here

                                  String arg1) {
                return arg1.endsWith( NodeTestCase.SUFFIX );
            }
        } ) ) {
            InputStream is = new FileInputStream( file );
            NodeTestCase tcase = ReteDslTestEngine.compile( is );
            tcase.setFileName(file.getName());
            if ( tcase.hasErrors() ) {
                throw new IllegalArgumentException( "Error parsing and loading testcase: " + file.getAbsolutePath() + "\n" + tcase.getErrors().toString() );
            }
            result.add( tcase );
            is.close();
        }
View Full Code Here

    private static NodeTestCase compile(final NodeTestDSLParser parser) {
        try {
            compilation_unit_return cur = parser.compilation_unit();
            if ( parser.hasErrors() ) {
                NodeTestCase result = new NodeTestCase();
                result.setErrors( parser.getErrorMessages() );
                return result;
            }
            NodeTestCase testCase = walk( parser.getTokenStream(),
                                          (CommonTree) cur.getTree() );
            return testCase;
        } catch ( RecognitionException e ) {
            NodeTestCase result = new NodeTestCase();
            result.setErrors( Collections.singletonList( e.getMessage() ) );
            return result;
        }
    }
View Full Code Here

    private static NodeTestCase compile(final NodeTestDSLParser parser) {
        try {
            compilation_unit_return cur = parser.compilation_unit();
            if ( parser.hasErrors() ) {
                NodeTestCase result = new NodeTestCase();
                result.setErrors( parser.getErrorMessages() );
                return result;
            }
            NodeTestCase testCase = walk( parser.getTokenStream(),
                                          (CommonTree) cur.getTree() );
            return testCase;
        } catch ( RecognitionException e ) {
            NodeTestCase result = new NodeTestCase();
            result.setErrors( Collections.singletonList( e.getMessage() ) );
            return result;
        }
    }
View Full Code Here

    private static NodeTestCase compile(final NodeTestDSLParser parser) {
        try {
            compilation_unit_return cur = parser.compilation_unit();
            if ( parser.hasErrors() ) {
                NodeTestCase result = new NodeTestCase();
                result.setErrors( parser.getErrorMessages() );
                return result;
            }
            NodeTestCase testCase = walk( parser.getTokenStream(),
                                          (CommonTree) cur.getTree() );
            return testCase;
        } catch ( RecognitionException e ) {
            NodeTestCase result = new NodeTestCase();
            result.setErrors( Collections.singletonList( e.getMessage() ) );
            return result;
        }
    }
View Full Code Here

    @Test
    public void testDslCommandBuilder() {
        InputStream stream = getClass().getResourceAsStream( "DslTestBuilder.testCase" );
        assertNotNull( stream );
        NodeTestCase test = null;
        try {
            test = ReteDslTestEngine.compile( stream );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( "Unexpected Exception: " + e.getMessage() );
        }
        assertEquals( "Test Case Name",
                      test.getName() );

        checkSetup( test );

        assertEquals( 0,
                      test.getTearDown().size() );

        List<NodeTestDef> tests = test.getTests();
        assertEquals( 2,
                      tests.size() );

        NodeTestDef test1 = tests.get( 0 );
        assertEquals( "test 1",
View Full Code Here

            System.out.println( command );
        }
    }

    private NodeTestResult executeTest(String str) throws IOException {
        NodeTestCase testCase = ReteDslTestEngine.compile( str );
        if( testCase.hasErrors() ) {
            fail( testCase.getErrors().toString() );
        }

        ReteDslTestEngine tester = new ReteDslTestEngine();
        NodeTestCaseResult testCaseResult = tester.run( testCase, null );
       
View Full Code Here

TOP

Related Classes of org.drools.reteoo.test.dsl.NodeTestCase

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.