From 28092e38fa610ad2bc070387293f925948a091ad Mon Sep 17 00:00:00 2001 From: Jeremy Grelle Date: Wed, 8 Aug 2007 16:58:32 +0000 Subject: [PATCH] Changed from Toplink to Hibernate for JpaFlowExecutionListenerTests so as to avoid the required jvm agent. --- spring-webflow/.classpath | 16 +++++++++++++++- spring-webflow/ivy.xml | 6 ++++-- .../persistence/JpaFlowExecutionListener.java | 2 +- .../JpaFlowExecutionListenerTests.java | 17 +++++++---------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/spring-webflow/.classpath b/spring-webflow/.classpath index d6f7beee..5575c81a 100644 --- a/spring-webflow/.classpath +++ b/spring-webflow/.classpath @@ -37,7 +37,21 @@ - + + + + + + + + + + + + + + + diff --git a/spring-webflow/ivy.xml b/spring-webflow/ivy.xml index 27d1fb0f..23134a1c 100644 --- a/spring-webflow/ivy.xml +++ b/spring-webflow/ivy.xml @@ -72,8 +72,10 @@ - - + + + + diff --git a/spring-webflow/src/main/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListener.java b/spring-webflow/src/main/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListener.java index b5ce895b..da5fcbbd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListener.java @@ -93,7 +93,7 @@ public class JpaFlowExecutionListener extends FlowExecutionListenerAdapter { public void sessionCreated(RequestContext context, FlowSession session) { if (session.getDefinition().getAttributes().contains("persistenceContext")) { EntityManager em = entityManagerFactory.createEntityManager(); - context.getFlowScope().put(ENTITY_MANAGER_ATTRIBUTE, em); + session.getScope().put(ENTITY_MANAGER_ATTRIBUTE, em); bind(em); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListenerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListenerTests.java index a26967a9..eef71bfb 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListenerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/support/persistence/JpaFlowExecutionListenerTests.java @@ -8,13 +8,12 @@ import javax.sql.DataSource; import junit.framework.TestCase; -import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.jpa.JpaTemplate; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.webflow.engine.EndState; import org.springframework.webflow.test.MockFlowSession; @@ -31,10 +30,9 @@ public class JpaFlowExecutionListenerTests extends TestCase { private JpaTemplate jpaTemplate; public void testTemp() { - + } - - /* + protected void setUp() throws Exception { DataSource dataSource = getDataSource(); populateDataBase(dataSource); @@ -107,11 +105,10 @@ public class JpaFlowExecutionListenerTests extends TestCase { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(dataSource); factory.setPersistenceXmlLocation("classpath:org/springframework/webflow/support/persistence/persistence.xml"); - TopLinkJpaVendorAdapter toplink = new TopLinkJpaVendorAdapter(); - factory.setJpaVendorAdapter(toplink); - factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); + HibernateJpaVendorAdapter hibernate = new HibernateJpaVendorAdapter(); + factory.setJpaVendorAdapter(hibernate); factory.afterPropertiesSet(); - return (EntityManagerFactory) factory.getObject(); + return factory.getObject(); } private void assertSessionNotBound() { @@ -121,5 +118,5 @@ public class JpaFlowExecutionListenerTests extends TestCase { private void assertSessionBound() { assertNotNull(TransactionSynchronizationManager.getResource(entityManagerFactory)); } - */ + }