portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject svn commit: r226651 - in /portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers: DatasourceHelper.java OJBHelper.java
Date Sun, 31 Jul 2005 15:39:59 GMT
Author: dlestrat
Date: Sun Jul 31 08:39:57 2005
New Revision: 226651

URL: http://svn.apache.org/viewcvs?rev=226651&view=rev
Log:
Added BuildPropertiesHelper to provide access to build.properties/project.properties
in unit tests.

Modified:
    portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/DatasourceHelper.java
    portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/OJBHelper.java

Modified: portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/DatasourceHelper.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/DatasourceHelper.java?rev=226651&r1=226650&r2=226651&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/DatasourceHelper.java
(original)
+++ portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/DatasourceHelper.java
Sun Jul 31 08:39:57 2005
@@ -5,28 +5,30 @@
 import org.apache.commons.dbcp.BasicDataSource;
 
 /**
- * This helper adds a "datasource" based on the maven
- * build.properties/project.properties database settings
- * passed to the test case, (see AbstractTestHelper).
- * 
+ * This helper adds a "datasource" based on the maven build.properties/project.properties
database settings passed to
+ * the test case, (see AbstractTestHelper).
  * 
  * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
- *
  */
 public class DatasourceHelper extends AbstractTestHelper
 {
 
     public static final String DATASOURCE_KEY = "datasource";
+
     private static final String ORG_APACHE_JETSPEED_TEST_DATABASE_PASSWORD = "org.apache.jetspeed.test.database.password";
+
     private static final String ORG_APACHE_JETSPEED_TEST_DATABASE_USER = "org.apache.jetspeed.test.database.user";
+
     private static final String ORG_APACHE_JETSPEED_TEST_DATABASE_URL = "org.apache.jetspeed.test.database.url";
+
     private static final String ORG_APACHE_JETSPEED_TEST_DATABASE_DRIVER = "org.apache.jetspeed.test.database.driver";
+
     protected BasicDataSource datasource;
-    
+
     public DatasourceHelper(Map context)
     {
         super(context);
-        
+
     }
 
     public void setUp() throws Exception
@@ -43,7 +45,5 @@
     {
         datasource.close();
     }
-
-   
 
 }

Modified: portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/OJBHelper.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/OJBHelper.java?rev=226651&r1=226650&r2=226651&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/OJBHelper.java
(original)
+++ portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/OJBHelper.java
Sun Jul 31 08:39:57 2005
@@ -13,7 +13,9 @@
 {
 
     public static final String DATASOURCE_BEAN = "JetspeedDS";
+
     private GenericApplicationContext appCtx;
+
     private DefaultListableBeanFactory bf;
 
     public OJBHelper(Map context)
@@ -22,13 +24,13 @@
     }
 
     public void setUp() throws Exception
-    {        
-        super.setUp();        
-        bf = new DefaultListableBeanFactory();        
+    {
+        super.setUp();
+        bf = new DefaultListableBeanFactory();
         bf.registerSingleton(DATASOURCE_BEAN, datasource);
         LocalOjbConfigurer ojbConfigurer = new LocalOjbConfigurer();
-        ojbConfigurer.setBeanFactory(bf);        
-        addBeanFactory(bf);        
+        ojbConfigurer.setBeanFactory(bf);
+        addBeanFactory(bf);
         appCtx = new GenericApplicationContext(bf);
         bf.preInstantiateSingletons();
         getContext().put(APP_CONTEXT, appCtx);
@@ -39,12 +41,15 @@
         bf.destroySingletons();
         super.tearDown();
     }
-    
+
     /**
-     * Surrounds the <code>object</code> with <code>TransactionProxyFactoryBean</code>
-     * that implements all interfaces specified in <code>interfacesToProxyAs</code>
-     * @param object object to wrap with a TX Proxy
-     * @param interfacesToProxyAs interfeaces to proxy as
+     * Surrounds the <code>object</code> with <code>TransactionProxyFactoryBean</code>
that implements all
+     * interfaces specified in <code>interfacesToProxyAs</code>
+     * 
+     * @param object
+     *            object to wrap with a TX Proxy
+     * @param interfacesToProxyAs
+     *            interfeaces to proxy as
      * @return Tx Wrapped version of the priginal object
      * @throws Exception
      */
@@ -53,14 +58,12 @@
         TransactionProxyFactoryBean txfb = new TransactionProxyFactoryBean();
         txfb.setTransactionManager(new PersistenceBrokerTransactionManager());
         Properties txProps = new Properties();
-        txProps.setProperty("*","PROPAGATION_REQUIRED");
+        txProps.setProperty("*", "PROPAGATION_REQUIRED");
         txfb.setTransactionAttributes(txProps);
         txfb.setTarget(object);
         txfb.setProxyInterfaces(interfacesToProxyAs);
         txfb.afterPropertiesSet();
         return txfb.getObject();
     }
-
-   
 
 }



---------------------------------------------------------------------
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