1 5 package com.opensymphony.workflow; 6 7 import com.opensymphony.workflow.basic.BasicWorkflow; 8 9 import junit.framework.TestCase; 10 11 import java.net.URL ; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 17 23 public class DescriptorQuirksTestCase extends TestCase { 24 26 public int counter = 0; 27 private AbstractWorkflow workflow; 28 29 31 public DescriptorQuirksTestCase(String s) { 32 super(s); 33 } 34 35 37 42 public void testArgComment() throws Exception { 43 counter = 0; 44 45 Map inputs = new HashMap (); 46 inputs.put("test", this); 47 48 URL resource = getClass().getResource("/samples/comment-arg.xml"); 49 long id = workflow.initialize(resource.toString(), 1, inputs); 50 assertEquals("beanshell script not parsed correctly", 2, counter); 51 } 52 53 58 public void testDoubleFunctionExecution() throws Exception { 59 counter = 0; 60 61 long id = workflow.initialize(getClass().getResource("/samples/double.xml").toString(), 1, new HashMap ()); 62 Map inputs = new HashMap (); 63 inputs.put("test", this); 64 workflow.doAction(id, 3, inputs); 65 assertEquals("function executed unexpected number of times", 2, counter); 66 } 67 68 protected void setUp() throws Exception { 69 workflow = new BasicWorkflow("testuser"); 70 } 71 } 72 | Popular Tags |