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.Workflow;
08: import com.opensymphony.workflow.config.Configuration;
09: import com.opensymphony.workflow.loader.WorkflowDescriptor;
10: import com.opensymphony.workflow.loader.WorkflowFactory;
11: import com.opensymphony.workflow.spi.AbstractFunctionalWorkflowTest;
12: import com.opensymphony.workflow.util.DatabaseHelper;
13:
14: import org.springframework.beans.factory.xml.XmlBeanFactory;
15:
16: import org.springframework.core.io.ClassPathResource;
17:
18: /**
19: * White Box semi-functional test case that uses Spring's managed Hibernate as Store
20: *
21: * @author Luca Masini (l.masini@infogroup.it)
22: */
23: public class SpringHibernateLoaderFunctionalWorkflowDisabled extends
24: AbstractFunctionalWorkflowTest {
25: //~ Constructors ///////////////////////////////////////////////////////////
26:
27: public SpringHibernateLoaderFunctionalWorkflowDisabled(String s) {
28: super (s);
29: }
30:
31: //~ Methods ////////////////////////////////////////////////////////////////
32:
33: protected void setUp() throws Exception {
34: super .setUp();
35: DatabaseHelper.runScript("", "jdbc/CreateDS");
36:
37: XmlBeanFactory beanFactory = new XmlBeanFactory(
38: new ClassPathResource(
39: "osworkflow-spring-hibernate-loader.xml"));
40: WorkflowFactory oldFactory = (WorkflowFactory) beanFactory
41: .getBean("xmlWorkflowFactory");
42: WorkflowDescriptor wfd = oldFactory
43: .getWorkflow(getWorkflowName());
44:
45: WorkflowFactory newFactory = (WorkflowFactory) beanFactory
46: .getBean("workflowFactory");
47: newFactory.saveWorkflow(getWorkflowName(), wfd, true);
48:
49: workflow = (Workflow) beanFactory.getBean("workflow");
50: workflow.setConfiguration((Configuration) beanFactory
51: .getBean("osworkflowConfiguration"));
52: }
53:
54: protected String getWorkflowName() {
55: return "example";
56: }
57:
58: protected void tearDown() throws Exception {
59: DatabaseHelper.runScript(getClass().getResource(
60: "/scripts/jdbc/dropschema.sql"), "jdbc/DefaultDS");
61: }
62: }
|