Author: porcherg
Date: 2008-07-15 05:43:11 -0400 (Tue, 15 Jul 2008)
New Revision: 1634
Modified:
jbpm4/pvm/trunk/
jbpm4/pvm/trunk/.classpath
jbpm4/pvm/trunk/modules/core/pom.xml
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/DbTestCase.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTest.java
Log:
fix some tests: only one environmentFactory is opened in the test suite
(when a new EnvironmentFactory needs to be opened, the previous one is closed)
Property changes on: jbpm4/pvm/trunk
___________________________________________________________________
Name: svn:ignore
+ target
Modified: jbpm4/pvm/trunk/.classpath
===================================================================
--- jbpm4/pvm/trunk/.classpath 2008-07-15 07:04:19 UTC (rev 1633)
+++ jbpm4/pvm/trunk/.classpath 2008-07-15 09:43:11 UTC (rev 1634)
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="modules/core/target/classes"
path="modules/core/src/main/java"/>
- <classpathentry kind="src" output="modules/core/target/classes"
path="modules/core/src/main/resources"/>
- <classpathentry kind="src"
output="modules/core/target/test-classes"
path="modules/core/src/test/java"/>
- <classpathentry kind="src"
output="modules/core/target/test-classes"
path="modules/core/src/test/resources"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="modules/core/target/classes"
path="modules/core/src/main/java"/>
+ <classpathentry kind="src" output="modules/core/target/classes"
path="modules/core/src/main/resources"/>
+ <classpathentry kind="src"
output="modules/core/target/test-classes"
path="modules/core/src/test/java"/>
+ <classpathentry kind="src"
output="modules/core/target/test-classes"
path="modules/core/src/test/resources"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Modified: jbpm4/pvm/trunk/modules/core/pom.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/pom.xml 2008-07-15 07:04:19 UTC (rev 1633)
+++ jbpm4/pvm/trunk/modules/core/pom.xml 2008-07-15 09:43:11 UTC (rev 1634)
@@ -103,11 +103,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<showDeprecation>false</showDeprecation>
- <testExcludes>
- <!-- sample currently do not compile -->
-
<exclude>org/jbpm/pvm/client/ExternalDecisionTest.java</exclude>
- <exclude>org/jbpm/pvm/client/PvmClientTests.java</exclude>
- </testExcludes>
+<!-- <testExcludes>-->
+<!-- sample currently do not compile -->
+<!--
<exclude>org/jbpm/pvm/client/ExternalDecisionTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/client/PvmClientTests.java</exclude>-->
+<!-- </testExcludes>-->
</configuration>
</plugin>
<plugin>
@@ -138,22 +138,22 @@
<exclude>org/jbpm/enterprise/EnterpriseTimerSessionTest.java</exclude>
<exclude>org/jbpm/enterprise/CommandReceiverTest.java</exclude>
<exclude>org/jbpm/jobexecutor/JobExecutorTimerSessionTest.java</exclude>
- <exclude>org/jbpm/msg/MemMessageServiceTest.java</exclude>
-
<exclude>org/jbpm/pvm/ConcurrentIncomingTransitionsTest.java</exclude>
+<!--
<exclude>org/jbpm/msg/MemMessageServiceTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/ConcurrentIncomingTransitionsTest.java</exclude>-->
<exclude>org/jbpm/pvm/timer/TimerIntegrationTest.java</exclude>
-
<exclude>org/jbpm/pvm/spring2/SpringPojoEnvironmentFactoryTest.java</exclude>
+<!--
<exclude>org/jbpm/pvm/spring2/SpringPojoEnvironmentFactoryTest.java</exclude>-->
<exclude>org/jbpm/pvm/expr/ExpressionTest.java</exclude>
- <exclude>org/jbpm/pvm/VariableExecutionTest.java</exclude>
-
<exclude>org/jbpm/pvm/ForLoopBasedOnTransitionTest.java</exclude>
-
<exclude>org/jbpm/pvm/VariableActivityInstanceTest.java</exclude>
-
<exclude>org/jbpm/pvm/VariableScopeProgrammaticTest.java</exclude>
+<!--
<exclude>org/jbpm/pvm/VariableExecutionTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/ForLoopBasedOnTransitionTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/VariableActivityInstanceTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/VariableScopeProgrammaticTest.java</exclude>-->
<exclude>org/jbpm/svc/jobexecutor/ContinuationTest.java</exclude>
-
<exclude>org/jbpm/svc/hibernate/ExecutionTypeTest.java</exclude>
-
<exclude>org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java</exclude>
+<!--
<exclude>org/jbpm/svc/hibernate/ExecutionTypeTest.java</exclude>-->
+<!--
<exclude>org/jbpm/pvm/internal/type/VariableAutoTypeResolutionTest.java</exclude>-->
<exclude>org/jbpm/pvm/samples/ex12/TimerTest.java</exclude>
<exclude>org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java</exclude>
<exclude>org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java</exclude>
-
<exclude>org/jbpm/pvm/samples/ex07/EventListenerTest.java</exclude>
+<!--
<exclude>org/jbpm/pvm/samples/ex07/EventListenerTest.java</exclude>-->
</excludes>
</configuration>
</plugin>
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/DbTestCase.java
===================================================================
---
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/DbTestCase.java 2008-07-15
07:04:19 UTC (rev 1633)
+++
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/DbTestCase.java 2008-07-15
09:43:11 UTC (rev 1634)
@@ -55,9 +55,12 @@
private static final String CLEAN_SQL_KEY = "cleanSql";
- public void tearDown() throws Exception {
- super.tearDown();
- cleanDb(getEnvironmentFactory());
+ @Override
+ public void setUp() throws Exception {
+ if (isSamePackage()) {
+ cleanDb(getEnvironmentFactory());
+ }
+ super.setUp();
}
public DbSession getDbSession() {
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
===================================================================
---
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-07-15
07:04:19 UTC (rev 1633)
+++
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-07-15
09:43:11 UTC (rev 1634)
@@ -29,9 +29,19 @@
*/
public abstract class EnvironmentFactoryTestCase extends JbpmTestCase {
+ static Package lastPackage = null;
+
public EnvironmentFactory getEnvironmentFactory() {
Package testPackage = this.getClass().getPackage();
+ if (lastPackage != null && lastPackage != testPackage) {
+ ConfigurationHelper.tearDownPackage(lastPackage);
+ }
+ lastPackage = testPackage;
return ConfigurationHelper.getEnvironmentFactory(testPackage);
}
-
+
+ public boolean isSamePackage() {
+ Package testPackage = this.getClass().getPackage();
+ return lastPackage == testPackage;
+ }
}
Modified:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTest.java
===================================================================
---
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTest.java 2008-07-15
07:04:19 UTC (rev 1633)
+++
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/jobexecutor/JobExecutorTest.java 2008-07-15
09:43:11 UTC (rev 1634)
@@ -32,6 +32,7 @@
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.Transaction;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
@@ -259,6 +260,9 @@
TestMessage testMessage = new TestMessage(i);
messageSession.send(testMessage);
}
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
} finally {
environment.close();
}
@@ -282,6 +286,9 @@
messageSession.send(testMessage);
}
}
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
} finally {
environment.close();
}
@@ -295,6 +302,9 @@
FailOnceTestMessage testMessage = new FailOnceTestMessage(i);
messageSession.send(testMessage);
}
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
} finally {
environment.close();
}
@@ -340,6 +350,9 @@
log.debug("found more jobs to process");
return true;
}
+ } catch (RuntimeException e) {
+ environment.get(Transaction.class).setRollbackOnly();
+ throw e;
} finally {
environment.close();
}
Show replies by date