[embjopr-commits] EMBJOPR SVN: r209 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit/as5 and 1 other directories.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Wed Mar 11 10:43:29 EDT 2009


Author: fjuma
Date: 2009-03-11 10:43:29 -0400 (Wed, 11 Mar 2009)
New Revision: 209

Added:
   trunk/jsfunit/testdata/datasources/testFiles/FlushAfterMultipleConnectionsExistingFile-ds.xml
   trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterClosingConnectionsExistingFile-ds.xml
   trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterMultipleConnectionsExistingFile-ds.xml
Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
Added datasource operations tests that use an existing -ds.xml file.


Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java	2009-03-11 02:04:08 UTC (rev 208)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java	2009-03-11 14:43:29 UTC (rev 209)
@@ -52,6 +52,8 @@
  *
  */
 public abstract class DatasourceTestBase extends EmbjoprTestCase {
+    
+    public static final String DS_NAV_LABEL = "Datasources";
    
     // Datasource types, as they appear in the left nav
     protected enum DatasourceType {
@@ -542,7 +544,7 @@
                                 DatasourceType datasourceType,
                                 Map<String, String> metricsMap) throws IOException, EmbJoprTestException {
 
-        refreshTreeNode("Datasources");
+        refreshTreeNode(DS_NAV_LABEL);
         ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
         datasourceTypeArrow.click();
 

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java	2009-03-11 02:04:08 UTC (rev 208)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java	2009-03-11 14:43:29 UTC (rev 209)
@@ -68,7 +68,7 @@
                                     Map<String, String> propertiesMap) throws IOException {
 
         // Expand the "Datasources" tree node
-        ClickableElement datasourcesArrow = getNavTreeArrow("Datasources");
+        ClickableElement datasourcesArrow = getNavTreeArrow(DS_NAV_LABEL);
         datasourcesArrow.click();
 
         HtmlAnchor datasourceLink = getNavTreeLink(datasourceType.getLabel());
@@ -138,7 +138,7 @@
                                 DatasourceType datasourceType,
                                 String tabName) throws IOException, EmbJoprTestException {
 
-        refreshTreeNode("Datasources");
+        refreshTreeNode(DS_NAV_LABEL);
         ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
         datasourceTypeArrow.click();
 
@@ -154,7 +154,7 @@
      */
     @Override
     protected void deleteDatasource(String datasourceName) throws IOException {
-        HtmlAnchor datasourceLink = getNavTreeLink("Datasources");
+        HtmlAnchor datasourceLink = getNavTreeLink(DS_NAV_LABEL);
         datasourceLink.click();
 
         HtmlSelect menu = (HtmlSelect)client.getElement("currentPageSize");
@@ -534,6 +534,30 @@
         // Min pool size will be 5, max pool size will be 20
         Map<String, String> propertiesMap = createLocalTXDatasource("FlushAfterMultipleConnectionsDS");
 
+        flushOperationAfterMultipleConnections(propertiesMap);   
+    }
+    
+    /**
+     * Test the "Flush" operation after multiple connections to a database 
+     * have been created. Use an existing datasource.
+     */ 
+    public void testFlushOperationAfterMultipleConnectionsUsingExistingDSFile() throws Exception {
+        
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("FlushAfterMultipleConnectionsExistingFile",
+                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        flushOperationAfterMultipleConnections(propertiesMap);
+    }
+    
+    /**
+     * Common code for the testFlushOperationAfterMultipleConnections* tests.
+     */
+    private void flushOperationAfterMultipleConnections(Map<String, String> propertiesMap) throws Exception {
+        
         // Create some connections and then close them. This will
         // result in non-zero values for "Connection Created Count" and
         // "Max Connections In Use Count".
@@ -616,6 +640,31 @@
         // Min pool size will be 5, max pool size will be 20
         Map<String, String> propertiesMap = createLocalTXDatasource("ListFormattedSubPoolStatisticsAfterMultipleConnectionsDS");
 
+        listFormattedSubPoolStatisticsAfterMultipleConnections(propertiesMap);   
+    }
+    
+    /**
+     * Test the "List Formatted Sub Pool Statistics" operation after multiple
+     * connections to a database have been established. Use an existing datasource. 
+     */
+    public void testListFormattedSubPoolStatisticsAfterMultipleConnectionsUsingExistingDSFile() throws Exception {
+        
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("ListFormattedAfterMultipleConnectionsExistingFile",
+                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        listFormattedSubPoolStatisticsAfterMultipleConnections(propertiesMap);
+    }
+
+    /**
+     * Common code for the 
+     * testListFormattedSubPoolStatisticsAfterMultipleConnections* tests.
+     */
+    private void listFormattedSubPoolStatisticsAfterMultipleConnections(Map<String, String> propertiesMap) throws Exception {
+        
         // Create some connections
         ArrayList<Connection> connections = createConnections(4, propertiesMap.get("jndi-name"), 
                                                               propertiesMap.get("user-name"), 
@@ -655,9 +704,9 @@
 
         // Clean up
         closeConnections(connections);
-        deleteDatasource(propertiesMap.get("jndi-name"));   
+        deleteDatasource(propertiesMap.get("jndi-name"));
     }
-
+    
     /**
      * Test the "List Formatted Sub Pool Statistics" operation after
      * closing some connections.
@@ -667,6 +716,30 @@
         // Min pool size will be 5, max pool size will be 20
         Map<String, String> propertiesMap = createLocalTXDatasource("ListFormattedSubPoolStatisticsAfterClosingConnectionsDS");
 
+        listFormattedSubPoolStatisticsAfterClosingConnections(propertiesMap); 
+    }
+    
+    /**
+     * Test the "List Formatted Sub Pool Statistics" operation after
+     * closing some connections. Use an existing datasource.
+     */
+    public void testListFormattedSubPoolStatisticsAfterClosingConnectionsUsingExistingDSFile() throws Exception {
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("ListFormattedAfterClosingConnectionsExistingFile",
+                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        listFormattedSubPoolStatisticsAfterClosingConnections(propertiesMap); 
+    }
+    
+    /**
+     * Common code for the 
+     * testListFormattedSubPoolStatisticsAfterClosingConnections* tests.
+     */
+    private void listFormattedSubPoolStatisticsAfterClosingConnections(Map<String, String> propertiesMap) throws Exception {
+        
         // Create some connections
         ArrayList<Connection> connections = createConnections(10, propertiesMap.get("jndi-name"), 
                                                               propertiesMap.get("user-name"), 
@@ -712,6 +785,7 @@
         deleteDatasource(propertiesMap.get("jndi-name"));   
     }
     
+    
     /*
      * METRICS TESTS
      */
@@ -764,7 +838,7 @@
         Map<String, String> propertiesMap = getPropertyValuesMap("MetricsInitialConnectionExistingFile",
                                                                  DatasourceType.LOCAL_TX_DATASOURCE);
         
-        expandNavTreeArrow("Datasources");
+        expandNavTreeArrow(DS_NAV_LABEL);
         
         // Min pool size will be 5, max pool size will be 20
         checkMetricsAfterInitialDBConnection(propertiesMap);
@@ -773,7 +847,7 @@
     /**
      * Common code for the testMetricsAfterInitialDBConnection* tests.
      */
-    public void checkMetricsAfterInitialDBConnection(Map<String, String> propertiesMap) throws Exception {
+    private void checkMetricsAfterInitialDBConnection(Map<String, String> propertiesMap) throws Exception {
         
         // Create the first connection
         Connection con = connectDB(propertiesMap.get("jndi-name"),  
@@ -822,7 +896,7 @@
         Map<String, String> propertiesMap = getPropertyValuesMap("MetricsMultipleConnectionsExistingFile",
                                                                  DatasourceType.NO_TX_DATASOURCE);
         
-        expandNavTreeArrow("Datasources");
+        expandNavTreeArrow(DS_NAV_LABEL);
         
         // Min pool size will be 5, max pool size will be 20
         checkMetricsAfterMultipleDBConnections(propertiesMap);
@@ -831,7 +905,7 @@
     /**
      * Common code for the testMetricsAfterMultipleDBConnections* tests.
      */
-    public void checkMetricsAfterMultipleDBConnections(Map<String, String> propertiesMap) throws Exception {
+    private void checkMetricsAfterMultipleDBConnections(Map<String, String> propertiesMap) throws Exception {
         
         // Establish multiple connections
         ArrayList<Connection> connections = createConnections(6, propertiesMap.get("jndi-name"),
@@ -879,7 +953,7 @@
         Map<String, String> propertiesMap = getPropertyValuesMap("MetricsCloseConnectionsExistingFile",
                                                                  DatasourceType.NO_TX_DATASOURCE);
         
-        expandNavTreeArrow("Datasources");
+        expandNavTreeArrow(DS_NAV_LABEL);
         
         // Min pool size will be 5, max pool size will be 20
         checkMetricsAfterClosingConnections(propertiesMap);
@@ -888,7 +962,7 @@
     /**
      * Common code for the testMetricsAfterClosingConnections* tests.
      */
-    public void checkMetricsAfterClosingConnections(Map<String, String> propertiesMap) throws Exception {
+    private void checkMetricsAfterClosingConnections(Map<String, String> propertiesMap) throws Exception {
         
         // Establish some connections
         ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"),

Added: trunk/jsfunit/testdata/datasources/testFiles/FlushAfterMultipleConnectionsExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/FlushAfterMultipleConnectionsExistingFile-ds.xml	                        (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/FlushAfterMultipleConnectionsExistingFile-ds.xml	2009-03-11 14:43:29 UTC (rev 209)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+    <local-tx-datasource>
+        <jndi-name>FlushAfterMultipleConnectionsExistingFile</jndi-name>
+        <rar-name>jboss-local-jdbc.rar</rar-name>
+        <use-java-context>true</use-java-context>
+        <connection-definition>javax.sql.DataSource</connection-definition>
+        <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+        <min-pool-size>5</min-pool-size>
+        <max-pool-size>20</max-pool-size>
+        <blocking-timeout-millis>35000</blocking-timeout-millis>
+        <idle-timeout-minutes>20</idle-timeout-minutes>
+        <prefill>false</prefill>
+        <background-validation>false</background-validation>
+        <background-validation-millis>0</background-validation-millis>
+        <validate-on-match>true</validate-on-match>
+        <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+        <isSameRM-override-value>false</isSameRM-override-value>
+        <allocation-retry>0</allocation-retry>
+        <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+        <metadata>
+            <type-mapping>FirstSQL/J</type-mapping>
+        </metadata>
+        <local-transaction/>
+        <user-name>sa</user-name>
+        <password></password>
+        <prepared-statement-cache-size>0</prepared-statement-cache-size>
+        <share-prepared-statements>false</share-prepared-statements>
+        <set-tx-query-timeout>false</set-tx-query-timeout>
+        <query-timeout>0</query-timeout>
+        <use-try-lock>60000</use-try-lock>
+        <driver-class>org.hsqldb.jdbcDriver</driver-class>
+        <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+    </local-tx-datasource>
+</datasources>

Added: trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterClosingConnectionsExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterClosingConnectionsExistingFile-ds.xml	                        (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterClosingConnectionsExistingFile-ds.xml	2009-03-11 14:43:29 UTC (rev 209)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+    <local-tx-datasource>
+        <jndi-name>ListFormattedAfterClosingConnectionsExistingFile</jndi-name>
+        <rar-name>jboss-local-jdbc.rar</rar-name>
+        <use-java-context>true</use-java-context>
+        <connection-definition>javax.sql.DataSource</connection-definition>
+        <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+        <min-pool-size>5</min-pool-size>
+        <max-pool-size>20</max-pool-size>
+        <blocking-timeout-millis>35000</blocking-timeout-millis>
+        <idle-timeout-minutes>20</idle-timeout-minutes>
+        <prefill>false</prefill>
+        <background-validation>false</background-validation>
+        <background-validation-millis>0</background-validation-millis>
+        <validate-on-match>true</validate-on-match>
+        <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+        <isSameRM-override-value>false</isSameRM-override-value>
+        <allocation-retry>0</allocation-retry>
+        <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+        <metadata>
+            <type-mapping>FirstSQL/J</type-mapping>
+        </metadata>
+        <local-transaction/>
+        <user-name>sa</user-name>
+        <password></password>
+        <prepared-statement-cache-size>0</prepared-statement-cache-size>
+        <share-prepared-statements>false</share-prepared-statements>
+        <set-tx-query-timeout>false</set-tx-query-timeout>
+        <query-timeout>0</query-timeout>
+        <use-try-lock>60000</use-try-lock>
+        <driver-class>org.hsqldb.jdbcDriver</driver-class>
+        <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+    </local-tx-datasource>
+</datasources>

Added: trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterMultipleConnectionsExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterMultipleConnectionsExistingFile-ds.xml	                        (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/ListFormattedAfterMultipleConnectionsExistingFile-ds.xml	2009-03-11 14:43:29 UTC (rev 209)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+    <local-tx-datasource>
+        <jndi-name>ListFormattedAfterMultipleConnectionsExistingFile</jndi-name>
+        <rar-name>jboss-local-jdbc.rar</rar-name>
+        <use-java-context>true</use-java-context>
+        <connection-definition>javax.sql.DataSource</connection-definition>
+        <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+        <min-pool-size>5</min-pool-size>
+        <max-pool-size>20</max-pool-size>
+        <blocking-timeout-millis>35000</blocking-timeout-millis>
+        <idle-timeout-minutes>20</idle-timeout-minutes>
+        <prefill>false</prefill>
+        <background-validation>false</background-validation>
+        <background-validation-millis>0</background-validation-millis>
+        <validate-on-match>true</validate-on-match>
+        <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+        <isSameRM-override-value>false</isSameRM-override-value>
+        <allocation-retry>0</allocation-retry>
+        <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+        <metadata>
+            <type-mapping>FirstSQL/J</type-mapping>
+        </metadata>
+        <local-transaction/>
+        <user-name>sa</user-name>
+        <password></password>
+        <prepared-statement-cache-size>0</prepared-statement-cache-size>
+        <share-prepared-statements>false</share-prepared-statements>
+        <set-tx-query-timeout>false</set-tx-query-timeout>
+        <query-timeout>0</query-timeout>
+        <use-try-lock>60000</use-try-lock>
+        <driver-class>org.hsqldb.jdbcDriver</driver-class>
+        <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+    </local-tx-datasource>
+</datasources>




More information about the embjopr-commits mailing list