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

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Thu Apr 30 14:17:11 EDT 2009


Author: fjuma
Date: 2009-04-30 14:17:11 -0400 (Thu, 30 Apr 2009)
New Revision: 368

Added:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceConfigurationTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceCreationTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceDeletionTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceMetricsTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceOperationsTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSConfigurationTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSCreationTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSDeletionTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSOperationsTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSTest.java
Removed:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
Modified:
   trunk/jsfunit/pom.xml
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
Log:
Adding two new pacakges for the JSFUnit tests: org.jboss.jopr.jsfunit.as5.datasources and org.jboss.jopr.jsfunit.as5.jmsDestinations.
Splitting the datasource tests and JMS tests into smaller classes (eg. DatasourceCreationTest.java, DatasourceDeletionTest.java, etc.).


Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml	2009-04-29 21:41:34 UTC (rev 367)
+++ trunk/jsfunit/pom.xml	2009-04-30 18:17:11 UTC (rev 368)
@@ -417,6 +417,8 @@
                            <skip>false</skip>
                            <includes>
                              <include>**/as5/*Test.java</include>
+                             <include>**/as5/jmsDestinations/*Test.java</include>
+                             <include>**/as5/datasources/*Test.java</include>
                              <include>**/jsfunit/*Test.java</include>
                              <!--
                              -->

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java	2009-04-29 21:41:34 UTC (rev 367)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -23,6 +23,7 @@
 package org.jboss.jopr.jsfunit;
 
 import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.as5.ResourceTestBase;
 import com.gargoylesoftware.htmlunit.html.*;
 import java.io.IOException;
 import junit.framework.Test;
@@ -54,22 +55,42 @@
  * @author Ondrej Zizka
  *
  */
-public abstract class DatasourceTestBase extends EmbjoprTestCase {
+public abstract class DatasourceTestBase extends ResourceTestBase {
     
+    // Nav labels for datasources
     public static final String DS_NAV_LABEL = "Datasources";
+    public static final String LOCAL_TX_DS_NAV_LABEL = "Local Tx Datasources";
+    public static final String NO_TX_DS_NAV_LABEL = "No Tx Datasources";
+    public static final String XA_DS_NAV_LABEL = "XA Datasources";
     
+    // Datasource operations
+    public static final String FLUSH = "Flush";
+    public static final String LIST_FORMATTED_SUB_POOL_STATISTICS = "List Formatted Sub Pool Statistics";
+    public static final String LIST_STATISTICS = "List Statistics";
+    
+    // Datasource metrics
+    public static final String AVAILABLE_CONNECTION_COUNT = "Available Connection Count";
+    public static final String CONNECTION_COUNT = "Connection Count";
+    public static final String CONNECTION_CREATED_COUNT = "Connection Created Count";
+    public static final String CONNECTION_DESTROYED_COUNT = "Connection Destroyed Count";
+    public static final String IN_USE_CONNECTION_COUNT = "In Use Connection Count";
+    public static final String MAX_CONNECTIONS_IN_USE_COUNT = "Max Connections In Use Count";
+    public static final String MAX_SIZE = "Max Size";
+    public static final String MIN_SIZE = "Min Size";
+    
+    // Gets displayed in the output of the "List Formatted Sub Pool Statistics" operation
     public static final String POOL_SEPARATOR = "------------------------------------------------------";
    
     // Datasource types, as they appear in the left nav
-    protected enum DatasourceType {
+    public enum DatasourceType {
 
         // Some of these values are specific for AS 5.  TODO: Think up some way to split nicely.
         //                  // label                serviceName  xml-element-name       template <select>
-        LOCAL_TX_DATASOURCE("Local Tx Datasources", "LocalTxCM", "local-tx-datasource", "default__Local Tx Datasource",
+        LOCAL_TX_DATASOURCE(LOCAL_TX_DS_NAV_LABEL, "LocalTxCM", "local-tx-datasource", "default__Local Tx Datasource",
                             "Local Tx Datasource"),
-        NO_TX_DATASOURCE(   "No Tx Datasources",    "NoTxCM",    "no-tx-datasource",    "default__No Tx Datasource",
+        NO_TX_DATASOURCE(   NO_TX_DS_NAV_LABEL,    "NoTxCM",    "no-tx-datasource",    "default__No Tx Datasource",
                             "No Tx Datasource"),  
-        XA_DATASOURCE(      "XA Datasources",       "XATxCM",    "xa-datasource",       "default__XA Datasource",
+        XA_DATASOURCE(      XA_DS_NAV_LABEL,       "XATxCM",    "xa-datasource",       "default__XA Datasource",
                             "XA Datasource");
 
         protected String label;
@@ -91,8 +112,8 @@
         protected final String typeName;
         public String getTypeName() { return typeName; }
 
-        private DatasourceType(String label, String serviceName, 
-                               String xmlElementName, String htmlSelectValue, String typeName)
+        DatasourceType(String label, String serviceName, 
+                       String xmlElementName, String htmlSelectValue, String typeName)
         {
             this.label = label;
             this.serviceName = serviceName;
@@ -129,7 +150,7 @@
 			</select>
 
      */
-    protected enum DatasourceTemplate {
+    public enum DatasourceTemplate {
 
         /** AS 4 */
         AS4_ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
@@ -146,7 +167,7 @@
 
         protected final String templateHtmlSelectValue;
 
-        private DatasourceTemplate(String templateHtmlSelectValue) {
+        DatasourceTemplate(String templateHtmlSelectValue) {
             this.templateHtmlSelectValue = templateHtmlSelectValue;
         }
 
@@ -159,7 +180,7 @@
     }
 
     // Datasource properties
-    private Map<String, String> datasourceProperties = createDatasourceProperties();
+    protected Map<String, String> datasourceProperties = createDatasourceProperties();
 
     /**
      * @returns a set of properties created upon initialization by overriden createDatasourceProperties().
@@ -423,7 +444,7 @@
         createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
                          DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // "default__Local Tx Datasource",
                          propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
+        client.click(SAVE_BUTTON);
 
         return propertiesMap;
     }
@@ -454,7 +475,7 @@
         createDatasource(DatasourceType.NO_TX_DATASOURCE,
                          DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No Tx Datasource",
                          propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
+        client.click(SAVE_BUTTON);
 
         return propertiesMap;
     }
@@ -478,7 +499,7 @@
         createDatasource(DatasourceType.XA_DATASOURCE,
                          DatasourceType.XA_DATASOURCE.getTemplateHtmlSelectValue(), //"default__XA Datasource",
                          propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
+        client.click(SAVE_BUTTON);
 
         return propertiesMap;
     }
@@ -564,29 +585,29 @@
         datasource.click();
 
         // Check values under the "Metrics" tab
-        HtmlAnchor metricsLink = (HtmlAnchor)client.getElement("metricsTab");
+        HtmlAnchor metricsLink = (HtmlAnchor)client.getElement(METRICS_TAB);
         metricsLink.click();
 
         for(Iterator i = metricsMap.keySet().iterator(); i.hasNext();) {
             String metricName = (String)i.next();
             String expected = metricsMap.get(metricName);
-            String actual = getMetricValueFromTable(metricName, "dataTable");
+            String actual = getMetricValueFromTable(metricName, DATA_TABLE);
             actual = normalizeIfDoubleExpected(expected, actual); // Some LOCALEs encode doubles with coma.
             assertEquals("Incorrect metric value for '" + metricName + "'", expected, actual);
         }
 
         // Check values under the "Summary" tab
-        HtmlAnchor summaryLink = (HtmlAnchor)client.getElement("summaryTab");
+        HtmlAnchor summaryLink = (HtmlAnchor)client.getElement(SUMMARY_TAB);
         summaryLink.click();
 
         ArrayList<String> summaryMetrics = new ArrayList<String>();
-        summaryMetrics.add("Available Connection Count");
-        summaryMetrics.add("Connection Count");
+        summaryMetrics.add(AVAILABLE_CONNECTION_COUNT);
+        summaryMetrics.add(CONNECTION_COUNT);
 
         for(Iterator i = summaryMetrics.iterator(); i.hasNext(); ) {
             String metricName = (String)i.next();
             String expected = metricsMap.get(metricName);
-            String actual = getMetricValueFromTable(metricName, "dataTable");
+            String actual = getMetricValueFromTable(metricName, DATA_TABLE);
             actual = normalizeIfDoubleExpected(expected, actual); // Some LOCALEs encode doubles with coma.
             assertEquals("Incorrect summary metric value for '" + metricName + "'='" + actual + "'," +
                          " expected '"+expected+"'", expected, actual);
@@ -632,147 +653,5 @@
         
         return actualValuesMap;
     }
-    
-    /*
-     * CREATION TESTS
-     */
-    
-    /**
-     * Attempt to create a new datasource but leave at least one required
-     * value unset. An error should occur.
-		 *
-		 * TODO:  Check if works for AS 4 .
-     */
-    public void testCreateDatasourceMissingRequiredValues() throws IOException, EmbJoprTestException {
-        
-        // Leave jndi-name and connection-url unset
-        Map<String, String> propertiesMap = new HashMap<String, String>();
-        propertiesMap.put("user-name", "testUser");
-        propertiesMap.put("max-pool-size", "10");
-        propertiesMap.put("idle-timeout-minutes", "20");
-        if(!isJBoss4){
-            propertiesMap.put("prefill", "true");
-            propertiesMap.put("set-tx-query-timeout", "true");
-            propertiesMap.put("query-timeout", "1800");
-        }
-        
-        createDatasource(DatasourceType.NO_TX_DATASOURCE, 
-                         //"default__No Tx Datasource",
-                         isJBoss4 ?
-                             DatasourceTemplate.AS4_DEFAULT.getTemplateHtmlSelectValue() :
-                             DatasourceTemplate.AS5_DEFAULT_NO_TX.getTemplateHtmlSelectValue(),
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-        
-        // Check for the appropriate error messages
-        checkClientAndServerMessages("An invalid value was specified for one or more properties",
-                                     "Value is required",  true);
-    }
-    
-
-    /**
-     * Attempt to create a new datasource but set a property value
-     * beyond its expected range of values. An error should occur.
-		 *
-		 * TODO:  Check if works for AS 4 .
-     */
-    public void testCreateDatasourcePropertyOutOfRange() throws IOException, EmbJoprTestException {
-        Map<String, String> propertiesMap = new HashMap<String, String>();
-        propertiesMap.put("jndi-name", "PropertyOutOfRangeDS");
-        propertiesMap.put("user-name", "testUser");
-        propertiesMap.put("password", "password");
-        propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
-        propertiesMap.put("xa-resource-timeout", "36000");
-
-        // This number is too big
-        propertiesMap.put("max-pool-size", "100000000000000");
-
-        createDatasource(DatasourceType.XA_DATASOURCE,
-                         DatasourceTemplate.AS5_DEFAULT_XA.getTemplateHtmlSelectValue(),
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate error messages
-        checkClientAndServerMessages("An invalid value was specified for one or more properties",
-                                     "Specified attribute is not between the expected values",
-                                     true);
-    }
-    
-    /**
-     * Attempt to create a new datasource but set a property value
-     * to an invalid type. An error should occur.
-		 *
-		 * TODO:  Check if works for AS 4 .
-     */
-    public void testCreateDatasourceInvalidPropertyType() throws IOException, EmbJoprTestException {
-        Map<String, String> propertiesMap = new HashMap<String, String>();
-        propertiesMap.put("jndi-name", "InvalidPropertyTypeDS");
-        propertiesMap.put("min-pool-size", "10");
-        propertiesMap.put("max-pool-size", "20");
-        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
-        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
-        propertiesMap.put("share-prepared-statements", "false"); 
-        
-        // This property value is supposed to be an integer
-        propertiesMap.put("background-validation-millis", "abcde"); 
-        
-        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
-                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // TODO: Redundant, remove.
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-        
-        // Check for the appropriate error messages
-        checkClientAndServerMessages("An invalid value was specified for one or more properties", 
-                                     "Value is not a valid integer", 
-                                     true);
-    }
-
-    /**
-     * Attempt to create a new datasource but set a property value to a value
-     * that is the correct type but is not an allowed value for that
-     * property. An error should occur.
-     */
-    public void testCreateDatasourcePropertyNotAllowed() throws IOException, EmbJoprTestException {
-        Map<String, String> propertiesMap = new HashMap<String, String>();
-        propertiesMap.put("jndi-name", "PropertyNotAllowedDS");
-        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
-        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
-
-        // This number is a valid integer but is below the
-        // allowable minimum value
-        propertiesMap.put("max-pool-size", "-25");
-
-        createDatasource(DatasourceType.NO_TX_DATASOURCE,
-                         DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No Tx Datasource",
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate error messages
-        checkClientAndServerMessages("An invalid value was specified for one "
-                                     + "or more properties",
-                                     "Value is less than allowable minimum",
-                                     true);
-    }
-
-    /**
-     * Attempt to create a new datasource using a JNDI name that already exists.
-     * An error should occur.
-     */
-    public void testCreateDatasourceDuplicateJNDIName() throws IOException, EmbJoprTestException {
-        Map<String, String> propertiesMap = new HashMap<String, String>();
-        propertiesMap.put("jndi-name", "DefaultDS");
-        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
-        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
-
-        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
-                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__Local Tx Datasource",
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate error messages
-        String expectedMessage = "A " + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName() + " named "
-                                 + "'DefaultDS' already exists";
-        checkClientAndServerMessages(expectedMessage, expectedMessage, true);
-    }
 }
 

Deleted: 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-04-29 21:41:34 UTC (rev 367)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -1,1032 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.IOException;
-import java.util.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import javax.management.ObjectName;
-import java.util.Map;
-import javax.management.JMException;
-import java.sql.Connection;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-import org.jboss.deployers.spi.management.KnownComponentTypes;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
-
-/**
- * When complete, this class will contain tests for creating, 
- * configuring, and deleting various types of datasources. This
- * test class should be run against JBAS 5.x.
- * 
- * @author Farah Juma
- *
- */
-public class DatasourceTest extends DatasourceTestBase {
-
-    private final String MAX_ITEMS_PER_PAGE="20";
-    
-    private static final ComponentType LOCAL_TX_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.LocalTx.getType();
-    private static final ComponentType NO_TX_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.NoTx.getType();
-    private static final ComponentType XA_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.XA.getType();
-
-    private static final String OPERATION_RESULTS = "operationResults";
-    
-    /**
-     * Create a new datasource using the given type, template, and properties.
-     *
-     * AS 5 version differs in menu tree structure - one more step.
-     * Thus, this method is overriden from the Base class.
-     * 
-     * @param datasourceType must be a datasource type from DatasourceType enum.
-     * It's label from the left nav (eg. "Local Tx Datasources") is in getLabel() property.
-     *
-     */
-    @Override
-    protected void createDatasource(DatasourceType datasourceType,
-                                    String datasourceTemplate,
-                                    Map<String, String> propertiesMap) throws IOException, EmbJoprTestException {
-
-        // Expand the "Datasources" tree node
-        ClickableElement datasourcesArrow = getNavTreeArrow(DS_NAV_LABEL);
-        datasourcesArrow.click();
-
-        HtmlAnchor datasourceLink = getNavTreeLink(datasourceType.getLabel());
-        datasourceLink.click();
-        
-        // Add a new datasource 
-        client.click("actionHeaderForm:addNewNotContent");
-        HtmlSelect menu = (HtmlSelect)client.getElement("selectedTemplate");
-        menu.setSelectedAttribute(datasourceTemplate, Boolean.TRUE);
-        client.click("resourceCreateForm:addButton");
-        
-        // Configure the properties associated with this datasource
-        fillOutForm(propertiesMap);  
-    }
-
-    /**
-     * Properties needed for testCreateDatasource.
-     * @returns the properties from the base class overriden by properties for AS 5.
-     */
-    @Override
-    protected Map<String, MetaValue> createDatasourcePropertiesAsMetaValues() {
-        Map<String, MetaValue> propertiesMap = super.createDatasourcePropertiesAsMetaValues();
-        
-        // Additional properties
-        propertiesMap.put("query-timeout", SimpleValueSupport.wrap(new Integer(180)));
-        propertiesMap.put("share-prepared-statements", SimpleValueSupport.wrap(Boolean.FALSE));
-        propertiesMap.put("stale-connection-checker-class-name", 
-                          SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.StaleConnectionChecker"));
-        propertiesMap.put("allocation-retry", SimpleValueSupport.wrap(new Integer(10000)));
-        propertiesMap.put("allocation-retry-wait-millis", SimpleValueSupport.wrap(new Long(10000)));
-        propertiesMap.put("background-validation-millis", SimpleValueSupport.wrap(new Long(15000)));
-        propertiesMap.put("prefill", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMap.put("use-try-lock", SimpleValueSupport.wrap(new Long(61000)));
-        
-        return propertiesMap;
-    }
-    
-    /**
-     * Perform the given operation on the given datasource.
-     * 
-     * performDatasourceOperation() assumes that the "Datasources"
-     * tree node is already expanded when this method is called.
-     */
-    protected void performDatasourceOperation(String datasourceName,
-                                              DatasourceType datasourceType,
-                                              String operationName) throws IOException, EmbJoprTestException {
-
-        navigateToPage(datasourceName, datasourceType, "controlTab");
-
-        HtmlForm form = (HtmlForm)client.getElement("operationsForm");
-        String xpath = ".//input[@value=\"" + operationName + "\"]";
-
-        HtmlButtonInput operationButton = (HtmlButtonInput)form.getFirstByXPath(xpath);
-        operationButton.click();
-    }
-
-    /**
-     * Navigate to the given tab (eg. "configurationTab", "controlTab") for 
-     * the given datasource.
-     * 
-     * navigateToPage() assumes that the "Datasources" tree node is already 
-     * expanded when this method is called.
-     */
-    private void navigateToPage(String datasourceName,
-                                DatasourceType datasourceType,
-                                String tabName) throws IOException, EmbJoprTestException {
-        
-        //refreshTreeNode(DS_NAV_LABEL);
-        
-        if(!ejtt.getNavTree().getNodeByLabel(datasourceType.getLabel()).isExpanded()) {
-            expandNavTreeArrow(datasourceType.getLabel());
-        }
-       
-        HtmlAnchor datasource = getNavTreeLink(datasourceName);
-        datasource.click();
-
-        HtmlAnchor tabLink = (HtmlAnchor)client.getElement(tabName);
-        tabLink.click();
-    }
-    
-    /**
-     * Delete the datasource given by datasourceName.
-     */
-    protected void deleteDatasource(String datasourceName, 
-                                    DatasourceType datasourceType) throws IOException, 
-                                    HtmlElementNotFoundException, EmbJoprTestException {
-        if(!ejtt.getNavTree().getNodeByLabel(DS_NAV_LABEL).isExpanded()) {
-            expandNavTreeArrow(DS_NAV_LABEL);
-        }
-        
-        HtmlAnchor datasourceLink = getNavTreeLink(datasourceType.getLabel()); 
-        datasourceLink.click();
-
-        HtmlSelect menu = (HtmlSelect)client.getElement("currentPageSize");
-        if(menu != null) {
-            menu.setSelectedAttribute(MAX_ITEMS_PER_PAGE, Boolean.TRUE);
-        }
-
-        HtmlButtonInput deleteButton;
-        try {
-            deleteButton = getDeleteButton("resourceSummaryForm", datasourceName);
-            deleteButton.click();
-        } catch (IllegalStateException e) { 
-            
-            // The delete button was not found on this page
-            client.click("nextPage");
-            deleteButton = getDeleteButton("resourceSummaryForm", datasourceName);
-            deleteButton.click();
-        }  
-    }
-
-    /**
-     * This method should query the JMX server and decide whether the given 
-     * MBean displays deployed resource.
-     * @param deploymentMBean  Name of the MBean to examine. Differs between AS4 and 5.
-     * @return true  if the MBean indicates that the resource is deployed, false otherwise.
-     * @throws javax.management.JMException  upon JMX related error, including invalid
-     *                 or non-existent MBean / attribute name.
-     * @throws java.io.IOException  upon I/O error.
-     */
-    @Override
-    protected boolean isMBeanStateDeployedImpl(ObjectName deploymentMBean)  throws JMException, IOException {
-
-        JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
-
-        Object state = jmxUtils.getMBeanAttribute(deploymentMBean, "State");
-        return ("DEPLOYED".equals( state.toString() ));
-
-    }
-
-    /**
-     * Return the location of the -ds.xml file that corresponds to the 
-     * datasource given by jndiName.
-     */
-    @Override
-    protected String getDatasourceConfigFile( String jndiName ) {
-        return System.getProperty("jsfunit.deploy.dir") + "/" + jndiName + "-ds.xml";
-    }
-
-    /**
-     * Return the name of the MBean that corresponds to the given
-     * JNDI name and service.
-     */
-    @Override
-    protected String getMBeanName( String jndiName, String serviceName ){
-        return "jboss.deployment:id=\"jboss.jca:name=" + jndiName + "," +
-        "service=" + serviceName + "\",type=Component";
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite(DatasourceTest.class);
-    }
-    
-    /*
-     * CREATION TESTS
-     */
-    
-    /**
-     * Create a new datasource. Leave some property values, that aren't
-     * required, unset.
-     */
-    public void testCreateDatasource() throws Exception {
-
-
-        // The properties we want to configure
-        Map<String, MetaValue> propertiesMapAsMetaValues = createDatasourcePropertiesAsMetaValues();
-        Map<String, String> propertiesMap = formatPropertiesMap(propertiesMapAsMetaValues);
-
-        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
-                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // TODO: Redundant - remove.
-                         propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        String expectedMessage = "Successfully added new " + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName();
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-        assertTrue("Datasource is not deployed (isDatasourceDeployed() returned false).",
-                   isDatasourceDeployed(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE));
-        
-        checkComponentProperties(propertiesMapAsMetaValues, propertiesMap.get("jndi-name"), LOCAL_TX_COMPONENT_TYPE);
-        
-        checkProperties(propertiesMap.get("jndi-name"),
-                        DatasourceType.LOCAL_TX_DATASOURCE,
-                        propertiesMap);
-
-        // TODO: need to verify that appropriate default values were
-        // set for properties that were not specified above
-
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
-    }
-      
-    /*
-     * DELETION TESTS
-     */
-
-    /**
-     * Remove a Local TX Datasource.
-     */
-    public void testDeleteLocalTXDatasource() throws Exception {
-        Map<String, String> propertiesMap = createLocalTXDatasource("DeleteLocalTXDS");
-     
-        deleteDS(propertiesMap, LOCAL_TX_COMPONENT_TYPE, DatasourceType.LOCAL_TX_DATASOURCE);
-    }
-    
-    /**
-     * Remove a No TX Datasource.
-     */
-    public void testDeleteNoTXDatasource() throws Exception {
-        Map<String, String> propertiesMap = createNoTXDatasource("DeleteNoTXDS");
-        
-        deleteDS(propertiesMap, NO_TX_COMPONENT_TYPE, 
-                 DatasourceType.NO_TX_DATASOURCE);
-    }
-
-    /**
-     * Remove an XA Datasource.
-     */
-    public void testDeleteXADatasource() throws Exception {
-        Map<String, String> propertiesMap = createXADatasource("DeleteXADS");
-                
-        deleteDS(propertiesMap, XA_COMPONENT_TYPE, DatasourceType.XA_DATASOURCE);
-    }
-    
-    /**
-     * Remove a Local TX Datasource. Use an existing -ds.xml file.
-     */
-    public void testDeleteLocalTXDatasourceUsingExistingDSFile() throws Exception {
-        
-        // Use an existing -ds.xml file
-        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteLocalTXExistingFile",
-                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
-               
-        deleteDS(propertiesMap, LOCAL_TX_COMPONENT_TYPE, DatasourceType.LOCAL_TX_DATASOURCE);
-    }
-    
-    /**
-     * Remove a No TX Datasource. Use an existing -ds.xml file.
-     */
-    public void testDeleteNoTXDatasourceUsingExistingDSFile() throws Exception {
-        
-        // Use an existing -ds.xml file
-        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteNoTXExistingFile",
-                                                                 DatasourceType.NO_TX_DATASOURCE);
-                
-        deleteDS(propertiesMap, NO_TX_COMPONENT_TYPE, 
-                 DatasourceType.NO_TX_DATASOURCE);
-    }
-    
-    /**
-     * Remove an XA Datasource. Use an existing -ds.xml file.
-     */
-    public void testDeleteXADatasourceUsingExistingDSFile() throws Exception {
-        
-        // Use an existing -ds.xml file
-        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteXAExistingFile",
-                                                                 DatasourceType.XA_DATASOURCE);
-          
-        deleteDS(propertiesMap, XA_COMPONENT_TYPE, 
-                 DatasourceType.XA_DATASOURCE);
-    }
-    
-    /**
-     * Common code for the testDelete* tests.
-     */
-    private void deleteDS(Map<String, String> propertiesMap, 
-                          ComponentType componentType, DatasourceType datasourceType) throws Exception {
-        String expectedMessage = "Successfully deleted " + datasourceType.getTypeName() 
-                                 + " '" + propertiesMap.get("jndi-name") + "'";
-        
-        deleteDatasource(propertiesMap.get("jndi-name"), datasourceType);
-
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-        // Make sure the ManagedComponent was removed
-        assertNull("The datasource was not removed after deletion (the ManagedComponent is non-null)",
-                   getManagedComponent(propertiesMap.get("jndi-name"), componentType));
-        
-        // Make sure the entry was removed from the -ds.xml file (See JOPR-44)
-        assertFalse(containsElement(propertiesMap.get("jndi-name"),
-                                    datasourceType.getXmlElementName()));
-        
-        assertFalse("According to JMX view, the deleted datasource is still deployed",
-                    isDatasourceDeployed(propertiesMap.get("jndi-name"),
-                                         datasourceType));
-    }
-    
-    /**
-     * Test the case in which the -ds.xml file that contains the datasource
-     * to be deleted contains more than one datasource. Make sure the entire
-     * -ds.xml file does not get deleted. (See JBAS-6227.)
-     */
-    public void testDeleteDatasourceComplexDSDotXmlFile() throws Exception {
-        String jndiName = "NoTXDeletionTest";
-        
-        // MultipleDatasources-ds.xml contains two Local TX Datasources and
-        // a No TX Datasource. We will delete the No TX Datasource (NoTXDeletionTest-ds.xml).
-        deleteDatasource(jndiName, DatasourceType.NO_TX_DATASOURCE);
-        
-        // Check for the appropriate success messages
-        String expectedMessage = "Successfully deleted " 
-                                 + DatasourceType.NO_TX_DATASOURCE.getTypeName() + " '" 
-                                 + jndiName + "'";
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-        
-        // Make sure the ManagedComponent was removed
-        assertNull("The datasource was not removed after deletion (the ManagedComponent is non-null)",
-                   getManagedComponent(jndiName, NO_TX_COMPONENT_TYPE));
-
-        // Make sure only the No TX Datasource entry was removed 
-        // from the -ds.xml file
-        String actualDSFile = System.getProperty("jsfunit.deploy.dir") 
-                              + "/MultipleDatasources-ds.xml";
-        String expectedDSFile = System.getProperty("jsfunit.testdata") 
-                                                   + "/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml";
-        compareFiles(actualDSFile, expectedDSFile); 
-    }
-    
-    /*
-     * CONFIGURATION TESTS
-     */
-    
-    /**
-     * Change the value of some already set properties.
-     */
-    public void testConfigureDatasourceChangeSetProperties() throws Exception {
-        String jndiName = "ChangeSetPropertiesDS";
-        Map<String, String> propertiesMap = createXADatasource(jndiName);
-        
-        // Change some property values that are already set 
-        Map<String, MetaValue> propertiesMapChangesAsMetaValues = new LinkedHashMap<String, MetaValue>();
-        propertiesMapChangesAsMetaValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(60000)));
-        propertiesMapChangesAsMetaValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMapChangesAsMetaValues.put("user-name", SimpleValueSupport.wrap("newUser"));
-
-        navigateToPage(propertiesMap.get("jndi-name"), 
-                       DatasourceType.XA_DATASOURCE, 
-                       "configurationTab");
-                       
-        // See EMBJOPR-58               
-        assertFalse("The configuration page could not be displayed",
-                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
-
-        Map<String, String> propertiesMapChanges = formatPropertiesMap(propertiesMapChangesAsMetaValues);
-        fillOutForm(propertiesMapChanges);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        String expectedMessage = "Successfully updated " + DatasourceType.XA_DATASOURCE.getTypeName() 
-                                 + " '" + propertiesMap.get("jndi-name") + "'";
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-        
-        checkComponentProperties(propertiesMapChangesAsMetaValues, jndiName, XA_COMPONENT_TYPE);
-
-        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
-                                        DatasourceType.XA_DATASOURCE)); 
-
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE);  
-    }
-    
-    /**
-     * Change the value of some previously unset properties.
-     */
-    public void testConfigureDatasourceChangeUnsetProperties() throws Exception {
-        String jndiName = "ChangeUnsetPropertiesDS";
-        
-        Map<String, String> propertiesMap = createLocalTXDatasource(jndiName);
-
-        // Set some property values that were previously unset 
-        Map<String, MetaValue> propertiesMapChangesAsMetaValues = new LinkedHashMap<String, MetaValue>();
-        propertiesMapChangesAsMetaValues.put("valid-connection-checker-class-name", 
-                                             SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL"));
-        propertiesMapChangesAsMetaValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMapChangesAsMetaValues.put("background-validation", SimpleValueSupport.wrap(Boolean.FALSE));
-        propertiesMapChangesAsMetaValues.put("allocation-retry", SimpleValueSupport.wrap(new Integer(10000)));
-
-        navigateToPage(propertiesMap.get("jndi-name"), 
-                       DatasourceType.LOCAL_TX_DATASOURCE, 
-                       "configurationTab");
-                       
-        // See EMBJOPR-58
-        assertFalse("The configuration page could not be displayed",
-                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
-
-        Map<String, String> propertiesMapChanges = formatPropertiesMap(propertiesMapChangesAsMetaValues);
-        fillOutForm(propertiesMapChanges);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        String expectedMessage = "Successfully updated " + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName() 
-                                 + " '" + propertiesMap.get("jndi-name") + "'";
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-        
-        checkComponentProperties(propertiesMapChangesAsMetaValues, jndiName, LOCAL_TX_COMPONENT_TYPE);
-
-        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
-                                        DatasourceType.LOCAL_TX_DATASOURCE)); 
-        
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);   
-    }
-
-   /**
-    * Unset the value of some previously set properties. 
-    */ 
-    public void testConfigureDatasourceUnsetProperties() throws IOException, EmbJoprTestException {
-        Map<String, String> propertiesMap = createNoTXDatasource("UnsetPropertiesDS");
-
-        // Unset some property values
-        navigateToPage(propertiesMap.get("jndi-name"), 
-                       DatasourceType.NO_TX_DATASOURCE, 
-                       "configurationTab");
-                       
-        // See EMBJOPR-58
-        assertFalse("The configuration page could not be displayed",
-                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
-
-        enableOrDisableFormInput("user-name", Boolean.FALSE);
-        enableOrDisableFormInput("idle-timeout-minutes", Boolean.FALSE);
-        enableOrDisableFormInput("track-connection-by-tx", Boolean.FALSE);
-        enableOrDisableFormInput("domain", Boolean.FALSE);
-        enableOrDisableFormInput("no-tx-separate-pools", Boolean.FALSE);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        String expectedMessage = "Successfully updated " + DatasourceType.NO_TX_DATASOURCE.getTypeName() 
-                                 + " '" + propertiesMap.get("jndi-name") + "'";
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
-                                        DatasourceType.NO_TX_DATASOURCE)); 
-        
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);   
-    }
-    
-    /*
-     * OPERATIONS TESTS
-     */
-    
-    /**
-     * Test the "Flush" operation after creating a new datasource.
-     */
-    public void testFlushOperationAfterDatasourceCreation() throws IOException, EmbJoprTestException { 
-        
-        // Min pool size will be 6, max pool size will be 15
-        Map<String, String> propertiesMap = createXADatasource("FlushAfterDatasourceCreationDS");
-
-        performDatasourceOperation(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, "Flush");
-
-        // Make sure the metrics are updated appropriately
-        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-        expectedMetrics.put("Available Connection Count", "15.0");
-        expectedMetrics.put("Connection Count", "0.0"); 
-        expectedMetrics.put("Connection Created Count", "0.0");
-        expectedMetrics.put("Connection Destroyed Count", "0.0");
-        expectedMetrics.put("In Use Connection Count", "0.0");
-        expectedMetrics.put("Max Connections In Use Count", "0.0");
-        expectedMetrics.put("Max Size", "15.0");
-        expectedMetrics.put("Min Size", "6.0");
-
-        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, expectedMetrics);
-        
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE);   
-    }
-    
-    /**
-     * Test the "Flush" operation after multiple connections to a database 
-     * have been created.  
-     */
-    public void testFlushOperationAfterMultipleConnections() throws Exception { 
-        
-        // 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".
-        ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"), 
-                                                              propertiesMap.get("user-name"), 
-                                                              propertiesMap.get("password")); 
-        
-        closeConnections(connections); 
-
-        performDatasourceOperation(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, "Flush");
-
-        // Make sure the metrics are updated appropriately
-        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-        expectedMetrics.put("Available Connection Count", "20.0");
-        expectedMetrics.put("Connection Count", "0.0"); 
-        expectedMetrics.put("Connection Created Count", "0.0");
-        expectedMetrics.put("Connection Destroyed Count", "0.0");
-        expectedMetrics.put("In Use Connection Count", "0.0");
-        expectedMetrics.put("Max Connections In Use Count", "0.0");
-        expectedMetrics.put("Max Size", "20.0");
-        expectedMetrics.put("Min Size", "5.0");
-
-        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
-
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);   
-    }
-    
-    /**
-     * Test the "List Formatted Sub Pool Statistics" after creating a new
-     * datasource.
-     */
-    public void testListFormattedSubPoolStatisticsAfterDatasourceCreation() throws Exception {
-
-        // Min pool size will be 5, max pool size will be 20
-        Map<String, String> propertiesMap = createNoTXDatasource("ListFormattedSubPoolStatisticsAfterDatasourceCreationDS");
-
-        performDatasourceOperation(propertiesMap.get("jndi-name"), 
-                                   DatasourceType.NO_TX_DATASOURCE, 
-                                   "List Formatted Sub Pool Statistics");
-        
-        // Use the default formatter
-        client.click("parametersForm:okButton");
-
-        // Get the result of the operation
-        HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
-        HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
-
-        assertNotNull("Could not get the result of the operation", resultTextBox);
-        
-        String actualResult = resultTextBox.getText();
-        
-        // Set up the expected results
-        StringBuffer expectedBuffer = new StringBuffer();
-        expectedBuffer.append("Sub Pool Statistics: \n");
-        expectedBuffer.append("Sub Pool Count: 0\n");
-        expectedBuffer.append(POOL_SEPARATOR);
-        expectedBuffer.append("\n\n");
-     
-        assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedBuffer.toString() 
-                   + "\n\nbut was:\n\n" + actualResult,
-                   actualResult.contains(expectedBuffer.toString()));
-
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);   
-    }
-
-    /**
-     * Test the "List Formatted Sub Pool Statistics" operation after multiple
-     * connections to a database have been established.
-     */
-    public void testListFormattedSubPoolStatisticsAfterMultipleConnections() throws Exception {
-
-        // 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"), 
-                                                              propertiesMap.get("password")); 
-        try { 
-            performDatasourceOperation(propertiesMap.get("jndi-name"), 
-                                       DatasourceType.LOCAL_TX_DATASOURCE, 
-                                       "List Formatted Sub Pool Statistics");
-
-            // Use the default formatter
-            client.click("parametersForm:okButton");
-
-            // Get the result of the operation
-            HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
-            HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
-
-            assertNotNull("Could not get the result of the operation", resultTextBox);
-            
-            String actualResult = resultTextBox.getText();
-            
-            // Set up the expected results
-            StringBuffer expectedBuffer = new StringBuffer();
-            expectedBuffer.append("Sub Pool Statistics: \n");
-            expectedBuffer.append("Sub Pool Count: 1\n");
-            expectedBuffer.append(POOL_SEPARATOR);
-            expectedBuffer.append("\n\n");
-            expectedBuffer.append("Track By Transaction: true\n");
-            expectedBuffer.append("Available Connections Count: 16\n");
-            expectedBuffer.append("Max Connections In Use Count:4\n");
-            expectedBuffer.append("Connections Destroyed Count:0\n");
-            expectedBuffer.append("Connections In Use Count:4\n");
-
-            assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" 
-                       + expectedBuffer.toString() 
-                       + "\n\nbut was:\n\n" + actualResult,
-                       actualResult.contains(expectedBuffer.toString()));
-        } finally {
-            
-            // Clean up
-            closeConnections(connections);
-            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
-        }
-    }
-    
-    /**
-     * Test the "List Formatted Sub Pool Statistics" operation after
-     * closing some connections.
-     */
-    public void testListFormattedSubPoolStatisticsAfterClosingConnections() throws Exception {
-
-        // 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"), 
-                                                              propertiesMap.get("password")); 
-        try {
-            
-            // Close some connections
-            for(int i = 0; i < 2; i++) {
-                disconnectDB(connections.get(i));
-                connections.set(i, null);
-            }
-        
-            performDatasourceOperation(propertiesMap.get("jndi-name"), 
-                                       DatasourceType.LOCAL_TX_DATASOURCE, 
-                                       "List Formatted Sub Pool Statistics");
-
-            // Use the default formatter
-            client.click("parametersForm:okButton");
-
-            // Get the result of the operation
-            HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
-            HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
-
-            assertNotNull("Could not get the result of the operation", resultTextBox);
-            
-            String actualResult = resultTextBox.getText();
-            
-            // Set up the expected results
-            StringBuffer expectedBuffer = new StringBuffer();
-            expectedBuffer.append("Sub Pool Statistics: \n");
-            expectedBuffer.append("Sub Pool Count: 1\n");
-            expectedBuffer.append(POOL_SEPARATOR);
-            expectedBuffer.append("\n\n");
-            expectedBuffer.append("Track By Transaction: true\n");
-            expectedBuffer.append("Available Connections Count: 12\n");
-            expectedBuffer.append("Max Connections In Use Count:10\n");
-            expectedBuffer.append("Connections Destroyed Count:0\n");
-            expectedBuffer.append("Connections In Use Count:8");
-
-            assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" 
-                        + expectedBuffer.toString() 
-                        + "\n\nbut was:\n\n" + actualResult,
-                        actualResult.contains(expectedBuffer.toString()));
-        } finally {
-            
-            // Clean up
-            closeConnections(connections);
-            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
-        }
-    }
-    
-    
-    /*
-     * METRICS TESTS
-     */
-
-    /**
-     * Check that the metrics are correct after creating a new datasource.
-     */
-    public void testMetricsAfterDatasourceCreation() throws IOException, EmbJoprTestException {
-
-        // Min pool size will be 5, max pool size will be 20
-        Map<String, String> propertiesMap = createLocalTXDatasource("MetricsCreateDS");
-
-        // Set up the expected values
-        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-        expectedMetrics.put("Available Connection Count", "20.0");
-        expectedMetrics.put("Connection Count", "0.0");
-        expectedMetrics.put("Connection Created Count", "0.0");
-        expectedMetrics.put("Connection Destroyed Count", "0.0");
-        expectedMetrics.put("In Use Connection Count", "0.0");
-        expectedMetrics.put("Max Connections In Use Count", "0.0");
-        expectedMetrics.put("Max Size", "20.0");
-        expectedMetrics.put("Min Size", "5.0");
-
-        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
-
-        // Clean up
-        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
-    }
-
-    /**
-     * Make an initial request for a connection to a database. Make
-     * sure the metrics are updated accordingly.
-     */
-    public void testMetricsAfterInitialDBConnection() throws Exception {
-
-        // Create the datasource
-        Map<String, String> propertiesMap = createLocalTXDatasource("MetricsInitalConnectionDS");
-
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterInitialDBConnection(propertiesMap);
-    }
-    
-    /**
-     * Make an initial request for a connection to a database. Use an
-     * existing datasource. Make sure the metrics are updated accordingly. 
-     */
-    public void testMetricsAfterInitialDBConnectionUsingExistingDSFile() throws Exception {
-        
-        // Use an existing datasource
-        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsInitialConnectionExistingFile",
-                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
-        
-        expandNavTreeArrow(DS_NAV_LABEL);
-        
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterInitialDBConnection(propertiesMap);
-    }
-    
-    /**
-     * Common code for the testMetricsAfterInitialDBConnection* tests.
-     */
-    private void checkMetricsAfterInitialDBConnection(Map<String, String> propertiesMap) throws Exception {
-        
-        // Create the first connection
-        ArrayList<Connection> connections = createConnections(1, propertiesMap.get("jndi-name"),
-                                                              propertiesMap.get("user-name"), 
-                                                              propertiesMap.get("password"));
-        
-        try {
-            
-            // Set up the expected values
-            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-            expectedMetrics.put("Available Connection Count", "19.0");
-            expectedMetrics.put("Connection Count", "5.0");
-            expectedMetrics.put("Connection Created Count", "5.0");
-            expectedMetrics.put("Connection Destroyed Count", "0.0");
-            expectedMetrics.put("In Use Connection Count", "1.0");
-            expectedMetrics.put("Max Connections In Use Count", "1.0");
-            expectedMetrics.put("Max Size", "20.0");
-            expectedMetrics.put("Min Size", "5.0");
-
-            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
-            
-        } finally {
-            
-            // Clean up
-            closeConnections(connections);
-            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
-        }
-    }
-
-    /**
-     * Establish multiple connections to a database. Make sure
-     * the metrics are updated accordingly.
-     */
-    public void testMetricsAfterMultipleDBConnections() throws Exception {
-
-        // Create the datasource
-        Map<String, String> propertiesMap = createNoTXDatasource("MetricsMultipleConnectionDS");
-
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterMultipleDBConnections(propertiesMap);
-    }
-    
-    /**
-     * Establish multiple connections to a database. Use an existing
-     * datasource. Make sure the metrics are updated accordingly.
-     */
-    public void testMetricsAfterMultipleDBConnectionsUsingExistingDSFile() throws Exception {
-        
-        // Use an existing datasource
-        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsMultipleConnectionsExistingFile",
-                                                                 DatasourceType.NO_TX_DATASOURCE);
-        
-        expandNavTreeArrow(DS_NAV_LABEL);
-        
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterMultipleDBConnections(propertiesMap);
-    }
-    
-    /**
-     * Common code for the testMetricsAfterMultipleDBConnections* tests.
-     */
-    private void checkMetricsAfterMultipleDBConnections(Map<String, String> propertiesMap) throws Exception {
-        
-        // Establish multiple connections
-        ArrayList<Connection> connections = createConnections(6, propertiesMap.get("jndi-name"),
-                                                              propertiesMap.get("user-name"), 
-                                                              propertiesMap.get("password"));
-        try {
-            
-            // Set up the expected values
-            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-            expectedMetrics.put("Available Connection Count", "14.0");
-            expectedMetrics.put("Connection Count", "6.0");
-            expectedMetrics.put("Connection Created Count", "6.0");
-            expectedMetrics.put("Connection Destroyed Count", "0.0");
-            expectedMetrics.put("In Use Connection Count", "6.0");
-            expectedMetrics.put("Max Connections In Use Count", "6.0");
-            expectedMetrics.put("Max Size", "20.0");
-            expectedMetrics.put("Min Size", "5.0");
-
-            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE, expectedMetrics);
-        } finally {
-            
-            // Clean up
-            closeConnections(connections);
-            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);
-        }
-    }
-
-    /**
-     * Make sure the metrics are updated appropriately after
-     * closing some connections.
-     */
-    public void testMetricsAfterClosingConnections() throws Exception {
-        
-        // Create the datasource
-        Map<String, String> propertiesMap = createNoTXDatasource("MetricsCloseConnectionsDS");
-        
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterClosingConnections(propertiesMap);
-    }
-    
-    /**
-     * Make sure the metrics are updated appropriately after
-     * closing some connections. Use an existing datasource.
-     */
-    public void testMetricsAfterClosingConnectionsUsingExistingDSFile() throws Exception {
-        
-        // Use an existing datasource
-        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsCloseConnectionsExistingFile",
-                                                                 DatasourceType.NO_TX_DATASOURCE);
-        
-        expandNavTreeArrow(DS_NAV_LABEL);
-        
-        // Min pool size will be 5, max pool size will be 20
-        checkMetricsAfterClosingConnections(propertiesMap);
-    }
-    
-    /**
-     * Common code for the testMetricsAfterClosingConnections* tests.
-     */
-    private void checkMetricsAfterClosingConnections(Map<String, String> propertiesMap) throws Exception {
-        
-        // Establish some connections
-        ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"),
-                                                              propertiesMap.get("user-name"), 
-                                                              propertiesMap.get("password"));
-
-        try {
-            
-            // Close some connections
-            for(int i = 0; i < 2; i++) {
-                disconnectDB(connections.get(i));
-                connections.set(i, null);
-            }
-      
-            // Set up the expected values
-            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-            expectedMetrics.put("Available Connection Count", "17.0"); 
-            expectedMetrics.put("Connection Count", "3.0");          
-            expectedMetrics.put("Connection Created Count", "5.0");    
-            expectedMetrics.put("Connection Destroyed Count", "0.0");   
-            expectedMetrics.put("In Use Connection Count", "3.0");     
-            expectedMetrics.put("Max Connections In Use Count", "5.0");
-            expectedMetrics.put("Max Size", "20.0");
-            expectedMetrics.put("Min Size", "5.0");
-
-            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE, expectedMetrics); 
-            
-        } finally {
-            
-            // Clean up
-            closeConnections(connections);
-            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);
-        }
-    }
-}
-

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java	2009-04-29 21:41:34 UTC (rev 367)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -1,3059 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.IOException;
-import junit.framework.Test;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.ArrayList;
-import org.jboss.jopr.jsfunit.*;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.deployers.spi.management.KnownComponentTypes;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.managed.api.ComponentType;
-import java.io.File;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSubscriber;
-import javax.jms.TopicSession;
-import javax.naming.InitialContext;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.QueueSender;
-import javax.jms.QueueReceiver;
-import javax.jms.ConnectionFactory;
-import javax.jms.TextMessage;
-import javax.jms.JMSException;
-import javax.naming.NamingException;
-import org.jboss.jms.destination.JBossDestination;
-
-/**
- * This class contains tests for managing JMS topics and queues
- * using Embedded Jopr. This test class should be run against
- * JBAS 5.x.
- * 
- * @author Farah Juma
- *
- */
-
-public class JMSTest extends ResourceTestBase {
-    
-    public enum DestinationType {
-        QUEUE("Queues", "Queue"),
-        TOPIC("Topics", "Topic");
-        
-        private final String navLabel;
-        private final String name;
-        
-        DestinationType(String navLabel, String name) {
-            this.navLabel = navLabel;
-            this.name = name;
-        }
-        
-        private String getNavLabel() {
-            return this.navLabel;
-        }
-        
-        private String getName() {
-            return this.name;
-        }
-    }
-    
-    // Constants
-    private static final String QUEUE_DEFAULT_TEMPLATE="default__Queue";
-    private static final String TOPIC_DEFAULT_TEMPLATE="default__Topic";
-    private static final String JMS_NAV_LABEL="JMS Destinations";
-    private static final ComponentType QUEUE_COMPONENT_TYPE = KnownComponentTypes.JMSDestination.Queue.getType();
-    private static final ComponentType TOPIC_COMPONENT_TYPE = KnownComponentTypes.JMSDestination.Topic.getType();
-    private static final String SERVICE_FILE_ROOT_ELEMENT = "server";
-    private static final String SERVICE_FILE_CHILD_ELEMENT = "mbean";
-    private static final String TOPIC_FACTORY = "/ConnectionFactory";
-    private static final String QUEUE_FACTORY = "/ConnectionFactory";
-    private static final String CLIENT_ID = "EmbjoprTest";
-    
-    // Topic Metrics
-    private static final String ALL_MSG_COUNT = "All Message Count";
-    private static final String ALL_SUB_COUNT = "All Subscriptions Count";
-    private static final String DURABLE_MSG_COUNT = "Durable Message Count";
-    private static final String DURABLE_SUB_COUNT = "Durable Subscriptions Count";
-    private static final String NON_DURABLE_MSG_COUNT = "Non Durable Message Count";
-    private static final String NON_DURABLE_SUB_COUNT = "Non Durable Subscriptions Count";
-    
-    // Queue Metrics
-    private static final String CONSUMER_COUNT = "Consumer Count";
-    private static final String DELIVERING_COUNT = "Delivering Count";
-    private static final String MSG_COUNT = "Message Count";
-    private static final String SCHEDULED_MSG_COUNT = "Scheduled Message Count";
-    private static final String COUNT = "Count";
-    private static final String COUNT_DELTA = "Count Delta";
-    private static final String DEPTH = "Depth";
-    private static final String DEPTH_DELTA = "Depth Delta";
-    private static final String TIME_LAST_UPDATE = "Time Last Update";
-    
-    // Common operations 
-    private static final String CREATE = "Create";
-    private static final String DESTROY = "Destroy";
-    private static final String LIST_ALL_MSGS = "List All Messages";
-    private static final String LIST_DURABLE_MSGS = "List Durable Messages";
-    private static final String LIST_NON_DURABLE_MSGS = "List Non Durable Messages";
-    private static final String REMOVE_ALL_MSGS = "Remove All Messages";
-    private static final String START = "Start";
-    private static final String STOP = "Stop";
-    
-    // Topic-specific operations
-    private static final String LIST_ALL_SUB = "List All Subscriptions";
-    private static final String LIST_ALL_SUB_AS_HTML = "List All Subscriptions As HTML";
-    private static final String LIST_DURABLE_SUB = "List Durable Subscriptions";
-    private static final String LIST_DURABLE_SUB_AS_HTML = "List Durable Subscriptions As HTML";
-    private static final String LIST_NON_DURABLE_SUB = "List Non Durable Subscriptions";
-    private static final String LIST_NON_DURABLE_SUB_AS_HTML = "List Non Durable Subscriptions As HTML";
-    
-    // Queue-specific operations
-    private static final String LIST_MSG_COUNTER_AS_HTML = "List Message Counter As HTML";
-    private static final String LIST_MSG_COUNTER_HISTORY_AS_HTML = "List Message Counter History As HTML";
-    private static final String RESET_MSG_COUNTER = "Reset Message Counter";
-    private static final String RESET_MSG_COUNTER_HISTORY = "Reset Message Counter History";
-    
-    private static final long SCHEDULED_TIME = 3600000;
-    
-    private TopicConnection topicConnection = null;
-    private QueueConnection queueConnection = null;
-    
-    private static final String DLQ = "jboss.messaging.destination:name=DLQ,service=Queue";
-    private static final String EXPIRY_QUEUE = "jboss.messaging.destination:name=ExpiryQueue,service=Queue";
-    private static final String SERVER_PEER = "jboss.messaging:service=ServerPeer";
-    private static final String DURABLE = "Durable";
-    private static final String NON_DURABLE = "Non Durable";
-    
-    /**
-     * Create a new topic or queue using the given destination type and properties.
-     */
-    protected void createDestination(DestinationType destinationType,
-                                     String templateName,
-                                     Map<String, MetaValue> propertiesMap) throws IOException, EmbJoprTestException {
-        expandNavTreeArrow(JMS_NAV_LABEL);
-        createResource(destinationType.getNavLabel(), templateName, propertiesMap); 
-    }
-      
-    /**
-     * Delete the given JMS destination.
-     * 
-     * Assumes the JMS Destinations tree node is already expanded.
-     */
-    protected void deleteDestination(DestinationType destinationType, 
-                                     String destinationName) throws Exception {
-        //refreshTreeNode(JMS_NAV_LABEL);
-        clickNavTreeLink(destinationType.getNavLabel());
-        deleteResource("resourceSummaryForm", destinationName);
-    }
-         
-    /**
-     * Create a basic queue. Return the mapping of property names to property 
-     * values.
-     */
-    protected Map<String, MetaValue> createQueue(String queueName) throws IOException, EmbJoprTestException {
-    
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("name", SimpleValueSupport.wrap(queueName)); 
-        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(queueName));
-        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.FALSE));
-        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(1500)));
-        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(76000)));
-        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(76000)));
-        /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(5))); **/
-        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(5)));
-        propertiesMap.put("pageSize", SimpleValueSupport.wrap(new Integer(1500)));
-        
-        createDestination(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-        
-        return propertiesMap;
-    }
-    
-    /**
-     * Create a basic topic. Return the mapping of property names to property
-     * values.
-     */
-    protected Map<String, MetaValue> createTopic(String topicName) throws IOException, EmbJoprTestException {
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("name", SimpleValueSupport.wrap(topicName));
-        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(topicName));
-        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(70000)));
-        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(70000)));
-        propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(60000)));
-        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2000)));
-        
-        createDestination(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-        
-        return propertiesMap;
-    }
-    
-    protected String getDestinationDeploymentFile(String jndiName) {
-        return System.getProperty("jsfunit.deploy.dir") + "/" + jndiName + "-service.xml";
-    }
-    
-    /**
-     * Create a map of property names to property values for a particular
-     * destination. The desired property names are given by specificProperties.
-     * (This is useful when we need to check the values of some specific properties
-     * only - eg. the configuration tests)
-     */
-    protected Map<String, MetaValue> getSpecificComponentProperties(String componentName,
-                                                                    ComponentType type) throws Exception {
-        
-        // @TODO: add messageCounterHistoryDayLimit to this list if this property
-        // becomes configurable again
-        String[] specificProperties = new String[] {"name", "JNDIName", "clustered", 
-                                                    "downCacheSize", "fullSize", 
-                                                    "maxDeliveryAttempts", "maxSize",
-                                                    "pageSize",
-                                                    "redeliveryDelay", "DLQ", "expiryQueue", "serverPeer"};
-        return super.getSpecificComponentProperties(componentName, type, specificProperties);
-    }
-    
-    /**
-     * Create a topic session and return it.
-     */
-    protected TopicSession createTopicSession() throws Exception {
-    	InitialContext context = new InitialContext();
-    	Object tmp = context.lookup(TOPIC_FACTORY);
-    	
-    	TopicConnectionFactory tcf = (TopicConnectionFactory)tmp;
-    	topicConnection = tcf.createTopicConnection();
-    	topicConnection.setClientID(CLIENT_ID);
-    	
-    	TopicSession topicSession = topicConnection.createTopicSession(Boolean.FALSE, 
-    	                                                               TopicSession.AUTO_ACKNOWLEDGE);
-    	topicConnection.start();
-    	
-    	return topicSession;
-    }
-    
-    /**
-     * Create a non-durable topic subscriber and return it.
-     */
-    protected TopicSubscriber createNonDurableTopicSubscriber(TopicSession session,
-                                                              Topic topic) throws JMSException {
-        return session.createSubscriber(topic);
-    }
-    
-    /**
-     * Create a durable topic subscriber and return it.
-     */
-    protected TopicSubscriber createDurableTopicSubscriber(TopicSession session, 
-                                                           Topic topic,
-                                                           String subscriptionName) throws JMSException {
-        return session.createDurableSubscriber(topic, subscriptionName);
-    }
-    
-    /**
-     * Create a TopicPublisher for the given topic and 
-     * publish the given number of messages.
-     */
-    protected void publishMessages(TopicSession session, 
-                                   Topic topic,
-                                   int numMessages) throws JMSException {
-        TopicPublisher publisher = session.createPublisher(topic);
-
-        for(int i = 0; i < numMessages; i++) {
-            TextMessage message = session.createTextMessage("Message " + i);
-            publisher.publish(message);
-        }
-
-        publisher.close();
-    }
-    
-    /**
-     * Lookup and return the topic given by jndiName.
-     */
-    protected Topic getTopic(String jndiName) throws NamingException {
-        InitialContext context = new InitialContext();
-        Topic topic = (Topic)context.lookup(jndiName);
-
-        return topic;
-    }
-    
-    /**
-     * Create a queue session and return it.
-     */
-    protected QueueSession createQueueSession() throws Exception {
-    	InitialContext context = new InitialContext();
-    	Object tmp = context.lookup(QUEUE_FACTORY);
-    	
-    	QueueConnectionFactory qcf = (QueueConnectionFactory)tmp;
-    	queueConnection = qcf.createQueueConnection();
-    	
-    	QueueSession queueSession = queueConnection.createQueueSession(Boolean.FALSE, 
-    	                                                               QueueSession.AUTO_ACKNOWLEDGE);
-    	queueConnection.start();
-    	
-    	return queueSession;
-    }
-    
-    /**
-     * Create a QueueReceiver and return it.
-     */
-    protected QueueReceiver createQueueReceiver(QueueSession session, 
-                                                Queue queue) throws JMSException {
-    	return session.createReceiver(queue);
-    }
-    
-    /**
-     * Create a QueueSender for the given queue and send the
-     * given number of messages.
-     */
-    protected void sendMessages(QueueSession session, 
-                                Queue queue,
-                                int numMessages) throws JMSException {
-
-        QueueSender sender = session.createSender(queue);
-
-        for(int i = 0; i < numMessages; i++) {
-            TextMessage message = session.createTextMessage("Message " + i);
-            sender.send(message);
-        }
-
-        sender.close();
-    }
-    
-    /**
-     * Create a queue session and then send the given number
-     * of messages to the given queue.
-     */
-    protected void createQueueSessionAndSendMessages(int numMessages, 
-                                                     String jndiName) throws Exception {
-        QueueSession session = createQueueSession();
-        Queue queue = getQueue(jndiName);
-        sendMessages(session, queue, numMessages);
-    }
-    
-    /**
-     * Create a QueueSender for the given queue and schedule the
-     * given number of messages.
-     */
-    protected void sendScheduledMessages(QueueSession session,
-                                         Queue queue,
-                                         int numMessages) throws JMSException {
-        QueueSender sender = session.createSender(queue);
-
-        for(int i = 0; i < numMessages; i++) {
-
-            // Schedule the message
-            TextMessage message = session.createTextMessage("Message " + i);
-
-            long now = System.currentTimeMillis();
-            message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", now + SCHEDULED_TIME);         
-
-            sender.send(message);
-        }
-
-        sender.close();
-    }
-    
-    /**
-     * Lookup and return the queue given by jndiName.
-     */
-    protected Queue getQueue(String jndiName) throws NamingException {
-    	InitialContext context = new InitialContext();
-    	Queue queue = (Queue)context.lookup(jndiName);
-    	
-    	return queue;
-    }
-    		
-    
-    /**
-     * Close all connections.
-     */
-    protected void disconnect() throws JMSException {
-
-        if(topicConnection != null) {
-            topicConnection.close();
-            topicConnection = null;
-        }
-
-        if(queueConnection != null) {
-            queueConnection.close();
-            queueConnection = null;
-        }
-    }
-    
-    /**
-     * Get the list of metrics that appear on the summary
-     * page for topics.
-     */
-    protected ArrayList<String> getTopicSummaryMetrics() {
-    	ArrayList<String> topicSummaryMetrics = new ArrayList<String>();
-    	
-    	// The metrics we need to check on the summary tab
-    	// TODO: add the summary page metrics that need to be checked -
-    	// currently no summary metrics are displayed on the page (EMBJOPR-90)
-    	
-    	return topicSummaryMetrics;
-    }
-    
-    /**
-     * Get the list of metrics that appear on the summary
-     * page for queues.
-     */
-    protected ArrayList<String> getQueueSummaryMetrics() {
-    	ArrayList<String> queueSummaryMetrics = new ArrayList<String>();
-    	
-    	// The metrics we need to check on the summary tab
-    	// TODO: add the summary page metrics that need to be checked -
-    	// currently no summary metrics are displayed on the page (EMBJOPR-90)
-    	
-    	return queueSummaryMetrics;
-    }
-    
-    /**
-     * Make sure we close any topic or queue
-     * connections.
-     */
-    protected void tearDown() throws Exception
-    {
- 	   super.tearDown();
- 	   disconnect();
-    }
-    
-    /**
-     * Create a topic session, a durable subscriber, and a non-durable
-     * subscriber. Then, send the specified number of messages to the
-     * given topic.
-     */
-    protected void createTopicSessionAndSendMessages(int numMessages,
-                                                     String jndiName) throws Exception {
-        TopicSession session = createTopicSession();
-        Topic topic = getTopic(jndiName);
-        
-        // Create 1 durable subscriber, 1 non-durable subscriber
-        // and then publish the specified number of messages
-        createDurableTopicSubscriber(session, topic, jndiName + "Subscriber");
-        createNonDurableTopicSubscriber(session, topic);
-        
-        publishMessages(session, topic, numMessages);
-    }
-
-    /**
-     * Create a topic session and the given number of durable subscribers.
-     */
-    protected void createTopicSessionAndDurableSubscribers(int numSubscribers,
-                                                           String jndiName) throws Exception {
-        TopicSession session = createTopicSession();
-        Topic topic = getTopic(jndiName);
-        
-        for(int i = 0; i < numSubscribers; i++) {
-            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
-        }
-    }
-    
-    /**
-     * Create a topic session and the given number of non-durable subscribers.
-     */
-    protected void createTopicSessionAndNonDurableSubscribers(int numSubscribers,
-                                                              String jndiName) throws Exception {
-        TopicSession session = createTopicSession();
-        Topic topic = getTopic(jndiName);
-        
-        for(int i = 0; i < numSubscribers; i++) {
-            createNonDurableTopicSubscriber(session, topic);
-        }
-    }
-    
-    /**
-     * Create a topic session and the given number of durable and non-durable subscribers.
-     */
-    protected void createTopicSessionAndMultipleSubscribers(int numSubscribers,
-                                                            String jndiName) throws Exception {
-        TopicSession session = createTopicSession();
-        Topic topic = getTopic(jndiName);
-        
-        for(int i = 0; i < numSubscribers; i++) {
-            createNonDurableTopicSubscriber(session, topic);
-            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
-        }
-    }
-
-    /*
-     * CREATION TESTS
-     */
-    
-    /**
-     * Test Name: testCreateQueue
-     * Assertion: Verify the ability to create a new queue.
-     * 
-     * Strategy: Create a queue. Make sure the queue is deployed and that
-     * the properties of the ManagedComponent are set correctly.
-     */
-    public void testCreateQueue() throws Exception {
-        
-        String jndiName = "CreateQueue";
-        String expectedMessage = ADD_MESSAGE + DestinationType.QUEUE.getName();
-        
-        createDestinationCommon(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
-                                jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
-    }
-    
-    /**
-     * Test Name: testCreateTopic
-     * Assertion: Verify the ability to create a new topic.
-     * 
-     * Strategy: Create a topic. Make sure the topic is deployed and that
-     * the properties of the ManagedComponent are set correctly.
-     */
-    public void testCreateTopic() throws Exception {
-        
-        String jndiName = "CreateTopic";
-        String expectedMessage = ADD_MESSAGE + DestinationType.TOPIC.getName();
-        
-        createDestinationCommon(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE, 
-                                jndiName, expectedMessage, TOPIC_COMPONENT_TYPE);
-    }
-    
-    /**
-     * Common code for the testCreateQueue() and testCreateTopic() tests.
-     */
-    private void createDestinationCommon(DestinationType destinationType, 
-                                         String destinationTemplate, 
-                                         String jndiName, 
-                                         String expectedMessage,
-                                         ComponentType componentType) throws Exception {
-        
-        // The properties we want to configure
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2500)));
-        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
-        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
-        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(80000)));
-        /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(0))); **/
-        propertiesMap.put("pageSize", SimpleValueSupport.wrap(new Integer(2500)));
-        propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(50000)));
-
-        createDestination(destinationType, destinationTemplate, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-        // Make sure the ManagedComponent was created and that the properties are
-        // set correctly
-        assertTrue("The destination is not deployed ",
-                   isDeployed(jndiName + "-service.xml"));
-        checkComponentProperties(propertiesMap, jndiName, componentType);
-        
-        // Clean up
-        deleteDestination(destinationType, jndiName);
-    }
-    
-    /**
-     * Test Name: testCreateQueueSetObjectNameManagedProperties
-     * Assertion: Verify the ability to specify ObjectName ManagedProperties
-     * (eg. DLQ, expiryQueue, serverPeer) when creating a new queue.
-     * (See JOPR-121)
-     */
-    public void testCreateQueueSetObjectNameManagedProperties() throws Exception {
-        String jndiName = "ObjectNameManagedPropertiesQueue";
-        String expectedMessage = ADD_MESSAGE + DestinationType.QUEUE.getName();
-        
-        createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
-                                                         jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
-    }
-    
-    /**
-     * Test Name: testCreateTopicSetObjectNameManagedProperties
-     * Assertion: Verify the ability to specify ObjectName ManagedProperties
-     * (eg. DLQ, expiryQueue, serverPeer) when creating a new topic.
-     * (See JOPR-121)
-     */
-    public void testCreateTopicSetObjectNameManagedProperties() throws Exception {
-        
-        String jndiName = "ObjectNameManagedPropertiesTopic";
-        String expectedMessage = ADD_MESSAGE + DestinationType.TOPIC.getName();
-        
-        createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
-                                                         jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
-    }
-    
-    /**
-     * Common code for the testCreateQueueSetObjectNameManagedProperties() and 
-     * testCreateTopicSetObjectNameManagedProperties() tests.
-     */
-    private void createDestinationWithObjectNameManagedProperties(DestinationType destinationType, 
-                                                                  String destinationTemplate, 
-                                                                  String jndiName, 
-                                                                  String expectedMessage,
-                                                                  ComponentType componentType) throws Exception {
-        
-        // The properties we want to configure
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("DLQ", SimpleValueSupport.wrap(DLQ));
-        propertiesMap.put("expiryQueue", SimpleValueSupport.wrap(EXPIRY_QUEUE));
-        propertiesMap.put("serverPeer", SimpleValueSupport.wrap(SERVER_PEER));
-
-        createDestination(destinationType, destinationTemplate, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-
-        // Check for the appropriate success messages
-        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-        // Make sure the ManagedComponent was created and that the properties are
-        // set correctly
-        assertTrue("The destination is not deployed ",
-                   isDeployed(jndiName + "-service.xml"));
-        checkComponentProperties(propertiesMap, jndiName, componentType);
-        
-        // Clean up
-        deleteDestination(destinationType, jndiName);
-    }
-    
-     /**
-     * Test Name: testCreateQueueMissingRequiredValue
-     * Assertion: Verify the ability to handle a missing required value when
-     * creating a queue. Make sure the appropriate error message occurs.
-     */
-    public void testCreateQueueMissingRequiredValue() throws IOException, EmbJoprTestException {
-        createDestinationMissingRequiredValue(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE);
-    }
-    
-    /**
-     * Test Name: testCreateTopicMissingRequiredValue
-     * Assertion: Verify the ability to handle a missing required value when
-     * creating a topic. Make sure the appropriate error message occurs.
-     */
-    public void testCreateTopicMissingRequiredValue() throws IOException, EmbJoprTestException {
-        createDestinationMissingRequiredValue(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE);
-    }
-    
-    /**
-     * Common code for the testCreate*MissingRequiredValue() tests.
-     */
-    private void createDestinationMissingRequiredValue(DestinationType destinationType,
-                                                       String destinationTemplate) throws IOException, EmbJoprTestException {
-        // Leave the JNDI name and name unset
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
-        
-        createDestination(destinationType, destinationTemplate, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-        
-        // Check for the appropriate error messages
-        checkClientAndServerMessages(INVALID_VALUE_MESSAGE, 
-                                     MISSING_VALUE_MESSAGE, true);
-    }
-    
-    /**
-     * Test Name: testCreateQueuePropertyOutOfRange
-     * Assertion: Verify the ability to handle a property value beyond its
-     * expected range of values when creating a queue. Make sure the appropriate 
-     * error message occurs.
-     */
-    public void testCreateQueuePropertyOutOfRange() throws IOException, EmbJoprTestException {
-        createDestinationPropertyOutOfRange(DestinationType.QUEUE, 
-                                            QUEUE_DEFAULT_TEMPLATE, 
-                                            "PropertyOutOfRangeQueue");
-    }
-    
-    /**
-     * Test Name: testCreateTopicPropertyOutOfRange
-     * Assertion: Verify the ability to handle a property value beyond its
-     * expected range of values when creating a topic. Make sure the appropriate 
-     * error message occurs.
-     */
-    public void testCreateTopicPropertyOutOfRange() throws IOException, EmbJoprTestException {
-        createDestinationPropertyOutOfRange(DestinationType.TOPIC, 
-                                            TOPIC_DEFAULT_TEMPLATE, 
-                                            "PropertyOutOfRangeTopic");
-    }
-
-    
-    /**
-     * Common code for the testCreate*PropertyOutOfRange() tests.
-     */
-    private void createDestinationPropertyOutOfRange(DestinationType destinationType,
-                                                     String destinationTemplate,
-                                                     String jndiName) throws IOException, EmbJoprTestException {
-        // The properties we want to configure
-        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
-        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
-        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2500)));
-        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
-        
-        // This number is too large
-        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Long(Long.MAX_VALUE)));
-        
-        createDestination(destinationType, destinationTemplate, propertiesMap);
-        client.click("resourceConfigurationForm:saveButton");
-   
-        // Check for the appropriate error messages
-        checkClientAndServerMessages(INVALID_VALUE_MESSAGE, 
-                                     OUT_OF_RANGE_MESSAGE, true);
-    }
-    
-    /**
-     * Test Name: testCreateQueueInvalidPropertyType
-     * Assertion: Verify the ability to handle a property value that has an
-     * invalid type when creating a queue. Make sure the appropriate 
-     * error message occurs.
-     */
-     public void testCreateQueueInvalidPropertyType() throws IOException, EmbJoprTestException {
-         createDestinationInvalidPropertyType(DestinationType.QUEUE, 
-                                              QUEUE_DEFAULT_TEMPLATE, 
-                                              "InvalidPropertyTypeQueue");
-     }
-     
-    /**
-     * Test Name: testCreateTopicInvalidPropertyType
-     * Assertion: Verify the ability to handle a property value that has an
-     * invalid type when creating a topic. Make sure the appropriate 
-     * error message occurs.
-     */
-     public void testCreateTopicInvalidPropertyType() throws IOException, EmbJoprTestException {
-          createDestinationInvalidPropertyType(DestinationType.TOPIC, 
-                                               TOPIC_DEFAULT_TEMPLATE, 
-                                               "InvalidPropertyTypeTopic");
-     }
-     
-     /**
-      * Common code for the testCreate*InvalidPropertyType() tests.
-      */ 
-     private void createDestinationInvalidPropertyType(DestinationType destinationType,
-                                                       String destinationTemplate,
-                                                       String jndiName) throws IOException, EmbJoprTestException {
-         // The properties we want to configure
-         Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
-         propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
-         propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
-         propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
-         /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(0))); **/
-         propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(50000)));
-         propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(1500)));
-         
-         // This property value is supposed to be an integer
-         propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap("fifteen"));
-         
-         createDestination(destinationType, destinationTemplate, propertiesMap);
-         client.click("resourceConfigurationForm:saveButton");
-         
-         // Check for the appropriate error messages
-         checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
-                                      INVALID_INTEGER_MESSAGE, true);
-     }
-     
-     /**
-      * Test Name: testCreateQueueDuplicateJNDIName
-      * Assertion: Verify the ability to handle a duplicate JNDI name 
-      * when creating a queue. Make sure the appropriate error message 
-      * occurs.
-      */
-     public void testCreateQueueDuplicateJNDIName() throws IOException, EmbJoprTestException {
-         String jndiName = "TestQueue";
-         createQueue(jndiName);
-         
-         checkDestinationDuplicateJNDIName(DestinationType.QUEUE, jndiName);
-
-     }
-     
-     /**
-      * Test Name: testCreateTopicDuplicateJNDIName
-      * Assertion: Verify the ability to handle a duplicate JNDI name 
-      * when creating a queue. Make sure the appropriate error message 
-      * occurs.
-      */
-     public void testCreateTopicDuplicateJNDIName() throws IOException, EmbJoprTestException {
-         String jndiName = "TestTopic";
-         createTopic(jndiName);
-         
-         checkDestinationDuplicateJNDIName(DestinationType.TOPIC, jndiName);
-     }
-     
-     /**
-      * Common code for the testCreate*DuplicateJNDIName() tests.
-      */
-     public void checkDestinationDuplicateJNDIName(DestinationType destinationType,
-                                                   String jndiName) throws IOException, EmbJoprTestException {
-
-         // Check for the appropriate error messages
-         String expectedMessage = "A " + destinationType.getName() + " named '" + jndiName + "' already exists";
-         checkClientAndServerMessages(expectedMessage, expectedMessage, true);
-     }
-
-     /*
-      * DELETION TESTS
-      */
-     
-     /**
-      * Test Name: testDeleteQueueUsingExistingServiceFile
-      * Assertion: Verify the ability to delete a queue. Use a queue
-      * that already exists.
-      * 
-      * Strategy: Delete the queue. Make sure the ManagedComponent is removed.
-      */
-     public void testDeleteQueueUsingExistingServiceFile() throws Exception {
-         String jndiName = "DeleteQueueExistingFile";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         deleteDestinationCommon(jndiName, DestinationType.QUEUE, QUEUE_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Test Name: testDeleteQueue
-      * Assertion: Verify the ability to delete a queue. 
-      * 
-      * Strategy: Create a queue and then delete it. Make sure the ManagedComponent 
-      * is removed.
-      */
-     public void testDeleteQueue() throws Exception {
-         String jndiName = "QueueDelete";
-         
-         // Create the queue first
-         Map<String, MetaValue> propertiesMap = createQueue(jndiName);
-         deleteDestinationCommon(jndiName, DestinationType.QUEUE, QUEUE_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Test Name: testDeleteTopicUsingExistingServiceFile
-      * Assertion: Verify the ability to delete a topic. Use a topic
-      * that already exists.
-      * 
-      * Strategy: Delete the topic. Make sure the ManagedComponent is removed.
-      */
-     public void testDeleteTopicUsingExistingServiceFile() throws Exception {
-         String jndiName = "DeleteTopicExistingFile";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         deleteDestinationCommon(jndiName, DestinationType.TOPIC, TOPIC_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Test Name: testDeleteTopic
-      * Assertion: Verify the ability to delete a topic. 
-      * 
-      * Strategy: Create a topic and then delete it. Make sure the ManagedComponent 
-      * is removed.
-      */
-     public void testDeleteTopic() throws Exception {
-         String jndiName = "TopicDelete";
-         
-         // Create the topic first
-         Map<String, MetaValue> propertiesMap = createTopic(jndiName);
-         deleteDestinationCommon(jndiName, DestinationType.TOPIC, TOPIC_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Common code for the testDelete* tests.
-      */
-     public void deleteDestinationCommon(String jndiName, 
-                                         DestinationType destinationType, 
-                                         ComponentType componentType) throws Exception {
-         deleteDestination(destinationType, jndiName);
-         
-         // Check for the appropriate success messages
-         String expectedMessage = DELETE_MESSAGE + destinationType.getName() + " '" + jndiName + "'";
-         checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-         
-         // Make sure the ManagedComponent was removed
-         assertNull("The destination was not removed after deletion (the ManagedComponent is non-null)",
-                    getManagedComponent(jndiName, componentType));
-         assertFalse("The entry was not removed from the -service.xml file after deletion",
-                     containsElement(getDestinationDeploymentFile(jndiName), 
-                                     SERVICE_FILE_CHILD_ELEMENT, 
-                                     SERVICE_FILE_ROOT_ELEMENT));
-     }
-     
-     /*
-      * CONFIGURATION TESTS
-      */
-     
-     /**
-      * Test Name: testConfigureQueueChangePropertiesUsingExistingServiceFile
-      * Assertion: Verify the ability to change queue property values. 
-      * Use a queue that already exists.
-      * 
-      * Strategy: Change some property values for the queue. 
-      * Make sure the properties of the ManagedComponent are updated accordingly.
-      */
-     public void testConfigureQueuePropertiesUsingExistingServiceFile() throws Exception {
-         String jndiName = "ChangePropertiesExistingQueue";
-         Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, QUEUE_COMPONENT_TYPE);
-         
-         // The properties we are going to change
-         // (Before: maxDeliveryAttempts=-1, redeliveryDelay=-1 )
-         Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
-         propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(0)));
-         propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         changeDestinationProperties(jndiName, DestinationType.QUEUE, 
-                                     QUEUE_COMPONENT_TYPE, propertiesMapChanges,
-                                     propertiesMap);
-     }
-     
-     /**
-      * Test Name: testConfigureTopicChangePropertiesUsingExistingServiceFile
-      * Assertion: Verify the ability to change topic property values. 
-      * Use a topic that already exists.
-      * 
-      * Strategy: Change some property values for the topic.
-      * Make sure the properties of the ManagedComponent are updated accordingly.
-      */
-     public void testConfigureTopicChangePropertiesUsingExistingServiceFile() throws Exception {
-         String jndiName = "ChangePropertiesExistingTopic";
-         Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, TOPIC_COMPONENT_TYPE);
-       
-         // The properties we are going to change
-         // (Before: maxDeliveryAttempts=-1, redeliveryDelay=-1 )
-         Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
-         propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
-         propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         changeDestinationProperties(jndiName, DestinationType.TOPIC, 
-                                     TOPIC_COMPONENT_TYPE, propertiesMapChanges,
-                                     propertiesMap);
-     }
-    
-     /**
-      * Test Name: testConfigureQueueChangeProperties
-      * Assertion: Verify the ability to change queue property values.
-      * 
-      * Strategy: Create a new queue. Change some property 
-      * values for this queue. Make sure the properties of the ManagedComponent 
-      * are updated accordingly.
-      */
-     public void testConfigureQueueChangeProperties() throws Exception {
-         String jndiName = "ChangePropertiesQueue";
-         
-         // Create the queue first
-         Map<String, MetaValue> propertiesMap = createQueue(jndiName);
-         
-         // The properties we are going to change
-         // (Before: maxDeliveryAttempts=5, redeliveryDelay=-1 )
-         Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
-         propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(0)));
-         propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
-         
-         changeDestinationProperties(jndiName, DestinationType.QUEUE, 
-                                     QUEUE_COMPONENT_TYPE, propertiesMapChanges,
-                                     propertiesMap);
-     }
-     
-     /**
-      * Test Name: testConfigureTopicChangeProperties
-      * Assertion: Verify the ability to change topic property values.
-      * 
-      * Strategy: Create a new topic. Change some property 
-      * values for this topic. Make sure the properties of the ManagedComponent 
-      * are updated accordingly.
-      */
-     public void testConfigureTopicChangeProperties() throws Exception {
-         String jndiName = "ChangePropertiesTopic";
-         
-         // Create the topic first
-         Map<String, MetaValue> propertiesMap = createTopic(jndiName);
-         
-         // The properties we are going to change
-         // (Before: redeliveryDelay=60000, maxDeliveryAttempts=-1 )
-         Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
-         propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
-         propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
-         
-         changeDestinationProperties(jndiName, DestinationType.TOPIC, 
-                                     TOPIC_COMPONENT_TYPE, propertiesMapChanges,
-                                     propertiesMap);
-     }
-       
-     /**
-      * Common code for changing a destination's property values.
-      */
-     private void changeDestinationProperties(String jndiName, 
-                                              DestinationType destinationType,
-                                              ComponentType componentType,
-                                              Map<String, MetaValue> propertiesMapChanges,
-                                              Map<String, MetaValue> propertiesMap) throws Exception {
-         
-         // The success message we should see
-         String expectedMessage = UPDATE_MESSAGE + destinationType.getName() + " '" 
-                                  + jndiName + "'";
-         
-         // Change some property values
-         configureResource(JMS_NAV_LABEL, destinationType.getNavLabel(), jndiName, 
-                           propertiesMap, propertiesMapChanges, componentType,
-                           expectedMessage);
-   
-         assertTrue("The destination is not deployed ",
-                    isDeployed(jndiName + "-service.xml"));
-         
-         // Clean up
-         deleteDestination(destinationType, jndiName); 
-     }
-     
-     /**
-      * Test Name: testConfigureQueueUnsetPropertiesUsingExistingServiceFile
-      * Assertion: Verify the ability to unset queue property values. Use a
-      * queue that already exists.
-      * 
-      * Strategy: Unset some property values for the queue. Make sure the
-      * rest of the properties for the ManagedComponent remain unchanged.
-      */
-     public void testConfigureQueueUnsetPropertiesUsingExistingServiceFile() throws Exception {
-         String jndiName = "UnsetPropertiesExistingQueue";    
-         unsetPropertiesUsingExistingServiceFile(jndiName, DestinationType.QUEUE, 
-                                                 QUEUE_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Test Name: testConfigureTopicUnsetPropertiesUsingExistingServiceFile
-      * Assertion: Verify the ability to unset topic property values. Use a
-      * topic that already exists.
-      * 
-      * Strategy: Unset some property values for the topic. Make sure the
-      * rest of the properties for the ManagedComponent remain unchanged.
-      */
-     public void testConfigureTopicUnsetPropertiesUsingExistingServiceFile() throws Exception {
-         String jndiName = "UnsetPropertiesExistingTopic";    
-         unsetPropertiesUsingExistingServiceFile(jndiName, DestinationType.TOPIC, 
-                                                 TOPIC_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Common code for the testConfigure*UnsetPropertiesUsingExistingServiceFile 
-      * tests.
-      */
-     private void unsetPropertiesUsingExistingServiceFile(String jndiName, 
-                                                          DestinationType destinationType,
-                                                          ComponentType componentType) throws Exception {
-         Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, 
-                                                                               componentType);
-         
-         String[] propertiesToUnset = new String[] { "maxDeliveryAttempts" }; 
-         propertiesMap.remove("maxDeliveryAttempts");
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         unsetDestinationProperties(destinationType, jndiName, propertiesMap, 
-                                    propertiesToUnset, componentType);
-     }
-     
-     /**
-      * Test Name: testConfigureQueueUnsetProperties
-      * Assertion: Verify the ability to unset queue property values. 
-      * 
-      * Strategy: Create a new queue. Unset some property values for the 
-      * queue. Make sure the rest of the properties for the ManagedComponent 
-      * remain unchanged.
-      */
-     public void testConfigureQueueUnsetProperties() throws Exception {
-         String jndiName = "UnsetPropertiesQueue";
-         
-         // Create the queue first
-         Map<String, MetaValue> propertiesMap = createQueue(jndiName);
-         
-         String[] propertiesToUnset = new String[] { "maxSize" }; 
-         propertiesMap.remove("maxSize"); 
-         
-         unsetDestinationProperties(DestinationType.QUEUE, jndiName, propertiesMap, 
-                                    propertiesToUnset, QUEUE_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Test Name: testConfigureTopicUnsetProperties
-      * Assertion: Verify the ability to unset topic property values. 
-      * 
-      * Strategy: Create a new topic. Unset some property values for the 
-      * topic. Make sure the rest of the properties for the ManagedComponent 
-      * remain unchanged.
-      */
-     public void testConfigureTopicUnsetProperties() throws Exception {
-         String jndiName = "UnsetPropertiesTopic";
-         
-         // Create the topic first
-         Map<String, MetaValue> propertiesMap = createTopic(jndiName);
-         
-         String[] propertiesToUnset = new String[] { "maxSize" }; 
-         propertiesMap.remove("maxSize"); 
-         
-         unsetDestinationProperties(DestinationType.TOPIC, jndiName, propertiesMap, 
-                                    propertiesToUnset, TOPIC_COMPONENT_TYPE);
-     }
-     
-     /**
-      * Common code for the testConfigure*UnsetProperties* tests.
-      */
-     private void unsetDestinationProperties(DestinationType destinationType,
-                                             String jndiName,
-                                             Map<String, MetaValue> propertiesMap,
-                                             String[] propertiesToUnset,
-                                             ComponentType componentType) throws Exception {
-         
-         // The success message we should see
-         String expectedMessage = UPDATE_MESSAGE + destinationType.getName() + " '" 
-                                  + jndiName + "'";
-         
-         unsetResourceProperties(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                                 jndiName, propertiesMap, propertiesToUnset, 
-                                 componentType, expectedMessage);
-         
-         assertTrue("The destination is not deployed ",
-                    isDeployed(jndiName + "-service.xml"));
-      
-         // Clean up
-         deleteDestination(destinationType, jndiName);   
-     }
-     
-     /*
-      * METRICS TESTS
-      */
-     
-     /**
-      * Test Name: testTopicMetricsAfterCreation
-      * Assertion: Verify that topic metrics are correct after topic
-      * creation. 
-      */
-     public void testTopicMetricsAfterCreation() throws Exception {
-    	 String jndiName = "MetricsAfterTopicCreation";
-         
-         // Create the topic first
-         createTopic(jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "0.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
-           
-         checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
-                                 DestinationType.TOPIC);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneNonDurableSubscription
-      * Assertion: Verify that topic metrics are correct after creating
-      * a non-durable subscriber for the topic.
-      */
-     public void testTopicMetricsAfterOneNonDurableSubscription() throws Exception {
-    	 String jndiName = "MetricsAfterOneNonDurableTopicSubscriber";
-         
-         // Create the topic first
-         createTopic(jndiName);
-         
-         checkTopicMetricsAfterOneSubscription(jndiName, Boolean.FALSE);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneNonDurableSubscriptionUsingExistingServiceFile
-      * Assertion: Verify that topic metrics are correct after creating
-      * a non-durable subscriber for the topic. Use a topic that already exists.
-      */
-     public void testTopicMetricsAfterOneNonDurableSubscriptionUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "MetricsOneNonDurableTopicSubscriberExistingTopic";
-         
-    	 expandNavTreeArrow(JMS_NAV_LABEL);
-    	 checkTopicMetricsAfterOneSubscription(jndiName, Boolean.FALSE);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneDurableSubscription
-      * Assertion: Verify that topic metrics are correct after creating
-      * a durable subscriber for the topic.
-      */
-     public void testTopicMetricsAfterOneDurableSubscription() throws Exception {
-    	 String jndiName = "MetricsAfterOneDurableTopicSubscriber";
-         
-         // Create the topic first
-         createTopic(jndiName);
-         
-         checkTopicMetricsAfterOneSubscription(jndiName, Boolean.TRUE);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneDurableSubscriptionUsingExistingServiceFile
-      * Assertion: Verify that topic metrics are correct after creating
-      * a durable subscriber for the topic. Use a topic that already exists.
-      */
-     public void testTopicMetricsAfterOneDurableSubscriptionUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "MetricsOneDurableTopicSubscriberExistingTopic";
-         
-    	 expandNavTreeArrow(JMS_NAV_LABEL);
-    	 checkTopicMetricsAfterOneSubscription(jndiName, Boolean.TRUE);
-     }
-     
-     /**
-      * Common code for the testTopicMetricsAfterOne*Subscription* tests.
-      */
-     private void checkTopicMetricsAfterOneSubscription(String jndiName, 
-             Boolean isDurable) throws Exception {
-
-         // Create a subscriber
-         TopicSession session = createTopicSession();
-         Topic topic = getTopic(jndiName);
-
-         if(isDurable) {
-             createDurableTopicSubscriber(session, topic, jndiName + "Subscriber1");
-         } else {
-             createNonDurableTopicSubscriber(session, topic);
-         }
-
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "0.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "1.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-
-         if(isDurable) {
-             expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
-             expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
-         } else {
-             expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
-             expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
-         }
-
-         checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
-                                 DestinationType.TOPIC);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterMultipleSubscriptions()
-      * Assertion: Verify that topic metrics are correct after multiple subscribers
-      * for the topic are created.
-      */
-     public void testTopicMetricsAfterMultipleSubscriptions() throws Exception {
-    	 String jndiName = "MetricsAfterMultipleTopicSubscribers";
-         
-         // Create the topic first
-         createTopic(jndiName);
-         
-         checkTopicMetricsAfterMultipleSubscriptions(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterMultipleSubscriptionsUsingExistingServiceFile()
-      * Assertion: Verify that topic metrics are correct after multiple subscribers
-      * for the topic are created. Use a topic that already exists.
-      */
-     public void testTopicMetricsAfterMultipleSubscriptionsUsingExistingServiceFile() throws Exception {
-         String jndiName = "MetricsMultipleTopicSubscribersExistingTopic";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         checkTopicMetricsAfterMultipleSubscriptions(jndiName); 
-     }
-     
-     /**
-      * Common code for the testTopicMetricsAfterMultipleSubscriptions* tests.
-      */
-     private void checkTopicMetricsAfterMultipleSubscriptions(String jndiName) throws Exception {
-         
-         TopicSession session = createTopicSession();
-         Topic topic = getTopic(jndiName);
-
-         // Create multiple subscriptions (2 durable ones, 2 non-durable ones)
-         for(int i = 0; i < 2; i++) {
-             createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
-             createNonDurableTopicSubscriber(session, topic);
-         }
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "0.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "4.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "2.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "2.0");
-          
-         checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
-                                 DestinationType.TOPIC);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneMessage()
-      * Assertion: Verify that topic metrics are correct after sending
-      * one message to the topic.
-      */
-     public void testTopicMetricsAfterOneMessage() throws Exception {
-         String jndiName = "TopicMetricsAfterOneMessage";
-         
-         // Create the topic first
-         createTopic(jndiName);
-         
-         checkTopicMetricsAfterOneMessage(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterOneMessageUsingExistingServiceFile()
-      * Assertion: Verify that topic metrics are correct after sending
-      * one message to the topic. Use a topic that already exists.
-      */
-     public void testTopicMetricsAfterOneMessageUsingExistingServiceFile() throws Exception {
-         String jndiName = "TopicMetricsOneMessageExistingTopic";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         checkTopicMetricsAfterOneMessage(jndiName);
-     }
-     
-     /**
-      * Common code for the testTopicMetricsAfterOneMessage* tests.
-      */
-     private void checkTopicMetricsAfterOneMessage(String jndiName) throws Exception {
-         
-         // Create a subscriber for the topic and then publish
-         // 1 message
-         TopicSession session = createTopicSession();
-         Topic topic = getTopic(jndiName);
-         createDurableTopicSubscriber(session, topic, jndiName + "Subscriber1");
-         
-         publishMessages(session, topic, 1);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "1.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "1.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "1.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
-          
-         checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
-                                 DestinationType.TOPIC);
-         
-         
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterMultipleMessages()
-      * Assertion: Verify that topic metrics are correct after sending
-      * multiple message to the topic.
-      */
-     public void testTopicMetricsAfterMultipleMessages() throws Exception {
-         String jndiName = "TopicMetricsAfterMultipleMessages";
-             
-         // Create the topic first
-         createTopic(jndiName);
-         
-         checkTopicMetricsAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicMetricsAfterMultipleMessagesUsingExistingServiceFile()
-      * Assertion: Verify that topic metrics are correct after sending
-      * multiple message to the topic. Use a topic that already exists.
-      */
-     public void testTopicMetricsAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-         String jndiName = "TopicMetricsMultipleMessagesExistingTopic";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         checkTopicMetricsAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Common code for the testTopicMetricsAfterMultipleMessages* tests.
-      */
-     private void checkTopicMetricsAfterMultipleMessages(String jndiName) throws Exception {
-         
-         TopicSession session = createTopicSession();
-         Topic topic = getTopic(jndiName);
-         
-         // Create 1 durable subscriber, 1 non-durable subscriber
-         // and then publish 3 messages
-         createDurableTopicSubscriber(session, topic, jndiName + "Subscriber");
-         createNonDurableTopicSubscriber(session, topic);
-         
-         publishMessages(session, topic, 3);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "6.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "2.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "3.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "3.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
-          
-         checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
-                                 DestinationType.TOPIC);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterCreation
-      * Assertion: Verify that queue metrics are correct after queue
-      * creation. 
-      */
-     public void testQueueMetricsAfterCreation() throws Exception {
-    	 String jndiName = "MetricsAfterQueueCreation";
-         
-         // Create the queue first
-         createQueue(jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
-           
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-    
-     /**
-      * Test Name: testQueueMetricsAfterCreatingReceiver
-      * Assertion: Verify that queue metrics are correct after creating
-      * a queue receiver.
-      */
-     public void testQueueMetricsAfterCreatingReceiver() throws Exception {
-    	 String jndiName = "MetricsAfterQueueReceiver";
-         
-         // Create the queue first
-         createQueue(jndiName);
-         
-         checkQueueMetricsAfterCreatingReceiver(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile
-      * Assertion: Verify that queue metrics are correct after creating
-      * a queue receiver. Use a queue that already exists.
-      */
-     public void testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "MetricsOneQueueReceiverExistingQueue";
-         
-    	 expandNavTreeArrow(JMS_NAV_LABEL);
-         checkQueueMetricsAfterCreatingReceiver(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsAfterCreatingReceiver* tests.
-      */
-     private void checkQueueMetricsAfterCreatingReceiver(String jndiName) throws Exception {
-    	 
-    	 // Create a receiver
-         QueueSession session = createQueueSession();
-         Queue queue = getQueue(jndiName);
-         createQueueReceiver(session, queue);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "1.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
-           
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterOneMessage
-      * Assertion: Verify that queue metrics are correct after sending
-      * a message to the queue.
-      */
-     public void testQueueMetricsAfterOneMessage() throws Exception {
-    	 String jndiName = "QueueMetricsAfterOneMessage";
-    	 
-    	// Create the queue first
-        createQueue(jndiName);
-       
-        checkQueueMetricsAfterOneMessage(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterOneMessageUsingExistingServiceFile
-      * Assertion: Verify that queue metrics are correct after sending
-      * a message to the queue. Use a queue that already exists.
-      */
-     public void testQueueMetricsAfterOneMessageUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "QueueMetricsOneMessageExistingQueue";
-    	 
-    	 expandNavTreeArrow(JMS_NAV_LABEL);
-    	 checkQueueMetricsAfterOneMessage(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsAfterOneMessage* tests.
-      */
-     private void checkQueueMetricsAfterOneMessage(String jndiName) throws Exception {
-    	 
-    	 // Send 1 message to the queue
-    	 createQueueSessionAndSendMessages(1, jndiName);
-            
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "1.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "1.0");
-         expectedMetrics.put(COUNT_DELTA, "1.0");
-         expectedMetrics.put(DEPTH, "1.0");
-         expectedMetrics.put(DEPTH_DELTA, "1.0");
-         
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterMulipleMessages
-      * Assertion: Verify that queue metrics are correct after sending
-      * multiple messages to the queue.
-      */
-     public void testQueueMetricsAfterMultipleMessages() throws Exception {
-    	 String jndiName = "QueueMetricsAfterMultipleMessages";
-    	 
-    	 // Create the queue first
-    	 createQueue(jndiName);
-       
-    	 checkQueueMetricsAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterMulipleMessagesUsingExistingServiceFile
-      * Assertion: Verify that queue metrics are correct after sending
-      * multiple messages to the queue. Use a queue that already exists.
-      */
-     public void testQueueMetricsAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "QueueMetricsMultipleMessagesExistingQueue";
-    	 
-    	 expandNavTreeArrow(JMS_NAV_LABEL);
-    	 checkQueueMetricsAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsAfterMultipleMessages* tests.
-      */
-     private void checkQueueMetricsAfterMultipleMessages(String jndiName) throws Exception {
-    	 
-    	 // Send multiple messages to the queue
-    	 createQueueSessionAndSendMessages(3, jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "3.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "3.0");
-         expectedMetrics.put(COUNT_DELTA, "3.0");
-         expectedMetrics.put(DEPTH, "3.0");
-         expectedMetrics.put(DEPTH_DELTA, "3.0");
-         
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterReceivingMessage
-      * Assertion: Verify that queue metrics are correct 
-      * after a queue receiver actually receives a message.
-      */
-     public void testQueueMetricsAfterReceivingMessage() throws Exception {
-         String jndiName = "QueueMetricsAfterReceivingMessage";
-         
-         // Create the queue first
-         createQueue(jndiName);
-       
-         checkQueueMetricsAfterReceivingMessage(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterReceivingMessageUsingExistingServiceFile
-      * Assertion: Verify that queue metrics are correct 
-      * after a queue receiver actually receives a message. Use a queue
-      * that already exists.
-      */
-     public void testQueueMetricsAfterReceivingMessageUsingExistingServiceFile() throws Exception {
-         String jndiName = "QueueMetricsReceiveMessageExistingQueue";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         checkQueueMetricsAfterReceivingMessage(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsAfterReceivingMessage* tests.
-      */
-     private void checkQueueMetricsAfterReceivingMessage(String jndiName) throws Exception {
-         
-         // Create a queue receiver and then send multiple messages to the
-         // queue
-         QueueSession session = createQueueSession();
-         Queue queue = getQueue(jndiName);
-         QueueReceiver receiver = createQueueReceiver(session, queue);
-         sendMessages(session, queue, 3);
-         
-         // Actually receive a message
-         receiver.receive();
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "1.0");
-         expectedMetrics.put(DELIVERING_COUNT, "2.0");
-         expectedMetrics.put(MSG_COUNT, "2.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "3.0");
-         expectedMetrics.put(COUNT_DELTA, "3.0");
-         expectedMetrics.put(DEPTH, "2.0");
-         expectedMetrics.put(DEPTH_DELTA, "2.0");
-         
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterScheduledMessages
-      * Assertion: Verify that queue metrics are correct after creating
-      * some scheduled messages for the queue.
-      */
-     public void testQueueMetricsAfterScheduledMessages() throws Exception {
-    	 String jndiName = "QueueMetricsAfterScheduledMessages";
-    	 
-    	 // Create the queue first
-    	 createQueue(jndiName);
-    	 
-    	 checkQueueMetricsAfterScheduledMessage(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile
-      * Assertion: Verify that queue metrics are correct after creating
-      * a scheduled message for the queue. Use a queue that already exists.
-      */
-     public void testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile() throws Exception {
-    	 String jndiName = "QueueMetricsScheduledMessagesExistingQueue";
-    	 
-    	 expandNavTreeArrow(JMS_NAV_LABEL); 
-    	 checkQueueMetricsAfterScheduledMessage(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsAfterScheduledMessage* tests.
-      */
-     private void checkQueueMetricsAfterScheduledMessage(String jndiName) throws Exception {
-    	 
-    	 // Create a queue receiver and then schedule some
-    	 // messages
-    	 QueueSession session = createQueueSession();
-         Queue queue = getQueue(jndiName);
-         createQueueReceiver(session, queue);
-         sendScheduledMessages(session, queue, 2);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "2.0");
-         expectedMetrics.put(COUNT, "2.0");
-         expectedMetrics.put(COUNT_DELTA, "2.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0"); 
-         expectedMetrics.put(CONSUMER_COUNT, "1.0");
-         expectedMetrics.put(MSG_COUNT, "2.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         
-         checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
-                                 DestinationType.QUEUE);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsTimeLastUpdate
-      * Assertion: Verify that the "Time Last Update" metric for queues gets
-      * displayed appropriately.
-      */
-     public void testQueueMetricTimeLastUpdate() throws Exception {
-    	 String jndiName = "QueueMetricsCheckTimeLastUpdate";
-    	 	
-    	 // Create the queue first
-    	 createQueue(jndiName);
-    	 checkQueueMetricTimeLastUpdate(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueMetricsTimeLastUpdateUsingExistingServiceFile
-      * Assertion: Verify that the "Time Last Update" metric for queues gets
-      * displayed appropriately. Use a queue that already exists.
-      */
-     public void testQueueMetricTimeLastUpdateUsingExistingServiceFile() throws Exception {
-         String jndiName = "QueueMetricsTimeLastUpdateExistingQueue";
-            
-         expandNavTreeArrow(JMS_NAV_LABEL); 
-         checkQueueMetricTimeLastUpdate(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueMetricsTimeLastUpdate* tests.
-      */
-     private void checkQueueMetricTimeLastUpdate(String jndiName) throws Exception {
-         
-         // Send a message to the queue
-         createQueueSessionAndSendMessages(1, jndiName);
-         
-    	 ArrayList<String> expectedMetric = new ArrayList<String>();
-    	 expectedMetric.add(TIME_LAST_UPDATE);
-    	 
-    	 checkResourceMetricsNotNull(JMS_NAV_LABEL, DestinationType.QUEUE.getNavLabel(), 
-    	                             jndiName, expectedMetric.iterator(),
-    	                             ZERO_VALUE_MESSAGE,
-    	                             "0.0");
-    	 // Clean up
-    	 disconnect();
-    	 deleteDestination(DestinationType.QUEUE, jndiName);  	
-     }
-     
-     /**
-      * Common code for the metrics tests.
-      */
-     private void checkDestinationMetrics(String jndiName,
-                                          Map<String, String> expectedMetrics,
-                                          ArrayList<String> summaryMetrics,
-                                          DestinationType destinationType) throws Exception {
-         checkResourceMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                              jndiName, expectedMetrics, summaryMetrics);
-
-    	 // Clean up
-    	 disconnect();
-    	 deleteDestination(destinationType, jndiName);  
-     }
-     
-     /*
-      * OPERATIONS TESTS
-      */
-     
-     /* OPERATION #1 - REMOVE ALL MESSAGES - APPLIES TO TOPICS AND QUEUES */
-     
-     /**
-      * Test Name: testRemoveAllMessagesAfterTopicCreation
-      * Assertion: Verify that the metrics remain unchanged
-      * after executing the "Remove All Messages" operation for a topic
-      * when there are no messages.
-      */
-     public void testRemoveAllMessagesAfterTopicCreation() throws Exception {
-         String jndiName = "RemoveAllMessagesAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "0.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
-
-         performDestinationOperationAndCheckMetrics(DestinationType.TOPIC, 
-                                                    jndiName, REMOVE_ALL_MSGS,
-                                                    expectedMetrics,
-                                                    getTopicSummaryMetrics());
-     }
-     
-     /**
-      * Test Name: testTopicRemoveAllMessagesAfterMultipleMessages
-      * Assertion: Verify that the metrics are updated accordingly
-      * after executing the "Remove All Messages" operation for a topic
-      * when the topic has multiple messages.
-      */
-     public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessages() throws Exception {
-         String jndiName = "TopicRemoveAllMessagesAfterMultipleMessages"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         topicRemoveAllMessagesAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile
-      * Assertion: Verify that the metrics are updated accordingly
-      * after executing the "Remove All Messages" operation for a topic
-      * when the topic has multiple messages. Use a topic that already exists.
-      */
-     public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-         String jndiName = "RemoveAllMessagesMultipleMessagesExistingTopic";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL); 
-         topicRemoveAllMessagesAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Common code for the testTopicRemoveAllMessagesAfterMultipleMessages*
-      * tests.
-      */
-     private void topicRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
-         createTopicSessionAndSendMessages(2, jndiName);
-         
-         // Wait for messages to be delivered before removing them
-         Thread.sleep(10000);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(ALL_MSG_COUNT, "0.0");
-         expectedMetrics.put(ALL_SUB_COUNT, "2.0");
-         expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
-         expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
-         expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
-
-         performDestinationOperationAndCheckMetrics(DestinationType.TOPIC, 
-                                                    jndiName, REMOVE_ALL_MSGS,
-                                                    expectedMetrics,
-                                                    getTopicSummaryMetrics());
-     }
-     
-     /**
-      * Test Name: testRemoveAllMessagesAfterQueueCreation
-      * Assertion: Verify that the metrics remain unchanged
-      * after executing the "Remove All Messages" operation for a queue
-      * when there are no messages.
-      */
-     public void testRemoveAllMessagesAfterQueueCreation() throws Exception {
-
-         String jndiName = "RemoveAllMessagesMAfterQueueCreation"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, REMOVE_ALL_MSGS,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /**
-      * Test Name: testQueueRemoveAllMessagesAfterMultipleMessages
-      * Assertion: Verify that the metrics are updated appropriately
-      * after executing the "Remove All Messages" operation for a queue
-      * when there are multiple messages in the queue. 
-      */
-     public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessages() throws Exception {
-         String jndiName = "QueueRemoveAllMessagesAfterMultipleMessages";
-         
-         // Create the queue first
-         createQueue(jndiName);
-         queueRemoveAllMessagesAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServicefile
-      * Assertion: Verify that the metrics are updated appropriately
-      * after executing the "Remove All Messages" operation for a queue
-      * when there are multiple messages in the queue. Use a queue that
-      * already exists.
-      */
-     public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-         String jndiName = "RemoveAllMessagesMultipleMessagesExistingQueue";
-         
-         expandNavTreeArrow(JMS_NAV_LABEL); 
-         queueRemoveAllMessagesAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueRemoveAllMessagesAfterMultipleMessages*
-      * tests.
-      */
-     private void queueRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
-         createQueueSessionAndSendMessages(2, jndiName);
-         
-         // Wait for messages to be delivered before removing them
-         Thread.sleep(10000);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "2.0");
-         expectedMetrics.put(COUNT_DELTA, "2.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, REMOVE_ALL_MSGS,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /* OPERATION #2 - RESET MESSAGE COUNTER - APPLIES TO QUEUES ONLY */
-     
-     /**
-      * Test Name: testResetMessageCounterAfterQueueCreation
-      * Assertion: Verify that the queue metrics are correct
-      * after executing the "Reset Message Counter" operation for a queue
-      * right after creation.
-      */
-     public void testResetMessageCounterAfterQueueCreation() throws Exception {
-         String jndiName = "ResetMessageCounterAfterQueueCreation"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, RESET_MSG_COUNTER,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /**
-      * Test Name: testQueueResetMessageCounterAfterMultipleMessages
-      * Assertion: Verify that the queue metrics are correct
-      * after executing the "Reset Message Counter" operation for a queue
-      * when there are multiple messages in the queue.
-      */
-     public void testQueueResetMessageCounterAfterMultipleMessages() throws Exception {
-         String jndiName = "QueueResetMessageCounterAfterMultipleMessages"; 
-
-         // Create the queue first
-         createQueue(jndiName);   
-         resetMessageCounterAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile
-      * Assertion: Verify that the queue metrics are correct
-      * after executing the "Reset Message Counter" operation for a queue
-      * when there are multiple messages in the queue. Use a queue that 
-      * already exists.
-      */
-     public void testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-         String jndiName = "ResetMessageCounterMultipleMessagesExistingQueue";
-        
-         expandNavTreeArrow(JMS_NAV_LABEL); 
-         resetMessageCounterAfterMultipleMessages(jndiName);
-     }
-      
-     
-     /**
-      * Common code for the testQueueResetMessageCounterAfterMultipleMessages*
-      * tests.
-      */
-     private void resetMessageCounterAfterMultipleMessages(String jndiName) throws Exception {
-         createQueueSessionAndSendMessages(3, jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "3.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "3.0");
-         expectedMetrics.put(DEPTH_DELTA, "3.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, RESET_MSG_COUNTER,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /* OPERATION #3 - RESET MESSAGE COUNTER HISTORY - APPLIES TO QUEUES ONLY */
-     
-     /**
-      * Test Name: testResetMessageCounterHistoryAfterQueueCreation
-      * Assertion: Verify that the queue metrics are correct after
-      * executing the "Reset Message Counter History" operation for a queue
-      * after creation.
-      */
-     public void testResetMessageCounterHistoryAfterQueueCreation() throws Exception {
-         String jndiName = "ResetMessageCounterHistoryAfterQueueCreation"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "0.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "0.0");
-         expectedMetrics.put(COUNT_DELTA, "0.0");
-         expectedMetrics.put(DEPTH, "0.0");
-         expectedMetrics.put(DEPTH_DELTA, "0.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, RESET_MSG_COUNTER_HISTORY,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /**
-      * Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessages
-      * Assertion: Verify that the queue metrics are correct after
-      * executing the "Reset Message Counter History" operation for a queue
-      * that has multiple messages.
-      */
-     public void testQueueResetMessageCounterHistoryAfterMultipleMessages() throws Exception {
-         String jndiName = "QueueResetMessageCounterHistoryAfterMultipleMessages"; 
-
-         // Create the queue first
-         createQueue(jndiName);   
-         queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExistingServiceFile
-      * Assertion: Verify that the queue metrics are correct after
-      * executing the "Reset Message Counter History" operation for a queue
-      * that has multiple messages. Use a queue that already exists.
-      */
-     public void testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExsitingServiceFile() throws Exception {
-         String jndiName = "ResetMessageCounterHistoryMultipleMessagesExistingQueue";
-        
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Common code for the testQueueResetMessageCounterHistoryAfterMultipleMessages*
-      * tests.
-      */
-     private void queueResetMessageCounterHistoryAfterMultipleMessages(String jndiName) throws Exception {
-         createQueueSessionAndSendMessages(3, jndiName);
-         
-         // Set up the expected values
-         Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
-         expectedMetrics.put(CONSUMER_COUNT, "0.0");
-         expectedMetrics.put(DELIVERING_COUNT, "0.0");
-         expectedMetrics.put(MSG_COUNT, "3.0");
-         expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
-         expectedMetrics.put(COUNT, "3.0");
-         expectedMetrics.put(COUNT_DELTA, "3.0");
-         expectedMetrics.put(DEPTH, "3.0");
-         expectedMetrics.put(DEPTH_DELTA, "3.0");
-         
-         performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
-                                                    jndiName, RESET_MSG_COUNTER_HISTORY,
-                                                    expectedMetrics,
-                                                    getQueueSummaryMetrics());
-     }
-     
-     /* OPERATION #4 - LIST ALL SUBSCRIPTIONS - APPLIES ONLY TO TOPICS */
-    
-     /**
-      * Test Name: testListAllSubscriptionsAfterTopicCreation
-      * Assertion: Make sure that the correct results get displayed
-      * after the "List All Subscriptions" operation is invoked for
-      * a topic right after creation.
-      */
-     public void testListAllSubscriptionsAfterTopicCreation() throws Exception {
-         String jndiName = "ListAllSubscriptionsAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB, Boolean.TRUE);
-     }
-     
-     
-     /**
-      * Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribers
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List All Subscriptions" operation for a topic that has multiple subscribers.
-      */
-     public void testTopicListAllSubscriptionsAfterMultipleSubscribers() throws Exception {
-         String jndiName = "ListAllSubscriptionsAfterMultipleSubscribers"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         listAllSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List All Subscriptions" operation for a topic that has multiple subscribers.
-      * Use a topic that already exists.
-      */
-     public void testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
-         String jndiName = "ListAllSubscriptionsMultipleSubscribersExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         listAllSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-
-     /**
-      * Common code for the testListAllSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listAllSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
-         TopicSession session = createTopicSession();
-         Topic topic = getTopic(jndiName);
-
-         // Create multiple subscriptions (2 durable ones, 2 non-durable ones)
-         for(int i = 0; i < 2; i++) {
-             createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
-             createNonDurableTopicSubscriber(session, topic);
-         }
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB, 
-                                                 Boolean.FALSE);
-     }
-     
-     /* OPERATION #5 - LIST DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY */
-     
-     /**
-      * Test Name: testListDurableSubscriptionsAfterTopicCreation
-      * Assertion: Make sure that the correct results get displayed
-      * after the "List Durable Subscriptions" operation is invoked for
-      * a topic right after creation.
-      */
-     public void testListDurableSubscriptionsAfterTopicCreation() throws Exception {
-         String jndiName = "ListDurableSubscriptionsAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB, Boolean.TRUE);
-     }
-    
-     /**
-      * Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribers
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List Durable Subscriptions" operation for a topic that has multiple 
-      * durable subscribers.
-      */
-     public void testTopicListDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
-         String jndiName = "ListDurableSubscriptionsAfterMultipleSubscribers"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List Durable Subscriptions" operation for a topic that has multiple 
-      * durable subscribers. Use a topic that already exists.
-      */
-     public void testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
-         String jndiName = "ListDurableSubscriptionsMultipleSubscribersExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Common code for the testListDurableSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
-         createTopicSessionAndDurableSubscribers(2, jndiName);
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB, 
-                                                 Boolean.FALSE);
-     }
-     
-     /* OPERATION #6 - LIST NON DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY*/
-     
-     /**
-      * Test Name: testListNonDurableSubscriptionsAfterTopicCreation
-      * Assertion: Make sure that the correct results get displayed
-      * after the "List Non Durable Subscriptions" operation is invoked for
-      * a topic right after creation.
-      */
-     public void testListNonDurableSubscriptionsAfterTopicCreation() throws Exception {
-         String jndiName = "ListNonDurableSubscriptionsAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB, Boolean.TRUE);
-     }
-     
-     /**
-      * Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribers
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List Non Durable Subscriptions" operation for a topic that has multiple 
-      * non-durable subscribers.
-      */
-     public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
-         String jndiName = "ListNonDurableSubscriptionsAfterMultipleSubscribers"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Verify that the correct results get displayed after invoking 
-      * the "List Non Durable Subscriptions" operation for a topic that has multiple 
-      * non-durable subscribers. Use a topic that already exists.
-      */
-     public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
-         String jndiName = "ListNonDurableSubscriptionsMultipleSubscribersExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Common code for the testListNonDurableSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listNonDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
-         createTopicSessionAndNonDurableSubscribers(2, jndiName);
-         
-         performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB, 
-                                                 Boolean.FALSE);
-     }
-     
-     
-     /* OPERATION #7 - LIST MESSAGE COUNTER AS HTML - APPLIES TO QUEUES ONLY */
-     
-     /**
-      * Test Name: testListMessageCounterAsHTMLAfterQueueCreation
-      * Assertion: Make sure that the "List Message Counter As HTML" 
-      * operation for queues is executed successfully after creating
-      * a new queue.
-      */
-     public void testListMessageCounterAsHTMLAfterQueueCreation() throws Exception {
-         ArrayList<String> expectedValues = new ArrayList<String>();
-         
-         String jndiName = "ListMessageCounterAfterQueueCreation"; 
-
-         //Create the queue first
-         createQueue(jndiName);
-         
-         // Set up the expected result
-         StringBuffer expectedBuffer = new StringBuffer();
-         expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
-         expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName() 
-                                               + "." + jndiName));
-         expectedBuffer.append(formatTableCell("-"));  // Subscription
-         expectedBuffer.append(formatTableCell("-"));  // Durable 
-         expectedBuffer.append(formatTableCell("0"));  // Count
-         expectedBuffer.append(formatTableCell("-"));  // Count delta
-         expectedBuffer.append(formatTableCell("0"));  // Depth
-         expectedBuffer.append(formatTableCell("-"));  // Depth delta
-         
-         expectedValues.add(expectedBuffer.toString());
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.QUEUE, 
-                                    LIST_MSG_COUNTER_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValues);     
-     }
-     
-     /**
-      * Test Name: testListMessageCounterAsHTMLAfterMultipleMessages
-      * Assertion: Make sure that the "List Message Counter As HTML" 
-      * operation for queues returns the correct results when the queue has
-      * multiple messages. 
-      */
-     public void testListMessageCounterAsHTMLAfterMultipleMessagess() throws Exception {
-         String jndiName = "ListMessageCounterAfterMultipleMessages";
-         
-         // Create the queue first
-         createQueue(jndiName);
-         
-         listMessageCounterAsHtmlAfterMultipleMessages(jndiName);
-     }
-     
-     /**
-      * Test Name: testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile
-      * Assertion: Make sure that the "List Message Counter As HTML" 
-      * operation for queues returns the correct results when the queue has
-      * multiple messages. Use a queue that already exists.
-      */
-     public void testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
-         String jndiName = "ListMessageCounterMultipleMessagesExistingQueue";
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         listMessageCounterAsHtmlAfterMultipleMessages(jndiName); 
-     }
-     
-     /**
-      * Common code for the testListMessageCounterAsHTMLAfterMultipleMessages* tests.
-      */
-     private void listMessageCounterAsHtmlAfterMultipleMessages(String jndiName) throws Exception {
-         ArrayList<String> expectedValues = new ArrayList<String>();
-         
-         // Send some messages to the queue
-         createQueueSessionAndSendMessages(2, jndiName);
-         
-         // Set up the expected result
-         StringBuffer expectedBuffer = new StringBuffer();
-         expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
-         expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()
-                                               + "." + jndiName));
-         expectedBuffer.append(formatTableCell("-"));  // Subscription
-         expectedBuffer.append(formatTableCell("-"));  // Durable 
-         expectedBuffer.append(formatTableCell("2"));  // Count
-         expectedBuffer.append(formatTableCell("2"));  // Count delta
-         expectedBuffer.append(formatTableCell("2"));  // Depth
-         expectedBuffer.append(formatTableCell("2"));  // Depth delta
-         
-         expectedValues.add(expectedBuffer.toString());
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.QUEUE, 
-                                    LIST_MSG_COUNTER_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValues);
-     }
-     
-     /* OPERATION #8 - LIST MESSAGE COUNTER HISTORY AS HTML - APPLIES TO QUEUES ONLY*/
-     
-     /**
-      * Test Name: testListMessageCounterHistoryAsHTMLAfterQueueCreation
-      * Assertion: Make sure that the "List Message Counter History As HTML" 
-      * operation for queues returns the correct results after creating
-      * a new queue.
-      */
-     public void testListMessageCounterHistoryAsHTMLAfterQueueCreation() throws Exception {
-         String jndiName = "ListMessageCounterHistoryAfterQueueCreation"; 
-         
-         ArrayList<String> expectedValue = new ArrayList<String>();
-         expectedValue.add("");
-
-         //Create the queue first
-         createQueue(jndiName);
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.QUEUE, 
-                                    LIST_MSG_COUNTER_HISTORY_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValue);
-     }
-     
-     /**
-      * Test Name: testListMessageCounterHistoryAsHTMLUsingExistingServiceFile
-      * Assertion: Make sure that the "List Message Counter History As HTML" 
-      * operation for queues returns the correct results. Use a queue that already
-      * exists.
-      */
-     public void testListMessageCounterHistoryAsHTMLUsingExistingServiceFile() throws Exception {
-         String jndiName = "ListMessageCounterHistoryExistingQueue";
-         
-         ArrayList<String> expectedValue = new ArrayList<String>();
-         expectedValue.add("");
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.QUEUE, 
-                                    LIST_MSG_COUNTER_HISTORY_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValue); 
-     }
-     
-     /* OPERATION #9 - LIST DURABLE SUBSCRIPTIONS AS HTML - APPLIES TO TOPICS ONLY */
-     
-     /**
-      * Test Name: testListDurableSubscriptionsAsHTMLAfterTopicCreation
-      * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results after creating
-      * a new topic.
-      */
-     public void testListDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
-         String jndiName = "ListDurableSubscriptionsHtmlAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         performListAsHtmlOperationAfterCreation(jndiName, 
-                                                 DestinationType.TOPIC, 
-                                                 LIST_DURABLE_SUB_AS_HTML, 
-                                                 Boolean.FALSE);
-     }
-     
-     /**
-      * Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers
-      * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple durable subscribers.
-      */
-     public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers() 
-         throws Exception {
-         
-         String jndiName = "ListDurableSubscriptionsHtmlAfterMultipleSubscribers";
-         createTopic(jndiName);
-         
-         listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple durable subscribers. Use a topic that already exists.
-      */
-     public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
-         throws Exception {
-         
-         String jndiName = "ListDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Common code for the listDurableSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
-         ArrayList<String> expectedValues = new ArrayList<String>();
-         
-         // Create some durable subscribers
-         createTopicSessionAndDurableSubscribers(2, jndiName);
-         
-         // Set up the expected result
-         StringBuffer expectedBuffer1 = new StringBuffer();
-         expectedBuffer1.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
-         expectedBuffer1.append(formatTableCell(DURABLE)); // Durable
-         expectedBuffer1.append(formatTableCell(jndiName + "Subscriber0"));  // Subscription Name
-         expectedBuffer1.append(formatTableCell(CLIENT_ID));  // Client Id
-         expectedBuffer1.append(formatTableCell(""));  // Selector
-         expectedBuffer1.append(formatTableCell("0"));  // Message Count
-         
-         expectedValues.add(expectedBuffer1.toString());
-         
-         StringBuffer expectedBuffer2 = new StringBuffer();
-         expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber1")); // Id
-         expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
-         expectedBuffer2.append(formatTableCell(jndiName + "Subscriber1"));  // Subscription Name
-         expectedBuffer2.append(formatTableCell(CLIENT_ID));  // Client Id
-         expectedBuffer2.append(formatTableCell(""));  // Selector
-         expectedBuffer2.append(formatTableCell("0"));  // Message Count
-         
-         expectedValues.add(expectedBuffer2.toString());
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.TOPIC, 
-                                    LIST_DURABLE_SUB_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValues);
-     }
-     
-     /* OPERATION #10 - LIST NON DURABLE SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
-     
-     /**
-      * Test Name: testListNonDurableSubscriptionsAsHTMLAfterTopicCreation
-      * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results after creating
-      * a new topic.
-      */
-     public void testListNonDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
-         String jndiName = "ListNonDurableSubscriptionsHtmlAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-          
-         performListAsHtmlOperationAfterCreation(jndiName, 
-                                                 DestinationType.TOPIC, 
-                                                 LIST_NON_DURABLE_SUB_AS_HTML, 
-                                                 Boolean.FALSE);
-     }
-     
-     /**
-      * Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers
-      * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple non durable subscribers.
-      */
-     public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers() 
-         throws Exception {
-         
-         String jndiName = "ListNonDurableSubscriptionsHtmlAfterMultipleSubscribers";
-         createTopic(jndiName);
-         
-         listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple non durable subscribers. Use a topic that already exists.
-      */
-     public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
-         throws Exception {
-         
-         String jndiName = "ListNonDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Common code for the listNonDurableSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
-         ArrayList<String> expectedValues = new ArrayList<String>();
-         
-         // Create some non durable subscribers
-         createTopicSessionAndNonDurableSubscribers(2, jndiName);
-         
-         // Set up the expected result
-         StringBuffer expectedBuffer = new StringBuffer();
-         expectedBuffer.append(formatTableCell(NON_DURABLE)); // Durable
-         expectedBuffer.append(formatTableCell(""));  // Subscription Name
-         expectedBuffer.append(formatTableCell(""));  // Client Id
-         expectedBuffer.append(formatTableCell(""));  // Selector
-         expectedBuffer.append(formatTableCell("0"));  // Message Count
-         
-         expectedValues.add(expectedBuffer.toString());
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.TOPIC, 
-                                    LIST_NON_DURABLE_SUB_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValues);
-     }
-     
-     /* OPERATION #11 - LIST ALL SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
-     
-     /**
-      * Test Name: testListAllSubscriptionsAsHTMLAfterTopicCreation
-      * Assertion: Make sure that the "List All Subscriptions As HTML" 
-      * operation for topics returns the correct results after creating
-      * a new topic.
-      */
-     public void testListAllSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
-         String jndiName = "ListAllSubscriptionsHtmlAfterTopicCreation"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         
-         performListAsHtmlOperationAfterCreation(jndiName, 
-                                                 DestinationType.TOPIC, 
-                                                 LIST_ALL_SUB_AS_HTML, 
-                                                 Boolean.FALSE);
-     }
-     
-     /**
-      * Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribers
-      * Assertion: Make sure that the "List All Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple durable subscribers.
-      */
-     public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribers() 
-         throws Exception {
-         
-         String jndiName = "ListAllSubscriptionsHtmlAfterMultipleSubscribers";
-         createTopic(jndiName);
-         
-         listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
-      * Assertion: Make sure that the "List All Subscriptions As HTML" 
-      * operation for topics returns the correct results when the topic
-      * has multiple durable subscribers. Use a topic that already exists.
-      */
-     public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
-         throws Exception {
-         
-         String jndiName = "ListAllSubscriptionsHtmlMultipleSubscribersExistingTopic";
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         
-         listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
-     }
-     
-     /**
-      * Common code for the listAllSubscriptionsAfterMultipleSubscribers* tests.
-      */
-     private void listAllSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
-         ArrayList<String> expectedValues = new ArrayList<String>();
-         
-         // Create a non-durable and durable subscriber
-         createTopicSessionAndMultipleSubscribers(1, jndiName);
-         
-         // Set up the expected result
-         StringBuffer expectedBuffer1 = new StringBuffer();
-         expectedBuffer1.append(formatTableCell(NON_DURABLE)); // Durable
-         expectedBuffer1.append(formatTableCell(""));  // Subscription Name
-         expectedBuffer1.append(formatTableCell(""));  // Client Id
-         expectedBuffer1.append(formatTableCell(""));  // Selector
-         expectedBuffer1.append(formatTableCell("0"));  // Message Count
-        
-         expectedValues.add(expectedBuffer1.toString());
-         
-         StringBuffer expectedBuffer2 = new StringBuffer();
-         expectedBuffer2.append(TABLE_ROW_DELIM);
-         expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
-         expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
-         expectedBuffer2.append(formatTableCell(jndiName + "Subscriber0"));  // Subscription Name
-         expectedBuffer2.append(formatTableCell(CLIENT_ID));  // Client Id
-         expectedBuffer2.append(formatTableCell(""));  // Selector
-         expectedBuffer2.append(formatTableCell("0"));  // Message Count
-         
-         expectedValues.add(expectedBuffer2.toString());
-         
-         performListAsHtmlOperation(jndiName, 
-                                    DestinationType.TOPIC, 
-                                    LIST_ALL_SUB_AS_HTML, 
-                                    Boolean.FALSE,
-                                    expectedValues);
-     }
-     
-     /**
-      * Common code for the List*AsHTML tests.
-      */
-     private void performListAsHtmlOperation(String jndiName, 
-                                             DestinationType destinationType,
-                                             String operationName,
-                                             Boolean takesParameters,
-                                             ArrayList<String> expectedValues) throws Exception {
-         
-         performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                                  jndiName, operationName, takesParameters);
-         
-         // Get the result of the operation
-         HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
-         HtmlTextArea resultTextArea = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
-
-         assertNotNull("Could not get the result of the operation", resultTextArea);
-         
-         String result = resultTextArea.getText();
-         
-         String shortenedResult = result.substring(result.indexOf(TABLE_CELL_DELIM),
-                                                   result.lastIndexOf(TABLE_ROW_END_DELIM));
-         
-         log.info("Operation result was: " + shortenedResult);
-         
-         assertFalse("The result of the operation was an empty string", result.equals(""));
-         for(int i = 0; i < expectedValues.size(); i++) {
-             assertTrue("Expected the result to contain:\n\n" + expectedValues.get(i) + "\n\nbut was:\n\n" + shortenedResult,
-                         shortenedResult.contains(expectedValues.get(i)));
-         }
-         
-         // Clean up
-         disconnect();
-         deleteDestination(destinationType, jndiName); 
-     }
-     
-     /**
-      * Common code for the List*AsHTML*After*Creation tests.
-      */
-     private void performListAsHtmlOperationAfterCreation(String jndiName, 
-                                                          DestinationType destinationType,
-                                                          String operationName,
-                                                          Boolean takesParameters) throws Exception {
-         
-         performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                                  jndiName, operationName, takesParameters);
-         
-         // Get the result of the operation
-         HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
-         HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
-         assertNotNull("Could not get the result of the operation", resultTextBox);
-         
-         String result = resultTextBox.getText();
-         
-         log.info("Operation result was: " + result);
-         
-         assertFalse("The result of the operation was an empty string", result.equals(""));
-         
-         // Clean up
-         disconnect();
-         deleteDestination(destinationType, jndiName); 
-     }
-         
-     /* OPERATION #12 - CREATE - APPLIES TO TOPICS AND QUEUES */
-     
-     /**
-      * Test Name: testTopicCreateOperation
-      * Assertion: Make sure that the "Create" operation for topics is executed 
-      * successfully.
-      */
-     public void DISABLEDtestTopicCreateOperation() throws Exception {
-         String jndiName = "TopicCreate"; 
-
-         // Create the topic first
-         createTopic(jndiName);  
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          CREATE, Boolean.TRUE);
-     }
-     
-     /**
-      * Test Name: testTopicCreateOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Create" operation for topics is executed 
-      * successfully. Use a topic that already exists.
-      */
-     public void DISABLEDtestTopicCreateOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "CreateOperationExistingTopic"; 
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          CREATE, Boolean.TRUE);
-     }
-     
-     /**
-      * Test Name: testQueueCreateOperation
-      * Assertion: Make sure that the "Create" operation for queues is executed 
-      * successfully.
-      */
-     public void DISABLEDtestQueueCreateOperation() throws Exception {
-         String jndiName = "QueueCreate"; 
-
-         // Create the queue first
-         createQueue(jndiName);  
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          CREATE, Boolean.TRUE);
-     }
-     
-     /**
-      * Test Name: testQueueCreateOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Create" operation for queues is executed 
-      * successfully. Use a queue that already exists.
-      */
-     public void DISABLEDtestQueueCreateOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "CreateOperationExistingQueue"; 
-         
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          CREATE, Boolean.TRUE);
-     }
-     
-     /* OPERATION #13 - START - APPLIES TO TOPICS AND QUEUES */
-     
-     /**
-      * Test Name: testTopicStartOperation
-      * Assertion: Make sure that the "Start" operation for topics is executed 
-      * successfully.
-      */
-     public void testTopicStartOperation() throws Exception {
-         String jndiName = "TopicStart"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          START, Boolean.TRUE);
-         
-     }
-     
-     /**
-      * Test Name: testTopicStartOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Start" operation for topics is executed 
-      * successfully. Use a topic that already exists.
-      */
-     public void testTopicStartOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "StartOperationExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          START, Boolean.TRUE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueStartOperation
-      * Assertion: Make sure that the "Start" operation for queues is executed 
-      * successfully.
-      */
-     public void testQueueStartOperation() throws Exception {
-         String jndiName = "QueueStart"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          START, Boolean.TRUE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueStartOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Start" operation for queues is executed 
-      * successfully. Use a queue that already exists.
-      */
-     public void testQueueStartOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "StartOperationExistingQueue"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          START, Boolean.TRUE);
-         
-     }
-     
-     /* OPERATION #14 - DESTROY - APPLIES TO TOPICS AND QUEUES */
-     
-     /**
-      * Test Name: testTopicDestroyOperation
-      * Assertion: Make sure that the "Destroy" operation for topics is executed 
-      * successfully.
-      */
-     public void DISABLEDtestTopicDestroyOperation() throws Exception {
-         String jndiName = "TopicDestroy"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          DESTROY, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testTopicDestroyOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Destroy" operation for topics is executed 
-      * successfully. Use a topic that already exists.
-      */
-     public void DISABLEDtestTopicDestroyOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "DestroyOperationExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          DESTROY, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueDestroyOperation
-      * Assertion: Make sure that the "Destroy" operation for queues is executed 
-      * successfully.
-      */
-     public void DISABLEDtestQueueDestroyOperation() throws Exception {
-         String jndiName = "QueueDestroy"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          DESTROY, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueDestroyOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Destroy" operation for queues is executed 
-      * successfully. Use a queue that already exists.
-      */
-     public void DISABLEDtestQueueDestroyOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "DestroyOperationExistingQueue"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          DESTROY, Boolean.FALSE);
-         
-     }
-     
-     /* OPERATION #15 - STOP - APPLIES TO TOPICS AND QUEUES */
-     
-     /**
-      * Test Name: testTopicStopOperation
-      * Assertion: Make sure that the "Stop" operation for topics is executed 
-      * successfully.
-      */
-     public void testTopicStopOperation() throws Exception {
-         String jndiName = "TopicStop"; 
-
-         // Create the topic first
-         createTopic(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          STOP, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testTopicStopOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Stop" operation for topics is executed 
-      * successfully. Use a topic that already exists.
-      */
-     public void testTopicStopOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "StopOperationExistingTopic"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
-                                          STOP, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueStopOperation
-      * Assertion: Make sure that the "Stop" operation for queues is executed 
-      * successfully.
-      */
-     public void testQueueStopOperation() throws Exception {
-         String jndiName = "QueueStop"; 
-
-         // Create the queue first
-         createQueue(jndiName);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          STOP, Boolean.FALSE);
-         
-     }
-     
-     /**
-      * Test Name: testQueueStopOperationUsingExistingServiceFile
-      * Assertion: Make sure that the "Stop" operation for queues is executed 
-      * successfully. Use a queue that already exists.
-      */
-     public void testQueueStopOperationUsingExistingServiceFile() throws Exception {
-         String jndiName = "StopOperationExistingQueue"; 
-
-         expandNavTreeArrow(JMS_NAV_LABEL);
-         performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
-                                          STOP, Boolean.FALSE);
-         
-     }
-        
-     /**
-      * Common code for the Create/Start/Stop/Destroy operations. 
-      */
-     private void performServletLifecycleOperation(String jndiName, 
-                                                   DestinationType destinationType,
-                                                   String operationName,
-                                                   Boolean isActiveDestination) throws Exception {
-        
-         performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                                  jndiName, operationName, Boolean.FALSE);
-
-         // Make sure the correct parameters ("None") and the
-         // the correct results ("None") are displayed
-         checkNoParametersAndNoResults();
-
-         // Make sure the list of active destinations is updated,
-         // if necessary
-         JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
-         ObjectName deploymentMBean = new ObjectName("jboss.messaging:service=ServerPeer");
-         Object activeDestinations = jmxUtils.getMBeanAttribute(deploymentMBean, "Destinations");
-         
-         Boolean inActiveDestinationsList = false;
-         Iterator i = ((Set)activeDestinations).iterator();
-         
-         while(i.hasNext()) {
-             JBossDestination destination = (JBossDestination)i.next();
-             if(destination.getName().equals(jndiName)) {
-                 inActiveDestinationsList = true;
-                 break;
-             }
-         }
-
-         String errorMessage;
-         if(isActiveDestination) {
-             errorMessage = "The destination was not in the list of active destinations";
-         } else {
-             errorMessage = "The destination should not be in the list of active destinations";
-         }
-         assertEquals(errorMessage, isActiveDestination, inActiveDestinationsList);
-         
-         // Clean up
-         disconnect();
-         deleteDestination(destinationType, jndiName); 
-     }
-     
-     /**
-      * Common code for the list subscriptions tests.
-      * 
-      * @param isEmptyList - whether or not the list of subscriptions that
-      * gets displayed should be empty
-      */
-     private void performListSubscriptionsAndCheckResults(String jndiName,
-                                                          String operationName,
-                                                          Boolean isEmptyList) throws Exception {
-         performResourceOperation(JMS_NAV_LABEL, DestinationType.TOPIC.getNavLabel(), 
-                                  jndiName, operationName, Boolean.FALSE);
-
-         String actualOperationResults = ((HtmlDivision)client.getElement(OPERATION_RESULTS)).getTextContent();
-         
-         String shortenedResult = actualOperationResults.substring(actualOperationResults.indexOf("Viewing"), 
-                                                                   actualOperationResults.indexOf("]") + 1);
-         log.info("Operation result was: " + shortenedResult);
-         
-         if(!isEmptyList) {
-             assertFalse("Expected non-empty list but was: '" + shortenedResult + "'",
-                         actualOperationResults.contains(EMPTY_LIST));
-         } else {
-             assertTrue("Expected empty list but was: '" + shortenedResult + "'",
-                         actualOperationResults.contains(EMPTY_LIST));
-         }
-         
-         // Clean up
-         disconnect();
-         deleteDestination(DestinationType.TOPIC, jndiName); 
-     }
-     
-     /**
-      * Common code for the operations tests.
-      */
-     private void performDestinationOperationAndCheckMetrics(DestinationType destinationType, 
-                                                             String jndiName,
-                                                             String operationName,
-                                                             Map<String, String> expectedMetrics,
-                                                             ArrayList<String> summaryMetrics) throws Exception {
-         performResourceOperationAndCheckMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(), 
-                                                 jndiName, operationName, expectedMetrics,
-                                                 summaryMetrics, Boolean.FALSE);  
-        
-         // Clean up
-         disconnect();
-         deleteDestination(destinationType, jndiName);  
-     }
-}

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-04-29 21:41:34 UTC (rev 367)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -49,38 +49,58 @@
  */
 
 public abstract class ResourceTestBase extends EmbjoprTestCase {
-
-    private final String MAX_ITEMS_PER_PAGE="20";
-    
-    // Error messages
+   
+    // Error messages that get displayed during resource creation/configuration
     public static final String INVALID_VALUE_MESSAGE = "An invalid value was specified for one or more properties";
     public static final String MISSING_VALUE_MESSAGE = "Value is required";
     public static final String OUT_OF_RANGE_MESSAGE = "Specified attribute is not between the expected values";
     public static final String INVALID_INTEGER_MESSAGE = "Value is not a valid integer";
     public static final String ZERO_VALUE_MESSAGE = "Expected non-zero value for ";
+    public static final String BELOW_ALLOWABLE_MINIMUM = "Value is less than allowable minimum";
     
-    // Success messages
+    // Success messages that get displayed after creating/deleting/updating a resource
     public static final String ADD_MESSAGE = "Successfully added new ";
     public static final String DELETE_MESSAGE = "Successfully deleted ";
     public static final String UPDATE_MESSAGE = "Successfully updated ";
     
-    // Operations history table
-    public static final String OPERATION_DETAILS = "(Show/Hide Details)";
+    // Buttons
+    public static final String SAVE_BUTTON = "resourceConfigurationForm:saveButton";
+    public static final String PARAMETERS_FORM_OK_BUTTON = "parametersForm:okButton";
+    public static final String ADD_NEW_RESOURCE_BUTTON = "actionHeaderForm:addNewNotContent";
+    public static final String CONTINUE_AFTER_TEMPLATE_SELECTION_BUTTON = "resourceCreateForm:addButton";
     
-    // Operations table constants
-    public static final String OPERATION_HISTORY_FORM = "historyDetailsPanel";
-    public static final String DATA_TABLE = "dataTable";
+    // Template selection
+    public static final String SELECT_TEMPLATE = "selectedTemplate";
+    
+    // These values appear in the operations history table when the operation
+    // does not have any results or parameters
+    public static final String NO_RESULTS_MESSAGE = "The operation did not return any results";
+    public static final String NO_PARAMETERS_MESSAGE = "This operation does not take any parameters";
+    
+    // Operation history status
     public static final String INPROGRESS = "In Progress";
     public static final String SUCCESSFUL = "Successful";
     public static final String FAILED = "Failed";
-    public static final String REFRESH_OPERATIONS_TABLE = "refreshLink";
-    public static final int OPERATION_STATUS_COLUMN = 2;
-    public static final int FIRST_ROW = 1;
+    
+    // IDs (if these IDs get changed in resourceInstanceOperation.xhtml,
+    // resourceTypeSummary.xhtml, etc., these values will need to be updated)
+    public static final String OPERATIONS_FORM = "operationsForm";
+    public static final String OPERATION_HISTORY_FORM = "historyDetailsPanel";
+    public static final String DATA_TABLE = "dataTable";
     public static final String NO_PARAMETERS = "noParameters";
     public static final String NO_RESULTS = "noResults";
     public static final String OPERATION_RESULTS = "operationResults";
-    public static final String NO_RESULTS_MESSAGE = "The operation did not return any results";
-    public static final String NO_PARAMETERS_MESSAGE = "This operation does not take any parameters";
+    public static final String REFRESH_OPERATIONS_TABLE = "refreshLink";
+    public static final String RESOURCE_SUMMARY_FORM = "resourceSummaryForm";
+
+    // Pagination constants
+    public static final String MAX_ITEMS_PER_PAGE="50";
+    public static final String CURRENT_PAGE_SIZE = "currentPageSize";
+    public static final String NEXT_PAGE = "nextPage";
+    
+    // Useful constants for the tests
+    public static final int FIRST_ROW = 1;
+    public static final int OPERATION_STATUS_COLUMN = 2;
     public static final String EMPTY_LIST = "[]";
     public static final String TABLE_CELL_DELIM = "<td>";
     public static final String TABLE_CELL_END_DELIM = "</td>";
@@ -103,10 +123,10 @@
         resourceLink.click();
 
         // Add a new resource 
-        client.click("actionHeaderForm:addNewNotContent");
-        HtmlSelect menu = (HtmlSelect)client.getElement("selectedTemplate");
+        client.click(ADD_NEW_RESOURCE_BUTTON);
+        HtmlSelect menu = (HtmlSelect)client.getElement(SELECT_TEMPLATE);
         menu.setSelectedAttribute(resourceTemplate, Boolean.TRUE);
-        client.click("resourceCreateForm:addButton");
+        client.click(CONTINUE_AFTER_TEMPLATE_SELECTION_BUTTON);
         
         // Configure the properties associated with this resource
         setResourceProperties(propertiesMap);  
@@ -140,7 +160,7 @@
                        resourceName, CONFIGURATION_TAB);
         
         setResourceProperties(propertiesMapChanges);
-        client.click("resourceConfigurationForm:saveButton");
+        client.click(SAVE_BUTTON);
         
         checkClientAndServerMessages(expectedMessage, expectedMessage, false);
         
@@ -171,7 +191,7 @@
             enableOrDisableFormInput(propertyName, Boolean.FALSE);
         }
         
-        client.click("resourceConfigurationForm:saveButton");
+        client.click(SAVE_BUTTON);
         
         checkClientAndServerMessages(expectedMessage, expectedMessage, false);
         
@@ -186,7 +206,7 @@
      */
     protected void deleteResource(String resourceFormName, String resourceName) throws IOException {
         
-        HtmlSelect menu = (HtmlSelect)client.getElement("currentPageSize");
+        HtmlSelect menu = (HtmlSelect)client.getElement(CURRENT_PAGE_SIZE);
         if(menu != null) {
             menu.setSelectedAttribute(MAX_ITEMS_PER_PAGE, Boolean.TRUE);
         }
@@ -198,7 +218,7 @@
         } catch (IllegalStateException e) { 
             
             // The delete button was not found on this page
-            client.click("nextPage");
+            client.click(NEXT_PAGE);
             deleteButton = getDeleteButton(resourceFormName, resourceName);
             deleteButton.click();
         }  
@@ -265,7 +285,7 @@
         navigateToPage(resourceCategory, resourceSubCategory, 
                        resourceName, CONTROL_TAB);
 
-        HtmlForm form = (HtmlForm)client.getElement("operationsForm");
+        HtmlForm form = (HtmlForm)client.getElement(OPERATIONS_FORM);
         String xpath = ".//input[@value=\"" + operationName + "\"]";
 
         HtmlButtonInput operationButton = (HtmlButtonInput)form.getFirstByXPath(xpath);
@@ -274,7 +294,7 @@
         if(takesParameters) {
             
             // Use default values
-            client.click("parametersForm:okButton");
+            client.click(PARAMETERS_FORM_OK_BUTTON);
         }
         
         waitForResourceOperationToFinish();
@@ -357,7 +377,7 @@
             String metricName = (String)i.next();
 
             String expected = metricsMap.get(metricName);
-            String actual = getMetricValueFromTable(metricName, "dataTable");
+            String actual = getMetricValueFromTable(metricName, DATA_TABLE);
             actual = normalizeIfDoubleExpected(expected, actual);
             assertEquals(errorMessage + " '" + metricName + "'", expected, actual);
         }
@@ -383,7 +403,7 @@
 
         while(i.hasNext()) {
             String metricName = (String)i.next();
-            String actual = getMetricValueFromTable(metricName, "dataTable");
+            String actual = getMetricValueFromTable(metricName, DATA_TABLE);
             assertTrue(errorMessage + "'" + metricName + "' but was: " + actual, !actual.equals(nullValue));
         }
     }

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceConfigurationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceConfigurationTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceConfigurationTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import java.util.Map;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+
+/**
+ * This class contains configuration tests for datasources.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class DatasourceConfigurationTest extends DatasourceTest {
+
+    /**
+     * Change the value of some already set properties.
+     */
+    public void testConfigureDatasourceChangeSetProperties() throws Exception {
+        String jndiName = "ChangeSetPropertiesDS";
+        Map<String, String> propertiesMap = createXADatasource(jndiName);
+        
+        // Change some property values that are already set 
+        Map<String, MetaValue> propertiesMapChangesAsMetaValues = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChangesAsMetaValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(60000)));
+        propertiesMapChangesAsMetaValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMapChangesAsMetaValues.put("user-name", SimpleValueSupport.wrap("newUser"));
+
+        navigateToPage(propertiesMap.get("jndi-name"), 
+                       DatasourceType.XA_DATASOURCE, 
+                       CONFIGURATION_TAB);
+                       
+        // See EMBJOPR-58               
+        assertFalse("The configuration page could not be displayed",
+                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
+
+        Map<String, String> propertiesMapChanges = formatPropertiesMap(propertiesMapChangesAsMetaValues);
+        fillOutForm(propertiesMapChanges);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        String expectedMessage = UPDATE_MESSAGE + DatasourceType.XA_DATASOURCE.getTypeName() 
+                                 + " '" + propertiesMap.get("jndi-name") + "'";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+        
+        checkComponentProperties(propertiesMapChangesAsMetaValues, jndiName, XA_COMPONENT_TYPE);
+
+        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
+                                        DatasourceType.XA_DATASOURCE)); 
+
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE);  
+    }
+    
+    /**
+     * Change the value of some previously unset properties.
+     */
+    public void testConfigureDatasourceChangeUnsetProperties() throws Exception {
+        String jndiName = "ChangeUnsetPropertiesDS";
+        
+        Map<String, String> propertiesMap = createLocalTXDatasource(jndiName);
+
+        // Set some property values that were previously unset 
+        Map<String, MetaValue> propertiesMapChangesAsMetaValues = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChangesAsMetaValues.put("valid-connection-checker-class-name", 
+                                             SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL"));
+        propertiesMapChangesAsMetaValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMapChangesAsMetaValues.put("background-validation", SimpleValueSupport.wrap(Boolean.FALSE));
+        propertiesMapChangesAsMetaValues.put("allocation-retry", SimpleValueSupport.wrap(new Integer(10000)));
+
+        navigateToPage(propertiesMap.get("jndi-name"), 
+                       DatasourceType.LOCAL_TX_DATASOURCE, 
+                       CONFIGURATION_TAB);
+                       
+        // See EMBJOPR-58
+        assertFalse("The configuration page could not be displayed",
+                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
+
+        Map<String, String> propertiesMapChanges = formatPropertiesMap(propertiesMapChangesAsMetaValues);
+        fillOutForm(propertiesMapChanges);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        String expectedMessage = UPDATE_MESSAGE + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName() 
+                                 + " '" + propertiesMap.get("jndi-name") + "'";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+        
+        checkComponentProperties(propertiesMapChangesAsMetaValues, jndiName, LOCAL_TX_COMPONENT_TYPE);
+
+        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
+                                        DatasourceType.LOCAL_TX_DATASOURCE)); 
+        
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);   
+    }
+
+   /**
+    * Unset the value of some previously set properties. 
+    */ 
+    public void testConfigureDatasourceUnsetProperties() throws IOException, EmbJoprTestException {
+        Map<String, String> propertiesMap = createNoTXDatasource("UnsetPropertiesDS");
+
+        // Unset some property values
+        navigateToPage(propertiesMap.get("jndi-name"), 
+                       DatasourceType.NO_TX_DATASOURCE, 
+                       CONFIGURATION_TAB);
+                       
+        // See EMBJOPR-58
+        assertFalse("The configuration page could not be displayed",
+                    client.getPageAsText().contains("There was an error retrieving the configuration for this resource"));
+
+        enableOrDisableFormInput("user-name", Boolean.FALSE);
+        enableOrDisableFormInput("idle-timeout-minutes", Boolean.FALSE);
+        enableOrDisableFormInput("track-connection-by-tx", Boolean.FALSE);
+        enableOrDisableFormInput("domain", Boolean.FALSE);
+        enableOrDisableFormInput("no-tx-separate-pools", Boolean.FALSE);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        String expectedMessage = UPDATE_MESSAGE + DatasourceType.NO_TX_DATASOURCE.getTypeName() 
+                                 + " '" + propertiesMap.get("jndi-name") + "'";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+        assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"), 
+                                        DatasourceType.NO_TX_DATASOURCE)); 
+        
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);   
+    }
+    
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(DatasourceConfigurationTest.class);
+    }
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceCreationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceCreationTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceCreationTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import javax.management.ObjectName;
+import java.util.Map;
+import javax.management.JMException;
+import java.sql.Connection;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
+
+/**
+ * This class contains creation tests for datasources.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class DatasourceCreationTest extends DatasourceTest {
+
+    /**
+     * Create a new datasource. Leave some property values, that aren't
+     * required, unset.
+     */
+    public void testCreateDatasource() throws Exception {
+
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMapAsMetaValues = createDatasourcePropertiesAsMetaValues();
+        Map<String, String> propertiesMap = formatPropertiesMap(propertiesMapAsMetaValues);
+
+        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
+                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // TODO: Redundant - remove.
+                         propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        String expectedMessage = ADD_MESSAGE + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName();
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+        assertTrue("Datasource is not deployed (isDatasourceDeployed() returned false).",
+                   isDatasourceDeployed(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE));
+        
+        checkComponentProperties(propertiesMapAsMetaValues, propertiesMap.get("jndi-name"), LOCAL_TX_COMPONENT_TYPE);
+        
+        checkProperties(propertiesMap.get("jndi-name"),
+                        DatasourceType.LOCAL_TX_DATASOURCE,
+                        propertiesMap);
+
+        // TODO: need to verify that appropriate default values were
+        // set for properties that were not specified above
+
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
+    } 
+    
+    /**
+     * Attempt to create a new datasource but leave at least one required
+     * value unset. An error should occur.
+     */
+    public void testCreateDatasourceMissingRequiredValues() throws IOException, EmbJoprTestException {
+        
+        // Leave jndi-name and connection-url unset
+        Map<String, String> propertiesMap = new HashMap<String, String>();
+        propertiesMap.put("user-name", "testUser");
+        propertiesMap.put("max-pool-size", "10");
+        propertiesMap.put("idle-timeout-minutes", "20");
+        if(!isJBoss4){
+            propertiesMap.put("prefill", "true");
+            propertiesMap.put("set-tx-query-timeout", "true");
+            propertiesMap.put("query-timeout", "1800");
+        }
+        
+        createDatasource(DatasourceType.NO_TX_DATASOURCE, 
+                        //"default__No Tx Datasource",
+                        isJBoss4 ?
+                                DatasourceTemplate.AS4_DEFAULT.getTemplateHtmlSelectValue() :
+                                DatasourceTemplate.AS5_DEFAULT_NO_TX.getTemplateHtmlSelectValue(),
+                        propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     MISSING_VALUE_MESSAGE,  true);
+    }
+    
+
+    /**
+     * Attempt to create a new datasource but set a property value
+     * beyond its expected range of values. An error should occur.
+     */
+    public void testCreateDatasourcePropertyOutOfRange() throws IOException, EmbJoprTestException {
+        Map<String, String> propertiesMap = new HashMap<String, String>();
+        propertiesMap.put("jndi-name", "PropertyOutOfRangeDS");
+        propertiesMap.put("user-name", "testUser");
+        propertiesMap.put("password", "password");
+        propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
+        propertiesMap.put("xa-resource-timeout", "36000");
+
+        // This number is too big
+        propertiesMap.put("max-pool-size", "100000000000000");
+
+        createDatasource(DatasourceType.XA_DATASOURCE,
+                         DatasourceTemplate.AS5_DEFAULT_XA.getTemplateHtmlSelectValue(),
+                         propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     OUT_OF_RANGE_MESSAGE,
+                                     true);
+    }
+    
+    /**
+     * Attempt to create a new datasource but set a property value
+     * to an invalid type. An error should occur.
+     */
+    public void testCreateDatasourceInvalidPropertyType() throws IOException, EmbJoprTestException {
+        Map<String, String> propertiesMap = new HashMap<String, String>();
+        propertiesMap.put("jndi-name", "InvalidPropertyTypeDS");
+        propertiesMap.put("min-pool-size", "10");
+        propertiesMap.put("max-pool-size", "20");
+        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
+        propertiesMap.put("share-prepared-statements", "false"); 
+        
+        // This property value is supposed to be an integer
+        propertiesMap.put("background-validation-millis", "abcde"); 
+        
+        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
+                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // TODO: Redundant, remove.
+                         propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE, 
+                                     INVALID_INTEGER_MESSAGE, 
+                                     true);
+    }
+
+    /**
+     * Attempt to create a new datasource but set a property value to a value
+     * that is the correct type but is not an allowed value for that
+     * property. An error should occur.
+     */
+    public void testCreateDatasourcePropertyNotAllowed() throws IOException, EmbJoprTestException {
+        Map<String, String> propertiesMap = new HashMap<String, String>();
+        propertiesMap.put("jndi-name", "PropertyNotAllowedDS");
+        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
+
+        // This number is a valid integer but is below the
+        // allowable minimum value
+        propertiesMap.put("max-pool-size", "-25");
+
+        createDatasource(DatasourceType.NO_TX_DATASOURCE,
+                         DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No Tx Datasource",
+                         propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                     BELOW_ALLOWABLE_MINIMUM,
+                                     true);
+    }
+
+    /**
+     * Attempt to create a new datasource using a JNDI name that already exists.
+     * An error should occur.
+     */
+    public void testCreateDatasourceDuplicateJNDIName() throws IOException, EmbJoprTestException {
+        Map<String, String> propertiesMap = new HashMap<String, String>();
+        propertiesMap.put("jndi-name", "DefaultDS");
+        propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+        propertiesMap.put("connection-url", "jdbc:hsqldb:.");
+
+        createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
+                         DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__Local Tx Datasource",
+                         propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate error messages
+        String expectedMessage = "A " + DatasourceType.LOCAL_TX_DATASOURCE.getTypeName() + " named "
+                                 + "'DefaultDS' already exists";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, true);
+    }
+    
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(DatasourceCreationTest.class);
+    }
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceDeletionTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceDeletionTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceDeletionTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import java.util.Map;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * This class contains deletion tests for datasources.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class DatasourceDeletionTest extends DatasourceTest {
+
+    /**
+     * Remove a Local TX Datasource.
+     */
+    public void testDeleteLocalTXDatasource() throws Exception {
+        Map<String, String> propertiesMap = createLocalTXDatasource("DeleteLocalTXDS");
+     
+        deleteDS(propertiesMap, LOCAL_TX_COMPONENT_TYPE, DatasourceType.LOCAL_TX_DATASOURCE);
+    }
+    
+    /**
+     * Remove a No TX Datasource.
+     */
+    public void testDeleteNoTXDatasource() throws Exception {
+        Map<String, String> propertiesMap = createNoTXDatasource("DeleteNoTXDS");
+        
+        deleteDS(propertiesMap, NO_TX_COMPONENT_TYPE, 
+                 DatasourceType.NO_TX_DATASOURCE);
+    }
+
+    /**
+     * Remove an XA Datasource.
+     */
+    public void testDeleteXADatasource() throws Exception {
+        Map<String, String> propertiesMap = createXADatasource("DeleteXADS");
+                
+        deleteDS(propertiesMap, XA_COMPONENT_TYPE, DatasourceType.XA_DATASOURCE);
+    }
+    
+    /**
+     * Remove a Local TX Datasource. Use an existing -ds.xml file.
+     */
+    public void testDeleteLocalTXDatasourceUsingExistingDSFile() throws Exception {
+        
+        // Use an existing -ds.xml file
+        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteLocalTXExistingFile",
+                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
+               
+        deleteDS(propertiesMap, LOCAL_TX_COMPONENT_TYPE, DatasourceType.LOCAL_TX_DATASOURCE);
+    }
+    
+    /**
+     * Remove a No TX Datasource. Use an existing -ds.xml file.
+     */
+    public void testDeleteNoTXDatasourceUsingExistingDSFile() throws Exception {
+        
+        // Use an existing -ds.xml file
+        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteNoTXExistingFile",
+                                                                 DatasourceType.NO_TX_DATASOURCE);
+                
+        deleteDS(propertiesMap, NO_TX_COMPONENT_TYPE, 
+                 DatasourceType.NO_TX_DATASOURCE);
+    }
+    
+    /**
+     * Remove an XA Datasource. Use an existing -ds.xml file.
+     */
+    public void testDeleteXADatasourceUsingExistingDSFile() throws Exception {
+        
+        // Use an existing -ds.xml file
+        Map<String, String> propertiesMap = getPropertyValuesMap("DeleteXAExistingFile",
+                                                                 DatasourceType.XA_DATASOURCE);
+          
+        deleteDS(propertiesMap, XA_COMPONENT_TYPE, 
+                 DatasourceType.XA_DATASOURCE);
+    }
+    
+    /**
+     * Common code for the testDelete* tests.
+     */
+    private void deleteDS(Map<String, String> propertiesMap, 
+                          ComponentType componentType, DatasourceType datasourceType) throws Exception {
+        String expectedMessage = DELETE_MESSAGE + datasourceType.getTypeName() 
+                                 + " '" + propertiesMap.get("jndi-name") + "'";
+        
+        deleteDatasource(propertiesMap.get("jndi-name"), datasourceType);
+
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+        // Make sure the ManagedComponent was removed
+        assertNull("The datasource was not removed after deletion (the ManagedComponent is non-null)",
+                   getManagedComponent(propertiesMap.get("jndi-name"), componentType));
+        
+        // Make sure the entry was removed from the -ds.xml file (See JOPR-44)
+        assertFalse(containsElement(propertiesMap.get("jndi-name"),
+                                    datasourceType.getXmlElementName()));
+        
+        assertFalse("According to JMX view, the deleted datasource is still deployed",
+                    isDatasourceDeployed(propertiesMap.get("jndi-name"),
+                                         datasourceType));
+    }
+    
+    /**
+     * Test the case in which the -ds.xml file that contains the datasource
+     * to be deleted contains more than one datasource. Make sure the entire
+     * -ds.xml file does not get deleted. (See JBAS-6227.)
+     */
+    public void testDeleteDatasourceComplexDSDotXmlFile() throws Exception {
+        String jndiName = "NoTXDeletionTest";
+        
+        // MultipleDatasources-ds.xml contains two Local TX Datasources and
+        // a No TX Datasource. We will delete the No TX Datasource (NoTXDeletionTest-ds.xml).
+        deleteDatasource(jndiName, DatasourceType.NO_TX_DATASOURCE);
+        
+        // Check for the appropriate success messages
+        String expectedMessage = DELETE_MESSAGE 
+                                 + DatasourceType.NO_TX_DATASOURCE.getTypeName() + " '" 
+                                 + jndiName + "'";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+        
+        // Make sure the ManagedComponent was removed
+        assertNull("The datasource was not removed after deletion (the ManagedComponent is non-null)",
+                   getManagedComponent(jndiName, NO_TX_COMPONENT_TYPE));
+
+        // Make sure only the No TX Datasource entry was removed 
+        // from the -ds.xml file
+        String actualDSFile = System.getProperty("jsfunit.deploy.dir") 
+                              + "/MultipleDatasources-ds.xml";
+        String expectedDSFile = System.getProperty("jsfunit.testdata") 
+                                                   + "/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml";
+        compareFiles(actualDSFile, expectedDSFile); 
+    }
+    
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(DatasourceDeletionTest.class);
+    }
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceMetricsTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceMetricsTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceMetricsTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import java.util.Map;
+import java.sql.Connection;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+/**
+ * This class contains metrics tests for datasources.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class DatasourceMetricsTest extends DatasourceTest {
+
+    /**
+     * Check that the metrics are correct after creating a new datasource.
+     */
+    public void testMetricsAfterDatasourceCreation() throws IOException, EmbJoprTestException {
+
+        // Min pool size will be 5, max pool size will be 20
+        Map<String, String> propertiesMap = createLocalTXDatasource("MetricsCreateDS");
+
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "20.0");
+        expectedMetrics.put(CONNECTION_COUNT, "0.0");
+        expectedMetrics.put(CONNECTION_CREATED_COUNT, "0.0");
+        expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");
+        expectedMetrics.put(IN_USE_CONNECTION_COUNT, "0.0");
+        expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "0.0");
+        expectedMetrics.put(MAX_SIZE, "20.0");
+        expectedMetrics.put(MIN_SIZE, "5.0");
+
+        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
+
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
+    }
+
+    /**
+     * Make an initial request for a connection to a database. Make
+     * sure the metrics are updated accordingly.
+     */
+    public void testMetricsAfterInitialDBConnection() throws Exception {
+
+        // Create the datasource
+        Map<String, String> propertiesMap = createLocalTXDatasource("MetricsInitalConnectionDS");
+
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterInitialDBConnection(propertiesMap);
+    }
+    
+    /**
+     * Make an initial request for a connection to a database. Use an
+     * existing datasource. Make sure the metrics are updated accordingly. 
+     */
+    public void testMetricsAfterInitialDBConnectionUsingExistingDSFile() throws Exception {
+        
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsInitialConnectionExistingFile",
+                                                                 DatasourceType.LOCAL_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterInitialDBConnection(propertiesMap);
+    }
+    
+    /**
+     * Common code for the testMetricsAfterInitialDBConnection* tests.
+     */
+    private void checkMetricsAfterInitialDBConnection(Map<String, String> propertiesMap) throws Exception {
+        
+        // Create the first connection
+        ArrayList<Connection> connections = createConnections(1, propertiesMap.get("jndi-name"),
+                                                              propertiesMap.get("user-name"), 
+                                                              propertiesMap.get("password"));
+        
+        try {
+            
+            // Set up the expected values
+            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+            expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "19.0");
+            expectedMetrics.put(CONNECTION_COUNT, "5.0");
+            expectedMetrics.put(CONNECTION_CREATED_COUNT, "5.0");
+            expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");
+            expectedMetrics.put(IN_USE_CONNECTION_COUNT, "1.0");
+            expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "1.0");
+            expectedMetrics.put(MAX_SIZE, "20.0");
+            expectedMetrics.put(MIN_SIZE, "5.0");
+
+            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
+            
+        } finally {
+            
+            // Clean up
+            closeConnections(connections);
+            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
+        }
+    }
+
+    /**
+     * Establish multiple connections to a database. Make sure
+     * the metrics are updated accordingly.
+     */
+    public void testMetricsAfterMultipleDBConnections() throws Exception {
+
+        // Create the datasource
+        Map<String, String> propertiesMap = createNoTXDatasource("MetricsMultipleConnectionDS");
+
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterMultipleDBConnections(propertiesMap);
+    }
+    
+    /**
+     * Establish multiple connections to a database. Use an existing
+     * datasource. Make sure the metrics are updated accordingly.
+     */
+    public void testMetricsAfterMultipleDBConnectionsUsingExistingDSFile() throws Exception {
+        
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsMultipleConnectionsExistingFile",
+                                                                 DatasourceType.NO_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterMultipleDBConnections(propertiesMap);
+    }
+    
+    /**
+     * Common code for the testMetricsAfterMultipleDBConnections* tests.
+     */
+    private void checkMetricsAfterMultipleDBConnections(Map<String, String> propertiesMap) throws Exception {
+        
+        // Establish multiple connections
+        ArrayList<Connection> connections = createConnections(6, propertiesMap.get("jndi-name"),
+                                                              propertiesMap.get("user-name"), 
+                                                              propertiesMap.get("password"));
+        try {
+            
+            // Set up the expected values
+            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+            expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "14.0");
+            expectedMetrics.put(CONNECTION_COUNT, "6.0");
+            expectedMetrics.put(CONNECTION_CREATED_COUNT, "6.0");
+            expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");
+            expectedMetrics.put(IN_USE_CONNECTION_COUNT, "6.0");
+            expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "6.0");
+            expectedMetrics.put(MAX_SIZE, "20.0");
+            expectedMetrics.put(MIN_SIZE, "5.0");
+
+            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE, expectedMetrics);
+        } finally {
+            
+            // Clean up
+            closeConnections(connections);
+            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);
+        }
+    }
+
+    /**
+     * Make sure the metrics are updated appropriately after
+     * closing some connections.
+     */
+    public void testMetricsAfterClosingConnections() throws Exception {
+        
+        // Create the datasource
+        Map<String, String> propertiesMap = createNoTXDatasource("MetricsCloseConnectionsDS");
+        
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterClosingConnections(propertiesMap);
+    }
+    
+    /**
+     * Make sure the metrics are updated appropriately after
+     * closing some connections. Use an existing datasource.
+     */
+    public void testMetricsAfterClosingConnectionsUsingExistingDSFile() throws Exception {
+        
+        // Use an existing datasource
+        Map<String, String> propertiesMap = getPropertyValuesMap("MetricsCloseConnectionsExistingFile",
+                                                                 DatasourceType.NO_TX_DATASOURCE);
+        
+        expandNavTreeArrow(DS_NAV_LABEL);
+        
+        // Min pool size will be 5, max pool size will be 20
+        checkMetricsAfterClosingConnections(propertiesMap);
+    }
+    
+    /**
+     * Common code for the testMetricsAfterClosingConnections* tests.
+     */
+    private void checkMetricsAfterClosingConnections(Map<String, String> propertiesMap) throws Exception {
+        
+        // Establish some connections
+        ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"),
+                                                              propertiesMap.get("user-name"), 
+                                                              propertiesMap.get("password"));
+
+        try {
+            
+            // Close some connections
+            for(int i = 0; i < 2; i++) {
+                disconnectDB(connections.get(i));
+                connections.set(i, null);
+            }
+      
+            // Set up the expected values
+            Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+            expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "17.0"); 
+            expectedMetrics.put(CONNECTION_COUNT, "3.0");          
+            expectedMetrics.put(CONNECTION_CREATED_COUNT, "5.0");    
+            expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");   
+            expectedMetrics.put(IN_USE_CONNECTION_COUNT, "3.0");     
+            expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "5.0");
+            expectedMetrics.put(MAX_SIZE, "20.0");
+            expectedMetrics.put(MIN_SIZE, "5.0");
+
+            checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE, expectedMetrics); 
+            
+        } finally {
+            
+            // Clean up
+            closeConnections(connections);
+            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);
+        }
+    }
+    
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(DatasourceMetricsTest.class);
+    }
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceOperationsTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceOperationsTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceOperationsTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,339 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import java.util.Map;
+import java.sql.Connection;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import java.io.IOException;
+
+/**
+ * This class contains operations tests for datasources.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class DatasourceOperationsTest extends DatasourceTest {
+
+    /**
+     * Test the "Flush" operation after creating a new datasource.
+     */
+    public void testFlushOperationAfterDatasourceCreation() throws IOException, EmbJoprTestException { 
+        
+        // Min pool size will be 6, max pool size will be 15
+        Map<String, String> propertiesMap = createXADatasource("FlushAfterDatasourceCreationDS");
+
+        performDatasourceOperation(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, FLUSH);
+
+        // Make sure the metrics are updated appropriately
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "15.0");
+        expectedMetrics.put(CONNECTION_COUNT, "0.0"); 
+        expectedMetrics.put(CONNECTION_CREATED_COUNT, "0.0");
+        expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");
+        expectedMetrics.put(IN_USE_CONNECTION_COUNT, "0.0");
+        expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "0.0");
+        expectedMetrics.put(MAX_SIZE, "15.0");
+        expectedMetrics.put(MIN_SIZE, "6.0");
+
+        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, expectedMetrics);
+        
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE);   
+    }
+    
+    /**
+     * Test the "Flush" operation after multiple connections to a database 
+     * have been created.  
+     */
+    public void testFlushOperationAfterMultipleConnections() throws Exception { 
+        
+        // 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".
+        ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"), 
+                                                              propertiesMap.get("user-name"), 
+                                                              propertiesMap.get("password")); 
+        
+        closeConnections(connections); 
+
+        performDatasourceOperation(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, FLUSH);
+
+        // Make sure the metrics are updated appropriately
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(AVAILABLE_CONNECTION_COUNT, "20.0");
+        expectedMetrics.put(CONNECTION_COUNT, "0.0"); 
+        expectedMetrics.put(CONNECTION_CREATED_COUNT, "0.0");
+        expectedMetrics.put(CONNECTION_DESTROYED_COUNT, "0.0");
+        expectedMetrics.put(IN_USE_CONNECTION_COUNT, "0.0");
+        expectedMetrics.put(MAX_CONNECTIONS_IN_USE_COUNT, "0.0");
+        expectedMetrics.put(MAX_SIZE, "20.0");
+        expectedMetrics.put(MIN_SIZE, "5.0");
+
+        checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE, expectedMetrics);
+
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);   
+    }
+    
+    /**
+     * Test the "List Formatted Sub Pool Statistics" after creating a new
+     * datasource.
+     */
+    public void testListFormattedSubPoolStatisticsAfterDatasourceCreation() throws Exception {
+
+        // Min pool size will be 5, max pool size will be 20
+        Map<String, String> propertiesMap = createNoTXDatasource("ListFormattedSubPoolStatisticsAfterDatasourceCreationDS");
+
+        performDatasourceOperation(propertiesMap.get("jndi-name"), 
+                                   DatasourceType.NO_TX_DATASOURCE, 
+                                   LIST_FORMATTED_SUB_POOL_STATISTICS);
+        
+        // Use the default formatter
+        client.click(PARAMETERS_FORM_OK_BUTTON);
+
+        // Get the result of the operation
+        HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+        HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
+
+        assertNotNull("Could not get the result of the operation", resultTextBox);
+        
+        String actualResult = resultTextBox.getText();
+        
+        // Set up the expected results
+        StringBuffer expectedBuffer = new StringBuffer();
+        expectedBuffer.append("Sub Pool Statistics: \n");
+        expectedBuffer.append("Sub Pool Count: 0\n");
+        expectedBuffer.append(POOL_SEPARATOR);
+        expectedBuffer.append("\n\n");
+     
+        assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedBuffer.toString() 
+                   + "\n\nbut was:\n\n" + actualResult,
+                   actualResult.contains(expectedBuffer.toString()));
+
+        // Clean up
+        deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);   
+    }
+
+    /**
+     * Test the "List Formatted Sub Pool Statistics" operation after multiple
+     * connections to a database have been established.
+     */
+    public void testListFormattedSubPoolStatisticsAfterMultipleConnections() throws Exception {
+
+        // 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"), 
+                                                              propertiesMap.get("password")); 
+        try { 
+            performDatasourceOperation(propertiesMap.get("jndi-name"), 
+                                       DatasourceType.LOCAL_TX_DATASOURCE, 
+                                       LIST_FORMATTED_SUB_POOL_STATISTICS);
+
+            // Use the default formatter
+            client.click(PARAMETERS_FORM_OK_BUTTON);
+
+            // Get the result of the operation
+            HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+            HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
+
+            assertNotNull("Could not get the result of the operation", resultTextBox);
+            
+            String actualResult = resultTextBox.getText();
+            
+            // Set up the expected results
+            StringBuffer expectedBuffer = new StringBuffer();
+            expectedBuffer.append("Sub Pool Statistics: \n");
+            expectedBuffer.append("Sub Pool Count: 1\n");
+            expectedBuffer.append(POOL_SEPARATOR);
+            expectedBuffer.append("\n\n");
+            expectedBuffer.append("Track By Transaction: true\n");
+            expectedBuffer.append("Available Connections Count: 16\n");
+            expectedBuffer.append("Max Connections In Use Count:4\n");
+            expectedBuffer.append("Connections Destroyed Count:0\n");
+            expectedBuffer.append("Connections In Use Count:4\n");
+
+            assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" 
+                       + expectedBuffer.toString() 
+                       + "\n\nbut was:\n\n" + actualResult,
+                       actualResult.contains(expectedBuffer.toString()));
+        } finally {
+            
+            // Clean up
+            closeConnections(connections);
+            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
+        }
+    }
+    
+    /**
+     * Test the "List Formatted Sub Pool Statistics" operation after
+     * closing some connections.
+     */
+    public void testListFormattedSubPoolStatisticsAfterClosingConnections() throws Exception {
+
+        // 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"), 
+                                                              propertiesMap.get("password")); 
+        try {
+            
+            // Close some connections
+            for(int i = 0; i < 2; i++) {
+                disconnectDB(connections.get(i));
+                connections.set(i, null);
+            }
+        
+            performDatasourceOperation(propertiesMap.get("jndi-name"), 
+                                       DatasourceType.LOCAL_TX_DATASOURCE, 
+                                       LIST_FORMATTED_SUB_POOL_STATISTICS);
+
+            // Use the default formatter
+            client.click(PARAMETERS_FORM_OK_BUTTON);
+
+            // Get the result of the operation
+            HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+            HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
+
+            assertNotNull("Could not get the result of the operation", resultTextBox);
+            
+            String actualResult = resultTextBox.getText();
+            
+            // Set up the expected results
+            StringBuffer expectedBuffer = new StringBuffer();
+            expectedBuffer.append("Sub Pool Statistics: \n");
+            expectedBuffer.append("Sub Pool Count: 1\n");
+            expectedBuffer.append(POOL_SEPARATOR);
+            expectedBuffer.append("\n\n");
+            expectedBuffer.append("Track By Transaction: true\n");
+            expectedBuffer.append("Available Connections Count: 12\n");
+            expectedBuffer.append("Max Connections In Use Count:10\n");
+            expectedBuffer.append("Connections Destroyed Count:0\n");
+            expectedBuffer.append("Connections In Use Count:8");
+
+            assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" 
+                        + expectedBuffer.toString() 
+                        + "\n\nbut was:\n\n" + actualResult,
+                        actualResult.contains(expectedBuffer.toString()));
+        } finally {
+            
+            // Clean up
+            closeConnections(connections);
+            deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE);
+        }
+    }
+    
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite() {
+        return new TestSuite(DatasourceOperationsTest.class);
+    }
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/datasources/DatasourceTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,231 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.datasources;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import javax.management.ObjectName;
+import java.util.Map;
+import javax.management.JMException;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
+
+/**
+ * This is the base test class for datasource tests for AS 5.
+ * 
+ * @author Farah Juma
+ *
+ */
+public abstract class DatasourceTest extends DatasourceTestBase {
+
+    // Note: Nav panel labels, names of metrics, and operation names for 
+    // datasources are found in DatasourceTestBase.java
+    
+    // Component types
+    public static final ComponentType LOCAL_TX_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.LocalTx.getType();
+    public static final ComponentType NO_TX_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.NoTx.getType();
+    public static final ComponentType XA_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.XA.getType();
+
+    /**
+     * Create a new datasource using the given type, template, and properties.
+     *
+     * AS 5 version differs in menu tree structure - one more step.
+     * Thus, this method is overriden from the Base class.
+     * 
+     * @param datasourceType must be a datasource type from DatasourceType enum.
+     * It's label from the left nav (eg. "Local Tx Datasources") is in getLabel() property.
+     *
+     */
+    @Override
+    protected void createDatasource(DatasourceType datasourceType,
+                                    String datasourceTemplate,
+                                    Map<String, String> propertiesMap) throws IOException, EmbJoprTestException {
+
+        // Expand the "Datasources" tree node
+        ClickableElement datasourcesArrow = getNavTreeArrow(DS_NAV_LABEL);
+        datasourcesArrow.click();
+
+        HtmlAnchor datasourceLink = getNavTreeLink(datasourceType.getLabel());
+        datasourceLink.click();
+        
+        // Add a new datasource 
+        client.click(ADD_NEW_RESOURCE_BUTTON);
+        HtmlSelect menu = (HtmlSelect)client.getElement(SELECT_TEMPLATE);
+        menu.setSelectedAttribute(datasourceTemplate, Boolean.TRUE);
+        client.click(CONTINUE_AFTER_TEMPLATE_SELECTION_BUTTON);
+        
+        // Configure the properties associated with this datasource
+        fillOutForm(propertiesMap);  
+    }
+
+    /**
+     * Properties needed for testCreateDatasource.
+     * @returns the properties from the base class overriden by properties for AS 5.
+     */
+    @Override
+    protected Map<String, MetaValue> createDatasourcePropertiesAsMetaValues() {
+        Map<String, MetaValue> propertiesMap = super.createDatasourcePropertiesAsMetaValues();
+        
+        // Additional properties
+        propertiesMap.put("query-timeout", SimpleValueSupport.wrap(new Integer(180)));
+        propertiesMap.put("share-prepared-statements", SimpleValueSupport.wrap(Boolean.FALSE));
+        propertiesMap.put("stale-connection-checker-class-name", 
+                          SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.StaleConnectionChecker"));
+        propertiesMap.put("allocation-retry", SimpleValueSupport.wrap(new Integer(10000)));
+        propertiesMap.put("allocation-retry-wait-millis", SimpleValueSupport.wrap(new Long(10000)));
+        propertiesMap.put("background-validation-millis", SimpleValueSupport.wrap(new Long(15000)));
+        propertiesMap.put("prefill", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMap.put("use-try-lock", SimpleValueSupport.wrap(new Long(61000)));
+        
+        return propertiesMap;
+    }
+    
+    /**
+     * Perform the given operation on the given datasource.
+     * 
+     * performDatasourceOperation() assumes that the "Datasources"
+     * tree node is already expanded when this method is called.
+     */
+    protected void performDatasourceOperation(String datasourceName,
+                                              DatasourceType datasourceType,
+                                              String operationName) throws IOException, EmbJoprTestException {
+
+        navigateToPage(datasourceName, datasourceType, CONTROL_TAB);
+
+        HtmlForm form = (HtmlForm)client.getElement(OPERATIONS_FORM);
+        String xpath = ".//input[@value=\"" + operationName + "\"]";
+
+        HtmlButtonInput operationButton = (HtmlButtonInput)form.getFirstByXPath(xpath);
+        operationButton.click();
+    }
+
+    /**
+     * Navigate to the given tab (eg. "configurationTab", "controlTab") for 
+     * the given datasource.
+     * 
+     * navigateToPage() assumes that the "Datasources" tree node is already 
+     * expanded when this method is called.
+     */
+    protected void navigateToPage(String datasourceName,
+                                  DatasourceType datasourceType,
+                                  String tabName) throws IOException, EmbJoprTestException {
+        
+        //refreshTreeNode(DS_NAV_LABEL);
+        
+        if(!ejtt.getNavTree().getNodeByLabel(datasourceType.getLabel()).isExpanded()) {
+            expandNavTreeArrow(datasourceType.getLabel());
+        }
+       
+        HtmlAnchor datasource = getNavTreeLink(datasourceName);
+        datasource.click();
+
+        HtmlAnchor tabLink = (HtmlAnchor)client.getElement(tabName);
+        tabLink.click(); 
+    }
+    
+    /**
+     * Delete the datasource given by datasourceName.
+     */
+    protected void deleteDatasource(String datasourceName, 
+                                    DatasourceType datasourceType) throws IOException, 
+                                    HtmlElementNotFoundException, EmbJoprTestException {
+        if(!ejtt.getNavTree().getNodeByLabel(DS_NAV_LABEL).isExpanded()) {
+            expandNavTreeArrow(DS_NAV_LABEL);
+        }
+        
+        HtmlAnchor datasourceLink = getNavTreeLink(datasourceType.getLabel()); 
+        datasourceLink.click();
+
+        HtmlSelect menu = (HtmlSelect)client.getElement(CURRENT_PAGE_SIZE);
+        if(menu != null) {
+            menu.setSelectedAttribute(MAX_ITEMS_PER_PAGE, Boolean.TRUE);
+        }
+
+        HtmlButtonInput deleteButton;
+        try {
+            deleteButton = getDeleteButton(RESOURCE_SUMMARY_FORM, datasourceName);
+            deleteButton.click();
+        } catch (IllegalStateException e) { 
+            
+            // The delete button was not found on this page
+            client.click(NEXT_PAGE);
+            deleteButton = getDeleteButton(RESOURCE_SUMMARY_FORM, datasourceName);
+            deleteButton.click();
+        }  
+    }
+
+    /**
+     * This method should query the JMX server and decide whether the given 
+     * MBean displays deployed resource.
+     * @param deploymentMBean  Name of the MBean to examine. Differs between AS4 and 5.
+     * @return true  if the MBean indicates that the resource is deployed, false otherwise.
+     * @throws javax.management.JMException  upon JMX related error, including invalid
+     *                 or non-existent MBean / attribute name.
+     * @throws java.io.IOException  upon I/O error.
+     */
+    @Override
+    protected boolean isMBeanStateDeployedImpl(ObjectName deploymentMBean)  throws JMException, IOException {
+
+        JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
+
+        Object state = jmxUtils.getMBeanAttribute(deploymentMBean, "State");
+        return ("DEPLOYED".equals( state.toString() ));
+
+    }
+
+    /**
+     * Return the location of the -ds.xml file that corresponds to the 
+     * datasource given by jndiName.
+     */
+    @Override
+    protected String getDatasourceConfigFile( String jndiName ) {
+        return System.getProperty("jsfunit.deploy.dir") + "/" + jndiName + "-ds.xml";
+    }
+
+    /**
+     * Return the name of the MBean that corresponds to the given
+     * JNDI name and service.
+     */
+    @Override
+    protected String getMBeanName( String jndiName, String serviceName ){
+        return "jboss.deployment:id=\"jboss.jca:name=" + jndiName + "," +
+        "service=" + serviceName + "\",type=Component";
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    /*public static Test suite()
+    {
+        return new TestSuite(DatasourceTest.class);
+    }*/
+}
+

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSConfigurationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSConfigurationTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSConfigurationTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,280 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import org.jboss.jopr.jsfunit.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * This class contains configuration tests for JMS topics and queues.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class JMSConfigurationTest extends JMSTest {
+    
+    /**
+     * Test Name: testConfigureQueueChangePropertiesUsingExistingServiceFile
+     * Assertion: Verify the ability to change queue property values. 
+     * Use a queue that already exists.
+     * 
+     * Strategy: Change some property values for the queue. 
+     * Make sure the properties of the ManagedComponent are updated accordingly.
+     */
+    public void testConfigureQueuePropertiesUsingExistingServiceFile() throws Exception {
+        String jndiName = "ChangePropertiesExistingQueue";
+        Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, QUEUE_COMPONENT_TYPE);
+        
+        // The properties we are going to change
+        // (Before: maxDeliveryAttempts=-1, redeliveryDelay=-1 )
+        Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(0)));
+        propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        changeDestinationProperties(jndiName, DestinationType.QUEUE, 
+                                    QUEUE_COMPONENT_TYPE, propertiesMapChanges,
+                                    propertiesMap);
+    }
+    
+    /**
+     * Test Name: testConfigureTopicChangePropertiesUsingExistingServiceFile
+     * Assertion: Verify the ability to change topic property values. 
+     * Use a topic that already exists.
+     * 
+     * Strategy: Change some property values for the topic.
+     * Make sure the properties of the ManagedComponent are updated accordingly.
+     */
+    public void testConfigureTopicChangePropertiesUsingExistingServiceFile() throws Exception {
+        String jndiName = "ChangePropertiesExistingTopic";
+        Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, TOPIC_COMPONENT_TYPE);
+      
+        // The properties we are going to change
+        // (Before: maxDeliveryAttempts=-1, redeliveryDelay=-1 )
+        Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
+        propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        changeDestinationProperties(jndiName, DestinationType.TOPIC, 
+                                    TOPIC_COMPONENT_TYPE, propertiesMapChanges,
+                                    propertiesMap);
+    }
+   
+    /**
+     * Test Name: testConfigureQueueChangeProperties
+     * Assertion: Verify the ability to change queue property values.
+     * 
+     * Strategy: Create a new queue. Change some property 
+     * values for this queue. Make sure the properties of the ManagedComponent 
+     * are updated accordingly.
+     */
+    public void testConfigureQueueChangeProperties() throws Exception {
+        String jndiName = "ChangePropertiesQueue";
+        
+        // Create the queue first
+        Map<String, MetaValue> propertiesMap = createQueue(jndiName);
+        
+        // The properties we are going to change
+        // (Before: maxDeliveryAttempts=5, redeliveryDelay=-1 )
+        Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(0)));
+        propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
+        
+        changeDestinationProperties(jndiName, DestinationType.QUEUE, 
+                                    QUEUE_COMPONENT_TYPE, propertiesMapChanges,
+                                    propertiesMap);
+    }
+    
+    /**
+     * Test Name: testConfigureTopicChangeProperties
+     * Assertion: Verify the ability to change topic property values.
+     * 
+     * Strategy: Create a new topic. Change some property 
+     * values for this topic. Make sure the properties of the ManagedComponent 
+     * are updated accordingly.
+     */
+    public void testConfigureTopicChangeProperties() throws Exception {
+        String jndiName = "ChangePropertiesTopic";
+        
+        // Create the topic first
+        Map<String, MetaValue> propertiesMap = createTopic(jndiName);
+        
+        // The properties we are going to change
+        // (Before: redeliveryDelay=60000, maxDeliveryAttempts=-1 )
+        Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
+        propertiesMapChanges.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(40000)));
+        propertiesMapChanges.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
+        
+        changeDestinationProperties(jndiName, DestinationType.TOPIC, 
+                                    TOPIC_COMPONENT_TYPE, propertiesMapChanges,
+                                    propertiesMap);
+    }
+      
+    /**
+     * Common code for changing a destination's property values.
+     */
+    private void changeDestinationProperties(String jndiName, 
+                                             DestinationType destinationType,
+                                             ComponentType componentType,
+                                             Map<String, MetaValue> propertiesMapChanges,
+                                             Map<String, MetaValue> propertiesMap) throws Exception {
+        
+        // The success message we should see
+        String expectedMessage = UPDATE_MESSAGE + destinationType.getName() + " '" 
+                                 + jndiName + "'";
+        
+        // Change some property values
+        configureResource(JMS_NAV_LABEL, destinationType.getNavLabel(), jndiName, 
+                          propertiesMap, propertiesMapChanges, componentType,
+                          expectedMessage);
+  
+        assertTrue("The destination is not deployed ",
+                   isDeployed(jndiName + "-service.xml"));
+        
+        // Clean up
+        deleteDestination(destinationType, jndiName); 
+    }
+    
+    /**
+     * Test Name: testConfigureQueueUnsetPropertiesUsingExistingServiceFile
+     * Assertion: Verify the ability to unset queue property values. Use a
+     * queue that already exists.
+     * 
+     * Strategy: Unset some property values for the queue. Make sure the
+     * rest of the properties for the ManagedComponent remain unchanged.
+     */
+    public void testConfigureQueueUnsetPropertiesUsingExistingServiceFile() throws Exception {
+        String jndiName = "UnsetPropertiesExistingQueue";    
+        unsetPropertiesUsingExistingServiceFile(jndiName, DestinationType.QUEUE, 
+                                                QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testConfigureTopicUnsetPropertiesUsingExistingServiceFile
+     * Assertion: Verify the ability to unset topic property values. Use a
+     * topic that already exists.
+     * 
+     * Strategy: Unset some property values for the topic. Make sure the
+     * rest of the properties for the ManagedComponent remain unchanged.
+     */
+    public void testConfigureTopicUnsetPropertiesUsingExistingServiceFile() throws Exception {
+        String jndiName = "UnsetPropertiesExistingTopic";    
+        unsetPropertiesUsingExistingServiceFile(jndiName, DestinationType.TOPIC, 
+                                                TOPIC_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Common code for the testConfigure*UnsetPropertiesUsingExistingServiceFile 
+     * tests.
+     */
+    private void unsetPropertiesUsingExistingServiceFile(String jndiName, 
+                                                         DestinationType destinationType,
+                                                         ComponentType componentType) throws Exception {
+        Map<String, MetaValue> propertiesMap = getSpecificComponentProperties(jndiName, 
+                                                                              componentType);
+        
+        String[] propertiesToUnset = new String[] { "maxDeliveryAttempts" }; 
+        propertiesMap.remove("maxDeliveryAttempts");
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        unsetDestinationProperties(destinationType, jndiName, propertiesMap, 
+                                   propertiesToUnset, componentType);
+    }
+    
+    /**
+     * Test Name: testConfigureQueueUnsetProperties
+     * Assertion: Verify the ability to unset queue property values. 
+     * 
+     * Strategy: Create a new queue. Unset some property values for the 
+     * queue. Make sure the rest of the properties for the ManagedComponent 
+     * remain unchanged.
+     */
+    public void testConfigureQueueUnsetProperties() throws Exception {
+        String jndiName = "UnsetPropertiesQueue";
+        
+        // Create the queue first
+        Map<String, MetaValue> propertiesMap = createQueue(jndiName);
+        
+        String[] propertiesToUnset = new String[] { "maxSize" }; 
+        propertiesMap.remove("maxSize"); 
+        
+        unsetDestinationProperties(DestinationType.QUEUE, jndiName, propertiesMap, 
+                                   propertiesToUnset, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testConfigureTopicUnsetProperties
+     * Assertion: Verify the ability to unset topic property values. 
+     * 
+     * Strategy: Create a new topic. Unset some property values for the 
+     * topic. Make sure the rest of the properties for the ManagedComponent 
+     * remain unchanged.
+     */
+    public void testConfigureTopicUnsetProperties() throws Exception {
+        String jndiName = "UnsetPropertiesTopic";
+        
+        // Create the topic first
+        Map<String, MetaValue> propertiesMap = createTopic(jndiName);
+        
+        String[] propertiesToUnset = new String[] { "maxSize" }; 
+        propertiesMap.remove("maxSize"); 
+        
+        unsetDestinationProperties(DestinationType.TOPIC, jndiName, propertiesMap, 
+                                   propertiesToUnset, TOPIC_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Common code for the testConfigure*UnsetProperties* tests.
+     */
+    private void unsetDestinationProperties(DestinationType destinationType,
+                                            String jndiName,
+                                            Map<String, MetaValue> propertiesMap,
+                                            String[] propertiesToUnset,
+                                            ComponentType componentType) throws Exception {
+        
+        // The success message we should see
+        String expectedMessage = UPDATE_MESSAGE + destinationType.getName() + " '" 
+                                 + jndiName + "'";
+        
+        unsetResourceProperties(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                                jndiName, propertiesMap, propertiesToUnset, 
+                                componentType, expectedMessage);
+        
+        assertTrue("The destination is not deployed ",
+                   isDeployed(jndiName + "-service.xml"));
+     
+        // Clean up
+        deleteDestination(destinationType, jndiName);   
+    }
+}

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSCreationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSCreationTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSCreationTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,352 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import org.jboss.jopr.jsfunit.*;
+import javax.management.ObjectName;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * This class contains creation tests for JMS topics and queues.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class JMSCreationTest extends JMSTest {
+    
+    /**
+     * Test Name: testCreateQueue
+     * Assertion: Verify the ability to create a new queue.
+     * 
+     * Strategy: Create a queue. Make sure the queue is deployed and that
+     * the properties of the ManagedComponent are set correctly.
+     */
+    public void testCreateQueue() throws Exception {
+        
+        String jndiName = "CreateQueue";
+        String expectedMessage = ADD_MESSAGE + DestinationType.QUEUE.getName();
+        
+        createDestinationCommon(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
+                                jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testCreateTopic
+     * Assertion: Verify the ability to create a new topic.
+     * 
+     * Strategy: Create a topic. Make sure the topic is deployed and that
+     * the properties of the ManagedComponent are set correctly.
+     */
+    public void testCreateTopic() throws Exception {
+        
+        String jndiName = "CreateTopic";
+        String expectedMessage = ADD_MESSAGE + DestinationType.TOPIC.getName();
+        
+        createDestinationCommon(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE, 
+                                jndiName, expectedMessage, TOPIC_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Common code for the testCreateQueue() and testCreateTopic() tests.
+     */
+    private void createDestinationCommon(DestinationType destinationType, 
+                                         String destinationTemplate, 
+                                         String jndiName, 
+                                         String expectedMessage,
+                                         ComponentType componentType) throws Exception {
+        
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2500)));
+        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
+        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(15)));
+        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(80000)));
+        /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(0))); **/
+        propertiesMap.put("pageSize", SimpleValueSupport.wrap(new Integer(2500)));
+        propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(50000)));
+
+        createDestination(destinationType, destinationTemplate, propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+        // Make sure the ManagedComponent was created and that the properties are
+        // set correctly
+        assertTrue("The destination is not deployed ",
+                   isDeployed(jndiName + "-service.xml"));
+        checkComponentProperties(propertiesMap, jndiName, componentType);
+        
+        // Clean up
+        deleteDestination(destinationType, jndiName);
+    }
+    
+    /**
+     * Test Name: testCreateQueueSetObjectNameManagedProperties
+     * Assertion: Verify the ability to specify ObjectName ManagedProperties
+     * (eg. DLQ, expiryQueue, serverPeer) when creating a new queue.
+     * (See JOPR-121)
+     */
+    public void testCreateQueueSetObjectNameManagedProperties() throws Exception {
+        String jndiName = "ObjectNameManagedPropertiesQueue";
+        String expectedMessage = ADD_MESSAGE + DestinationType.QUEUE.getName();
+        
+        createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
+                                                         jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testCreateTopicSetObjectNameManagedProperties
+     * Assertion: Verify the ability to specify ObjectName ManagedProperties
+     * (eg. DLQ, expiryQueue, serverPeer) when creating a new topic.
+     * (See JOPR-121)
+     */
+    public void testCreateTopicSetObjectNameManagedProperties() throws Exception {
+        
+        String jndiName = "ObjectNameManagedPropertiesTopic";
+        String expectedMessage = ADD_MESSAGE + DestinationType.TOPIC.getName();
+        
+        createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, 
+                                                         jndiName, expectedMessage, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Common code for the testCreateQueueSetObjectNameManagedProperties() and 
+     * testCreateTopicSetObjectNameManagedProperties() tests.
+     */
+    private void createDestinationWithObjectNameManagedProperties(DestinationType destinationType, 
+                                                                  String destinationTemplate, 
+                                                                  String jndiName, 
+                                                                  String expectedMessage,
+                                                                  ComponentType componentType) throws Exception {
+        
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("DLQ", SimpleValueSupport.wrap(DLQ));
+        propertiesMap.put("expiryQueue", SimpleValueSupport.wrap(EXPIRY_QUEUE));
+        propertiesMap.put("serverPeer", SimpleValueSupport.wrap(SERVER_PEER));
+
+        createDestination(destinationType, destinationTemplate, propertiesMap);
+        client.click(SAVE_BUTTON);
+
+        // Check for the appropriate success messages
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+        // Make sure the ManagedComponent was created and that the properties are
+        // set correctly
+        assertTrue("The destination is not deployed ",
+                   isDeployed(jndiName + "-service.xml"));
+        checkComponentProperties(propertiesMap, jndiName, componentType);
+        
+        // Clean up
+        deleteDestination(destinationType, jndiName);
+    }
+    
+     /**
+     * Test Name: testCreateQueueMissingRequiredValue
+     * Assertion: Verify the ability to handle a missing required value when
+     * creating a queue. Make sure the appropriate error message occurs.
+     */
+    public void testCreateQueueMissingRequiredValue() throws IOException, EmbJoprTestException {
+        createDestinationMissingRequiredValue(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE);
+    }
+    
+    /**
+     * Test Name: testCreateTopicMissingRequiredValue
+     * Assertion: Verify the ability to handle a missing required value when
+     * creating a topic. Make sure the appropriate error message occurs.
+     */
+    public void testCreateTopicMissingRequiredValue() throws IOException, EmbJoprTestException {
+        createDestinationMissingRequiredValue(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE);
+    }
+    
+    /**
+     * Common code for the testCreate*MissingRequiredValue() tests.
+     */
+    private void createDestinationMissingRequiredValue(DestinationType destinationType,
+                                                       String destinationTemplate) throws IOException, EmbJoprTestException {
+        // Leave the JNDI name and name unset
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
+        
+        createDestination(destinationType, destinationTemplate, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE, 
+                                     MISSING_VALUE_MESSAGE, true);
+    }
+    
+    /**
+     * Test Name: testCreateQueuePropertyOutOfRange
+     * Assertion: Verify the ability to handle a property value beyond its
+     * expected range of values when creating a queue. Make sure the appropriate 
+     * error message occurs.
+     */
+    public void testCreateQueuePropertyOutOfRange() throws IOException, EmbJoprTestException {
+        createDestinationPropertyOutOfRange(DestinationType.QUEUE, 
+                                            QUEUE_DEFAULT_TEMPLATE, 
+                                            "PropertyOutOfRangeQueue");
+    }
+    
+    /**
+     * Test Name: testCreateTopicPropertyOutOfRange
+     * Assertion: Verify the ability to handle a property value beyond its
+     * expected range of values when creating a topic. Make sure the appropriate 
+     * error message occurs.
+     */
+    public void testCreateTopicPropertyOutOfRange() throws IOException, EmbJoprTestException {
+        createDestinationPropertyOutOfRange(DestinationType.TOPIC, 
+                                            TOPIC_DEFAULT_TEMPLATE, 
+                                            "PropertyOutOfRangeTopic");
+    }
+
+    
+    /**
+     * Common code for the testCreate*PropertyOutOfRange() tests.
+     */
+    private void createDestinationPropertyOutOfRange(DestinationType destinationType,
+                                                     String destinationTemplate,
+                                                     String jndiName) throws IOException, EmbJoprTestException {
+        // The properties we want to configure
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2500)));
+        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(80000)));
+        
+        // This number is too large
+        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Long(Long.MAX_VALUE)));
+        
+        createDestination(destinationType, destinationTemplate, propertiesMap);
+        client.click(SAVE_BUTTON);
+   
+        // Check for the appropriate error messages
+        checkClientAndServerMessages(INVALID_VALUE_MESSAGE, 
+                                     OUT_OF_RANGE_MESSAGE, true);
+    }
+    
+    /**
+     * Test Name: testCreateQueueInvalidPropertyType
+     * Assertion: Verify the ability to handle a property value that has an
+     * invalid type when creating a queue. Make sure the appropriate 
+     * error message occurs.
+     */
+     public void testCreateQueueInvalidPropertyType() throws IOException, EmbJoprTestException {
+         createDestinationInvalidPropertyType(DestinationType.QUEUE, 
+                                              QUEUE_DEFAULT_TEMPLATE, 
+                                              "InvalidPropertyTypeQueue");
+     }
+     
+    /**
+     * Test Name: testCreateTopicInvalidPropertyType
+     * Assertion: Verify the ability to handle a property value that has an
+     * invalid type when creating a topic. Make sure the appropriate 
+     * error message occurs.
+     */
+     public void testCreateTopicInvalidPropertyType() throws IOException, EmbJoprTestException {
+          createDestinationInvalidPropertyType(DestinationType.TOPIC, 
+                                               TOPIC_DEFAULT_TEMPLATE, 
+                                               "InvalidPropertyTypeTopic");
+     }
+     
+     /**
+      * Common code for the testCreate*InvalidPropertyType() tests.
+      */ 
+     private void createDestinationInvalidPropertyType(DestinationType destinationType,
+                                                       String destinationTemplate,
+                                                       String jndiName) throws IOException, EmbJoprTestException {
+         // The properties we want to configure
+         Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+         propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
+         propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+         propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
+         /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(0))); **/
+         propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(50000)));
+         propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(1500)));
+         
+         // This property value is supposed to be an integer
+         propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap("fifteen"));
+         
+         createDestination(destinationType, destinationTemplate, propertiesMap);
+         client.click(SAVE_BUTTON);
+         
+         // Check for the appropriate error messages
+         checkClientAndServerMessages(INVALID_VALUE_MESSAGE,
+                                      INVALID_INTEGER_MESSAGE, true);
+     }
+     
+     /**
+      * Test Name: testCreateQueueDuplicateJNDIName
+      * Assertion: Verify the ability to handle a duplicate JNDI name 
+      * when creating a queue. Make sure the appropriate error message 
+      * occurs.
+      */
+     public void testCreateQueueDuplicateJNDIName() throws IOException, EmbJoprTestException {
+         String jndiName = "TestQueue";
+         createQueue(jndiName);
+         
+         checkDestinationDuplicateJNDIName(DestinationType.QUEUE, jndiName);
+
+     }
+     
+     /**
+      * Test Name: testCreateTopicDuplicateJNDIName
+      * Assertion: Verify the ability to handle a duplicate JNDI name 
+      * when creating a queue. Make sure the appropriate error message 
+      * occurs.
+      */
+     public void testCreateTopicDuplicateJNDIName() throws IOException, EmbJoprTestException {
+         String jndiName = "TestTopic";
+         createTopic(jndiName);
+         
+         checkDestinationDuplicateJNDIName(DestinationType.TOPIC, jndiName);
+     }
+     
+     /**
+      * Common code for the testCreate*DuplicateJNDIName() tests.
+      */
+     public void checkDestinationDuplicateJNDIName(DestinationType destinationType,
+                                                   String jndiName) throws IOException, EmbJoprTestException {
+
+         // Check for the appropriate error messages
+         String expectedMessage = "A " + destinationType.getName() + " named '" + jndiName + "' already exists";
+         checkClientAndServerMessages(expectedMessage, expectedMessage, true);
+     }
+}

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSDeletionTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSDeletionTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSDeletionTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import org.jboss.jopr.jsfunit.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * This class contains deletion tests for JMS topics and queues.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class JMSDeletionTest extends JMSTest {
+    
+    /**
+     * Test Name: testDeleteQueueUsingExistingServiceFile
+     * Assertion: Verify the ability to delete a queue. Use a queue
+     * that already exists.
+     * 
+     * Strategy: Delete the queue. Make sure the ManagedComponent is removed.
+     */
+    public void testDeleteQueueUsingExistingServiceFile() throws Exception {
+        String jndiName = "DeleteQueueExistingFile";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        deleteDestinationCommon(jndiName, DestinationType.QUEUE, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testDeleteQueue
+     * Assertion: Verify the ability to delete a queue. 
+     * 
+     * Strategy: Create a queue and then delete it. Make sure the ManagedComponent 
+     * is removed.
+     */
+    public void testDeleteQueue() throws Exception {
+        String jndiName = "QueueDelete";
+        
+        // Create the queue first
+        Map<String, MetaValue> propertiesMap = createQueue(jndiName);
+        deleteDestinationCommon(jndiName, DestinationType.QUEUE, QUEUE_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testDeleteTopicUsingExistingServiceFile
+     * Assertion: Verify the ability to delete a topic. Use a topic
+     * that already exists.
+     * 
+     * Strategy: Delete the topic. Make sure the ManagedComponent is removed.
+     */
+    public void testDeleteTopicUsingExistingServiceFile() throws Exception {
+        String jndiName = "DeleteTopicExistingFile";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        deleteDestinationCommon(jndiName, DestinationType.TOPIC, TOPIC_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Test Name: testDeleteTopic
+     * Assertion: Verify the ability to delete a topic. 
+     * 
+     * Strategy: Create a topic and then delete it. Make sure the ManagedComponent 
+     * is removed.
+     */
+    public void testDeleteTopic() throws Exception {
+        String jndiName = "TopicDelete";
+        
+        // Create the topic first
+        Map<String, MetaValue> propertiesMap = createTopic(jndiName);
+        deleteDestinationCommon(jndiName, DestinationType.TOPIC, TOPIC_COMPONENT_TYPE);
+    }
+    
+    /**
+     * Common code for the testDelete* tests.
+     */
+    public void deleteDestinationCommon(String jndiName, 
+                                        DestinationType destinationType, 
+                                        ComponentType componentType) throws Exception {
+        deleteDestination(destinationType, jndiName);
+        
+        // Check for the appropriate success messages
+        String expectedMessage = DELETE_MESSAGE + destinationType.getName() + " '" + jndiName + "'";
+        checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+        
+        // Make sure the ManagedComponent was removed
+        assertNull("The destination was not removed after deletion (the ManagedComponent is non-null)",
+                   getManagedComponent(jndiName, componentType));
+        assertFalse("The entry was not removed from the -service.xml file after deletion",
+                    containsElement(getDestinationDeploymentFile(jndiName), 
+                                    SERVICE_FILE_CHILD_ELEMENT, 
+                                    SERVICE_FILE_ROOT_ELEMENT));
+    }
+}

Added: 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	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSMetricsTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,665 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import org.jboss.jopr.jsfunit.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import javax.jms.Topic;
+import javax.jms.TopicSession;
+import javax.jms.Queue;
+import javax.jms.QueueSession;
+import javax.jms.QueueReceiver;
+
+/**
+ * This class contains metrics tests for JMS topics and queues.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class JMSMetricsTest extends JMSTest {
+    
+    /**
+     * Test Name: testTopicMetricsAfterCreation
+     * Assertion: Verify that topic metrics are correct after topic
+     * creation. 
+     */
+    public void testTopicMetricsAfterCreation() throws Exception {
+        String jndiName = "MetricsAfterTopicCreation";
+        
+        // Create the topic first
+        createTopic(jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "0.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
+          
+        checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
+                                DestinationType.TOPIC);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneNonDurableSubscription
+     * Assertion: Verify that topic metrics are correct after creating
+     * a non-durable subscriber for the topic.
+     */
+    public void testTopicMetricsAfterOneNonDurableSubscription() throws Exception {
+        String jndiName = "MetricsAfterOneNonDurableTopicSubscriber";
+        
+        // Create the topic first
+        createTopic(jndiName);
+        
+        checkTopicMetricsAfterOneSubscription(jndiName, Boolean.FALSE);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneNonDurableSubscriptionUsingExistingServiceFile
+     * Assertion: Verify that topic metrics are correct after creating
+     * a non-durable subscriber for the topic. Use a topic that already exists.
+     */
+    public void testTopicMetricsAfterOneNonDurableSubscriptionUsingExistingServiceFile() throws Exception {
+        String jndiName = "MetricsOneNonDurableTopicSubscriberExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkTopicMetricsAfterOneSubscription(jndiName, Boolean.FALSE);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneDurableSubscription
+     * Assertion: Verify that topic metrics are correct after creating
+     * a durable subscriber for the topic.
+     */
+    public void testTopicMetricsAfterOneDurableSubscription() throws Exception {
+        String jndiName = "MetricsAfterOneDurableTopicSubscriber";
+        
+        // Create the topic first
+        createTopic(jndiName);
+        
+        checkTopicMetricsAfterOneSubscription(jndiName, Boolean.TRUE);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneDurableSubscriptionUsingExistingServiceFile
+     * Assertion: Verify that topic metrics are correct after creating
+     * a durable subscriber for the topic. Use a topic that already exists.
+     */
+    public void testTopicMetricsAfterOneDurableSubscriptionUsingExistingServiceFile() throws Exception {
+        String jndiName = "MetricsOneDurableTopicSubscriberExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkTopicMetricsAfterOneSubscription(jndiName, Boolean.TRUE);
+    }
+    
+    /**
+     * Common code for the testTopicMetricsAfterOne*Subscription* tests.
+     */
+    private void checkTopicMetricsAfterOneSubscription(String jndiName, 
+            Boolean isDurable) throws Exception {
+
+        // Create a subscriber
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+
+        if(isDurable) {
+            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber1");
+        } else {
+            createNonDurableTopicSubscriber(session, topic);
+        }
+
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "0.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "1.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+
+        if(isDurable) {
+            expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
+            expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
+        } else {
+            expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
+            expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
+        }
+
+        checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
+                                DestinationType.TOPIC);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterMultipleSubscriptions()
+     * Assertion: Verify that topic metrics are correct after multiple subscribers
+     * for the topic are created.
+     */
+    public void testTopicMetricsAfterMultipleSubscriptions() throws Exception {
+        String jndiName = "MetricsAfterMultipleTopicSubscribers";
+        
+        // Create the topic first
+        createTopic(jndiName);
+        
+        checkTopicMetricsAfterMultipleSubscriptions(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterMultipleSubscriptionsUsingExistingServiceFile()
+     * Assertion: Verify that topic metrics are correct after multiple subscribers
+     * for the topic are created. Use a topic that already exists.
+     */
+    public void testTopicMetricsAfterMultipleSubscriptionsUsingExistingServiceFile() throws Exception {
+        String jndiName = "MetricsMultipleTopicSubscribersExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkTopicMetricsAfterMultipleSubscriptions(jndiName); 
+    }
+    
+    /**
+     * Common code for the testTopicMetricsAfterMultipleSubscriptions* tests.
+     */
+    private void checkTopicMetricsAfterMultipleSubscriptions(String jndiName) throws Exception {
+        
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+
+        // Create multiple subscriptions (2 durable ones, 2 non-durable ones)
+        for(int i = 0; i < 2; i++) {
+            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
+            createNonDurableTopicSubscriber(session, topic);
+        }
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "0.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "4.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "2.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "2.0");
+         
+        checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
+                                DestinationType.TOPIC);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneMessage()
+     * Assertion: Verify that topic metrics are correct after sending
+     * one message to the topic.
+     */
+    public void testTopicMetricsAfterOneMessage() throws Exception {
+        String jndiName = "TopicMetricsAfterOneMessage";
+        
+        // Create the topic first
+        createTopic(jndiName);
+        
+        checkTopicMetricsAfterOneMessage(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterOneMessageUsingExistingServiceFile()
+     * Assertion: Verify that topic metrics are correct after sending
+     * one message to the topic. Use a topic that already exists.
+     */
+    public void testTopicMetricsAfterOneMessageUsingExistingServiceFile() throws Exception {
+        String jndiName = "TopicMetricsOneMessageExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkTopicMetricsAfterOneMessage(jndiName);
+    }
+    
+    /**
+     * Common code for the testTopicMetricsAfterOneMessage* tests.
+     */
+    private void checkTopicMetricsAfterOneMessage(String jndiName) throws Exception {
+        
+        // Create a subscriber for the topic and then publish
+        // 1 message
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        createDurableTopicSubscriber(session, topic, jndiName + "Subscriber1");
+        
+        publishMessages(session, topic, 1);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "1.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "1.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "1.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
+         
+        checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
+                                DestinationType.TOPIC);
+        
+        
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterMultipleMessages()
+     * Assertion: Verify that topic metrics are correct after sending
+     * multiple message to the topic.
+     */
+    public void testTopicMetricsAfterMultipleMessages() throws Exception {
+        String jndiName = "TopicMetricsAfterMultipleMessages";
+            
+        // Create the topic first
+        createTopic(jndiName);
+        
+        checkTopicMetricsAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicMetricsAfterMultipleMessagesUsingExistingServiceFile()
+     * Assertion: Verify that topic metrics are correct after sending
+     * multiple message to the topic. Use a topic that already exists.
+     */
+    public void testTopicMetricsAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "TopicMetricsMultipleMessagesExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkTopicMetricsAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Common code for the testTopicMetricsAfterMultipleMessages* tests.
+     */
+    private void checkTopicMetricsAfterMultipleMessages(String jndiName) throws Exception {
+        
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        
+        // Create 1 durable subscriber, 1 non-durable subscriber
+        // and then publish 3 messages
+        createDurableTopicSubscriber(session, topic, jndiName + "Subscriber");
+        createNonDurableTopicSubscriber(session, topic);
+        
+        publishMessages(session, topic, 3);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "6.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "2.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "3.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "3.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
+         
+        checkDestinationMetrics(jndiName, expectedMetrics, getTopicSummaryMetrics(),
+                                DestinationType.TOPIC);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterCreation
+     * Assertion: Verify that queue metrics are correct after queue
+     * creation. 
+     */
+    public void testQueueMetricsAfterCreation() throws Exception {
+        String jndiName = "MetricsAfterQueueCreation";
+        
+        // Create the queue first
+        createQueue(jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
+          
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+   
+    /**
+     * Test Name: testQueueMetricsAfterCreatingReceiver
+     * Assertion: Verify that queue metrics are correct after creating
+     * a queue receiver.
+     */
+    public void testQueueMetricsAfterCreatingReceiver() throws Exception {
+        String jndiName = "MetricsAfterQueueReceiver";
+        
+        // Create the queue first
+        createQueue(jndiName);
+        
+        checkQueueMetricsAfterCreatingReceiver(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile
+     * Assertion: Verify that queue metrics are correct after creating
+     * a queue receiver. Use a queue that already exists.
+     */
+    public void testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile() throws Exception {
+        String jndiName = "MetricsOneQueueReceiverExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkQueueMetricsAfterCreatingReceiver(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsAfterCreatingReceiver* tests.
+     */
+    private void checkQueueMetricsAfterCreatingReceiver(String jndiName) throws Exception {
+        
+        // Create a receiver
+        QueueSession session = createQueueSession();
+        Queue queue = getQueue(jndiName);
+        createQueueReceiver(session, queue);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "1.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
+          
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterOneMessage
+     * Assertion: Verify that queue metrics are correct after sending
+     * a message to the queue.
+     */
+    public void testQueueMetricsAfterOneMessage() throws Exception {
+        String jndiName = "QueueMetricsAfterOneMessage";
+        
+       // Create the queue first
+       createQueue(jndiName);
+      
+       checkQueueMetricsAfterOneMessage(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterOneMessageUsingExistingServiceFile
+     * Assertion: Verify that queue metrics are correct after sending
+     * a message to the queue. Use a queue that already exists.
+     */
+    public void testQueueMetricsAfterOneMessageUsingExistingServiceFile() throws Exception {
+        String jndiName = "QueueMetricsOneMessageExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkQueueMetricsAfterOneMessage(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsAfterOneMessage* tests.
+     */
+    private void checkQueueMetricsAfterOneMessage(String jndiName) throws Exception {
+        
+        // Send 1 message to the queue
+        createQueueSessionAndSendMessages(1, jndiName);
+           
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "1.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "1.0");
+        expectedMetrics.put(COUNT_DELTA, "1.0");
+        expectedMetrics.put(DEPTH, "1.0");
+        expectedMetrics.put(DEPTH_DELTA, "1.0");
+        
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterMulipleMessages
+     * Assertion: Verify that queue metrics are correct after sending
+     * multiple messages to the queue.
+     */
+    public void testQueueMetricsAfterMultipleMessages() throws Exception {
+        String jndiName = "QueueMetricsAfterMultipleMessages";
+        
+        // Create the queue first
+        createQueue(jndiName);
+      
+        checkQueueMetricsAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterMulipleMessagesUsingExistingServiceFile
+     * Assertion: Verify that queue metrics are correct after sending
+     * multiple messages to the queue. Use a queue that already exists.
+     */
+    public void testQueueMetricsAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "QueueMetricsMultipleMessagesExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkQueueMetricsAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsAfterMultipleMessages* tests.
+     */
+    private void checkQueueMetricsAfterMultipleMessages(String jndiName) throws Exception {
+        
+        // Send multiple messages to the queue
+        createQueueSessionAndSendMessages(3, jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "3.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "3.0");
+        expectedMetrics.put(COUNT_DELTA, "3.0");
+        expectedMetrics.put(DEPTH, "3.0");
+        expectedMetrics.put(DEPTH_DELTA, "3.0");
+        
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterReceivingMessage
+     * Assertion: Verify that queue metrics are correct 
+     * after a queue receiver actually receives a message.
+     */
+    public void testQueueMetricsAfterReceivingMessage() throws Exception {
+        String jndiName = "QueueMetricsAfterReceivingMessage";
+        
+        // Create the queue first
+        createQueue(jndiName);
+      
+        checkQueueMetricsAfterReceivingMessage(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterReceivingMessageUsingExistingServiceFile
+     * Assertion: Verify that queue metrics are correct 
+     * after a queue receiver actually receives a message. Use a queue
+     * that already exists.
+     */
+    public void testQueueMetricsAfterReceivingMessageUsingExistingServiceFile() throws Exception {
+        String jndiName = "QueueMetricsReceiveMessageExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        checkQueueMetricsAfterReceivingMessage(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsAfterReceivingMessage* tests.
+     */
+    private void checkQueueMetricsAfterReceivingMessage(String jndiName) throws Exception {
+        
+        // Create a queue receiver and then send multiple messages to the
+        // queue
+        QueueSession session = createQueueSession();
+        Queue queue = getQueue(jndiName);
+        QueueReceiver receiver = createQueueReceiver(session, queue);
+        sendMessages(session, queue, 3);
+        
+        // Actually receive a message
+        receiver.receive();
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "1.0");
+        expectedMetrics.put(DELIVERING_COUNT, "2.0");
+        expectedMetrics.put(MSG_COUNT, "2.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "3.0");
+        expectedMetrics.put(COUNT_DELTA, "3.0");
+        expectedMetrics.put(DEPTH, "2.0");
+        expectedMetrics.put(DEPTH_DELTA, "2.0");
+        
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterScheduledMessages
+     * Assertion: Verify that queue metrics are correct after creating
+     * some scheduled messages for the queue.
+     */
+    public void testQueueMetricsAfterScheduledMessages() throws Exception {
+        String jndiName = "QueueMetricsAfterScheduledMessages";
+        
+        // Create the queue first
+        createQueue(jndiName);
+        
+        checkQueueMetricsAfterScheduledMessage(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile
+     * Assertion: Verify that queue metrics are correct after creating
+     * a scheduled message for the queue. Use a queue that already exists.
+     */
+    public void testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "QueueMetricsScheduledMessagesExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL); 
+        checkQueueMetricsAfterScheduledMessage(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsAfterScheduledMessage* tests.
+     */
+    private void checkQueueMetricsAfterScheduledMessage(String jndiName) throws Exception {
+        
+        // Create a queue receiver and then schedule some
+        // messages
+        QueueSession session = createQueueSession();
+        Queue queue = getQueue(jndiName);
+        createQueueReceiver(session, queue);
+        sendScheduledMessages(session, queue, 2);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "2.0");
+        expectedMetrics.put(COUNT, "2.0");
+        expectedMetrics.put(COUNT_DELTA, "2.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0"); 
+        expectedMetrics.put(CONSUMER_COUNT, "1.0");
+        expectedMetrics.put(MSG_COUNT, "2.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        
+        checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+                                DestinationType.QUEUE);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsTimeLastUpdate
+     * Assertion: Verify that the "Time Last Update" metric for queues gets
+     * displayed appropriately.
+     */
+    public void testQueueMetricTimeLastUpdate() throws Exception {
+        String jndiName = "QueueMetricsCheckTimeLastUpdate";
+           
+        // Create the queue first
+        createQueue(jndiName);
+        checkQueueMetricTimeLastUpdate(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueMetricsTimeLastUpdateUsingExistingServiceFile
+     * Assertion: Verify that the "Time Last Update" metric for queues gets
+     * displayed appropriately. Use a queue that already exists.
+     */
+    public void testQueueMetricTimeLastUpdateUsingExistingServiceFile() throws Exception {
+        String jndiName = "QueueMetricsTimeLastUpdateExistingQueue";
+           
+        expandNavTreeArrow(JMS_NAV_LABEL); 
+        checkQueueMetricTimeLastUpdate(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueMetricsTimeLastUpdate* tests.
+     */
+    private void checkQueueMetricTimeLastUpdate(String jndiName) throws Exception {
+        
+        // Send a message to the queue
+        createQueueSessionAndSendMessages(1, jndiName);
+        
+        ArrayList<String> expectedMetric = new ArrayList<String>();
+        expectedMetric.add(TIME_LAST_UPDATE);
+        
+        checkResourceMetricsNotNull(JMS_NAV_LABEL, DestinationType.QUEUE.getNavLabel(), 
+                                    jndiName, expectedMetric.iterator(),
+                                    ZERO_VALUE_MESSAGE,
+                                    "0.0");
+        // Clean up
+        disconnect();
+        deleteDestination(DestinationType.QUEUE, jndiName);    
+    }
+    
+    /**
+     * Common code for the metrics tests.
+     */
+    private void checkDestinationMetrics(String jndiName,
+                                         Map<String, String> expectedMetrics,
+                                         ArrayList<String> summaryMetrics,
+                                         DestinationType destinationType) throws Exception {
+        checkResourceMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                             jndiName, expectedMetrics, summaryMetrics);
+
+        // Clean up
+        disconnect();
+        deleteDestination(destinationType, jndiName);  
+    }
+}

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSOperationsTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSOperationsTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSOperationsTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,1335 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+import org.jboss.jopr.jsfunit.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import javax.jms.Topic;
+import javax.jms.TopicSession;
+import javax.jms.Queue;
+import org.jboss.jms.destination.JBossDestination;
+import javax.management.ObjectName;
+
+/**
+ * This class contains operations tests for JMS topics and queues.  
+ * This class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ */
+public class JMSOperationsTest extends JMSTest {
+    
+    /* OPERATION #1 - REMOVE ALL MESSAGES - APPLIES TO TOPICS AND QUEUES */
+    
+    /**
+     * Test Name: testRemoveAllMessagesAfterTopicCreation
+     * Assertion: Verify that the metrics remain unchanged
+     * after executing the "Remove All Messages" operation for a topic
+     * when there are no messages.
+     */
+    public void testRemoveAllMessagesAfterTopicCreation() throws Exception {
+        String jndiName = "RemoveAllMessagesAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "0.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0.0");
+
+        performDestinationOperationAndCheckMetrics(DestinationType.TOPIC, 
+                                                   jndiName, REMOVE_ALL_MSGS,
+                                                   expectedMetrics,
+                                                   getTopicSummaryMetrics());
+    }
+    
+    /**
+     * Test Name: testTopicRemoveAllMessagesAfterMultipleMessages
+     * Assertion: Verify that the metrics are updated accordingly
+     * after executing the "Remove All Messages" operation for a topic
+     * when the topic has multiple messages.
+     */
+    public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessages() throws Exception {
+        String jndiName = "TopicRemoveAllMessagesAfterMultipleMessages"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        topicRemoveAllMessagesAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile
+     * Assertion: Verify that the metrics are updated accordingly
+     * after executing the "Remove All Messages" operation for a topic
+     * when the topic has multiple messages. Use a topic that already exists.
+     */
+    public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "RemoveAllMessagesMultipleMessagesExistingTopic";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL); 
+        topicRemoveAllMessagesAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Common code for the testTopicRemoveAllMessagesAfterMultipleMessages*
+     * tests.
+     */
+    private void topicRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
+        createTopicSessionAndSendMessages(2, jndiName);
+        
+        // Wait for messages to be delivered before removing them
+        Thread.sleep(10000);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(ALL_MSG_COUNT, "0.0");
+        expectedMetrics.put(ALL_SUB_COUNT, "2.0");
+        expectedMetrics.put(DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0.0");
+        expectedMetrics.put(DURABLE_SUB_COUNT, "1.0");
+        expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1.0");
+
+        performDestinationOperationAndCheckMetrics(DestinationType.TOPIC, 
+                                                   jndiName, REMOVE_ALL_MSGS,
+                                                   expectedMetrics,
+                                                   getTopicSummaryMetrics());
+    }
+    
+    /**
+     * Test Name: testRemoveAllMessagesAfterQueueCreation
+     * Assertion: Verify that the metrics remain unchanged
+     * after executing the "Remove All Messages" operation for a queue
+     * when there are no messages.
+     */
+    public void testRemoveAllMessagesAfterQueueCreation() throws Exception {
+
+        String jndiName = "RemoveAllMessagesMAfterQueueCreation"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, REMOVE_ALL_MSGS,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /**
+     * Test Name: testQueueRemoveAllMessagesAfterMultipleMessages
+     * Assertion: Verify that the metrics are updated appropriately
+     * after executing the "Remove All Messages" operation for a queue
+     * when there are multiple messages in the queue. 
+     */
+    public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessages() throws Exception {
+        String jndiName = "QueueRemoveAllMessagesAfterMultipleMessages";
+        
+        // Create the queue first
+        createQueue(jndiName);
+        queueRemoveAllMessagesAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServicefile
+     * Assertion: Verify that the metrics are updated appropriately
+     * after executing the "Remove All Messages" operation for a queue
+     * when there are multiple messages in the queue. Use a queue that
+     * already exists.
+     */
+    public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "RemoveAllMessagesMultipleMessagesExistingQueue";
+        
+        expandNavTreeArrow(JMS_NAV_LABEL); 
+        queueRemoveAllMessagesAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueRemoveAllMessagesAfterMultipleMessages*
+     * tests.
+     */
+    private void queueRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
+        createQueueSessionAndSendMessages(2, jndiName);
+        
+        // Wait for messages to be delivered before removing them
+        Thread.sleep(10000);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "2.0");
+        expectedMetrics.put(COUNT_DELTA, "2.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, REMOVE_ALL_MSGS,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /* OPERATION #2 - RESET MESSAGE COUNTER - APPLIES TO QUEUES ONLY */
+    
+    /**
+     * Test Name: testResetMessageCounterAfterQueueCreation
+     * Assertion: Verify that the queue metrics are correct
+     * after executing the "Reset Message Counter" operation for a queue
+     * right after creation.
+     */
+    public void testResetMessageCounterAfterQueueCreation() throws Exception {
+        String jndiName = "ResetMessageCounterAfterQueueCreation"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, RESET_MSG_COUNTER,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /**
+     * Test Name: testQueueResetMessageCounterAfterMultipleMessages
+     * Assertion: Verify that the queue metrics are correct
+     * after executing the "Reset Message Counter" operation for a queue
+     * when there are multiple messages in the queue.
+     */
+    public void testQueueResetMessageCounterAfterMultipleMessages() throws Exception {
+        String jndiName = "QueueResetMessageCounterAfterMultipleMessages"; 
+
+        // Create the queue first
+        createQueue(jndiName);   
+        resetMessageCounterAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile
+     * Assertion: Verify that the queue metrics are correct
+     * after executing the "Reset Message Counter" operation for a queue
+     * when there are multiple messages in the queue. Use a queue that 
+     * already exists.
+     */
+    public void testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "ResetMessageCounterMultipleMessagesExistingQueue";
+       
+        expandNavTreeArrow(JMS_NAV_LABEL); 
+        resetMessageCounterAfterMultipleMessages(jndiName);
+    }
+     
+    
+    /**
+     * Common code for the testQueueResetMessageCounterAfterMultipleMessages*
+     * tests.
+     */
+    private void resetMessageCounterAfterMultipleMessages(String jndiName) throws Exception {
+        createQueueSessionAndSendMessages(3, jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "3.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "3.0");
+        expectedMetrics.put(DEPTH_DELTA, "3.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, RESET_MSG_COUNTER,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /* OPERATION #3 - RESET MESSAGE COUNTER HISTORY - APPLIES TO QUEUES ONLY */
+    
+    /**
+     * Test Name: testResetMessageCounterHistoryAfterQueueCreation
+     * Assertion: Verify that the queue metrics are correct after
+     * executing the "Reset Message Counter History" operation for a queue
+     * after creation.
+     */
+    public void testResetMessageCounterHistoryAfterQueueCreation() throws Exception {
+        String jndiName = "ResetMessageCounterHistoryAfterQueueCreation"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "0.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "0.0");
+        expectedMetrics.put(COUNT_DELTA, "0.0");
+        expectedMetrics.put(DEPTH, "0.0");
+        expectedMetrics.put(DEPTH_DELTA, "0.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, RESET_MSG_COUNTER_HISTORY,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /**
+     * Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessages
+     * Assertion: Verify that the queue metrics are correct after
+     * executing the "Reset Message Counter History" operation for a queue
+     * that has multiple messages.
+     */
+    public void testQueueResetMessageCounterHistoryAfterMultipleMessages() throws Exception {
+        String jndiName = "QueueResetMessageCounterHistoryAfterMultipleMessages"; 
+
+        // Create the queue first
+        createQueue(jndiName);   
+        queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExistingServiceFile
+     * Assertion: Verify that the queue metrics are correct after
+     * executing the "Reset Message Counter History" operation for a queue
+     * that has multiple messages. Use a queue that already exists.
+     */
+    public void testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExsitingServiceFile() throws Exception {
+        String jndiName = "ResetMessageCounterHistoryMultipleMessagesExistingQueue";
+       
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Common code for the testQueueResetMessageCounterHistoryAfterMultipleMessages*
+     * tests.
+     */
+    private void queueResetMessageCounterHistoryAfterMultipleMessages(String jndiName) throws Exception {
+        createQueueSessionAndSendMessages(3, jndiName);
+        
+        // Set up the expected values
+        Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+        expectedMetrics.put(CONSUMER_COUNT, "0.0");
+        expectedMetrics.put(DELIVERING_COUNT, "0.0");
+        expectedMetrics.put(MSG_COUNT, "3.0");
+        expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+        expectedMetrics.put(COUNT, "3.0");
+        expectedMetrics.put(COUNT_DELTA, "3.0");
+        expectedMetrics.put(DEPTH, "3.0");
+        expectedMetrics.put(DEPTH_DELTA, "3.0");
+        
+        performDestinationOperationAndCheckMetrics(DestinationType.QUEUE, 
+                                                   jndiName, RESET_MSG_COUNTER_HISTORY,
+                                                   expectedMetrics,
+                                                   getQueueSummaryMetrics());
+    }
+    
+    /* OPERATION #4 - LIST ALL SUBSCRIPTIONS - APPLIES ONLY TO TOPICS */
+   
+    /**
+     * Test Name: testListAllSubscriptionsAfterTopicCreation
+     * Assertion: Make sure that the correct results get displayed
+     * after the "List All Subscriptions" operation is invoked for
+     * a topic right after creation.
+     */
+    public void testListAllSubscriptionsAfterTopicCreation() throws Exception {
+        String jndiName = "ListAllSubscriptionsAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB, Boolean.TRUE);
+    }
+    
+    
+    /**
+     * Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribers
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List All Subscriptions" operation for a topic that has multiple subscribers.
+     */
+    public void testTopicListAllSubscriptionsAfterMultipleSubscribers() throws Exception {
+        String jndiName = "ListAllSubscriptionsAfterMultipleSubscribers"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        listAllSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List All Subscriptions" operation for a topic that has multiple subscribers.
+     * Use a topic that already exists.
+     */
+    public void testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
+        String jndiName = "ListAllSubscriptionsMultipleSubscribersExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        listAllSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+
+    /**
+     * Common code for the testListAllSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listAllSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+
+        // Create multiple subscriptions (2 durable ones, 2 non-durable ones)
+        for(int i = 0; i < 2; i++) {
+            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
+            createNonDurableTopicSubscriber(session, topic);
+        }
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB, 
+                                                Boolean.FALSE);
+    }
+    
+    /* OPERATION #5 - LIST DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY */
+    
+    /**
+     * Test Name: testListDurableSubscriptionsAfterTopicCreation
+     * Assertion: Make sure that the correct results get displayed
+     * after the "List Durable Subscriptions" operation is invoked for
+     * a topic right after creation.
+     */
+    public void testListDurableSubscriptionsAfterTopicCreation() throws Exception {
+        String jndiName = "ListDurableSubscriptionsAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB, Boolean.TRUE);
+    }
+   
+    /**
+     * Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribers
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List Durable Subscriptions" operation for a topic that has multiple 
+     * durable subscribers.
+     */
+    public void testTopicListDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
+        String jndiName = "ListDurableSubscriptionsAfterMultipleSubscribers"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List Durable Subscriptions" operation for a topic that has multiple 
+     * durable subscribers. Use a topic that already exists.
+     */
+    public void testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
+        String jndiName = "ListDurableSubscriptionsMultipleSubscribersExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Common code for the testListDurableSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
+        createTopicSessionAndDurableSubscribers(2, jndiName);
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB, 
+                                                Boolean.FALSE);
+    }
+    
+    /* OPERATION #6 - LIST NON DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY*/
+    
+    /**
+     * Test Name: testListNonDurableSubscriptionsAfterTopicCreation
+     * Assertion: Make sure that the correct results get displayed
+     * after the "List Non Durable Subscriptions" operation is invoked for
+     * a topic right after creation.
+     */
+    public void testListNonDurableSubscriptionsAfterTopicCreation() throws Exception {
+        String jndiName = "ListNonDurableSubscriptionsAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB, Boolean.TRUE);
+    }
+    
+    /**
+     * Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribers
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List Non Durable Subscriptions" operation for a topic that has multiple 
+     * non-durable subscribers.
+     */
+    public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
+        String jndiName = "ListNonDurableSubscriptionsAfterMultipleSubscribers"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Verify that the correct results get displayed after invoking 
+     * the "List Non Durable Subscriptions" operation for a topic that has multiple 
+     * non-durable subscribers. Use a topic that already exists.
+     */
+    public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
+        String jndiName = "ListNonDurableSubscriptionsMultipleSubscribersExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Common code for the testListNonDurableSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listNonDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
+        createTopicSessionAndNonDurableSubscribers(2, jndiName);
+        
+        performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB, 
+                                                Boolean.FALSE);
+    }
+    
+    
+    /* OPERATION #7 - LIST MESSAGE COUNTER AS HTML - APPLIES TO QUEUES ONLY */
+    
+    /**
+     * Test Name: testListMessageCounterAsHTMLAfterQueueCreation
+     * Assertion: Make sure that the "List Message Counter As HTML" 
+     * operation for queues is executed successfully after creating
+     * a new queue.
+     */
+    public void testListMessageCounterAsHTMLAfterQueueCreation() throws Exception {
+        ArrayList<String> expectedValues = new ArrayList<String>();
+        
+        String jndiName = "ListMessageCounterAfterQueueCreation"; 
+
+        //Create the queue first
+        createQueue(jndiName);
+        
+        // Set up the expected result
+        StringBuffer expectedBuffer = new StringBuffer();
+        expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
+        expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName() 
+                                              + "." + jndiName));
+        expectedBuffer.append(formatTableCell("-"));  // Subscription
+        expectedBuffer.append(formatTableCell("-"));  // Durable 
+        expectedBuffer.append(formatTableCell("0"));  // Count
+        expectedBuffer.append(formatTableCell("-"));  // Count delta
+        expectedBuffer.append(formatTableCell("0"));  // Depth
+        expectedBuffer.append(formatTableCell("-"));  // Depth delta
+        
+        expectedValues.add(expectedBuffer.toString());
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.QUEUE, 
+                                   LIST_MSG_COUNTER_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValues);     
+    }
+    
+    /**
+     * Test Name: testListMessageCounterAsHTMLAfterMultipleMessages
+     * Assertion: Make sure that the "List Message Counter As HTML" 
+     * operation for queues returns the correct results when the queue has
+     * multiple messages. 
+     */
+    public void testListMessageCounterAsHTMLAfterMultipleMessagess() throws Exception {
+        String jndiName = "ListMessageCounterAfterMultipleMessages";
+        
+        // Create the queue first
+        createQueue(jndiName);
+        
+        listMessageCounterAsHtmlAfterMultipleMessages(jndiName);
+    }
+    
+    /**
+     * Test Name: testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile
+     * Assertion: Make sure that the "List Message Counter As HTML" 
+     * operation for queues returns the correct results when the queue has
+     * multiple messages. Use a queue that already exists.
+     */
+    public void testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+        String jndiName = "ListMessageCounterMultipleMessagesExistingQueue";
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        listMessageCounterAsHtmlAfterMultipleMessages(jndiName); 
+    }
+    
+    /**
+     * Common code for the testListMessageCounterAsHTMLAfterMultipleMessages* tests.
+     */
+    private void listMessageCounterAsHtmlAfterMultipleMessages(String jndiName) throws Exception {
+        ArrayList<String> expectedValues = new ArrayList<String>();
+        
+        // Send some messages to the queue
+        createQueueSessionAndSendMessages(2, jndiName);
+        
+        // Set up the expected result
+        StringBuffer expectedBuffer = new StringBuffer();
+        expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
+        expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()
+                                              + "." + jndiName));
+        expectedBuffer.append(formatTableCell("-"));  // Subscription
+        expectedBuffer.append(formatTableCell("-"));  // Durable 
+        expectedBuffer.append(formatTableCell("2"));  // Count
+        expectedBuffer.append(formatTableCell("2"));  // Count delta
+        expectedBuffer.append(formatTableCell("2"));  // Depth
+        expectedBuffer.append(formatTableCell("2"));  // Depth delta
+        
+        expectedValues.add(expectedBuffer.toString());
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.QUEUE, 
+                                   LIST_MSG_COUNTER_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValues);
+    }
+    
+    /* OPERATION #8 - LIST MESSAGE COUNTER HISTORY AS HTML - APPLIES TO QUEUES ONLY*/
+    
+    /**
+     * Test Name: testListMessageCounterHistoryAsHTMLAfterQueueCreation
+     * Assertion: Make sure that the "List Message Counter History As HTML" 
+     * operation for queues returns the correct results after creating
+     * a new queue.
+     */
+    public void testListMessageCounterHistoryAsHTMLAfterQueueCreation() throws Exception {
+        String jndiName = "ListMessageCounterHistoryAfterQueueCreation"; 
+        
+        ArrayList<String> expectedValue = new ArrayList<String>();
+        expectedValue.add("");
+
+        //Create the queue first
+        createQueue(jndiName);
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.QUEUE, 
+                                   LIST_MSG_COUNTER_HISTORY_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValue);
+    }
+    
+    /**
+     * Test Name: testListMessageCounterHistoryAsHTMLUsingExistingServiceFile
+     * Assertion: Make sure that the "List Message Counter History As HTML" 
+     * operation for queues returns the correct results. Use a queue that already
+     * exists.
+     */
+    public void testListMessageCounterHistoryAsHTMLUsingExistingServiceFile() throws Exception {
+        String jndiName = "ListMessageCounterHistoryExistingQueue";
+        
+        ArrayList<String> expectedValue = new ArrayList<String>();
+        expectedValue.add("");
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.QUEUE, 
+                                   LIST_MSG_COUNTER_HISTORY_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValue); 
+    }
+    
+    /* OPERATION #9 - LIST DURABLE SUBSCRIPTIONS AS HTML - APPLIES TO TOPICS ONLY */
+    
+    /**
+     * Test Name: testListDurableSubscriptionsAsHTMLAfterTopicCreation
+     * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results after creating
+     * a new topic.
+     */
+    public void testListDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
+        String jndiName = "ListDurableSubscriptionsHtmlAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        performListAsHtmlOperationAfterCreation(jndiName, 
+                                                DestinationType.TOPIC, 
+                                                LIST_DURABLE_SUB_AS_HTML, 
+                                                Boolean.FALSE);
+    }
+    
+    /**
+     * Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers
+     * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple durable subscribers.
+     */
+    public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers() 
+        throws Exception {
+        
+        String jndiName = "ListDurableSubscriptionsHtmlAfterMultipleSubscribers";
+        createTopic(jndiName);
+        
+        listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Make sure that the "List Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple durable subscribers. Use a topic that already exists.
+     */
+    public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
+        throws Exception {
+        
+        String jndiName = "ListDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Common code for the listDurableSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
+        ArrayList<String> expectedValues = new ArrayList<String>();
+        
+        // Create some durable subscribers
+        createTopicSessionAndDurableSubscribers(2, jndiName);
+        
+        // Set up the expected result
+        StringBuffer expectedBuffer1 = new StringBuffer();
+        expectedBuffer1.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
+        expectedBuffer1.append(formatTableCell(DURABLE)); // Durable
+        expectedBuffer1.append(formatTableCell(jndiName + "Subscriber0"));  // Subscription Name
+        expectedBuffer1.append(formatTableCell(CLIENT_ID));  // Client Id
+        expectedBuffer1.append(formatTableCell(""));  // Selector
+        expectedBuffer1.append(formatTableCell("0"));  // Message Count
+        
+        expectedValues.add(expectedBuffer1.toString());
+        
+        StringBuffer expectedBuffer2 = new StringBuffer();
+        expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber1")); // Id
+        expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
+        expectedBuffer2.append(formatTableCell(jndiName + "Subscriber1"));  // Subscription Name
+        expectedBuffer2.append(formatTableCell(CLIENT_ID));  // Client Id
+        expectedBuffer2.append(formatTableCell(""));  // Selector
+        expectedBuffer2.append(formatTableCell("0"));  // Message Count
+        
+        expectedValues.add(expectedBuffer2.toString());
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.TOPIC, 
+                                   LIST_DURABLE_SUB_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValues);
+    }
+    
+    /* OPERATION #10 - LIST NON DURABLE SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
+    
+    /**
+     * Test Name: testListNonDurableSubscriptionsAsHTMLAfterTopicCreation
+     * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results after creating
+     * a new topic.
+     */
+    public void testListNonDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
+        String jndiName = "ListNonDurableSubscriptionsHtmlAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+         
+        performListAsHtmlOperationAfterCreation(jndiName, 
+                                                DestinationType.TOPIC, 
+                                                LIST_NON_DURABLE_SUB_AS_HTML, 
+                                                Boolean.FALSE);
+    }
+    
+    /**
+     * Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers
+     * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple non durable subscribers.
+     */
+    public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers() 
+        throws Exception {
+        
+        String jndiName = "ListNonDurableSubscriptionsHtmlAfterMultipleSubscribers";
+        createTopic(jndiName);
+        
+        listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Make sure that the "List Non Durable Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple non durable subscribers. Use a topic that already exists.
+     */
+    public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
+        throws Exception {
+        
+        String jndiName = "ListNonDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Common code for the listNonDurableSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
+        ArrayList<String> expectedValues = new ArrayList<String>();
+        
+        // Create some non durable subscribers
+        createTopicSessionAndNonDurableSubscribers(2, jndiName);
+        
+        // Set up the expected result
+        StringBuffer expectedBuffer = new StringBuffer();
+        expectedBuffer.append(formatTableCell(NON_DURABLE)); // Durable
+        expectedBuffer.append(formatTableCell(""));  // Subscription Name
+        expectedBuffer.append(formatTableCell(""));  // Client Id
+        expectedBuffer.append(formatTableCell(""));  // Selector
+        expectedBuffer.append(formatTableCell("0"));  // Message Count
+        
+        expectedValues.add(expectedBuffer.toString());
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.TOPIC, 
+                                   LIST_NON_DURABLE_SUB_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValues);
+    }
+    
+    /* OPERATION #11 - LIST ALL SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
+    
+    /**
+     * Test Name: testListAllSubscriptionsAsHTMLAfterTopicCreation
+     * Assertion: Make sure that the "List All Subscriptions As HTML" 
+     * operation for topics returns the correct results after creating
+     * a new topic.
+     */
+    public void testListAllSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
+        String jndiName = "ListAllSubscriptionsHtmlAfterTopicCreation"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        
+        performListAsHtmlOperationAfterCreation(jndiName, 
+                                                DestinationType.TOPIC, 
+                                                LIST_ALL_SUB_AS_HTML, 
+                                                Boolean.FALSE);
+    }
+    
+    /**
+     * Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribers
+     * Assertion: Make sure that the "List All Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple durable subscribers.
+     */
+    public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribers() 
+        throws Exception {
+        
+        String jndiName = "ListAllSubscriptionsHtmlAfterMultipleSubscribers";
+        createTopic(jndiName);
+        
+        listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
+     * Assertion: Make sure that the "List All Subscriptions As HTML" 
+     * operation for topics returns the correct results when the topic
+     * has multiple durable subscribers. Use a topic that already exists.
+     */
+    public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile() 
+        throws Exception {
+        
+        String jndiName = "ListAllSubscriptionsHtmlMultipleSubscribersExistingTopic";
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        
+        listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
+    }
+    
+    /**
+     * Common code for the listAllSubscriptionsAfterMultipleSubscribers* tests.
+     */
+    private void listAllSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
+        ArrayList<String> expectedValues = new ArrayList<String>();
+        
+        // Create a non-durable and durable subscriber
+        createTopicSessionAndMultipleSubscribers(1, jndiName);
+        
+        // Set up the expected result
+        StringBuffer expectedBuffer1 = new StringBuffer();
+        expectedBuffer1.append(formatTableCell(NON_DURABLE)); // Durable
+        expectedBuffer1.append(formatTableCell(""));  // Subscription Name
+        expectedBuffer1.append(formatTableCell(""));  // Client Id
+        expectedBuffer1.append(formatTableCell(""));  // Selector
+        expectedBuffer1.append(formatTableCell("0"));  // Message Count
+       
+        expectedValues.add(expectedBuffer1.toString());
+        
+        StringBuffer expectedBuffer2 = new StringBuffer();
+        expectedBuffer2.append(TABLE_ROW_DELIM);
+        expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
+        expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
+        expectedBuffer2.append(formatTableCell(jndiName + "Subscriber0"));  // Subscription Name
+        expectedBuffer2.append(formatTableCell(CLIENT_ID));  // Client Id
+        expectedBuffer2.append(formatTableCell(""));  // Selector
+        expectedBuffer2.append(formatTableCell("0"));  // Message Count
+        
+        expectedValues.add(expectedBuffer2.toString());
+        
+        performListAsHtmlOperation(jndiName, 
+                                   DestinationType.TOPIC, 
+                                   LIST_ALL_SUB_AS_HTML, 
+                                   Boolean.FALSE,
+                                   expectedValues);
+    }
+    
+    /**
+     * Common code for the List*AsHTML tests.
+     */
+    private void performListAsHtmlOperation(String jndiName, 
+                                            DestinationType destinationType,
+                                            String operationName,
+                                            Boolean takesParameters,
+                                            ArrayList<String> expectedValues) throws Exception {
+        
+        performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                                 jndiName, operationName, takesParameters);
+        
+        // Get the result of the operation
+        HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
+        HtmlTextArea resultTextArea = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']"); 
+
+        assertNotNull("Could not get the result of the operation", resultTextArea);
+        
+        String result = resultTextArea.getText();
+        
+        String shortenedResult = result.substring(result.indexOf(TABLE_CELL_DELIM),
+                                                  result.lastIndexOf(TABLE_ROW_END_DELIM));
+        
+        log.info("Operation result was: " + shortenedResult);
+        
+        assertFalse("The result of the operation was an empty string", result.equals(""));
+        for(int i = 0; i < expectedValues.size(); i++) {
+            assertTrue("Expected the result to contain:\n\n" + expectedValues.get(i) + "\n\nbut was:\n\n" + shortenedResult,
+                        shortenedResult.contains(expectedValues.get(i)));
+        }
+        
+        // Clean up
+        disconnect();
+        deleteDestination(destinationType, jndiName); 
+    }
+    
+    /**
+     * Common code for the List*AsHTML*After*Creation tests.
+     */
+    private void performListAsHtmlOperationAfterCreation(String jndiName, 
+                                                         DestinationType destinationType,
+                                                         String operationName,
+                                                         Boolean takesParameters) throws Exception {
+        
+        performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                                 jndiName, operationName, takesParameters);
+        
+        // Get the result of the operation
+        HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
+        HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
+        assertNotNull("Could not get the result of the operation", resultTextBox);
+        
+        String result = resultTextBox.getText();
+        
+        log.info("Operation result was: " + result);
+        
+        assertFalse("The result of the operation was an empty string", result.equals(""));
+        
+        // Clean up
+        disconnect();
+        deleteDestination(destinationType, jndiName); 
+    }
+        
+    /* OPERATION #12 - CREATE - APPLIES TO TOPICS AND QUEUES */
+    
+    /**
+     * Test Name: testTopicCreateOperation
+     * Assertion: Make sure that the "Create" operation for topics is executed 
+     * successfully.
+     */
+    public void DISABLEDtestTopicCreateOperation() throws Exception {
+        String jndiName = "TopicCreate"; 
+
+        // Create the topic first
+        createTopic(jndiName);  
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         CREATE, Boolean.TRUE);
+    }
+    
+    /**
+     * Test Name: testTopicCreateOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Create" operation for topics is executed 
+     * successfully. Use a topic that already exists.
+     */
+    public void DISABLEDtestTopicCreateOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "CreateOperationExistingTopic"; 
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         CREATE, Boolean.TRUE);
+    }
+    
+    /**
+     * Test Name: testQueueCreateOperation
+     * Assertion: Make sure that the "Create" operation for queues is executed 
+     * successfully.
+     */
+    public void DISABLEDtestQueueCreateOperation() throws Exception {
+        String jndiName = "QueueCreate"; 
+
+        // Create the queue first
+        createQueue(jndiName);  
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         CREATE, Boolean.TRUE);
+    }
+    
+    /**
+     * Test Name: testQueueCreateOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Create" operation for queues is executed 
+     * successfully. Use a queue that already exists.
+     */
+    public void DISABLEDtestQueueCreateOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "CreateOperationExistingQueue"; 
+        
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         CREATE, Boolean.TRUE);
+    }
+    
+    /* OPERATION #13 - START - APPLIES TO TOPICS AND QUEUES */
+    
+    /**
+     * Test Name: testTopicStartOperation
+     * Assertion: Make sure that the "Start" operation for topics is executed 
+     * successfully.
+     */
+    public void testTopicStartOperation() throws Exception {
+        String jndiName = "TopicStart"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         START, Boolean.TRUE);
+        
+    }
+    
+    /**
+     * Test Name: testTopicStartOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Start" operation for topics is executed 
+     * successfully. Use a topic that already exists.
+     */
+    public void testTopicStartOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "StartOperationExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         START, Boolean.TRUE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueStartOperation
+     * Assertion: Make sure that the "Start" operation for queues is executed 
+     * successfully.
+     */
+    public void testQueueStartOperation() throws Exception {
+        String jndiName = "QueueStart"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         START, Boolean.TRUE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueStartOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Start" operation for queues is executed 
+     * successfully. Use a queue that already exists.
+     */
+    public void testQueueStartOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "StartOperationExistingQueue"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         START, Boolean.TRUE);
+        
+    }
+    
+    /* OPERATION #14 - DESTROY - APPLIES TO TOPICS AND QUEUES */
+    
+    /**
+     * Test Name: testTopicDestroyOperation
+     * Assertion: Make sure that the "Destroy" operation for topics is executed 
+     * successfully.
+     */
+    public void DISABLEDtestTopicDestroyOperation() throws Exception {
+        String jndiName = "TopicDestroy"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         DESTROY, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testTopicDestroyOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Destroy" operation for topics is executed 
+     * successfully. Use a topic that already exists.
+     */
+    public void DISABLEDtestTopicDestroyOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "DestroyOperationExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         DESTROY, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueDestroyOperation
+     * Assertion: Make sure that the "Destroy" operation for queues is executed 
+     * successfully.
+     */
+    public void DISABLEDtestQueueDestroyOperation() throws Exception {
+        String jndiName = "QueueDestroy"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         DESTROY, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueDestroyOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Destroy" operation for queues is executed 
+     * successfully. Use a queue that already exists.
+     */
+    public void DISABLEDtestQueueDestroyOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "DestroyOperationExistingQueue"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         DESTROY, Boolean.FALSE);
+        
+    }
+    
+    /* OPERATION #15 - STOP - APPLIES TO TOPICS AND QUEUES */
+    
+    /**
+     * Test Name: testTopicStopOperation
+     * Assertion: Make sure that the "Stop" operation for topics is executed 
+     * successfully.
+     */
+    public void testTopicStopOperation() throws Exception {
+        String jndiName = "TopicStop"; 
+
+        // Create the topic first
+        createTopic(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         STOP, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testTopicStopOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Stop" operation for topics is executed 
+     * successfully. Use a topic that already exists.
+     */
+    public void testTopicStopOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "StopOperationExistingTopic"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.TOPIC, 
+                                         STOP, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueStopOperation
+     * Assertion: Make sure that the "Stop" operation for queues is executed 
+     * successfully.
+     */
+    public void testQueueStopOperation() throws Exception {
+        String jndiName = "QueueStop"; 
+
+        // Create the queue first
+        createQueue(jndiName);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         STOP, Boolean.FALSE);
+        
+    }
+    
+    /**
+     * Test Name: testQueueStopOperationUsingExistingServiceFile
+     * Assertion: Make sure that the "Stop" operation for queues is executed 
+     * successfully. Use a queue that already exists.
+     */
+    public void testQueueStopOperationUsingExistingServiceFile() throws Exception {
+        String jndiName = "StopOperationExistingQueue"; 
+
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        performServletLifecycleOperation(jndiName, DestinationType.QUEUE, 
+                                         STOP, Boolean.FALSE);
+        
+    }
+       
+    /**
+     * Common code for the Create/Start/Stop/Destroy operations. 
+     */
+    private void performServletLifecycleOperation(String jndiName, 
+                                                  DestinationType destinationType,
+                                                  String operationName,
+                                                  Boolean isActiveDestination) throws Exception {
+       
+        performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                                 jndiName, operationName, Boolean.FALSE);
+
+        // Make sure the correct parameters ("None") and the
+        // the correct results ("None") are displayed
+        checkNoParametersAndNoResults();
+
+        // Make sure the list of active destinations is updated,
+        // if necessary
+        JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
+        ObjectName deploymentMBean = new ObjectName("jboss.messaging:service=ServerPeer");
+        Object activeDestinations = jmxUtils.getMBeanAttribute(deploymentMBean, "Destinations");
+        
+        Boolean inActiveDestinationsList = false;
+        Iterator i = ((Set)activeDestinations).iterator();
+        
+        while(i.hasNext()) {
+            JBossDestination destination = (JBossDestination)i.next();
+            if(destination.getName().equals(jndiName)) {
+                inActiveDestinationsList = true;
+                break;
+            }
+        }
+
+        String errorMessage;
+        if(isActiveDestination) {
+            errorMessage = "The destination was not in the list of active destinations";
+        } else {
+            errorMessage = "The destination should not be in the list of active destinations";
+        }
+        assertEquals(errorMessage, isActiveDestination, inActiveDestinationsList);
+        
+        // Clean up
+        disconnect();
+        deleteDestination(destinationType, jndiName); 
+    }
+    
+    /**
+     * Common code for the list subscriptions tests.
+     * 
+     * @param isEmptyList - whether or not the list of subscriptions that
+     * gets displayed should be empty
+     */
+    private void performListSubscriptionsAndCheckResults(String jndiName,
+                                                         String operationName,
+                                                         Boolean isEmptyList) throws Exception {
+        performResourceOperation(JMS_NAV_LABEL, DestinationType.TOPIC.getNavLabel(), 
+                                 jndiName, operationName, Boolean.FALSE);
+
+        String actualOperationResults = ((HtmlDivision)client.getElement(OPERATION_RESULTS)).getTextContent();
+        
+        String shortenedResult = actualOperationResults.substring(actualOperationResults.indexOf("Viewing"), 
+                                                                  actualOperationResults.indexOf("]") + 1);
+        log.info("Operation result was: " + shortenedResult);
+        
+        if(!isEmptyList) {
+            assertFalse("Expected non-empty list but was: '" + shortenedResult + "'",
+                        actualOperationResults.contains(EMPTY_LIST));
+        } else {
+            assertTrue("Expected empty list but was: '" + shortenedResult + "'",
+                        actualOperationResults.contains(EMPTY_LIST));
+        }
+        
+        // Clean up
+        disconnect();
+        deleteDestination(DestinationType.TOPIC, jndiName); 
+    }
+    
+    /**
+     * Common code for the operations tests.
+     */
+    private void performDestinationOperationAndCheckMetrics(DestinationType destinationType, 
+                                                            String jndiName,
+                                                            String operationName,
+                                                            Map<String, String> expectedMetrics,
+                                                            ArrayList<String> summaryMetrics) throws Exception {
+        performResourceOperationAndCheckMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(), 
+                                                jndiName, operationName, expectedMetrics,
+                                                summaryMetrics, Boolean.FALSE);  
+       
+        // Clean up
+        disconnect();
+        deleteDestination(destinationType, jndiName);  
+    }
+}

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jmsDestinations/JMSTest.java	2009-04-30 18:17:11 UTC (rev 368)
@@ -0,0 +1,514 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jmsDestinations;
+
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.IOException;
+import junit.framework.Test;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import org.jboss.jopr.jsfunit.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.as5.ResourceTestBase;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.managed.api.ComponentType;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSubscriber;
+import javax.jms.TopicSession;
+import javax.naming.InitialContext;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.QueueReceiver;
+import javax.jms.ConnectionFactory;
+import javax.jms.TextMessage;
+import javax.jms.JMSException;
+import javax.naming.NamingException;
+
+/**
+ * This is the base test class for JMS tests. This class
+ * contains helper methods for creating and deleting destinations as
+ * well as methods for sending/receiving messages to/from destinations.
+ * 
+ * This test class should be run against JBAS 5.x.
+ * 
+ * @author Farah Juma
+ *
+ */
+
+public abstract class JMSTest extends ResourceTestBase {
+    
+    // Nav panel labels for JMS destinations
+    public static final String JMS_NAV_LABEL="JMS Destinations";
+    public static final String TOPICS_NAV_LABEL = "Topics";
+    public static final String QUEUES_NAV_LABEL = "Queues";
+    
+    // Template values
+    public static final String QUEUE_DEFAULT_TEMPLATE="default__Queue";
+    public static final String TOPIC_DEFAULT_TEMPLATE="default__Topic";
+    
+    // Component types
+    public static final ComponentType QUEUE_COMPONENT_TYPE = KnownComponentTypes.JMSDestination.Queue.getType();
+    public static final ComponentType TOPIC_COMPONENT_TYPE = KnownComponentTypes.JMSDestination.Topic.getType();
+    
+    // Connection factories for topic and queues
+    public static final String TOPIC_FACTORY = "/ConnectionFactory";
+    public static final String QUEUE_FACTORY = "/ConnectionFactory";
+    
+    // Topic Metrics
+    public static final String ALL_MSG_COUNT = "All Message Count";
+    public static final String ALL_SUB_COUNT = "All Subscriptions Count";
+    public static final String DURABLE_MSG_COUNT = "Durable Message Count";
+    public static final String DURABLE_SUB_COUNT = "Durable Subscriptions Count";
+    public static final String NON_DURABLE_MSG_COUNT = "Non Durable Message Count";
+    public static final String NON_DURABLE_SUB_COUNT = "Non Durable Subscriptions Count";
+    
+    // Queue Metrics
+    public static final String CONSUMER_COUNT = "Consumer Count";
+    public static final String DELIVERING_COUNT = "Delivering Count";
+    public static final String MSG_COUNT = "Message Count";
+    public static final String SCHEDULED_MSG_COUNT = "Scheduled Message Count";
+    public static final String COUNT = "Count";
+    public static final String COUNT_DELTA = "Count Delta";
+    public static final String DEPTH = "Depth";
+    public static final String DEPTH_DELTA = "Depth Delta";
+    public static final String TIME_LAST_UPDATE = "Time Last Update";
+    
+    // Common operations 
+    public static final String LIST_ALL_MSGS = "List All Messages";
+    public static final String LIST_DURABLE_MSGS = "List Durable Messages";
+    public static final String LIST_NON_DURABLE_MSGS = "List Non Durable Messages";
+    public static final String REMOVE_ALL_MSGS = "Remove All Messages";
+    public static final String START = "Start";
+    public static final String STOP = "Stop";
+    public static final String CREATE = "Create";
+    public static final String DESTROY = "Destroy";
+    
+    // Topic-specific operations
+    public static final String LIST_ALL_SUB = "List All Subscriptions";
+    public static final String LIST_ALL_SUB_AS_HTML = "List All Subscriptions As HTML";
+    public static final String LIST_DURABLE_SUB = "List Durable Subscriptions";
+    public static final String LIST_DURABLE_SUB_AS_HTML = "List Durable Subscriptions As HTML";
+    public static final String LIST_NON_DURABLE_SUB = "List Non Durable Subscriptions";
+    public static final String LIST_NON_DURABLE_SUB_AS_HTML = "List Non Durable Subscriptions As HTML";
+    
+    // Queue-specific operations
+    public static final String LIST_MSG_COUNTER_AS_HTML = "List Message Counter As HTML";
+    public static final String LIST_MSG_COUNTER_HISTORY_AS_HTML = "List Message Counter History As HTML";
+    public static final String RESET_MSG_COUNTER = "Reset Message Counter";
+    public static final String RESET_MSG_COUNTER_HISTORY = "Reset Message Counter History";
+    
+    public enum DestinationType {
+        QUEUE(QUEUES_NAV_LABEL, "Queue"),
+        TOPIC(TOPICS_NAV_LABEL, "Topic");
+        
+        public final String navLabel;
+        public final String name;
+        
+        DestinationType(String navLabel, String name) {
+            this.navLabel = navLabel;
+            this.name = name;
+        }
+        
+        public String getNavLabel() {
+            return this.navLabel;
+        }
+        
+        public String getName() {
+            return this.name;
+        }
+    }
+    
+    // Useful constants for the tests
+    public static final String SERVICE_FILE_ROOT_ELEMENT = "server";
+    public static final String SERVICE_FILE_CHILD_ELEMENT = "mbean";
+    public static final String CLIENT_ID = "EmbjoprTest";
+    public static final long SCHEDULED_TIME = 3600000;
+    public static final String DLQ = "jboss.messaging.destination:name=DLQ,service=Queue";
+    public static final String EXPIRY_QUEUE = "jboss.messaging.destination:name=ExpiryQueue,service=Queue";
+    public static final String SERVER_PEER = "jboss.messaging:service=ServerPeer";
+    public static final String DURABLE = "Durable";
+    public static final String NON_DURABLE = "Non Durable";
+    
+    public TopicConnection topicConnection = null;
+    public QueueConnection queueConnection = null;
+    
+    /**
+     * Create a new topic or queue using the given destination type and properties.
+     */
+    protected void createDestination(DestinationType destinationType,
+                                     String templateName,
+                                     Map<String, MetaValue> propertiesMap) throws IOException, EmbJoprTestException {
+        expandNavTreeArrow(JMS_NAV_LABEL);
+        createResource(destinationType.getNavLabel(), templateName, propertiesMap); 
+    }
+      
+    /**
+     * Delete the given JMS destination.
+     * 
+     * Assumes the JMS Destinations tree node is already expanded.
+     */
+    protected void deleteDestination(DestinationType destinationType, 
+                                     String destinationName) throws Exception {
+        //refreshTreeNode(JMS_NAV_LABEL);
+        clickNavTreeLink(destinationType.getNavLabel());
+        deleteResource("resourceSummaryForm", destinationName);
+    }
+         
+    /**
+     * Create a basic queue. Return the mapping of property names to property 
+     * values.
+     */
+    protected Map<String, MetaValue> createQueue(String queueName) throws IOException, EmbJoprTestException {
+    
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("name", SimpleValueSupport.wrap(queueName)); 
+        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(queueName));
+        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.FALSE));
+        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(1500)));
+        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(76000)));
+        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(76000)));
+        /** propertiesMap.put("messageCounterHistoryDayLimit", SimpleValueSupport.wrap(new Integer(5))); **/
+        propertiesMap.put("maxDeliveryAttempts", SimpleValueSupport.wrap(new Integer(5)));
+        propertiesMap.put("pageSize", SimpleValueSupport.wrap(new Integer(1500)));
+        
+        createDestination(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        return propertiesMap;
+    }
+    
+    /**
+     * Create a basic topic. Return the mapping of property names to property
+     * values.
+     */
+    protected Map<String, MetaValue> createTopic(String topicName) throws IOException, EmbJoprTestException {
+        Map<String, MetaValue> propertiesMap = new LinkedHashMap<String, MetaValue>();
+        propertiesMap.put("name", SimpleValueSupport.wrap(topicName));
+        propertiesMap.put("JNDIName", SimpleValueSupport.wrap(topicName));
+        propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
+        propertiesMap.put("fullSize", SimpleValueSupport.wrap(new Integer(70000)));
+        propertiesMap.put("maxSize", SimpleValueSupport.wrap(new Integer(70000)));
+        propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new Long(60000)));
+        propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new Integer(2000)));
+        
+        createDestination(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE, propertiesMap);
+        client.click(SAVE_BUTTON);
+        
+        return propertiesMap;
+    }
+    
+    protected String getDestinationDeploymentFile(String jndiName) {
+        return System.getProperty("jsfunit.deploy.dir") + "/" + jndiName + "-service.xml";
+    }
+    
+    /**
+     * Create a map of property names to property values for a particular
+     * destination. The desired property names are given by specificProperties.
+     * (This is useful when we need to check the values of some specific properties
+     * only - eg. the configuration tests)
+     */
+    protected Map<String, MetaValue> getSpecificComponentProperties(String componentName,
+                                                                    ComponentType type) throws Exception {
+        
+        // @TODO: add messageCounterHistoryDayLimit to this list if this property
+        // becomes configurable again
+        String[] specificProperties = new String[] {"name", "JNDIName", "clustered", 
+                                                    "downCacheSize", "fullSize", 
+                                                    "maxDeliveryAttempts", "maxSize",
+                                                    "pageSize",
+                                                    "redeliveryDelay", "DLQ", "expiryQueue", "serverPeer"};
+        return super.getSpecificComponentProperties(componentName, type, specificProperties);
+    }
+    
+    /**
+     * Create a topic session and return it.
+     */
+    protected TopicSession createTopicSession() throws Exception {
+    	InitialContext context = new InitialContext();
+    	Object tmp = context.lookup(TOPIC_FACTORY);
+    	
+    	TopicConnectionFactory tcf = (TopicConnectionFactory)tmp;
+    	topicConnection = tcf.createTopicConnection();
+    	topicConnection.setClientID(CLIENT_ID);
+    	
+    	TopicSession topicSession = topicConnection.createTopicSession(Boolean.FALSE, 
+    	                                                               TopicSession.AUTO_ACKNOWLEDGE);
+    	topicConnection.start();
+    	
+    	return topicSession;
+    }
+    
+    /**
+     * Create a non-durable topic subscriber and return it.
+     */
+    protected TopicSubscriber createNonDurableTopicSubscriber(TopicSession session,
+                                                              Topic topic) throws JMSException {
+        return session.createSubscriber(topic);
+    }
+    
+    /**
+     * Create a durable topic subscriber and return it.
+     */
+    protected TopicSubscriber createDurableTopicSubscriber(TopicSession session, 
+                                                           Topic topic,
+                                                           String subscriptionName) throws JMSException {
+        return session.createDurableSubscriber(topic, subscriptionName);
+    }
+    
+    /**
+     * Create a TopicPublisher for the given topic and 
+     * publish the given number of messages.
+     */
+    protected void publishMessages(TopicSession session, 
+                                   Topic topic,
+                                   int numMessages) throws JMSException {
+        TopicPublisher publisher = session.createPublisher(topic);
+
+        for(int i = 0; i < numMessages; i++) {
+            TextMessage message = session.createTextMessage("Message " + i);
+            publisher.publish(message);
+        }
+
+        publisher.close();
+    }
+    
+    /**
+     * Lookup and return the topic given by jndiName.
+     */
+    protected Topic getTopic(String jndiName) throws NamingException {
+        InitialContext context = new InitialContext();
+        Topic topic = (Topic)context.lookup(jndiName);
+
+        return topic;
+    }
+    
+    /**
+     * Create a queue session and return it.
+     */
+    protected QueueSession createQueueSession() throws Exception {
+    	InitialContext context = new InitialContext();
+    	Object tmp = context.lookup(QUEUE_FACTORY);
+    	
+    	QueueConnectionFactory qcf = (QueueConnectionFactory)tmp;
+    	queueConnection = qcf.createQueueConnection();
+    	
+    	QueueSession queueSession = queueConnection.createQueueSession(Boolean.FALSE, 
+    	                                                               QueueSession.AUTO_ACKNOWLEDGE);
+    	queueConnection.start();
+    	
+    	return queueSession;
+    }
+    
+    /**
+     * Create a QueueReceiver and return it.
+     */
+    protected QueueReceiver createQueueReceiver(QueueSession session, 
+                                                Queue queue) throws JMSException {
+    	return session.createReceiver(queue);
+    }
+    
+    /**
+     * Create a QueueSender for the given queue and send the
+     * given number of messages.
+     */
+    protected void sendMessages(QueueSession session, 
+                                Queue queue,
+                                int numMessages) throws JMSException {
+
+        QueueSender sender = session.createSender(queue);
+
+        for(int i = 0; i < numMessages; i++) {
+            TextMessage message = session.createTextMessage("Message " + i);
+            sender.send(message);
+        }
+
+        sender.close();
+    }
+    
+    /**
+     * Create a queue session and then send the given number
+     * of messages to the given queue.
+     */
+    protected void createQueueSessionAndSendMessages(int numMessages, 
+                                                     String jndiName) throws Exception {
+        QueueSession session = createQueueSession();
+        Queue queue = getQueue(jndiName);
+        sendMessages(session, queue, numMessages);
+    }
+    
+    /**
+     * Create a QueueSender for the given queue and schedule the
+     * given number of messages.
+     */
+    protected void sendScheduledMessages(QueueSession session,
+                                         Queue queue,
+                                         int numMessages) throws JMSException {
+        QueueSender sender = session.createSender(queue);
+
+        for(int i = 0; i < numMessages; i++) {
+
+            // Schedule the message
+            TextMessage message = session.createTextMessage("Message " + i);
+
+            long now = System.currentTimeMillis();
+            message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", now + SCHEDULED_TIME);         
+
+            sender.send(message);
+        }
+
+        sender.close();
+    }
+    
+    /**
+     * Lookup and return the queue given by jndiName.
+     */
+    protected Queue getQueue(String jndiName) throws NamingException {
+    	InitialContext context = new InitialContext();
+    	Queue queue = (Queue)context.lookup(jndiName);
+    	
+    	return queue;
+    }
+    		
+    
+    /**
+     * Close all connections.
+     */
+    protected void disconnect() throws JMSException {
+
+        if(topicConnection != null) {
+            topicConnection.close();
+            topicConnection = null;
+        }
+
+        if(queueConnection != null) {
+            queueConnection.close();
+            queueConnection = null;
+        }
+    }
+    
+    /**
+     * Get the list of metrics that appear on the summary
+     * page for topics.
+     */
+    protected ArrayList<String> getTopicSummaryMetrics() {
+    	ArrayList<String> topicSummaryMetrics = new ArrayList<String>();
+    	
+    	// The metrics we need to check on the summary tab
+    	// TODO: add the summary page metrics that need to be checked -
+    	// currently no summary metrics are displayed on the page (EMBJOPR-90)
+    	
+    	return topicSummaryMetrics;
+    }
+    
+    /**
+     * Get the list of metrics that appear on the summary
+     * page for queues.
+     */
+    protected ArrayList<String> getQueueSummaryMetrics() {
+    	ArrayList<String> queueSummaryMetrics = new ArrayList<String>();
+    	
+    	// The metrics we need to check on the summary tab
+    	// TODO: add the summary page metrics that need to be checked -
+    	// currently no summary metrics are displayed on the page (EMBJOPR-90)
+    	
+    	return queueSummaryMetrics;
+    }
+    
+    /**
+     * Make sure we close any topic or queue
+     * connections.
+     */
+    protected void tearDown() throws Exception
+    {
+ 	   super.tearDown();
+ 	   disconnect();
+    }
+    
+    /**
+     * Create a topic session, a durable subscriber, and a non-durable
+     * subscriber. Then, send the specified number of messages to the
+     * given topic.
+     */
+    protected void createTopicSessionAndSendMessages(int numMessages,
+                                                     String jndiName) throws Exception {
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        
+        // Create 1 durable subscriber, 1 non-durable subscriber
+        // and then publish the specified number of messages
+        createDurableTopicSubscriber(session, topic, jndiName + "Subscriber");
+        createNonDurableTopicSubscriber(session, topic);
+        
+        publishMessages(session, topic, numMessages);
+    }
+
+    /**
+     * Create a topic session and the given number of durable subscribers.
+     */
+    protected void createTopicSessionAndDurableSubscribers(int numSubscribers,
+                                                           String jndiName) throws Exception {
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        
+        for(int i = 0; i < numSubscribers; i++) {
+            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
+        }
+    }
+    
+    /**
+     * Create a topic session and the given number of non-durable subscribers.
+     */
+    protected void createTopicSessionAndNonDurableSubscribers(int numSubscribers,
+                                                              String jndiName) throws Exception {
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        
+        for(int i = 0; i < numSubscribers; i++) {
+            createNonDurableTopicSubscriber(session, topic);
+        }
+    }
+    
+    /**
+     * Create a topic session and the given number of durable and non-durable subscribers.
+     */
+    protected void createTopicSessionAndMultipleSubscribers(int numSubscribers,
+                                                            String jndiName) throws Exception {
+        TopicSession session = createTopicSession();
+        Topic topic = getTopic(jndiName);
+        
+        for(int i = 0; i < numSubscribers; i++) {
+            createNonDurableTopicSubscriber(session, topic);
+            createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
+        }
+    }
+}




More information about the embjopr-commits mailing list