KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > spi > hibernate > HibernateFunctionalWorkflowTestCase


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

5 package com.opensymphony.workflow.spi.hibernate;
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 net.sf.hibernate.SessionFactory;
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 the persistence mechanism.
19  *
20  * @author Eric Pugh (epugh@upstate.com)
21  */

22 public class HibernateFunctionalWorkflowTestCase extends BaseFunctionalWorkflowTest {
23     //~ Instance fields ////////////////////////////////////////////////////////
24

25     private SessionFactory factory;
26
27     //~ Constructors ///////////////////////////////////////////////////////////
28

29     public HibernateFunctionalWorkflowTestCase(String JavaDoc s) {
30         super(s);
31     }
32
33     //~ Methods ////////////////////////////////////////////////////////////////
34

35     protected void setUp() throws Exception JavaDoc {
36         super.setUp();
37         DatabaseHelper.createDatabase("");
38
39         factory = DatabaseHelper.createHibernateSessionFactory();
40
41         Configuration config = new DefaultConfiguration();
42         config.load(getClass().getResource("/osworkflow-hibernate.xml"));
43         workflow.setConfiguration(config);
44         workflow.getConfiguration().getPersistenceArgs().put("sessionFactory", factory);
45     }
46
47     protected void tearDown() throws Exception JavaDoc {
48         factory.close();
49     }
50 }
51
Popular Tags