01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow;
06:
07: import com.opensymphony.workflow.basic.BasicWorkflow;
08:
09: import junit.framework.TestCase;
10:
11: import java.util.HashMap;
12: import java.util.Map;
13:
14: /**
15: * DOCUMENT ME!
16: *
17: * @author $author$
18: * @version $Revision: 1.1 $
19: */
20: public class GlobalConditionsTestCase extends TestCase {
21: //~ Methods ////////////////////////////////////////////////////////////////
22:
23: public void testGlobalConditions() throws Exception {
24: Workflow workflow = new BasicWorkflow("test");
25: long id = workflow.initialize(getClass().getResource(
26: "/samples/global-condition.xml").toString(), 1, null);
27: Map input = new HashMap();
28: input.put("global-test", Boolean.TRUE);
29:
30: int[] availableActions = workflow
31: .getAvailableActions(id, input);
32: assertEquals("Unexpected number of available actions", 0,
33: availableActions.length);
34: availableActions = workflow.getAvailableActions(id, null);
35: assertEquals("Unexpected number of available actions", 1,
36: availableActions.length);
37: }
38: }
|