KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > spi > jdbc > JDBCFunctionalWorkflowTestCase


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow.spi.jdbc;
6
7 import com.opensymphony.workflow.config.Configuration;
8 import com.opensymphony.workflow.config.DefaultConfiguration;
9 import com.opensymphony.workflow.spi.BaseFunctionalWorkflowTest;
10 import com.opensymphony.workflow.spi.DatabaseHelper;
11
12 import java.util.HashMap JavaDoc;
13
14
15 /**
16  * This test case is functional in that it attempts to validate the entire
17  * lifecycle of a workflow. This is also a good resource for beginners
18  * to OSWorkflow. This leverages Hibernate as teh
19  *
20  * @author Eric Pugh (epugh@upstate.com)
21  */

22 public class JDBCFunctionalWorkflowTestCase extends BaseFunctionalWorkflowTest {
23     //~ Constructors ///////////////////////////////////////////////////////////
24

25     public JDBCFunctionalWorkflowTestCase(String JavaDoc s) {
26         super(s);
27     }
28
29     //~ Methods ////////////////////////////////////////////////////////////////
30

31     public void testTrigger() throws Exception JavaDoc {
32         String JavaDoc workflowName = getClass().getResource("/samples/scheduler.xml").toString();
33         assertTrue("canInitialize for workflow " + workflowName + " is false", workflow.canInitialize(workflowName, 1));
34
35         long id = workflow.initialize(workflowName, 1, new HashMap JavaDoc());
36         Thread.sleep(500);
37         assertEquals("trigger was not fired", "blahblah", workflow.getPropertySet(id).getString("testTrigger"));
38     }
39
40     protected void setUp() throws Exception JavaDoc {
41         super.setUp();
42         DatabaseHelper.createDatabase(getClass().getResource("/scripts/jdbc/mckoi.sql"));
43
44         Configuration config = new DefaultConfiguration();
45         config.load(getClass().getResource("/osworkflow-jdbc.xml"));
46         workflow.setConfiguration(config);
47     }
48 }
49
Popular Tags