01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.spi.hibernate;
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:
12: import net.sf.hibernate.Session;
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 NewHibernateFunctionalWorkflowTestCase extends
21: AbstractFunctionalWorkflowTest {
22: //~ Instance fields ////////////////////////////////////////////////////////
23:
24: Session session;
25: private SessionFactory factory;
26:
27: //~ Constructors ///////////////////////////////////////////////////////////
28:
29: public NewHibernateFunctionalWorkflowTestCase(String s) {
30: super (s);
31: }
32:
33: //~ Methods ////////////////////////////////////////////////////////////////
34:
35: protected void setUp() throws Exception {
36: super .setUp();
37: DatabaseHelper.runScript("", "jdbc/CreateDS");
38:
39: factory = DatabaseHelper.createHibernateSessionFactory();
40: session = factory.openSession();
41:
42: Configuration config = new DefaultConfiguration();
43: config.load(getClass().getResource(
44: "/new-osworkflow-hibernate.xml"));
45: config.getPersistenceArgs().put("session", session);
46:
47: DefaultHibernatePropertySetDelegate propertySetDelegate = new DefaultHibernatePropertySetDelegate();
48: propertySetDelegate.setSessionFactory(factory);
49: config.getPersistenceArgs().put("propertySetDelegate",
50: propertySetDelegate);
51:
52: workflow.setConfiguration(config);
53: }
54:
55: protected void tearDown() throws Exception {
56: session.flush();
57: session.close();
58: factory.close();
59: DatabaseHelper.runScript(getClass().getResource(
60: "/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
61: }
62: }
|