Author: ozizka(a)redhat.com
Date: 2009-02-04 00:01:05 -0500 (Wed, 04 Feb 2009)
New Revision: 133
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
Log:
Few changes in DatasourceTestBase.java to prepare for AS4 tests versions
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-02-04
04:57:26 UTC (rev 132)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-02-04
05:01:05 UTC (rev 133)
@@ -94,19 +94,55 @@
// --- Datasource Templates --- //
/*
+ AS 4:
<select id="resourceCreateForm:selectedTemplate" size="1"
name="resourceCreateForm:selectedTemplate">
<option value="">Select Template</option>
<option value="Oracle Local TX__Datasource">Oracle Local TX
(Datasource)</option>
<option value="Oracle XA__Datasource">Oracle XA
(Datasource)</option>
<option value="default__Datasource">default
(Datasource)</option>
</select>
+
+ AS 5: Template selection depends on the active navtree node.
+
+ <select id="resourceCreateForm:selectedTemplate" size="1"
name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle No TX__No TX Datasource">Oracle No TX (No TX
Datasource)</option>
+ <option value="default__No TX Datasource">default (No TX
Datasource)</option>
+ </select>
+ <select id="resourceCreateForm:selectedTemplate" size="1"
name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle Local TX__Local TX Datasource">Oracle Local TX
(Local TX Datasource)</option>
+ <option value="default__Local TX Datasource">default (Local TX
Datasource)</option>
+ </select>
+ <select id="resourceCreateForm:selectedTemplate" size="1"
name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle XA__XA Datasource">Oracle XA (XA
Datasource)</option>
+ <option value="default__XA Datasource">default (XA
Datasource)</option>
+ </select>
+
*/
protected enum DatasourceTemplate {
- ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
- ORACLE_XA("Oracle XA__Datasource"),
- DEFAULT("default__Datasource");
+ /** AS 4 */
+ AS4_ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
+ /** AS 4 */
+ AS4_ORACLE_XA("Oracle XA__Datasource"),
+ /** AS 4 */
+ AS4_DEFAULT("default__Datasource"),
+
+ /** AS 5 */
+ AS5_ORACLE_LOCAL_TX("Oracle Local TX__Local TX Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_LOCAL_TX("default__Local TX Datasource"),
+ /** AS 5 */
+ AS5_ORACLE_NO_TX("Oracle No TX__No TX Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_NO_TX("default__No TX Datasource"),
+ /** AS 5 */
+ AS5_ORACLE_XA("Oracle XA__XA Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_XA("default__XA Datasource");
+
+
+
protected final String templateHtmlSelectValue;
@@ -359,8 +395,8 @@
String expectedMessage = "Successfully added new Local TX Datasource";
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
- assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"),
- DatasourceType.LOCAL_TX_DATASOURCE));
+ assertTrue("Datasource is not deployed (isDatasourceDeployed() returned
false).",
+ isDatasourceDeployed(propertiesMap.get("jndi-name"),
DatasourceType.LOCAL_TX_DATASOURCE));
assertTrue(checkProperties(propertiesMap.get("jndi-name"),
DatasourceType.LOCAL_TX_DATASOURCE,
propertiesMap));
@@ -384,23 +420,29 @@
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("user-name", "testUser");
propertiesMap.put("max-pool-size", "10");
- propertiesMap.put("prefill", "true");
propertiesMap.put("idle-timeout-minutes", "20");
- propertiesMap.put("set-tx-query-timeout", "true");
- propertiesMap.put("query-timeout", "1800");
+ if( !isJBoss4 ){
+ propertiesMap.put("prefill", "true");
+ propertiesMap.put("set-tx-query-timeout", "true");
+ propertiesMap.put("query-timeout", "1800");
+ }
createDatasource(DatasourceType.NO_TX_DATASOURCE,
- DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(),
//"default__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);
+ 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.
@@ -419,7 +461,7 @@
propertiesMap.put("max-pool-size", "100000000000000");
createDatasource(DatasourceType.XA_DATASOURCE,
- DatasourceType.XA_DATASOURCE.getTemplateHtmlSelectValue(),
+ DatasourceTemplate.AS5_DEFAULT_XA.getTemplateHtmlSelectValue(),
propertiesMap);
client.click("resourceConfigurationForm:saveButton");
@@ -930,9 +972,10 @@
for(Iterator i = metricsMap.keySet().iterator(); i.hasNext();) {
String metricName = (String)i.next();
- assertEquals("Incorrect metric value for: " + metricName,
- metricsMap.get(metricName),
- getMetricValueFromTable(metricName, "dataTable"));
+ String expected = metricsMap.get(metricName);
+ String actual = getMetricValueFromTable(metricName,
"dataTable");
+ assertEquals("Incorrect metric value for
'"+metricName+"'='"+actual+"'," +
+ " expected '"+expected+"'", actual, expected);
}
// Check values under the "Summary" tab
@@ -943,11 +986,13 @@
summaryMetrics.add("Available Connection Count");
summaryMetrics.add("Connection Count");
- for(Iterator i = summaryMetrics.iterator(); i.hasNext();) {
+ for(Iterator i = summaryMetrics.iterator(); i.hasNext(); ) {
String metricName = (String)i.next();
- assertEquals("Incorrect metric value for: " + metricName,
- metricsMap.get(metricName),
- getMetricValueFromTable(metricName, "dataTable"));
+
+ String expected = metricsMap.get(metricName);
+ String actual = getMetricValueFromTable(metricName,
"dataTable");
+ assertEquals("Incorrect summary metric value for
'"+metricName+"'='"+actual+"'," +
+ " expected '"+expected+"'", actual, expected);
}
}