01: package org.drools.compiler;
02:
03: import java.io.InputStream;
04: import java.io.InputStreamReader;
05:
06: import junit.framework.TestCase;
07:
08: import org.drools.RuleBase;
09: import org.drools.integrationtests.DslTest;
10:
11: public class RuleBaseLoaderTest extends TestCase {
12:
13: public void testLoadRuleBase() throws Exception {
14: final InputStream in = DslTest.class
15: .getResourceAsStream("HelloWorld.drl");
16: final RuleBase rb = RuleBaseLoader.getInstance()
17: .loadFromReader(new InputStreamReader(in));
18: assertNotNull(rb);
19: }
20:
21: public void testLoadRuleBaseWithDSL() throws Exception {
22: final InputStream in = DslTest.class
23: .getResourceAsStream("rule_with_expander_dsl.dslr");
24: final InputStream inDSL = DslTest.class
25: .getResourceAsStream("test_expander.dsl");
26: final RuleBase rb = RuleBaseLoader.getInstance()
27: .loadFromReader(new InputStreamReader(in),
28: new InputStreamReader(inDSL));
29: assertNotNull(rb);
30: }
31:
32: // todo: fix for LEAPS
33: // public void testEngineType() throws Exception {
34: // final InputStream in = IntegrationCases.class.getResourceAsStream( "HelloWorld.drl" );
35: // final RuleBaseLoader loader = RuleBaseLoader.getInstance();
36: // loader.setDefaultEngineType( RuleBase.LEAPS );
37: // final RuleBase rb = loader.loadFromReader( new InputStreamReader( in ) );
38: // assertNotNull( rb );
39: // assertTrue( rb instanceof LeapsRuleBase );
40: //
41: // }
42:
43: }
|