Package org.drools.compiler.lang

Examples of org.drools.compiler.lang.Expander.expand()


        KObject index = null;
        try {
            final String dslr = ioService.readAllString( path );
            final Expander expander = getDSLExpander( path );
            final String drl = expander.expand( dslr );
            final DrlParser drlParser = new DrlParser();
            final PackageDescr packageDescr = drlParser.parse( true,
                                                               drl );
            if ( packageDescr == null ) {
                logger.error( "Unable to parse DRL for '" + path.toUri().toString() + "'." );
View Full Code Here


        if ( model == null ) {
            return "";
        } else {
            final String dslr = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal( model );
            final Expander expander = getDSLExpander( path );
            final String drl = expander.expand( dslr );
            return drl;
        }
    }

    @Override
View Full Code Here

    @Test
    public void testMultiLineTemplates() throws Exception {
        final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_multiline.dslr" ) );
        final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_dsl_multiline.dsl" ) );
        Expander ex =  new DefaultExpanderResolver(dsl).get("*", null);
        String r = ex.expand(source);
        assertEquals("when Car(color==\"Red\") then doSomething();", r.trim());
    }

    @Test
    public void testWithExpanderDSL() throws Exception {
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.