Author: tfischer
Date: Wed Jul 6 14:22:13 2011
New Revision: 1143431
URL: http://svn.apache.org/viewvc?rev=1143431&view=rev
Log:
TORQUE-115: do not initialize Torque if it is already initialized
Modified:
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java
Modified:
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java?rev=1143431&r1=1143430&r2=1143431&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java
(original)
+++
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java
Wed Jul 6 14:22:13 2011
@@ -30,6 +30,8 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
+import junit.framework.TestCase;
+
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.configuration.Configuration;
@@ -48,11 +50,13 @@ import org.apache.torque.util.Criteria;
* It is tested whether we can bind a data source manually into jndi and
* retrieve it in Torque, and also it is tested whether we can bind a
* data source using Torque.
+ * Note: This test does not extend BaseRuntimeTestCase as we do not want Torque
+ * to be initialized.
*
* @author <a href="mailto:[email protected]">Thomas Fischer</a>
* @version $Id $
*/
-public class JndiConfigurationTest extends BaseRuntimeTestCase
+public class JndiConfigurationTest extends TestCase
{
/**
* The subcontext where the data source is bound.
@@ -156,6 +160,10 @@ public class JndiConfigurationTest exten
dataSourceConnect(dataSource);
+ if (Torque.isInit())
+ {
+ Torque.shutdown();
+ }
// initialize torque with the created configuration
// and check that we can connect to the database.
try
@@ -463,7 +471,7 @@ public class JndiConfigurationTest exten
{
Configuration configuration = new PropertiesConfiguration(
System.getProperty(
- CONFIG_FILE_SYSTEM_PROPERTY));
+ BaseRuntimeTestCase.CONFIG_FILE_SYSTEM_PROPERTY));
return configuration;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]