01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.spi.hibernate3;
06:
07: import com.opensymphony.workflow.config.Configuration;
08: import com.opensymphony.workflow.config.DefaultConfiguration;
09: import com.opensymphony.workflow.spi.AbstractFunctionalWorkflowTest;
10: import com.opensymphony.workflow.util.DatabaseHelper;
11: import com.opensymphony.workflow.util.PropertySetDelegateImpl;
12:
13: import net.sf.hibernate.SessionFactory;
14:
15: /**
16: * White Box semi-functional test case that uses Hibernate as Store
17: *
18: * @author Luca Masini (l.masini@infogroup.it)
19: */
20: public class HibernateFunctionalWorkflowTestCase extends
21: AbstractFunctionalWorkflowTest {
22: //~ Instance fields ////////////////////////////////////////////////////////
23:
24: org.hibernate.Session session;
25: private SessionFactory factory;
26: private org.hibernate.SessionFactory factory3;
27:
28: //~ Constructors ///////////////////////////////////////////////////////////
29:
30: public HibernateFunctionalWorkflowTestCase(String s) {
31: super (s);
32: }
33:
34: //~ Methods ////////////////////////////////////////////////////////////////
35:
36: protected void setUp() throws Exception {
37: super .setUp();
38: DatabaseHelper.runScript("", "jdbc/CreateDS");
39:
40: factory = DatabaseHelper.createPropertySetSessionFactory();
41: factory3 = DatabaseHelper.createHibernate3SessionFactory();
42: session = factory3.openSession();
43:
44: Configuration config = new DefaultConfiguration();
45: config.load(getClass()
46: .getResource("/osworkflow-hibernate3.xml"));
47: config.getPersistenceArgs().put("session", session);
48: config.getPersistenceArgs().put("propertySetDelegate",
49: new PropertySetDelegateImpl());
50:
51: workflow.setConfiguration(config);
52: }
53:
54: protected void tearDown() throws Exception {
55: session.flush();
56: session.close();
57:
58: factory.close();
59: factory3.close();
60: DatabaseHelper.runScript(getClass().getResource(
61: "/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
62: }
63: }
|