01: package org.drools.common;
02:
03: import org.drools.rule.Rule;
04: import org.drools.spi.Activation;
05:
06: import junit.framework.TestCase;
07:
08: public class SequentialAgendaTest extends TestCase {
09: public void testgetNext() {
10: SequentialAgendaGroupImpl agenda = new SequentialAgendaGroupImpl(
11: "test", null);
12:
13: agenda.add(createActivation(5));
14:
15: agenda.add(createActivation(49));
16:
17: agenda.add(createActivation(108));
18:
19: agenda.add(createActivation(320));
20:
21: agenda.add(createActivation(1053));
22:
23: assertEquals(5, agenda.getNext().getRule().getLoadOrder());
24: assertEquals(49, agenda.getNext().getRule().getLoadOrder());
25: assertEquals(108, agenda.getNext().getRule().getLoadOrder());
26: assertEquals(320, agenda.getNext().getRule().getLoadOrder());
27: assertEquals(1053, agenda.getNext().getRule().getLoadOrder());
28: assertNull(agenda.getNext());
29:
30: }
31:
32: public Activation createActivation(int index) {
33: Rule rule = new Rule("test rule");
34: rule.setLoadOrder(index);
35: final AgendaItem item = new AgendaItem(0, null, 0, null, rule,
36: null);
37: return item;
38: }
39: }
|