portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r224690 - in /portals/jetspeed-2/trunk: components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java etc/db-ojb/test-repository-datasource-spring.xml
Date Mon, 25 Jul 2005 04:59:49 GMT
Author: rwatler
Date: Sun Jul 24 21:59:46 2005
New Revision: 224690

URL: http://svn.apache.org/viewcvs?rev=224690&view=rev
Log:
implement test spring boot container and datasource config

Added:
    portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml   (with props)
Modified:
    portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java

Modified: portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java?rev=224690&r1=224689&r2=224690&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
(original)
+++ portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
Sun Jul 24 21:59:46 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.jetspeed.components.test;
 
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import junit.framework.TestCase;
@@ -38,13 +39,34 @@
      */
     protected ClassPathXmlApplicationContext ctx;
     
-    protected abstract String[] getConfigurations();
-    
-    
-
+    /**
+     * setup Spring context as part of test setup
+     */
     protected void setUp() throws Exception
     {        
         super.setUp();
-        ctx = new ClassPathXmlApplicationContext(getConfigurations());
+        String [] bootConfigurations = getBootConfigurations();
+        if (bootConfigurations != null)
+        {
+            ApplicationContext bootContext = new ClassPathXmlApplicationContext(bootConfigurations,
true);
+            ctx = new ClassPathXmlApplicationContext(getConfigurations(), true, bootContext);
+        }
+        else
+        {
+            ctx = new ClassPathXmlApplicationContext(getConfigurations(), true);
+        }
+    }
+
+    /**
+     * required specification of spring configurations
+     */
+    protected abstract String[] getConfigurations();
+    
+    /**
+     * optional specification of boot spring configurations
+     */
+    protected String[] getBootConfigurations()
+    {
+        return null;
     }
-}
\ No newline at end of file
+}

Added: portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml?rev=224690&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml (added)
+++ portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml Sun Jul 24 21:59:46
2005
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<beans>		
+
+  <!-- datasource bean -->
+  <bean id="JetspeedDS" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+    <property name="driverClassName">
+      <value>${org.apache.jetspeed.database.driver}</value>
+    </property>
+    <property name="url">
+      <value>${org.apache.jetspeed.database.url}</value>
+    </property>
+    <property name="username">
+      <value>${org.apache.jetspeed.database.user}</value>
+    </property>
+    <property name="password">
+      <value>${org.apache.jetspeed.database.password}</value>
+    </property>
+  </bean>      
+     
+  <!-- OJB configurer -->
+  <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer"/>
   	
+
+  <!-- properties configurer used to pick up system properties -->
+  <bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+</beans>

Propchange: portals/jetspeed-2/trunk/etc/db-ojb/test-repository-datasource-spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message