01: package org.drools.jsr94.rules.admin;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.io.InputStream;
20:
21: import javax.rules.admin.LocalRuleExecutionSetProvider;
22: import javax.rules.admin.RuleAdministrator;
23: import javax.rules.admin.RuleExecutionSet;
24:
25: import org.drools.jsr94.rules.RuleEngineTestBase;
26:
27: /**
28: * Test the RuleExecutionSet implementation.
29: *
30: * @author N. Alex Rupp (n_alex <at>codehaus.org)
31: * @author <a href="mailto:thomas.diesler@softcon-itec.de">thomas diesler </a>
32: * @author <a href="mailto:michael.frandsen@syngenio.de">michael frandsen </a>
33: */
34: public class RuleExecutionSetTest extends RuleEngineTestBase {
35:
36: private RuleAdministrator ruleAdministrator;
37:
38: private LocalRuleExecutionSetProvider ruleSetProvider;
39:
40: /**
41: * Setup the test case.
42: */
43: protected void setUp() throws Exception {
44: super .setUp();
45: this .ruleAdministrator = this .ruleServiceProvider
46: .getRuleAdministrator();
47: this .ruleSetProvider = this .ruleAdministrator
48: .getLocalRuleExecutionSetProvider(null);
49: }
50:
51: /**
52: * Test rule set name and description.
53: */
54: public void testRule() throws Exception {
55: final InputStream in = RuleEngineTestBase.class
56: .getResourceAsStream(this .bindUri);
57: final RuleExecutionSet ruleSet = this .ruleSetProvider
58: .createRuleExecutionSet(in, null);
59: assertEquals("number of rules", 1, ruleSet.getRules().size());
60:
61: assertEquals("rule set name", "SistersRules", ruleSet.getName());
62: assertEquals("SistersRules", ruleSet.getDescription());
63: assertNull("rule set default filter", ruleSet
64: .getDefaultObjectFilter());
65: }
66: }
|