01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.rule;
17:
18: import org.kuali.core.document.Document;
19: import org.kuali.core.document.MaintenanceDocument;
20: import org.kuali.core.rule.event.PreRulesCheckEvent;
21: import org.kuali.core.rules.PreRulesContinuationBase;
22: import org.kuali.core.rules.PreRulesContinuationBase.ContextSession;
23: import org.kuali.kfs.context.KualiTestBase;
24: import org.kuali.test.ConfigureContext;
25:
26: @ConfigureContext
27: public class PreRulesContinuationTest extends KualiTestBase {
28:
29: private class TestPreRules extends PreRulesContinuationBase {
30:
31: public boolean doRules(Document document) {
32: MaintenanceDocument maintenanceDocument = (MaintenanceDocument) document;
33: return false;
34: }
35:
36: }
37:
38: public void test() {
39:
40: TestPreRules preRules = new TestPreRules();
41:
42: PreRulesCheckEvent event = new PreRulesCheckEvent("", "", null);
43:
44: ContextSession contextSession = preRules.new ContextSession(
45: "test", event);
46:
47: contextSession.askQuestion("q1", "this is q1");
48: contextSession.setAttribute("t1", "test1");
49: contextSession.setAttribute("t2", "test2");
50: contextSession.setAttribute("t3", "test3");
51:
52: assertEquals("testing retrieve", "test1", contextSession
53: .getAttribute("t1"));
54: assertEquals("testing retrieve", "test2", contextSession
55: .getAttribute("t2"));
56: assertEquals("testing retrieve", "test3", contextSession
57: .getAttribute("t3"));
58:
59: }
60:
61: }
|