Author: aadamchik
Date: Sat May 27 20:50:51 2006
New Revision: 409916

URL: http://svn.apache.org/viewvc?rev=409916&view=rev
Log:
adding support for connection pools setup 

Modified:
    incubator/cayenne/main/trunk/cayenne-regression-profiler/build-jmeter.xml
    
incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/TestDataSourceFactory.java

Modified: 
incubator/cayenne/main/trunk/cayenne-regression-profiler/build-jmeter.xml
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/build-jmeter.xml?rev=409916&r1=409915&r2=409916&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/build-jmeter.xml 
(original)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/build-jmeter.xml 
Sat May 27 20:50:51 2006
@@ -3,6 +3,7 @@
 -->
 <project default="jmeter">
        
+       <property name="jmeter.jmx" 
value="src/main/jmeter/cayenne-profile.jmx"/>
        <property name="jmeter.html" 
value="target/jmeter/cayenne-profile.html"/>
        <path id="jmeter.classpath">
                        <fileset dir="${jmeter.home}/" includes="**/*.jar"/>
@@ -21,7 +22,7 @@
                
                <jmeter
                    jmeterhome="${jmeter.home}"
-                   testplan="src/main/jmeter/cayenne-profile.jmx"
+                   testplan="${jmeter.jmx}"
                    resultlog="target/jmeter/cayenne-profile.jtl"/>
                
                <xslt

Modified: 
incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/TestDataSourceFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/TestDataSourceFactory.java?rev=409916&r1=409915&r2=409916&view=diff
==============================================================================
--- 
incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/TestDataSourceFactory.java
 (original)
+++ 
incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/TestDataSourceFactory.java
 Sat May 27 20:50:51 2006
@@ -35,6 +35,8 @@
 
     // same as the one used in unit tests
     public static final String CONNECTION_SET_PROPERTY = 
"cayenne.test.connection";
+    public static final String CONNECTION_POOL_MIN_SIZE_PROPERTY = 
"cayenne.test.pool.min";
+    public static final String CONNECTION_POOL_MAX_SIZE_PROPERTY = 
"cayenne.test.pool.max";
 
     public static String getDataSourceName() {
         String connectionSet = System.getProperty(CONNECTION_SET_PROPERTY);
@@ -55,6 +57,20 @@
             throw new CayenneRuntimeException("Connection info for key '"
                     + connectionSet
                     + "' is not configured");
+        }
+        
+        String minPool = System.getProperty(CONNECTION_POOL_MIN_SIZE_PROPERTY);
+        if(minPool != null) {
+            dsi.setMinConnections(Integer.parseInt(minPool));
+        }
+        
+        String maxPool = System.getProperty(CONNECTION_POOL_MAX_SIZE_PROPERTY);
+        if(maxPool != null) {
+            dsi.setMaxConnections(Integer.parseInt(maxPool));
+        }
+        
+        if(dsi.getMinConnections() > dsi.getMaxConnections()) {
+            dsi.setMaxConnections(dsi.getMinConnections());
         }
 
         return new PoolManager(dsi.getJdbcDriver(), dsi.getDataSourceUrl(), dsi


Reply via email to