Author: tom.baeyens(a)jboss.com
Date: 2008-12-29 04:47:06 -0500 (Mon, 29 Dec 2008)
New Revision: 3572
Added:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml
Removed:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/spring/
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml
Log:
moved spring test
Copied: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring (from rev 3567,
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring)
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java 2008-12-29
01:26:51 UTC (rev 3567)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java 2008-12-29
09:47:06 UTC (rev 3572)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.api.spring;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.env.EnvironmentFactory;
-import org.jbpm.test.JbpmTestCase;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SpringTest extends JbpmTestCase {
-
- public void testOne() {
-
- if (true) {
- System.err.println("FIXME: SpringTest");
- return;
- }
-
-
- ClassPathXmlApplicationContext applicationContext = new
ClassPathXmlApplicationContext("org/jbpm/pvm/api/spring/spring.beans.xml");
- EnvironmentFactory environmentFactory = (EnvironmentFactory)
applicationContext.getBean("environmentFactory");
-
- CommandService commandService = environmentFactory.get(CommandService.class);
-
- assertNull(Environment.getCurrent());
-
- Session session = (Session) commandService.execute(new Command<Object>() {
- public Object execute(Environment environment) throws Exception {
- assertNotNull(environment);
- Session session = environment.get(Session.class);
- assertNotNull(session);
- assertTrue(session.isOpen());
- assertSame(session, environment.get(Session.class));
- return session;
- }
- });
-
- assertFalse(session.isOpen());
-
- assertNull(Environment.getCurrent());
-
- /* TODO translate the DeployerManager to a data structure that is
- * easy to wire up with spring
- ProcessService processService = environmentFactory.get(ProcessService.class);
-
- ProcessDefinition processDefinition = ProcessFactory.build("basic")
- .node("a").initial().behaviour(WaitState.class)
- .transition().to("b")
- .node("b").behaviour(WaitState.class)
- .transition().to("c")
- .node("c").behaviour(AutomaticActivity.class)
- .transition().to("d")
- .node("d").behaviour(AutomaticActivity.class)
- .transition().to("e")
- .node("e").behaviour(WaitState.class)
- .done();
-
- processService.deploy(processDefinition);
-
- Execution execution = processService.startExecution("basic",
"one");
-
- assertEquals("a", execution.getNode().getName());
-
- execution = processService.signalExecution("basic", "one");
-
- assertEquals("b", execution.getNode().getName());
-
- execution = processService.signalExecution("basic", "one");
-
- assertEquals("e", execution.getNode().getName());
- */
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java (from
rev 3570, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java
(rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/spring/SpringTest.java 2008-12-29
09:47:06 UTC (rev 3572)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.spring;
+
+import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.env.Environment;
+import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.test.JbpmTestCase;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SpringTest extends JbpmTestCase {
+
+ public void testSpringTransactions() {
+ ClassPathXmlApplicationContext applicationContext = new
ClassPathXmlApplicationContext("org/jbpm/pvm/spring/spring.beans.xml");
+ EnvironmentFactory environmentFactory = (EnvironmentFactory)
applicationContext.getBean("environmentFactory");
+
+ CommandService commandService = environmentFactory.get(CommandService.class);
+
+ assertNull(Environment.getCurrent());
+
+ Session session = (Session) commandService.execute(new Command<Object>() {
+ public Object execute(Environment environment) throws Exception {
+ assertNotNull(environment);
+ Session session = environment.get(Session.class);
+ assertNotNull(session);
+ assertTrue(session.isOpen());
+ assertSame(session, environment.get(Session.class));
+ return session;
+ }
+ });
+
+ assertFalse(session.isOpen());
+
+ assertNull(Environment.getCurrent());
+
+ /* TODO translate the DeployerManager to a data structure that is
+ * easy to wire up with spring
+ ProcessService processService = environmentFactory.get(ProcessService.class);
+
+ ProcessDefinition processDefinition = ProcessFactory.build("basic")
+ .node("a").initial().behaviour(WaitState.class)
+ .transition().to("b")
+ .node("b").behaviour(WaitState.class)
+ .transition().to("c")
+ .node("c").behaviour(AutomaticActivity.class)
+ .transition().to("d")
+ .node("d").behaviour(AutomaticActivity.class)
+ .transition().to("e")
+ .node("e").behaviour(WaitState.class)
+ .done();
+
+ processService.deploy(processDefinition);
+
+ Execution execution = processService.startExecution("basic",
"one");
+
+ assertEquals("a", execution.getNode().getName());
+
+ execution = processService.signalExecution("basic", "one");
+
+ assertEquals("b", execution.getNode().getName());
+
+ execution = processService.signalExecution("basic", "one");
+
+ assertEquals("e", execution.getNode().getName());
+ */
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring (from rev 3567,
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/spring)
Deleted: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/spring/spring.beans.xml 2008-12-29
01:26:51 UTC (rev 3567)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml 2008-12-29
09:47:06 UTC (rev 3572)
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans
xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <!-- SINGLETONS
- SpringEnvironmentFactory will only see the singleton beans.
- -->
-
- <bean id="processService"
- class="org.jbpm.pvm.internal.svc.CommandProcessService"
- scope="singleton">
- <property name="commandService" ref="commandService" />
- </bean>
-
- <bean id="commandService"
- class="org.jbpm.pvm.internal.spring.SpringCommandService"
- scope="singleton">
- <property name="transactionManager" ref="transactionManager"
/>
- <property name="environmentFactory"
ref="environmentFactory"/>
- </bean>
-
- <bean id="transactionManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager"
- scope="singleton">
- <property name="sessionFactory" ref="sessionFactory"/>
- </bean>
-
- <bean id="environmentFactory"
- class="org.jbpm.pvm.env.SpringEnvironmentFactory"
- scope="singleton" />
-
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
- scope="singleton">
- <property name="mappingResources">
- <list>
- <value>jbpm.pvm.typedefs.hbm.xml</value>
- <value>jbpm.pvm.wire.hbm.xml</value>
- <value>jbpm.pvm.definition.hbm.xml</value>
- <value>jbpm.pvm.execution.hbm.xml</value>
- <value>jbpm.pvm.variable.hbm.xml</value>
- <value>jbpm.pvm.job.hbm.xml</value>
- </list>
- </property>
- <property name="hibernateProperties"><value>
- hibernate.dialect = org.hibernate.dialect.HSQLDialect
- hibernate.connection.driver_class = org.hsqldb.jdbcDriver
- hibernate.connection.url = jdbc:hsqldb:mem:.
- hibernate.connection.username = sa
- hibernate.connection.password =
- hibernate.hbm2ddl.auto = create-drop
- hibernate.cache.use_second_level_cache = true
- hibernate.cache.provider_class =
org.hibernate.cache.HashtableCacheProvider
- </value></property>
- </bean>
-
- <bean id="hibernateSessionManager"
- class="org.jbpm.pvm.internal.spring.HibernateSessionManager"
- scope="singleton">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-
- <!-- PROTOTYPES
- The PVM environment scope will only see prototype beans.
- Each environment will cache the prototype beans that are fetched
- through it.
- -->
-
- <bean id="session"
- factory-bean="hibernateSessionManager"
- factory-method="getSession"
- scope="prototype" />
-
-</beans>
\ No newline at end of file
Copied: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml
(from rev 3570,
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/spring/spring.beans.xml)
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/spring/spring.beans.xml 2008-12-29
09:47:06 UTC (rev 3572)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans
xmlns="http://www.springframework.org/schema/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <!-- SINGLETONS
+ SpringEnvironmentFactory will only see the singleton beans.
+ -->
+
+ <bean id="processService"
+ class="org.jbpm.pvm.internal.svc.ProcessServiceImpl"
+ scope="singleton">
+ <property name="commandService" ref="commandService" />
+ </bean>
+
+ <bean id="commandService"
+ class="org.jbpm.pvm.internal.spring.SpringCommandService"
+ scope="singleton">
+ <property name="transactionManager" ref="transactionManager"
/>
+ <property name="environmentFactory"
ref="environmentFactory"/>
+ </bean>
+
+ <bean id="transactionManager"
+ class="org.springframework.orm.hibernate3.HibernateTransactionManager"
+ scope="singleton">
+ <property name="sessionFactory" ref="sessionFactory"/>
+ </bean>
+
+ <bean id="environmentFactory"
+ class="org.jbpm.cfg.SpringConfiguration"
+ scope="singleton" />
+
+ <bean id="sessionFactory"
+ class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
+ scope="singleton">
+ <property name="mappingResources">
+ <list>
+ <value>jbpm.pvm.typedefs.hbm.xml</value>
+ <value>jbpm.pvm.wire.hbm.xml</value>
+ <value>jbpm.pvm.definition.hbm.xml</value>
+ <value>jbpm.pvm.execution.hbm.xml</value>
+ <value>jbpm.pvm.variable.hbm.xml</value>
+ <value>jbpm.pvm.job.hbm.xml</value>
+ </list>
+ </property>
+ <property name="hibernateProperties"><value>
+ hibernate.dialect = org.hibernate.dialect.HSQLDialect
+ hibernate.connection.driver_class = org.hsqldb.jdbcDriver
+ hibernate.connection.url = jdbc:hsqldb:mem:.
+ hibernate.connection.username = sa
+ hibernate.connection.password =
+ hibernate.hbm2ddl.auto = create-drop
+ hibernate.cache.use_second_level_cache = true
+ hibernate.cache.provider_class =
org.hibernate.cache.HashtableCacheProvider
+ </value></property>
+ </bean>
+
+ <bean id="hibernateSessionManager"
+ class="org.jbpm.pvm.internal.spring.HibernateSessionManager"
+ scope="singleton">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
+ <!-- PROTOTYPES
+ The PVM environment scope will only see prototype beans.
+ Each environment will cache the prototype beans that are fetched
+ through it.
+ -->
+
+ <bean id="session"
+ factory-bean="hibernateSessionManager"
+ factory-method="getSession"
+ scope="prototype" />
+
+</beans>
\ No newline at end of file