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

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Mon Jun 1 11:59:17 EDT 2009


Author: fjuma
Date: 2009-06-01 11:59:17 -0400 (Mon, 01 Jun 2009)
New Revision: 485

Added:
   trunk/jsfunit/testdata/connfactories/TestCF-ds.xml
Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryCreationTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java
Log:
Adding some more creation tests for connection factories.


Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java	2009-05-30 13:36:34 UTC (rev 484)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java	2009-06-01 15:59:17 UTC (rev 485)
@@ -399,7 +399,7 @@
      */
     protected void waitForResourceOperationToFinish() throws HtmlElementNotFoundException, IOException, InterruptedException {
         
-        for(int i = 0; i < 20; i++) {
+        for(int i = 0; i < 40; i++) {
             
             String status = getLatestOperationStatus();
             

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryCreationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryCreationTest.java	2009-05-30 13:36:34 UTC (rev 484)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryCreationTest.java	2009-06-01 15:59:17 UTC (rev 485)
@@ -33,6 +33,7 @@
 import org.jboss.metatype.api.values.SimpleValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import java.util.Map;
+import java.util.HashMap;
 
 
 /**
@@ -105,6 +106,106 @@
     }
     
     /**
+     * Test Name: testCreateConnFactoryMissingRequiredValues
+     * Assertion: Verify the ability to handle a missing required value when
+     * creating a connection factory. Make sure the appropriate error message occurs.
+     */
+    public void testCreateConnFactoryMissingRequiredValues() throws IOException, EmbJoprTestException {   
+        Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
+        
+        // Leave jndi-name and connection-definition unset
+        propertiesMap.put("rar-name", SimpleValueSupport.wrap(EMBJOPR_TEST_ADAPTER));
+        
+        createConnFactory(CFType.NO_TX_CF, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     MISSING_VALUE_MESSAGE,  true);
+    }
+    
+    /**
+     * Test Name: testCreateConnFactoryPropertyOutOfRange
+     * Assertion: Verify the ability to handle a property value below its
+     * expected range of values when creating a connection factory. Make sure the 
+     * appropriate error message occurs.
+     */
+    public void testCreateConnFactoryPropertyOutOfRange() throws IOException, EmbJoprTestException {
+        String jndiName = "PropertyOutOfRangeCF";
+
+        Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
+        
+        propertiesMap.put("jndi-name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("rar-name", SimpleValueSupport.wrap(EMBJOPR_TEST_ADAPTER));
+        propertiesMap.put("connection-definition", SimpleValueSupport.wrap(TEST_CONNECTION_DEFINITION));
+        propertiesMap.put("min-pool-size", SimpleValueSupport.wrap(new Integer(5)));
+        
+        // This number is too small
+        propertiesMap.put("max-pool-size", SimpleValueSupport.wrap(new Integer(-5)));
+        
+        createConnFactory(CFType.LOCAL_TX_CF, propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     BELOW_ALLOWABLE_MINIMUM,
+                                     true);
+    }
+    
+    /**
+     * Test Name: testCreateConnFactoryInvalidPropertyType
+     * Assertion: Verify the ability to handle a property value that has an
+     * invalid type when creating a connection factory. Make sure the appropriate 
+     * error message occurs.
+     */
+    public void testCreateConnFactoryInvalidPropertyType() throws IOException, EmbJoprTestException {
+        String jndiName = "InvalidPropertyCF";
+        
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
+        
+        propertiesMap.put("jndi-name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("rar-name", SimpleValueSupport.wrap(EMBJOPR_TEST_ADAPTER));
+        propertiesMap.put("connection-definition", SimpleValueSupport.wrap(TEST_CONNECTION_DEFINITION));
+        
+        // This property should be an integer
+        propertiesMap.put("min-pool-size", SimpleValueSupport.wrap("abcde"));
+        
+        createConnFactory(CFType.LOCAL_TX_CF, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     INVALID_INTEGER_MESSAGE, true);
+    }
+    
+    /**
+     * Test Name: testCreateConnFactoryDuplicateJNDIName
+     * Assertion: Verify the ability to handle a duplicate JNDI name 
+     * when creating a connection factory. Make sure the appropriate error message 
+     * occurs.
+     */
+    public void testCreateConnFactoryDuplicateJNDIName() throws IOException, EmbJoprTestException {
+        
+        // A connection factory with this JNDI name already exists
+        String jndiName = "TestCF";
+            
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
+
+        propertiesMap.put("jndi-name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("rar-name", SimpleValueSupport.wrap(EMBJOPR_TEST_ADAPTER));
+        propertiesMap.put("connection-definition", SimpleValueSupport.wrap(TEST_CONNECTION_DEFINITION));
+
+        createConnFactory(CFType.LOCAL_TX_CF, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        String expectedMessage = "A " + CFType.LOCAL_TX_CF.getName() + " named '" 
+                                 + jndiName + "' already exists";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, true);
+    }
+    
+    /**
      * @return the suite of tests being tested
      */
     public static Test suite() {

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java	2009-05-30 13:36:34 UTC (rev 484)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java	2009-06-01 15:59:17 UTC (rev 485)
@@ -603,8 +603,6 @@
         expectedMetrics.put(SCHEDULED_MSG_COUNT, "2");
         expectedMetrics.put(COUNT, "2");
         expectedMetrics.put(COUNT_DELTA, "2");
-        expectedMetrics.put(DEPTH, "0");
-        expectedMetrics.put(DEPTH_DELTA, "0"); 
         expectedMetrics.put(CONSUMER_COUNT, "1");
         expectedMetrics.put(MSG_COUNT, "2");
         expectedMetrics.put(DELIVERING_COUNT, "0");

Added: trunk/jsfunit/testdata/connfactories/TestCF-ds.xml
===================================================================
--- trunk/jsfunit/testdata/connfactories/TestCF-ds.xml	                        (rev 0)
+++ trunk/jsfunit/testdata/connfactories/TestCF-ds.xml	2009-06-01 15:59:17 UTC (rev 485)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<connection-factories>
+    <tx-connection-factory>
+        <jndi-name>TestCF</jndi-name>
+        <rar-name>embjoprtestadapter.rar</rar-name>
+        <use-java-context>true</use-java-context>
+        <connection-definition>javax.resource.cci.ConnectionFactory</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>30000</blocking-timeout-millis>
+        <idle-timeout-minutes>30</idle-timeout-minutes>
+        <prefill>true</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>
+        <application-managed-security xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
+        <metadata/>
+        <xa-resource-timeout>0</xa-resource-timeout>
+    </tx-connection-factory>
+</connection-factories>




More information about the embjopr-commits mailing list