[jbpm-commits] JBoss JBPM SVN: r1828 - in jbpm4/pvm/trunk/modules/core/src: test/java/org/jbpm/pvm and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Aug 6 03:03:33 EDT 2008
Author: porcherg
Date: 2008-08-06 03:03:33 -0400 (Wed, 06 Aug 2008)
New Revision: 1828
Added:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml
Modified:
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/pvm/DbTests.java
Log:
introduce TestSetup to create/close one environmentFactory before/after running a test suite - JBPM-1417
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-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -58,6 +58,10 @@
}
EnvironmentFactory createEnvironmentFactory() {
+ return createEnvironmentFactory(configResource);
+ }
+
+ static EnvironmentFactory createEnvironmentFactory(String configResource) {
try {
log.debug("creating environment factory for ["+configResource+"]");
EnvironmentFactory newEnvironmentFactory = new PvmEnvironmentFactory(configResource);
@@ -68,6 +72,14 @@
}
}
+ static void closeEnvironmentFactory(String configResource) {
+ EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
+ if (environmentFactory!=null) {
+ log.debug("closing environment factory for ["+configResource+"]");
+ environmentFactory.close();
+ }
+ }
+
/*
static String getConfigResource(Package p) {
return p.getName().replace('.','/')+"/environment.cfg.xml";
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2007 Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library 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
+ * version 2.1 of the License.
+ * This library 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
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ **/
+package org.jbpm.pvm.test.base;
+
+
+import org.jbpm.pvm.PvmException;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.PvmEnvironmentFactory;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+
+/**
+ * @author Guillaume Porcher
+ *
+ */
+public class EnvironmentFactoryTestSetup extends TestSetup {
+
+ private String configResource;
+ /**
+ * @param test
+ */
+ public EnvironmentFactoryTestSetup(Test test, String configResource) {
+ super(test);
+ this.configResource = configResource;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ EnvironmentFactoryTestCase.createEnvironmentFactory(configResource);
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
+ }
+}
Property changes on: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-08-06 07:03:33 UTC (rev 1828)
@@ -30,6 +30,7 @@
import org.jbpm.pvm.internal.db.langext.DbLangExtTests;
import org.jbpm.pvm.internal.db.model.DbModelTests;
import org.jbpm.pvm.internal.jobexecutor.JobExecutorTests;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
/**
@@ -42,23 +43,18 @@
//$JUnit-BEGIN$
TestSuite defaultConfigTests = new TestSuite("default config tests");
- defaultConfigTests.addTest(DbLangExtTests.suite());
defaultConfigTests.addTest(DbModelTests.suite());
defaultConfigTests.addTest(DbSvcTests.suite());
- defaultConfigTests.addTest(SpringTests.suite());
defaultConfigTests.addTest(JobExecutorTests.suite());
// defaultConfigTests.addTest(ContinuationTests.suite());
- // TODO wrap the suite with a test setup that creates and closes the environment factory
- // something like this:
- // suite.addTest(new JbpmTestSetup(defaultConfigTests, "environment.cfg.xml");
+ suite.addTest(new EnvironmentFactoryTestSetup(defaultConfigTests, "environment.cfg.xml"));
+ suite.addTest(new EnvironmentFactoryTestSetup(DbLangExtTests.suite(), "org/jbpm/pvm/internal/db/langext/environment.cfg.xml"));
+ // Spring tests do not use EnvironmentFactoryTestCase
+ suite.addTest(SpringTests.suite());
- // TestSuite customConfigTest1 = new TestSuite("default config tests");
- // customConfigTest1.addTest(CustomDbConfigTest.suite());
- // suite.addTest(new JbpmTestSetup(customConfigTest1, "custom/environment.cfg.xml");
-
//$JUnit-END$
- return defaultConfigTests;
+ return suite;
}
}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml 2008-08-05 19:47:06 UTC (rev 1827)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/language.extensions.hbm.xml 2008-08-06 07:03:33 UTC (rev 1828)
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.jbpm.pvm" default-access="field">
-
- <class name="org.jbpm.pvm.internal.db.langext.AddressActivity">
- <id name="id" column="DBID_" type="long">
- <generator class="native" />
- </id>
- <version name="version" />
- <property name="street" />
- <property name="number" />
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
More information about the jbpm-commits
mailing list