EMBJOPR SVN: r205 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-10 19:47:02 -0400 (Tue, 10 Mar 2009)
New Revision: 205
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/
Log:
Property changes on: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit
___________________________________________________________________
Name: svn:ignore
+ MultipleUserLoginTest1_Debug.java
MultipleUserLoginTest_JSFUnit.java
15 years, 10 months
EMBJOPR SVN: r204 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-10 19:45:55 -0400 (Tue, 10 Mar 2009)
New Revision: 204
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
Log:
Added Application browsing and pagination tests.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 23:22:42 UTC (rev 203)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 23:45:55 UTC (rev 204)
@@ -370,7 +370,7 @@
if( null == tabContent )
- throw new HtmlElementNotFoundException("Tab '"+label+" not found using XPath '"+xPath+"'");
+ throw new HtmlElementNotFoundException("Tab '"+label+"' not found using XPath '"+xPath+"'");
return tabContent;
@@ -499,7 +499,7 @@
{
checkIfStillValid();
- String xPath = ".//form//table[contains( normalize-space(@id), ':dataTable'))]";
+ String xPath = ".//form//table[contains( normalize-space(@id), ':dataTable')]";
// [@id='resourceSummaryForm:dataTable'] - is this reliable?
HtmlTable tableElement = (HtmlTable) element.getFirstByXPath(xPath);
return new ContentTable(tableElement);
@@ -901,9 +901,13 @@
}
}
- protected HtmlSpan getGoSpan( String spanLabel ){
+ protected HtmlSpan getGoSpan( String spanLabel ) throws HtmlElementNotFoundException {
String xPath = ".//span[normalize-space() = '"+spanLabel+"']";
- return (HtmlSpan) getPageContols().getFirstByXPath(xPath);
+ HtmlSpan span = getPageContols().getFirstByXPath(xPath);
+ if( null == span )
+ throw new HtmlElementNotFoundException(
+ "Span with '"+spanLabel+"' not found using XPath '"+xPath+"'");
+ return span;
}
protected HtmlTableCell getGoPage( int pageNumber ) throws HtmlElementNotFoundException{
@@ -916,25 +920,26 @@
}
- public boolean goFirst() throws IOException{
+ public boolean goFirst() throws IOException, HtmlElementNotFoundException{
+ // TODO: Compare old and new page object reference?
HtmlSpan goSpan = getGoSpan("First");
goSpan.click();
return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public boolean goPrev() throws IOException{
+ public boolean goPrev() throws IOException, HtmlElementNotFoundException{
HtmlSpan goSpan = getGoSpan("Prev");
goSpan.click();
return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public boolean goNext() throws IOException{
+ public boolean goNext() throws IOException, HtmlElementNotFoundException{
HtmlSpan goSpan = getGoSpan("Next");
goSpan.click();
return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public boolean goLast() throws IOException{
+ public boolean goLast() throws IOException, HtmlElementNotFoundException{
HtmlSpan goSpan = getGoSpan("Last");
goSpan.click();
return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java 2009-03-10 23:45:55 UTC (rev 204)
@@ -0,0 +1,293 @@
+/*
+ * 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 java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang.StringUtils;
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.ApplicationTestBaseAS5;
+import org.jboss.jopr.jsfunit.DebugUtils;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+
+
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise Application archives with JBoss AS 5.
+ *
+ * @author Shelly McGowan
+ *
+ */
+public class ApplicationsPageTest extends ApplicationTestBaseAS5 {
+
+ public ApplicationsPageTest() {
+ }
+ private ApplicationsPageTest(String testToRun) {
+ super(testToRun);
+ }
+
+
+ public void testNavigationToApplications() throws EmbJoprTestException, IOException {
+
+ //DebugUtils.writeFile("target/appNav.html", client.getPageAsText());
+
+ sleep(2000);
+
+ // Navigate to apps summary tab
+ NavTreeNode appsNode = navTree.getNodeByLabel(NAV_APPLICATIONS);
+ assertNotNull(appsNode);
+ appsNode.click();
+ tabMenu.clickTab("Summary");
+
+ // Check text bits appearance.
+ String text = client.getElement("content").getTextContent();
+ assertTrue("Content part should contain 'Applications' header.", text.contains("Applications") );
+ assertTrue("Content part should contain 'View by Type' label.", text.contains("View by Type") );
+
+ }
+
+
+
+ /**
+ * Test pagination in Applications page.
+ *
+ * FAILS HERE because of EMBJOPR-61.
+ * Bad number of listed rows at page 2. expected:<5> but was:<0>
+ */
+ public void testAppsPagination() throws EmbJoprTestException, IOException {
+
+ // Navigate to apps summary tab
+ NavTreeNode appsNode = navTree.getNodeByLabel(NAV_APPLICATIONS);
+ assertNotNull(appsNode);
+ appsNode.click();
+ tabMenu.clickTab("Summary");
+
+ sleep(1000);
+
+ // Get and check total items count.
+ int itemsCount = new ContentBoxPagination().getTotalItemsCount();
+
+ // Returns null, skipping.
+ //Number serverCount = (Number) server.getManagedBeanValue("#{paginationDataModel.size}");
+ //assertEquals("Items count reported in page differs from server's.", serverCount, itemsCount);
+
+ // Check whether trinomial equation fits
+ int itemsPerPage = new ContentBoxPagination().getItemsPerPage();
+ int expectedPages = itemsCount / itemsPerPage;
+ if( itemsCount % itemsPerPage > 0 )
+ expectedPages++;
+ int pageCount = new ContentBoxPagination().getPageCount();
+ assertEquals("Expected number of pages: "+itemsCount+" / "+itemsPerPage, expectedPages, pageCount);
+
+ // ------- FAILS HERE because of EMBJOPR-61. --------- //
+ int page = 0;
+ while( new ContentBoxPagination().goNext() ){
+
+ page++;
+ if( page > expectedPages )
+ throw new EmbJoprTestException("Got too far when clicking Next" +
+ " - to "+page+"th page, expected only "+expectedPages+".");
+
+ // Get rows.
+ ContentTable table = tabMenu.getTabContentBox().getFirstTable();
+ List<ContentTableRow> rows = table.getRows();
+
+ // Check the number of rows listed against what set in combo.
+ if( page < expectedPages )
+ assertEquals("Bad number of listed rows at page "+page+".", itemsPerPage, rows.size() );
+ else
+ assertEquals("Bad number of listed rows at last page.", itemsCount % itemsPerPage, rows.size() );
+
+ }// while (next page)
+
+
+ // TODO: And back
+
+ // TODO: Go to specified page
+
+ // TODO: Check that more pages do not list same app.
+
+ }// testAppsPagination()
+
+
+
+
+ /**
+ * Tests Applications listing.
+ * Creates a list of all apps listed,
+ * then checks whether they are listed when using different type filters.
+ *
+ * FAILS HERE because of EMBJOPR-61:
+ * Span with 'Next not found using XPath './/span[normalize-space() = 'Next']'
+ */
+ public void testAppsListing() throws EmbJoprTestException, IOException {
+
+ // Navigate to apps summary tab
+ NavTreeNode appsNode = navTree.getNodeByLabel(NAV_APPLICATIONS);
+ assertNotNull(appsNode);
+ appsNode.click();
+ tabMenu.clickTab("Summary");
+
+
+
+ // Iterate through all the applications,
+ // check whether the type is determined well,
+ // and store the info in a pool to be used later.
+
+ ApplicationsPool appsPool = new ApplicationsPool();
+
+ // For all pages...
+
+ // ------- FAILS HERE because of EMBJOPR-61. --------- //
+ int max = 100;
+ while( max-- > 0 && new ContentBoxPagination().goNext() ){
+
+ // Get rows.
+ ContentTable table = tabMenu.getTabContentBox().getFirstTable();
+ List<ContentTableRow> rows = table.getRows();
+
+ // For all rows...
+ for( ContentTableRow row : rows ) {
+ appsPool.add( new ApplicationInfo(
+ row.getCellTextByColumnName("Name"),
+ parseDeployableType( row.getCellTextByColumnName("Type") )
+ ) );
+ }// for
+
+ }// while (next page)
+
+
+
+ // TODO: Now change the View by Type select and see whether all apps of that type are displayed.
+
+ // TODO: Get to the filter via nav tree.
+
+
+ }// testNavigationToApplications()
+
+
+
+ /**
+ * Determines the type of the deployable based on the value
+ * in the Type column in EmbJopr.
+ */
+ public DeployableTypes parseDeployableType( String desc ) throws EmbJoprTestException
+ {
+ for( DeployableTypes type : DeployableTypes.values() ){
+ if( desc.toUpperCase().contains( type.name() )){
+ return type;
+ }
+ }
+ throw new EmbJoprTestException("Unrecognized deployable type: "+desc);
+ }
+
+ /**
+ * Determines the type of the deployable using the value
+ * in the Name column in EmbJopr's Summary tab.
+ */
+ public DeployableTypes determineDeployableTypeFromName( String name ) throws EmbJoprTestException
+ {
+ for( DeployableTypes type : DeployableTypes.values() ){
+ if( StringUtils.endsWith(name, type.getSuffix() ) ) return type;
+ if( StringUtils.endsWith(name, type.getExtension() ) ) return type;
+ }
+ throw new EmbJoprTestException("Unrecognized deployable type: "+name);
+ }
+
+
+}// class ApplicationsTest
+/**
+ * Application info - it's type (EAR, WAR, ...) and name.
+ * @author ondra
+ */
+class ApplicationInfo {
+
+ private String name;
+ private DeployableTypes type;
+
+ public String getName() { return name; }
+ public DeployableTypes getType() { return type; }
+
+ public ApplicationInfo(String name, DeployableTypes type) {
+ this.name = name;
+ this.type = type;
+ }
+
+
+ @Override
+ public String toString() {
+ return getType().name()+" "+getName();
+ }
+
+ /**
+ * Overriden to work correctly in ApplicationPool.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if( null == obj ) return false;
+ if( this == obj ) return true;
+ if( ! (obj instanceof ApplicationInfo) ) return false;
+ return this.name.equals( ((ApplicationInfo)obj).name )
+ && this.type.equals( ((ApplicationInfo)obj).type );
+ }
+
+ @Override
+ public int hashCode() { return this.name.hashCode() + this.type.hashCode(); }
+
+}
+
+
+
+/**
+ * Pool of applications; to handle apps listed in EmbJopr.
+ */
+class ApplicationsPool {
+
+ private List<ApplicationInfo> apps = new ArrayList();
+ private Map<DeployableTypes, List<ApplicationInfo>> mapAppsByType = new HashMap();
+
+ public void add( ApplicationInfo app ){
+ // Add to the list of all apps.
+ this.apps.add(app);
+ // Add to the groups separated by type.
+ List<ApplicationInfo> typeGroup = this.mapAppsByType.get(app.getType());
+ if(null == typeGroup){
+ typeGroup = new ArrayList<ApplicationInfo>();
+ this.mapAppsByType.put(app.getType(), typeGroup );
+ }
+ typeGroup.add(app);
+ }
+}
+
+
+
+
+
+
15 years, 10 months
EMBJOPR SVN: r203 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-10 19:22:42 -0400 (Tue, 10 Mar 2009)
New Revision: 203
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
Log:
normalize-string() replaced with normalize-space() in XPath expressions
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 23:18:53 UTC (rev 202)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 23:22:42 UTC (rev 203)
@@ -885,26 +885,29 @@
return (HtmlSelect) client.getElement(ID_PAGE_SIZE_SELECT);
}
- public int getTotalItemsCount() throws ActionNotAvailableException {
+ public int getTotalItemsCount() throws ActionNotAvailableException
+ {
Element e = client.getElement(ID_PAGINATION_TOTAL_ITEMS);
String textContent = e.getTextContent();
String[] parts = textContent.split(":");
if( parts.length < 2 )
throw new ActionNotAvailableException("Total pagination items count expected after 'Total:' or similar.");
+
+ String countStr = parts[1].trim();
try{
- return NumberUtils.createInteger(parts[1]);
+ return NumberUtils.createInteger( countStr );
}catch(NumberFormatException ex ){
- throw new ActionNotAvailableException("Can't parse pagination items count from '"+parts[1]+"'", ex);
+ throw new ActionNotAvailableException("Can't parse pagination items count from '"+countStr+"'", ex);
}
}
protected HtmlSpan getGoSpan( String spanLabel ){
- String xPath = ".//span[normalize-string() = '"+spanLabel+"']";
+ String xPath = ".//span[normalize-space() = '"+spanLabel+"']";
return (HtmlSpan) getPageContols().getFirstByXPath(xPath);
}
protected HtmlTableCell getGoPage( int pageNumber ) throws HtmlElementNotFoundException{
- String xPath = ".//td[normalize-string() = '"+pageNumber+"']";
+ String xPath = ".//td[normalize-space() = '"+pageNumber+"']";
HtmlElement td = getPageContols().getFirstByXPath(xPath);
if( null == td )
throw new HtmlElementNotFoundException(
@@ -947,7 +950,7 @@
}
public int getPageCount(){
- String xPath = ".//td[ count(./*) = 0 and normalize-string() > 0 ]";
+ String xPath = ".//td[ count(./*) = 0 and normalize-space() > 0 ]";
List<?> elements = getPageContols().getByXPath(xPath);
return elements.size();
}
15 years, 10 months
EMBJOPR SVN: r202 - trunk/core/src/main/webapp/include.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-10 19:18:53 -0400 (Tue, 10 Mar 2009)
New Revision: 202
Modified:
trunk/core/src/main/webapp/include/resourceDataScroller.xhtml
Log:
Added id="paginationTotalItems"
Modified: trunk/core/src/main/webapp/include/resourceDataScroller.xhtml
===================================================================
--- trunk/core/src/main/webapp/include/resourceDataScroller.xhtml 2009-03-10 23:04:57 UTC (rev 201)
+++ trunk/core/src/main/webapp/include/resourceDataScroller.xhtml 2009-03-10 23:18:53 UTC (rev 202)
@@ -110,7 +110,7 @@
</f:facet>
</rich:datascroller>
<h:panelGroup layout="block" style=" margin-top: -4px; float: right; font-size:11px;">
- <h:outputText value="Total: #{paginationDataModel.size}" style="margin-right: 1em;"/>
+ <h:outputText id="paginationTotalItems" value="Total: #{paginationDataModel.size}" style="margin-right: 1em;"/>
<!-- Allow the user to configure the number of items per page
displayed in a data table. -->
15 years, 10 months
EMBJOPR SVN: r201 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-10 19:04:57 -0400 (Tue, 10 Mar 2009)
New Revision: 201
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/Condition.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/DescribedCondition.java
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
Log:
util package created, ActiveConditionChecker moved there
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-03-10 20:08:00 UTC (rev 200)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -28,31 +28,49 @@
public static final String SYSPROP_TESTDATA_DIR = "jsfunit.testdata";
+ /**
+ * Information about deployable types -
+ * navigation tree labels, archive extensions, and XML descriptor suffixes.
+ */
public enum DeployableTypes {
- EAR(AppConstants.NAV_EAR),
- WAR(AppConstants.NAV_WAR),
- EJB(AppConstants.NAV_EJB),
- SAR(AppConstants.NAV_SAR),
- RAR(AppConstants.NAV_RAR),
- MC_BEAN(AppConstants.NAV_MC);
+ EAR(AppConstants.NAV_EAR, ".ear", null),
+ WAR(AppConstants.NAV_WAR, ".war", null),
+ EJB(AppConstants.NAV_EJB, ".jar", null),
+ SAR(AppConstants.NAV_SAR, ".sar", "-service.xml"),
+ RAR(AppConstants.NAV_RAR, ".rar", null),
+ MC_BEAN(AppConstants.NAV_MC, "", null);
protected final String navTreeLabel;
public String getNavTreeLabel() { return navTreeLabel; }
- DeployableTypes( String navTreeLabel ){
+ protected final String extension;
+ public String getExtension() { return extension; }
+
+ protected final String suffix;
+ public String getSuffix() { return suffix; }
+
+
+ private DeployableTypes(String navTreeLabel, String extension, String suffix) {
this.navTreeLabel = navTreeLabel;
+ this.extension = extension;
+ this.suffix = suffix;
}
- }
+ }// enum DeployableTypes
+
+
public enum DeploymentMeans {
VIA_EMBJOPR,
VIA_FILESYSTEM,
VIA_JMX
}
+
+
// Navigation
+ public static final String NAV_APPLICATIONS = "Applications";
public static final String NAV_EJB = "EJB Application (EJB JAR)s";
public static final String NAV_EAR = "Enterprise Application (EAR)s";
public static final String NAV_SAR = "JBoss Service (SAR)s";
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 20:08:00 UTC (rev 200)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -33,10 +33,12 @@
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
import org.w3c.dom.Element;
@@ -221,6 +223,13 @@
}
+ public void waitForNavTreeLoaded(){
+ sleep(1500);///
+ // TODO: Use ActiveConditionChecker
+
+ }
+
+
/**
* Finds the nav tree node by it's link label.
*
@@ -480,7 +489,23 @@
return new ContentTable(tableElement);
}
+ /**
+ * Returns first table in the content box.
+ * @param headerText
+ * @return
+ * @throws org.jboss.jopr.jsfunit.exceptions.ActionOutOfSyncException
+ */
+ public ContentTable getFirstTable() throws ActionOutOfSyncException
+ {
+ checkIfStillValid();
+ String xPath = ".//form//table[contains( normalize-space(@id), ':dataTable'))]";
+ // [@id='resourceSummaryForm:dataTable'] - is this reliable?
+ HtmlTable tableElement = (HtmlTable) element.getFirstByXPath(xPath);
+ return new ContentTable(tableElement);
+ }
+
+
/**
* Finds first button with given label inside this box.
* @param label
@@ -597,6 +622,19 @@
return new ContentTableRow(elm, this);
}
+ public List<ContentTableRow> getRows(){
+ if( 0 == element.getRowCount() )
+ return Collections.EMPTY_LIST;
+
+ String xPath = "./tbody/tr";
+ List<HtmlTableRow> trList = (List) element.getByXPath(xPath);
+ List<ContentTableRow> rows = new ArrayList(trList.size());
+ for (HtmlTableRow tr : trList) {
+ rows.add( new ContentTableRow(tr, this));
+ }
+ return rows;
+ }
+
/**
* Returns wrapper of the table row which contains a link with given label.
* @throws org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException
@@ -825,17 +863,19 @@
+
/**
* Pagination control
* Not tested yet.
*/
- protected class ContentBoxPagination {
+ public class ContentBoxPagination {
//private HtmlElement element;
//public HtmlElement getElement() { return element; }
private static final String ID_PAGE_CONTROLS = "categorySummaryForm:dataTableScroller";
private static final String ID_PAGE_SIZE_SELECT = "categorySummaryForm:currentPageSize";
+ private static final String ID_PAGINATION_TOTAL_ITEMS = "paginationTotalItems";
protected HtmlDivision getPageContols(){
return (HtmlDivision) client.getElement(ID_PAGE_CONTROLS);
@@ -845,6 +885,18 @@
return (HtmlSelect) client.getElement(ID_PAGE_SIZE_SELECT);
}
+ public int getTotalItemsCount() throws ActionNotAvailableException {
+ Element e = client.getElement(ID_PAGINATION_TOTAL_ITEMS);
+ String textContent = e.getTextContent();
+ String[] parts = textContent.split(":");
+ if( parts.length < 2 )
+ throw new ActionNotAvailableException("Total pagination items count expected after 'Total:' or similar.");
+ try{
+ return NumberUtils.createInteger(parts[1]);
+ }catch(NumberFormatException ex ){
+ throw new ActionNotAvailableException("Can't parse pagination items count from '"+parts[1]+"'", ex);
+ }
+ }
protected HtmlSpan getGoSpan( String spanLabel ){
String xPath = ".//span[normalize-string() = '"+spanLabel+"']";
@@ -861,20 +913,28 @@
}
- public void goFirst() throws IOException{
- getGoSpan("First").click();
+ public boolean goFirst() throws IOException{
+ HtmlSpan goSpan = getGoSpan("First");
+ goSpan.click();
+ return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public void goPrev() throws IOException{
- getGoSpan("Prev").click();
+ public boolean goPrev() throws IOException{
+ HtmlSpan goSpan = getGoSpan("Prev");
+ goSpan.click();
+ return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public void goNext() throws IOException{
- getGoSpan("Next").click();
+ public boolean goNext() throws IOException{
+ HtmlSpan goSpan = getGoSpan("Next");
+ goSpan.click();
+ return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
- public void goLast() throws IOException{
- getGoSpan("Last").click();
+ public boolean goLast() throws IOException{
+ HtmlSpan goSpan = getGoSpan("Last");
+ goSpan.click();
+ return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
}
public void goPage( int pageNumber ) throws IOException, HtmlElementNotFoundException{
@@ -892,7 +952,16 @@
return elements.size();
}
- public void setItemsPerPage( int num ) throws HtmlElementNotFoundException{
+ public int getItemsPerPage() throws HtmlElementNotFoundException, ActionNotAvailableException {
+ String selectText = getPageSizeSelect().asText();
+ try {
+ return NumberUtils.createInteger( selectText );
+ }
+ catch( NumberFormatException ex ){
+ throw new ActionNotAvailableException("Can't parse 'items per page' from '"+selectText+"'.", ex);
+ }
+ }
+ public void setItemsPerPage( int num ) throws HtmlElementNotFoundException {
String optionValue = ""+num;
HtmlSelect pageSizeSelect = getPageSizeSelect();
@@ -918,8 +987,18 @@
+ /** Calls Thread.sleep(ms), ignores the InterruptedException. */
+ @SuppressWarnings("empty-statement")
+ public static void sleep( int ms ) {
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException ex) {
+ ; // We don't care, that's the purpose of this method.
+ }
+ }
+
// TODO
protected class JMXDeploymentInfo {
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java 2009-03-10 20:08:00 UTC (rev 200)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -35,17 +35,21 @@
public static void writeFile( String sFilePath, String content ) throws FileNotFoundException, IOException{
-
// TODO: Do this better... Maven surely provides target path.
//sFilePath = "target/"+sFilePath;
+ /*FileWriter fileWriter = new FileWriter(sFilePath);
+ fileWriter.write(content);
+ fileWriter.close();/**/
+ FileOutputStream fileOutputStream = new FileOutputStream(sFilePath);
+ fileOutputStream.write(content.getBytes());
+ fileOutputStream.close();
- //new FileWriter(sFilePath).write(content);
- new FileOutputStream(sFilePath).write(content.getBytes());
-
}
static void writeFile(String sToPath, byte[] bytes) throws FileNotFoundException, IOException {
- new FileOutputStream(sToPath).write(bytes);
+ FileOutputStream fileOutputStream = new FileOutputStream(sToPath);
+ fileOutputStream.write(bytes);
+ fileOutputStream.close();
}
public static String readFileAsString(String filePath) throws java.io.IOException {
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-10 20:08:00 UTC (rev 200)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -22,33 +22,20 @@
package org.jboss.jopr.jsfunit.as5;
-import java.io.FileNotFoundException;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
+import org.jboss.jopr.jsfunit.util.DescribedCondition;
+import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
import org.jboss.jopr.jsfunit.*;
import com.gargoylesoftware.htmlunit.html.*;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.io.*;
+import java.util.*;
+import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.faces.application.FacesMessage;
-import javax.faces.application.FacesMessage.Severity;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.lang.StringUtils;
import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
-import org.jboss.jopr.jsfunit.exceptions.ActionNotAvailableException;
-import org.jboss.jopr.jsfunit.exceptions.ActionOutOfSyncException;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
+import org.jboss.jopr.jsfunit.exceptions.*;
import org.w3c.dom.Node;
@@ -466,87 +453,8 @@
}
- /**
- * Actively waits for a given condition.
- * @see Condition
- */
- private class ActiveConditionChecker {
- Condition condition;
- private boolean dumpPageOnTimout = false;
- private boolean throwExceptionOnTimout = false;
- private EmbjoprTestCase test;
- public ActiveConditionChecker(Condition condition) {
- this.condition = condition;
- }
-
- @SuppressWarnings("empty-statement")
- public boolean waitWithTimeout( int msInterval, int retries ) throws Exception {
-
- while( retries-- > 0 ){
- if( this.condition.isTrue() )
- return true;
- try {
- Thread.sleep(msInterval);
- } catch (InterruptedException ex){
- ;
- }
- }
-
- // While ended, thus we reached the "timeout".
-
- if( this.dumpPageOnTimout ){
- try {
- // Since this is still inner class, we could use 'this'.
- //DebugUtils.writeFile(test.getName() + ".html", test.getClient().getPageAsText());///
- } catch (Exception ex) { log.error("Can't dump page.", ex); }
- }
-
- if( this.throwExceptionOnTimout ){
- String message = "Timeout expired while waiting for condition: "+condition.getDescription();
- throw new EmbJoprTestException(message);
- }
-
- return false;
- }
-
- /** If called, exception is thrown if the timeout expires. */
- private ActiveConditionChecker throwOnTimeout( /*String conditionDesc*/ ){
- this.throwExceptionOnTimout = true;
- //this.conditionDesc = conditionDesc;
- return this;
- }
-
- // This has nothing to do with condition checking, but is convenient shorthand...
- private ActiveConditionChecker dumpPageOnTimeout(EmbjoprTestCase test) {
- this.dumpPageOnTimout = true;
- this.test = test;
- return this;
- }
-
- }
-
- /** Condition for ActiveConditionChecker */
- public interface Condition {
- public String getDescription();
- public boolean isTrue() throws Exception;
- }
-
- /** Half-implementation of Condition - takes care of the description. */
- public abstract class DescribedCondition implements Condition {
- private String description;
- public DescribedCondition( String description ){
- this.description = StringUtils.defaultIfEmpty(description, "(undescribed)");
- }
- public String getDescription() { return this.description; }
- }
-
-
-
-
-
-
/**
* Utilities for performing and checking deployment.
* In the future, it should be general interface like
@@ -781,15 +689,6 @@
}
}
- /** Calls Thread.sleep(ms), ignores the InterruptedException. */
- @SuppressWarnings("empty-statement")
- private void sleep( int ms ) {
- try {
- Thread.sleep(3000);
- } catch (InterruptedException ex) {
- ; // We don't care, that's the purpose of this method.
- }
- }
}// class EarTest
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -0,0 +1,75 @@
+package org.jboss.jopr.jsfunit.util;
+
+import org.jboss.jopr.jsfunit.*;
+import org.apache.commons.lang.StringUtils;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.logging.*;
+
+
+/**
+ * Actively waits for a given condition.
+ * @see Condition
+ */
+public class ActiveConditionChecker {
+
+ protected final Logger log = Logger.getLogger(this.getClass().getName());
+
+ Condition condition;
+ private boolean dumpPageOnTimout = false;
+ private boolean throwExceptionOnTimout = false;
+ private EmbjoprTestCase test;
+
+
+ public ActiveConditionChecker(Condition condition) {
+ this.condition = condition;
+ }
+
+
+ @SuppressWarnings("empty-statement")
+ public boolean waitWithTimeout( int msInterval, int retries ) throws Exception {
+
+ while( retries-- > 0 ){
+ if( this.condition.isTrue() )
+ return true;
+ try {
+ Thread.sleep(msInterval);
+ } catch (InterruptedException ex){
+ ;
+ }
+ }
+
+ // While ended, thus we reached the "timeout".
+
+ if( this.dumpPageOnTimout ){
+ try {
+ // Since this is still inner class, we could use 'this'.
+ //DebugUtils.writeFile(test.getName() + ".html", test.getClient().getPageAsText());///
+ } catch (Exception ex) { log.error("Can't dump page.", ex); }
+ }
+
+ if( this.throwExceptionOnTimout ){
+ String message = "Timeout expired while waiting for condition: "+condition.getDescription();
+ throw new EmbJoprTestException(message);
+ }
+
+ return false;
+ }
+
+ /** If called, exception is thrown if the timeout expires. */
+ public ActiveConditionChecker throwOnTimeout( /*String conditionDesc*/ ){
+ this.throwExceptionOnTimout = true;
+ //this.conditionDesc = conditionDesc;
+ return this;
+ }
+
+ // This has nothing to do with condition checking, but is convenient shorthand...
+ public ActiveConditionChecker dumpPageOnTimeout(EmbjoprTestCase test) {
+ this.dumpPageOnTimout = true;
+ this.test = test;
+ return this;
+ }
+
+
+}// class
+
+
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/Condition.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/Condition.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/Condition.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -0,0 +1,14 @@
+package org.jboss.jopr.jsfunit.util;
+
+
+
+/**
+ * Condition for ActiveConditionChecker.
+ */
+public interface Condition {
+
+ public String getDescription();
+
+ public boolean isTrue() throws Exception;
+
+}// class
\ No newline at end of file
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/DescribedCondition.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/DescribedCondition.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/DescribedCondition.java 2009-03-10 23:04:57 UTC (rev 201)
@@ -0,0 +1,15 @@
+
+package org.jboss.jopr.jsfunit.util;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Half-implementation of Condition - takes care of the description.
+ */
+public abstract class DescribedCondition implements Condition {
+ private String description;
+ public DescribedCondition( String description ){
+ this.description = StringUtils.defaultIfEmpty(description, "(undescribed)");
+ }
+ public String getDescription() { return this.description; }
+}// class
\ No newline at end of file
15 years, 10 months
EMBJOPR SVN: r200 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit/as5 and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2009-03-10 16:08:00 -0400 (Tue, 10 Mar 2009)
New Revision: 200
Added:
trunk/jsfunit/testdata/datasources/testFiles/MetricsCloseConnectionsExistingFile-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/MetricsInitialConnectionExistingFile-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/MetricsMultipleConnectionsExistingFile-ds.xml
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
Moved the datasource metrics tests from DatasourceTestBase.java to as5/DatasourceTest.java.
Added datasource metrics tests that use an existing -ds.xml file.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-10 19:09:32 UTC (rev 199)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-10 20:08:00 UTC (rev 200)
@@ -792,138 +792,5 @@
+ "'DefaultDS' already exists";
checkClientAndServerMessages(expectedMessage, expectedMessage, true);
}
-
- /*
- * 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 HashMap<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"));
- }
-
- /**
- * Make an initial request for a connection to a database. Make
- * sure the metrics are updated accordingly.
- */
- public void testMetricsAfterInitialDBConnection() throws Exception {
-
- // Min pool size will be 5, max pool size will be 20
- Map<String, String> propertiesMap = createLocalTXDatasource("MetricsInitalConnectionDS");
-
- // Create the first connection
- Connection con = connectDB(propertiesMap.get("jndi-name"),
- propertiesMap.get("user-name"),
- propertiesMap.get("password"));
- assertNotNull(con);
-
- // Set up the expected values
- Map<String, String> expectedMetrics = new HashMap<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);
-
- // Clean up
- disconnectDB(con);
- deleteDatasource(propertiesMap.get("jndi-name"));
- }
-
- /**
- * Establish multiple connections to a database. Make sure
- * the metrics are updated accordingly.
- */
- public void testMetricsAfterMultipleDBConnections() throws Exception {
-
- // Min pool size will be 5, max pool size will be 20
- Map<String, String> propertiesMap = createNoTXDatasource("MetricsMultipleConnectionDS");
-
- // Establish multiple connections
- ArrayList<Connection> connections = createConnections(6, propertiesMap.get("jndi-name"),
- propertiesMap.get("user-name"),
- propertiesMap.get("password"));
-
- // Set up the expected values
- Map<String, String> expectedMetrics = new HashMap<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);
-
- // Clean up
- closeConnections(connections);
- deleteDatasource(propertiesMap.get("jndi-name"));
- }
-
- /**
- * Make sure the metrics are updated appropriately after
- * closing some connections.
- */
- public void testMetricsAfterClosingConnections() throws Exception {
-
- // Min pool size will be 5, max pool size will be 20
- Map<String, String> propertiesMap = createNoTXDatasource("MetricsCloseConnectionsDS");
-
- // Establish some connections
- ArrayList<Connection> connections = createConnections(5, propertiesMap.get("jndi-name"),
- propertiesMap.get("user-name"),
- propertiesMap.get("password"));
-
- // Close some connections
- disconnectDB(connections.get(0));
- disconnectDB(connections.get(1));
-
- // Set up the expected values
- Map<String, String> expectedMetrics = new HashMap<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);
-
- // Clean up
- for(int i = 2; i <= 4; i++) {
- disconnectDB(connections.get(i));
- }
-
- deleteDatasource(propertiesMap.get("jndi-name"));
- }
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-10 19:09:32 UTC (rev 199)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-10 20:08:00 UTC (rev 200)
@@ -711,5 +711,213 @@
deleteDatasource(propertiesMap.get("jndi-name"));
}
+
+ /*
+ * 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 HashMap<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"));
+ }
+
+ /**
+ * 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("Datasources");
+
+ // Min pool size will be 5, max pool size will be 20
+ checkMetricsAfterInitialDBConnection(propertiesMap);
+ }
+
+ /**
+ * Common code for the testMetricsAfterInitialDBConnection* tests.
+ */
+ public void checkMetricsAfterInitialDBConnection(Map<String, String> propertiesMap) throws Exception {
+
+ // Create the first connection
+ Connection con = connectDB(propertiesMap.get("jndi-name"),
+ propertiesMap.get("user-name"),
+ propertiesMap.get("password"));
+ assertNotNull(con);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new HashMap<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);
+
+ // Clean up
+ disconnectDB(con);
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
+
+ /**
+ * 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("Datasources");
+
+ // Min pool size will be 5, max pool size will be 20
+ checkMetricsAfterMultipleDBConnections(propertiesMap);
+ }
+
+ /**
+ * Common code for the testMetricsAfterMultipleDBConnections* tests.
+ */
+ public 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"));
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new HashMap<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);
+
+ // Clean up
+ closeConnections(connections);
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
+
+ /**
+ * 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("Datasources");
+
+ // Min pool size will be 5, max pool size will be 20
+ checkMetricsAfterClosingConnections(propertiesMap);
+ }
+
+ /**
+ * Common code for the testMetricsAfterClosingConnections* tests.
+ */
+ public 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"));
+
+ // Close some connections
+ disconnectDB(connections.get(0));
+ disconnectDB(connections.get(1));
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new HashMap<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);
+
+ // Clean up
+ for(int i = 2; i <= 4; i++) {
+ disconnectDB(connections.get(i));
+ }
+
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
}
Added: trunk/jsfunit/testdata/datasources/testFiles/MetricsCloseConnectionsExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/MetricsCloseConnectionsExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/MetricsCloseConnectionsExistingFile-ds.xml 2009-03-10 20:08:00 UTC (rev 200)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <no-tx-datasource>
+ <jndi-name>MetricsCloseConnectionsExistingFile</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>55000</blocking-timeout-millis>
+ <idle-timeout-minutes>60</idle-timeout-minutes>
+ <prefill>true</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <interleaving/>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </no-tx-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/MetricsInitialConnectionExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/MetricsInitialConnectionExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/MetricsInitialConnectionExistingFile-ds.xml 2009-03-10 20:08:00 UTC (rev 200)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>MetricsInitialConnectionExistingFile</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/MetricsMultipleConnectionsExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/MetricsMultipleConnectionsExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/MetricsMultipleConnectionsExistingFile-ds.xml 2009-03-10 20:08:00 UTC (rev 200)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <no-tx-datasource>
+ <jndi-name>MetricsMultipleConnectionsExistingFile</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>55000</blocking-timeout-millis>
+ <idle-timeout-minutes>60</idle-timeout-minutes>
+ <prefill>true</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <interleaving/>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </no-tx-datasource>
+</datasources>
15 years, 10 months
EMBJOPR SVN: r199 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit and 4 other directories.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2009-03-10 15:09:32 -0400 (Tue, 10 Mar 2009)
New Revision: 199
Added:
trunk/jsfunit/testdata/datasources/expectedFiles/
trunk/jsfunit/testdata/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/
trunk/jsfunit/testdata/datasources/testFiles/DeleteLocalTXExistingFile-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/DeleteNoTXExistingFile-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/DeleteXAExistingFile-ds.xml
trunk/jsfunit/testdata/datasources/testFiles/MultipleDatasources-ds.xml
Removed:
trunk/jsfunit/testdata/datasources/ExpectedMultipleDatasourcesAfterDeletion-ds.xml
trunk/jsfunit/testdata/datasources/MultipleDatasources-ds.xml
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/DatasourceTest.java
Log:
Adding datasource deletion tests that use an existing -ds.xml file.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-03-10 15:41:53 UTC (rev 198)
+++ trunk/jsfunit/pom.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -307,17 +307,18 @@
<file>${basedir}/testdata/jboss-configuration/conf/props/jmx-console-users.properties</file>
<tofile>conf/props/jmx-console-users.properties</tofile>
</configfile>
- <!-- Datasources -->
- <configfile>
- <file>${basedir}/testdata/datasources/MultipleDatasources-ds.xml</file>
- <toFile>deploy/MultipleDatasources-ds.xml</toFile>
- </configfile>
</configfiles>
+
+ <!-- Deploy the test files -->
<files>
<copy>
<file>${basedir}/testdata/destinations</file>
<toDir>deploy</toDir>
</copy>
+ <copy>
+ <file>${basedir}/testdata/datasources/testFiles</file>
+ <toDir>deploy</toDir>
+ </copy>
</files>
</configuration>
<!-- /Container configuration -->
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-10 15:41:53 UTC (rev 198)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-10 19:09:32 UTC (rev 199)
@@ -589,6 +589,35 @@
*/
protected abstract boolean isMBeanStateDeployedImpl( ObjectName deploymentMBean ) throws JMException, IOException;
+ /**
+ * Parse the -ds.xml file given by jndiName. Return a mapping of property
+ * names to property values.
+ */
+ public Map<String, String> getPropertyValuesMap(String jndiName,
+ DatasourceType datasourceType) throws Exception {
+ File file = new File(this.getDatasourceConfigFile(jndiName));
+
+ Map<String, String> actualValuesMap = new HashMap<String, String>();
+
+ SAXBuilder builder = new SAXBuilder();
+ Document doc = builder.build(file);
+
+ Element root = doc.getRootElement();
+ assertTrue(root.getName().equals("datasources"));
+
+ // Get the datasource element
+ Element datasource = root.getChild(datasourceType.getXmlElementName());
+
+ // Create actualValuesMap by mapping property names to
+ // property values
+ Iterator itr = (datasource.getChildren()).iterator();
+ while(itr.hasNext()) {
+ Element property = (Element)itr.next();
+ actualValuesMap.put(property.getName(), property.getValue());
+ }
+
+ return actualValuesMap;
+ }
/*
* CREATION TESTS
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-10 15:41:53 UTC (rev 198)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-10 19:09:32 UTC (rev 199)
@@ -268,6 +268,55 @@
}
/**
+ * 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);
+
+ String expectedMessage = "Successfully deleted Local TX Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, 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);
+
+ String expectedMessage = "Successfully deleted No TX Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, 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);
+
+ // Check for the appropriate success messages
+ String expectedMessage = "Successfully deleted XA Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, propertiesMap, XA_COMPONENT_TYPE,
+ DatasourceType.XA_DATASOURCE);
+ }
+
+ /**
* Common code for the testDelete* tests.
*/
private void deleteDS(String expectedMessage, Map<String, String> propertiesMap,
@@ -296,25 +345,26 @@
* -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 (NoTX-ds.xml).
- deleteDatasource("NoTX");
+ // a No TX Datasource. We will delete the No TX Datasource (NoTXDeletionTest-ds.xml).
+ deleteDatasource(jndiName);
// Check for the appropriate success messages
- String expectedMessage = "Successfully deleted No TX Datasource 'NoTX'";
+ String expectedMessage = "Successfully deleted No TX Datasource '" + 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("NoTX", NO_TX_COMPONENT_TYPE));
+ 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/ExpectedMultipleDatasourcesAfterDeletion-ds.xml";
+ + "/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml";
compareFiles(actualDSFile, expectedDSFile);
}
@@ -556,7 +606,7 @@
// Clean up
deleteDatasource(propertiesMap.get("jndi-name"));
}
-
+
/**
* Test the "List Formatted Sub Pool Statistics" operation after multiple
* connections to a database have been established.
@@ -607,7 +657,7 @@
closeConnections(connections);
deleteDatasource(propertiesMap.get("jndi-name"));
}
-
+
/**
* Test the "List Formatted Sub Pool Statistics" operation after
* closing some connections.
Deleted: trunk/jsfunit/testdata/datasources/ExpectedMultipleDatasourcesAfterDeletion-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/ExpectedMultipleDatasourcesAfterDeletion-ds.xml 2009-03-10 15:41:53 UTC (rev 198)
+++ trunk/jsfunit/testdata/datasources/ExpectedMultipleDatasourcesAfterDeletion-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -1,40 +0,0 @@
-<datasources>
- <local-tx-datasource>
- <jndi-name>LocalTX1</jndi-name>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
- <min-pool-size>5</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <idle-timeout-minutes>10</idle-timeout-minutes>
- <track-statements/>
- <security-domain>HsqlDbRealm</security-domain>
- <prepared-statement-cache-size>32</prepared-statement-cache-size>
- <metadata>
- <type-mapping>FirstSQL/J</type-mapping>
- </metadata>
- </local-tx-datasource>
- <local-tx-datasource>
- <jndi-name>LocalTX2</jndi-name>
- <use-java-context>false</use-java-context>
- <min-pool-size>5</min-pool-size>
- <max-pool-size>10</max-pool-size>
- <idle-timeout-minutes>15</idle-timeout-minutes>
- <background-validation>false</background-validation>
- <background-validation-millis>10000</background-validation-millis>
- <validate-on-match>false</validate-on-match>
- <metadata>
- <type-mapping>FirstSQL/J</type-mapping>
- </metadata>
- <user-name>sa</user-name>
- <password></password>
- <prepared-statement-cache-size>10</prepared-statement-cache-size>
- <share-prepared-statements>false</share-prepared-statements>
- <set-tx-query-timeout>false</set-tx-query-timeout>
- <query-timeout>36000</query-timeout>
- <use-try-lock>60000</use-try-lock>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- </local-tx-datasource>
-</datasources>
Deleted: trunk/jsfunit/testdata/datasources/MultipleDatasources-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/MultipleDatasources-ds.xml 2009-03-10 15:41:53 UTC (rev 198)
+++ trunk/jsfunit/testdata/datasources/MultipleDatasources-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -1,56 +0,0 @@
-<datasources>
- <local-tx-datasource>
- <jndi-name>LocalTX1</jndi-name>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
- <min-pool-size>5</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <idle-timeout-minutes>10</idle-timeout-minutes>
- <track-statements/>
- <security-domain>HsqlDbRealm</security-domain>
- <prepared-statement-cache-size>32</prepared-statement-cache-size>
- <metadata>
- <type-mapping>FirstSQL/J</type-mapping>
- </metadata>
- </local-tx-datasource>
- <no-tx-datasource>
- <jndi-name>NoTX</jndi-name>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>30</max-pool-size>
- <idle-timeout-minutes>5</idle-timeout-minutes>
- <track-statements/>
- <security-domain>HsqlDbRealm</security-domain>
- <prepared-statement-cache-size>20</prepared-statement-cache-size>
- <metadata>
- <type-mapping>FirstSQL/J</type-mapping>
- </metadata>
- </no-tx-datasource>
- <local-tx-datasource>
- <jndi-name>LocalTX2</jndi-name>
- <use-java-context>false</use-java-context>
- <min-pool-size>5</min-pool-size>
- <max-pool-size>10</max-pool-size>
- <idle-timeout-minutes>15</idle-timeout-minutes>
- <background-validation>false</background-validation>
- <background-validation-millis>10000</background-validation-millis>
- <validate-on-match>false</validate-on-match>
- <metadata>
- <type-mapping>FirstSQL/J</type-mapping>
- </metadata>
- <user-name>sa</user-name>
- <password></password>
- <prepared-statement-cache-size>10</prepared-statement-cache-size>
- <share-prepared-statements>false</share-prepared-statements>
- <set-tx-query-timeout>false</set-tx-query-timeout>
- <query-timeout>36000</query-timeout>
- <use-try-lock>60000</use-try-lock>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- </local-tx-datasource>
-</datasources>
Added: trunk/jsfunit/testdata/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/expectedFiles/ExpectedMultipleDatasourcesAfterDeletion-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -0,0 +1,66 @@
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>LocalTX1</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+ <local-tx-datasource>
+ <jndi-name>LocalTX2</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/DeleteLocalTXExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/DeleteLocalTXExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/DeleteLocalTXExistingFile-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>DeleteLocalTXExistingFile</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/DeleteNoTXExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/DeleteNoTXExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/DeleteNoTXExistingFile-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <no-tx-datasource>
+ <jndi-name>DeleteNoTXExistingFile</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>55000</blocking-timeout-millis>
+ <idle-timeout-minutes>60</idle-timeout-minutes>
+ <prefill>true</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <interleaving/>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </no-tx-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/DeleteXAExistingFile-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/DeleteXAExistingFile-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/DeleteXAExistingFile-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<datasources>
+ <xa-datasource>
+ <jndi-name>DeleteXAExistingFile</jndi-name>
+ <rar-name>jboss-xa-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>15</min-pool-size>
+ <max-pool-size>6</max-pool-size>
+ <blocking-timeout-millis>30000</blocking-timeout-millis>
+ <idle-timeout-minutes>15</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <user-name>testUser</user-name>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
+ <xa-resource-timeout>36000</xa-resource-timeout>
+ </xa-datasource>
+</datasources>
Added: trunk/jsfunit/testdata/datasources/testFiles/MultipleDatasources-ds.xml
===================================================================
--- trunk/jsfunit/testdata/datasources/testFiles/MultipleDatasources-ds.xml (rev 0)
+++ trunk/jsfunit/testdata/datasources/testFiles/MultipleDatasources-ds.xml 2009-03-10 19:09:32 UTC (rev 199)
@@ -0,0 +1,98 @@
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>LocalTX1</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+ <no-tx-datasource>
+ <jndi-name>NoTXDeletionTest</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>55000</blocking-timeout-millis>
+ <idle-timeout-minutes>60</idle-timeout-minutes>
+ <prefill>true</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <interleaving/>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </no-tx-datasource>
+ <local-tx-datasource>
+ <jndi-name>LocalTX2</jndi-name>
+ <rar-name>jboss-local-jdbc.rar</rar-name>
+ <use-java-context>true</use-java-context>
+ <connection-definition>javax.sql.DataSource</connection-definition>
+ <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <blocking-timeout-millis>35000</blocking-timeout-millis>
+ <idle-timeout-minutes>20</idle-timeout-minutes>
+ <prefill>false</prefill>
+ <background-validation>false</background-validation>
+ <background-validation-millis>0</background-validation-millis>
+ <validate-on-match>true</validate-on-match>
+ <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <allocation-retry>0</allocation-retry>
+ <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
+ <metadata>
+ <type-mapping>FirstSQL/J</type-mapping>
+ </metadata>
+ <local-transaction/>
+ <user-name>sa</user-name>
+ <password></password>
+ <prepared-statement-cache-size>0</prepared-statement-cache-size>
+ <share-prepared-statements>false</share-prepared-statements>
+ <set-tx-query-timeout>false</set-tx-query-timeout>
+ <query-timeout>0</query-timeout>
+ <use-try-lock>60000</use-try-lock>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+ </local-tx-datasource>
+</datasources>
15 years, 10 months
EMBJOPR SVN: r198 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as4 and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2009-03-10 11:41:53 -0400 (Tue, 10 Mar 2009)
New Revision: 198
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
Moved the datasource deletion tests from DatasourceTestBase.java to as5/DatasourceTest.java.
Corrected spacing, indentation, and formatting in DatasourceTestBase.java.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-09 23:36:10 UTC (rev 197)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-10 15:41:53 UTC (rev 198)
@@ -52,51 +52,45 @@
*
*/
public abstract class DatasourceTestBase extends EmbjoprTestCase {
-
// Datasource types, as they appear in the left nav
- protected enum DatasourceType {
+ protected 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"),
- NO_TX_DATASOURCE( "No TX Datasources", "NoTxCM", "no-tx-datasource", "default__No TX Datasource"),
- XA_DATASOURCE( "XA Datasources", "XATxCM", "xa-datasource", "default__XA Datasource");
+ // 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"),
+ NO_TX_DATASOURCE( "No TX Datasources", "NoTxCM", "no-tx-datasource", "default__No TX Datasource"),
+ XA_DATASOURCE( "XA Datasources", "XATxCM", "xa-datasource", "default__XA Datasource");
- protected String label;
- public String getLabel() { return label; }
- //public void setLabel(String label) { this.label = label; }
+ protected String label;
+ public String getLabel() { return label; }
+
+ protected final String serviceName;
+ public String getServiceName() { return serviceName; }
- protected final String serviceName;
- public String getServiceName() { return serviceName; }
+ protected final String xmlElementName;
+ public String getXmlElementName() { return xmlElementName; }
+ // Also serves as value for HTML Radio for Datasource type selection.
+ public String getHtmlRadioValue() { return xmlElementName; }
- protected final String xmlElementName;
- public String getXmlElementName() { return xmlElementName; }
- // Also serves as value for HTML Radio for Datasource type selection.
- public String getHtmlRadioValue() { return xmlElementName; }
-
- protected final String templateHtmlSelectValue;
- public String getTemplateHtmlSelectValue() { return templateHtmlSelectValue; }
+ protected final String templateHtmlSelectValue;
+ public String getTemplateHtmlSelectValue() { return templateHtmlSelectValue; }
+ private DatasourceType(String label, String serviceName,
+ String xmlElementName, String htmlSelectValue)
+ {
+ this.label = label;
+ this.serviceName = serviceName;
+ this.xmlElementName = xmlElementName;
+ this.templateHtmlSelectValue = htmlSelectValue;
+ }
+ }// DatasourceTypes
- private DatasourceType(String label, String serviceName,
- String xmlElementName, String htmlSelectValue)
- {
- this.label = label;
- this.serviceName = serviceName;
- this.xmlElementName = xmlElementName;
- this.templateHtmlSelectValue = htmlSelectValue;
- }
-
- }// DatasourceTypes
-
-
-
- // --- Datasource Templates --- //
- /*
+ // --- Datasource Templates --- //
+ /*
AS 4:
<select id="resourceCreateForm:selectedTemplate" size="1" name="resourceCreateForm:selectedTemplate">
<option value="">Select Template</option>
@@ -120,59 +114,44 @@
<option value="default__XA Datasource">default (XA Datasource)</option>
</select>
- */
- protected enum DatasourceTemplate {
+ */
+ protected enum DatasourceTemplate {
- /** AS 4 */
- AS4_ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
- AS4_ORACLE_XA("Oracle XA__Datasource"),
- AS4_DEFAULT("default__Datasource"),
+ /** AS 4 */
+ AS4_ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
+ AS4_ORACLE_XA("Oracle XA__Datasource"),
+ AS4_DEFAULT("default__Datasource"),
- /** AS 5 */
- AS5_ORACLE_LOCAL_TX("Oracle Local TX__Local TX Datasource"),
- AS5_DEFAULT_LOCAL_TX("default__Local TX Datasource"),
- AS5_ORACLE_NO_TX("Oracle No TX__No TX Datasource"),
- AS5_DEFAULT_NO_TX("default__No TX Datasource"),
- AS5_ORACLE_XA("Oracle XA__XA Datasource"),
- AS5_DEFAULT_XA("default__XA Datasource");
+ /** AS 5 */
+ AS5_ORACLE_LOCAL_TX("Oracle Local TX__Local TX Datasource"),
+ AS5_DEFAULT_LOCAL_TX("default__Local TX Datasource"),
+ AS5_ORACLE_NO_TX("Oracle No TX__No TX Datasource"),
+ AS5_DEFAULT_NO_TX("default__No TX Datasource"),
+ AS5_ORACLE_XA("Oracle XA__XA Datasource"),
+ AS5_DEFAULT_XA("default__XA Datasource");
+ protected final String templateHtmlSelectValue;
+ private DatasourceTemplate(String templateHtmlSelectValue) {
+ this.templateHtmlSelectValue = templateHtmlSelectValue;
+ }
- protected final String templateHtmlSelectValue;
+ /**
+ * Value of HTML select option for this template.
+ */
+ public String getTemplateHtmlSelectValue() {
+ return templateHtmlSelectValue;
+ }
+ }
+ // Datasource properties
+ private Map<String, String> datasourceProperties = createDatasourceProperties();
- private DatasourceTemplate(String templateHtmlSelectValue) {
- this.templateHtmlSelectValue = templateHtmlSelectValue;
- }
+ /**
+ * @returns a set of properties created upon initialization by overriden createDatasourceProperties().
+ */
+ public Map<String, String> getDatasourceProperties() { return datasourceProperties; }
-
-
- /**
- * Value of HTML select option for this template.
- */
- public String getTemplateHtmlSelectValue() {
- return templateHtmlSelectValue;
- }
-
- }
-
-
-
-
-
- // Datasource properties
-
- private Map<String, String> datasourceProperties = createDatasourceProperties();
-
- /**
- * @returns a set of properties created upon initialization by overriden createDatasourceProperties().
- */
- public Map<String, String> getDatasourceProperties() { return datasourceProperties; }
-
-
-
-
-
/**
* Create a new datasource using the given type, template, and properties.
*
@@ -182,36 +161,36 @@
protected abstract void createDatasource(DatasourceType datasourceType,
String datasourceTemplate,
Map<String, String> propertiesMap) throws IOException;
-
+
/**
* Delete the datasource given by datasourceName.
*/
protected abstract void deleteDatasource(String datasourceName) throws IOException, EmbJoprTestException;
-
+
/**
* Use JMX to check if the datasource given by datasourceName is deployed.
*/
- protected boolean isDatasourceDeployed(String jndiName, DatasourceType datasourceType) {
+ protected boolean isDatasourceDeployed(String jndiName, DatasourceType datasourceType) {
try {
String[] dsMBeanServices = {"DataSourceBinding",
"ManagedConnectionPool",
"ManagedConnectionFactory",
- datasourceType.getServiceName() };
+ datasourceType.getServiceName()};
// Query the MBean server to check if the datasource is deployed
MBeanServer jmxServer = MBeanServerLocator.locateJBoss();
// Inspect these MBeans and make sure that the their state indicates successful deployment
- // (e.g. for AS 5, "State" attribute is "DEPLOYED"):
+ // (e.g. for AS 5, "State" attribute is "DEPLOYED"):
// 1) "jboss.jca:name=TestDS,service=DataSourceBinding",type=Component
// 2) "jboss.jca:name=TestDS,service=ManagedConnectionPool",type=Component
// 3) "jboss.jca:name=TestDS,service=ManagedConnectionFactory",type=Component
// 4) The fourth MBean inspected depends on the type of datasource.
for(int i = 0; i < dsMBeanServices.length; i++) {
- // Is this necessary? Can't we just query? See InstanceNotFoundException;
- // And AFAIK, full MBean name is unique. I vote for minimalistic code.
+ // Is this necessary? Can't we just query? See InstanceNotFoundException;
+ // And AFAIK, full MBean name is unique. I vote for minimalistic code.
/*ObjectName objName = new ObjectName( this.getMBeanName(jndiName, dsMBeanServices[i]));
Set dsMBeans = jmxServer.queryNames(objName, null);
@@ -220,18 +199,16 @@
// Get the first and only one MBean returned.
ObjectName deploymentMBean = (ObjectName)dsMBeans.iterator().next(); /**/
- String mBeanName = this.getMBeanName(jndiName, dsMBeanServices[i]);
- log.info("Looking for MBean "+mBeanName+"...");
- ObjectName deploymentMBean = new ObjectName( mBeanName );
+ String mBeanName = this.getMBeanName(jndiName, dsMBeanServices[i]);
+ log.info("Looking for MBean "+mBeanName+"...");
+ ObjectName deploymentMBean = new ObjectName( mBeanName );
- ///Object state = jmxServer.getAttribute(deploymentMBean, "State");
- ///if(!("DEPLOYED".equals(state.toString()))) return false;
- if( this.isMBeanStateDeployedImpl( deploymentMBean ) ){
- log.info("Found, OK");
- }else{
- log.info("Not found.");
- return false;
- }
+ if( this.isMBeanStateDeployedImpl( deploymentMBean ) ){
+ log.info("Found, OK");
+ }else{
+ log.info("Not found.");
+ return false;
+ }
}
@@ -240,7 +217,7 @@
throw new RuntimeException(e);
}
}
-
+
/**
* checkProperties reads the *-ds.xml file corresponding to the datasource
* given by jndiName and compares the property values in this file to the
@@ -250,53 +227,55 @@
protected boolean checkProperties(String jndiName,
DatasourceType datasourceType,
Map<String, String> expectedValuesMap)
- {
-
+ {
+
Map<String, String> actualValuesMap = new HashMap<String, String>();
-
-
+
+
try {
-
+
// Parse the *-ds.xml file; create appropriate file name for AS 4 or 5.
File file = new File(this.getDatasourceConfigFile(jndiName));
- log.info("Examining: "+file.getAbsolutePath());
+ log.info("Examining: "+file.getAbsolutePath());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(file);
-
+
Element root = doc.getRootElement();
assertTrue(root.getName().equals("datasources"));
-
+
// Get the datasource element
Element datasource = root.getChild(datasourceType.getXmlElementName());
-
+
// Create actualValuesMap by mapping property names to
// property values
Iterator itr = (datasource.getChildren()).iterator();
while(itr.hasNext()) {
- Element property = (Element)itr.next();
- actualValuesMap.put(property.getName(), property.getValue());
+ Element property = (Element)itr.next();
+ actualValuesMap.put(property.getName(), property.getValue());
}
-
+
// Compare the actual values to the expected ones.
- for( String key : expectedValuesMap.keySet() ){
- if(!actualValuesMap.containsKey(key)){
- // Value was not set.
- log.fatal("Property '"+key+"' is not found.");
- return false;
- }
+ for( String key : expectedValuesMap.keySet() ){
+ if(!actualValuesMap.containsKey(key)){
+
+ // Value was not set.
+ log.fatal("Property '" + key + "' is not found.");
+ return false;
+ }
- if(!expectedValuesMap.get(key).equals(actualValuesMap.get(key))) {
- // Incorrect value.
- log.fatal("Property '"+key+"' has unexpected value: '"+actualValuesMap.get(key)+"'");
- return false;
- }
- }
-
+ if(!expectedValuesMap.get(key).equals(actualValuesMap.get(key))) {
+
+ // Incorrect value.
+ log.fatal("Property '" + key +"' has unexpected value: '" + actualValuesMap.get(key) + "'");
+ return false;
+ }
+ }
+
return true;
-
+
} catch (Exception e) {
- log.fatal("Config file check failed: "+e.getMessage());
+ log.fatal("Config file check failed: "+e.getMessage());
throw new RuntimeException(e);
}
}
@@ -374,6 +353,8 @@
assertTrue("Missing line in -ds.xml file: " + expectedLine, expectedLine == null);
}
+
+
/**
* @return the suite of tests being tested
* @throws UnsupportedOperationException - you have to override this.
@@ -384,7 +365,229 @@
throw new UnsupportedOperationException("This has to be overriden.");
}
+ /**
+ * Creates the default properties for the datasource - shared by AS4 and AS5.
+ * Overriding method should get result of this method and overwrite it with it's custom properties.
+ * @returns a set of default properties.
+ */
+ protected Map<String, String> createDatasourceProperties()
+ {
+ Map<String, String> propertiesMap = new HashMap();
+ // The properties we want to configure
+ propertiesMap.put("jndi-name", "TestDS");
+ propertiesMap.put("user-name", "testUser");
+ propertiesMap.put("password", "password");
+ propertiesMap.put("min-pool-size", "5");
+ propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+ propertiesMap.put("connection-url", "jdbc:hsqldb:."); // Store data current working dir.
+ propertiesMap.put("idle-timeout-minutes", "20");
+ propertiesMap.put("prepared-statement-cache-size", "2");
+ propertiesMap.put("valid-connection-checker-class-name",
+ "org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL");
+ propertiesMap.put("exception-sorter-class-name",
+ "org.jboss.resource.adapter.jdbc.ExceptionSorter");
+
+ return propertiesMap;
+ }
+
+
+ /**
+ * Create a basic Local TX Datasource. Return the mapping of property
+ * names to property values.
+ */
+ protected Map<String, String> createLocalTXDatasource(String datasourceName) throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("jndi-name", datasourceName);
+ propertiesMap.put("max-pool-size", "20");
+ propertiesMap.put("min-pool-size", "5");
+ propertiesMap.put("user-name", "sa");
+ propertiesMap.put("password", "");
+ propertiesMap.put("domain", "HsqlDbRealm");
+ propertiesMap.put("blocking-timeout-millis", "35000");
+ propertiesMap.put("idle-timeout-minutes", "20");
+ propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+ propertiesMap.put("connection-url", "jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB");
+
+ createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
+ DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // "default__Local TX Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ return propertiesMap;
+ }
+
+
+
+ /**
+ * Create a basic No TX Datasource. Return the mapping of property
+ * names to property values.
+ */
+ protected Map<String, String> createNoTXDatasource(String datasourceName) throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("jndi-name", datasourceName);
+ propertiesMap.put("prefill", "true");
+ propertiesMap.put("track-connection-by-tx", "false");
+ propertiesMap.put("max-pool-size", "20");
+ propertiesMap.put("min-pool-size", "5");
+ propertiesMap.put("blocking-timeout-millis", "55000");
+ propertiesMap.put("idle-timeout-minutes", "60");
+ propertiesMap.put("noTxSeparatePools", "true");
+ propertiesMap.put("user-name", "sa");
+ propertiesMap.put("password", "");
+ propertiesMap.put("domain", "HsqlDbRealm");
+ propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+ propertiesMap.put("connection-url", "jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB");
+
+ createDatasource(DatasourceType.NO_TX_DATASOURCE,
+ DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No TX Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ return propertiesMap;
+ }
+
+
+ /**
+ * Create a basic XA Datasource. Return the mapping of property
+ * name to property values.
+ */
+ protected Map<String, String> createXADatasource(String datasourceName) throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("jndi-name", datasourceName);
+ propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
+ propertiesMap.put("xa-resource-timeout", "36000");
+ propertiesMap.put("max-pool-size", "15");
+ propertiesMap.put("min-pool-size", "6");
+ propertiesMap.put("set-tx-query-timeout", "false");
+ propertiesMap.put("user-name", "testUser");
+
+ createDatasource(DatasourceType.XA_DATASOURCE,
+ DatasourceType.XA_DATASOURCE.getTemplateHtmlSelectValue(), //"default__XA Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ return propertiesMap;
+ }
+
+ /**
+ *
+ * @returns a name of the Datasource's config file to check the properties in.
+ */
+ protected abstract String getDatasourceConfigFile( String jndiName );
+
+ protected abstract String getMBeanName( String jndiName, String serviceName );
+
+
+
+ /**
+ * This method is wrapper that handles JMX exceptions at Base level.
+ * Intended to keep AS-version-specific method, isMBeanStateDeployedImpl(), as small as possible.
+ * @param deploymentMBean
+ * @return
+ * @throws javax.management.JMException
+ * @throws java.io.IOException
+ */
+ protected boolean isMBeanStateDeployed( ObjectName deploymentMBean ) {
+
+ try {
+ return this.isMBeanStateDeployedImpl(deploymentMBean);
+ }
+ // This super-exception includes JMX operation failures, including:
+ // AttributeNotFoundException, InstanceNotFoundException, MalformedObjectNameException, ServiceNotFoundException
+ catch (OperationsException ex) {
+ log.warn("JMX operation error when retrieving MBean attribute.", ex);
+ return false;
+ }
+ // All other JMX failures...
+ catch (JMException ex) {
+ log.warn("JMX error when retrieving MBean attribute.", ex);
+ return false;
+ }
+ catch (IOException ex) {
+ log.warn("I/O error when retrieving MBean attribute.", ex);
+ return false;
+ }
+
+ }// isMBeanStateDeployed()
+
+
+ /**
+ * containsElement returns whether or not the *-ds.xml file corresponding
+ * to the datasource given by jndiName contains the given element.
+ */
+ protected boolean containsElement(String jndiName, String elementName) {
+ try {
+ File file = new File(this.getDatasourceConfigFile(jndiName));
+ SAXBuilder builder = new SAXBuilder();
+ Document doc = builder.build(file);
+
+ Element root = doc.getRootElement();
+ assertTrue(root.getName().equals("datasources"));
+ return root.getChild(elementName) != null;
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+
+ /**
+ * Make sure that the metrics corresponding to the given datasource
+ * are correct.
+ *
+ * @param metricsMap maps metric names to the expected metric values.
+ */
+ protected void checkMetrics(String datasourceName,
+ DatasourceType datasourceType,
+ Map<String, String> metricsMap) throws IOException, EmbJoprTestException {
+
+ refreshTreeNode("Datasources");
+ ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
+ datasourceTypeArrow.click();
+
+ HtmlAnchor datasource = getNavTreeLink(datasourceName);
+ datasource.click();
+
+ // Check values under the "Metrics" tab
+ HtmlAnchor metricsLink = (HtmlAnchor)client.getElement("metricsTab");
+ 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");
+ 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");
+ summaryLink.click();
+
+ ArrayList<String> summaryMetrics = new ArrayList<String>();
+ 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");
+ actual = normalizeIfDoubleExpected(expected, actual); // Some LOCALEs encode doubles with coma.
+ assertEquals("Incorrect summary metric value for '"+metricName+"'='"+actual+"'," +
+ " expected '"+expected+"'", expected, actual);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ protected abstract boolean isMBeanStateDeployedImpl( ObjectName deploymentMBean ) throws JMException, IOException;
/*
@@ -562,73 +765,6 @@
}
/*
- * DELETION TESTS:
- */
-
- /**
- * Remove a Local TX Datasource.
- */
- public void testDeleteLocalTXDatasource() throws Exception {
- Map<String, String> propertiesMap = createLocalTXDatasource("DeleteLocalTXDS");
-
- deleteDatasource(propertiesMap.get("jndi-name"));
-
- // Check for the appropriate success messages
- String expectedMessage = "Successfully deleted Local TX Datasource '"
- + propertiesMap.get("jndi-name") + "'";
- checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
- assertFalse(isDatasourceDeployed(propertiesMap.get("jndi-name"),
- DatasourceType.LOCAL_TX_DATASOURCE));
-
- // Make sure the entry was removed from the -ds.xml file (See JOPR-44)
- assertFalse(containsElement(propertiesMap.get("jndi-name"),
- DatasourceType.LOCAL_TX_DATASOURCE.getXmlElementName()));
- }
-
- /**
- * Remove a No TX Datasource.
- */
- public void testDeleteNoTXDatasource() throws Exception {
- Map<String, String> propertiesMap = createNoTXDatasource("DeleteNoTXDS");
-
- deleteDatasource(propertiesMap.get("jndi-name"));
-
- // Check for the appropriate success messages
- String expectedMessage = "Successfully deleted No TX Datasource '"
- + propertiesMap.get("jndi-name") + "'";
- checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
- assertFalse(isDatasourceDeployed(propertiesMap.get("jndi-name"),
- DatasourceType.NO_TX_DATASOURCE));
-
- // Make sure the entry was removed from the -ds.xml file (See JOPR-44)
- assertFalse(containsElement(propertiesMap.get("jndi-name"),
- "no-tx-datasource"));
- }
-
- /**
- * Remove an XA Datasource.
- */
- public void testDeleteXADatasource() throws Exception {
- Map<String, String> propertiesMap = createXADatasource("DeleteXADS");
-
- deleteDatasource(propertiesMap.get("jndi-name"));
-
- // Check for the appropriate success messages
- String expectedMessage = "Successfully deleted XA Datasource '"
- + propertiesMap.get("jndi-name") + "'";
- checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
- assertFalse(isDatasourceDeployed(propertiesMap.get("jndi-name"),
- DatasourceType.XA_DATASOURCE));
-
- // Make sure the entry was removed from the -ds.xml file (See JOPR-44)
- assertFalse(containsElement(propertiesMap.get("jndi-name"),
- "xa-datasource"));
- }
-
- /*
* METRICS TESTS
*/
@@ -760,248 +896,5 @@
deleteDatasource(propertiesMap.get("jndi-name"));
}
-
-
-
-
-
-
-
- /*
- * --- Various support methods. ---
- */
-
-
-
-
- /**
- * Creates the default properties for the datasource - shared by AS4 and AS5.
- * Overriding method should get result of this method and overwrite it with it's custom properties.
- * @returns a set of default properties.
- */
- protected Map<String, String> createDatasourceProperties()
- {
- Map<String, String> propertiesMap = new HashMap();
-
- // The properties we want to configure
- propertiesMap.put("jndi-name", "TestDS");
- propertiesMap.put("user-name", "testUser");
- propertiesMap.put("password", "password");
- propertiesMap.put("min-pool-size", "5");
- propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
- propertiesMap.put("connection-url", "jdbc:hsqldb:."); // Store data current working dir.
- propertiesMap.put("idle-timeout-minutes", "20");
- propertiesMap.put("prepared-statement-cache-size", "2");
- propertiesMap.put("valid-connection-checker-class-name",
- "org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL");
- propertiesMap.put("exception-sorter-class-name",
- "org.jboss.resource.adapter.jdbc.ExceptionSorter");
-
- return propertiesMap;
- }
-
-
- /**
- * Create a basic Local TX Datasource. Return the mapping of property
- * names to property values.
- */
- protected Map<String, String> createLocalTXDatasource(String datasourceName) throws IOException {
- Map<String, String> propertiesMap = new HashMap<String, String>();
- propertiesMap.put("jndi-name", datasourceName);
- propertiesMap.put("max-pool-size", "20");
- propertiesMap.put("min-pool-size", "5");
- propertiesMap.put("user-name", "sa");
- propertiesMap.put("password", "");
- propertiesMap.put("domain", "HsqlDbRealm");
- propertiesMap.put("blocking-timeout-millis", "35000");
- propertiesMap.put("idle-timeout-minutes", "20");
- propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
- propertiesMap.put("connection-url", "jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB");
-
- createDatasource(DatasourceType.LOCAL_TX_DATASOURCE,
- DatasourceType.LOCAL_TX_DATASOURCE.getTemplateHtmlSelectValue(), // "default__Local TX Datasource",
- propertiesMap);
- client.click("resourceConfigurationForm:saveButton");
-
- return propertiesMap;
- }
-
-
-
- /**
- * Create a basic No TX Datasource. Return the mapping of property
- * names to property values.
- */
- protected Map<String, String> createNoTXDatasource(String datasourceName) throws IOException {
- Map<String, String> propertiesMap = new HashMap<String, String>();
- propertiesMap.put("jndi-name", datasourceName);
- propertiesMap.put("prefill", "true");
- propertiesMap.put("track-connection-by-tx", "false");
- propertiesMap.put("max-pool-size", "20");
- propertiesMap.put("min-pool-size", "5");
- propertiesMap.put("blocking-timeout-millis", "55000");
- propertiesMap.put("idle-timeout-minutes", "60");
- propertiesMap.put("noTxSeparatePools", "true");
- propertiesMap.put("user-name", "sa");
- propertiesMap.put("password", "");
- propertiesMap.put("domain", "HsqlDbRealm");
- propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
- propertiesMap.put("connection-url", "jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB");
-
- createDatasource(DatasourceType.NO_TX_DATASOURCE,
- DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No TX Datasource",
- propertiesMap);
- client.click("resourceConfigurationForm:saveButton");
-
- return propertiesMap;
- }
-
-
- /**
- * Create a basic XA Datasource. Return the mapping of property
- * name to property values.
- */
- protected Map<String, String> createXADatasource(String datasourceName) throws IOException {
- Map<String, String> propertiesMap = new HashMap<String, String>();
- propertiesMap.put("jndi-name", datasourceName);
- propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
- propertiesMap.put("xa-resource-timeout", "36000");
- propertiesMap.put("max-pool-size", "15");
- propertiesMap.put("min-pool-size", "6");
- propertiesMap.put("set-tx-query-timeout", "false");
- propertiesMap.put("user-name", "testUser");
-
- createDatasource(DatasourceType.XA_DATASOURCE,
- DatasourceType.XA_DATASOURCE.getTemplateHtmlSelectValue(), //"default__XA Datasource",
- propertiesMap);
- client.click("resourceConfigurationForm:saveButton");
-
- return propertiesMap;
- }
-
-
-
-
-
- /**
- *
- * @returns a name of the Datasource's config file to check the properties in.
- */
- protected abstract String getDatasourceConfigFile( String jndiName );
-
- protected abstract String getMBeanName( String jndiName, String serviceName );
-
-
-
- /**
- * This method is wrapper that handles JMX exceptions at Base level.
- * Intended to keep AS-version-specific method, isMBeanStateDeployedImpl(), as small as possible.
- * @param deploymentMBean
- * @return
- * @throws javax.management.JMException
- * @throws java.io.IOException
- */
- protected boolean isMBeanStateDeployed( ObjectName deploymentMBean ) {
-
- try {
- return this.isMBeanStateDeployedImpl(deploymentMBean);
- }
- // This super-exception includes JMX operation failures, including:
- // AttributeNotFoundException, InstanceNotFoundException, MalformedObjectNameException, ServiceNotFoundException
- catch (OperationsException ex) {
- log.warn("JMX operation error when retrieving MBean attribute.", ex);
- return false;
- }
- // All other JMX failures...
- catch (JMException ex) {
- log.warn("JMX error when retrieving MBean attribute.", ex);
- return false;
- }
- catch (IOException ex) {
- log.warn("I/O error when retrieving MBean attribute.", ex);
- return false;
- }
-
- }// isMBeanStateDeployed()
-
-
-
- /**
- * containsElement returns whether or not the *-ds.xml file corresponding
- * to the datasource given by jndiName contains the given element.
- */
- protected boolean containsElement(String jndiName, String elementName) {
- try {
- File file = new File(this.getDatasourceConfigFile(jndiName));
- SAXBuilder builder = new SAXBuilder();
- Document doc = builder.build(file);
-
- Element root = doc.getRootElement();
- assertTrue(root.getName().equals("datasources"));
- return root.getChild(elementName) != null;
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-
-
- /**
- * Make sure that the metrics corresponding to the given datasource
- * are correct.
- *
- * @param metricsMap maps metric names to the expected metric values.
- */
- protected void checkMetrics(String datasourceName,
- DatasourceType datasourceType,
- Map<String, String> metricsMap) throws IOException, EmbJoprTestException {
-
- refreshTreeNode("Datasources");
- ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
- datasourceTypeArrow.click();
-
- HtmlAnchor datasource = getNavTreeLink(datasourceName);
- datasource.click();
-
- // Check values under the "Metrics" tab
- HtmlAnchor metricsLink = (HtmlAnchor)client.getElement("metricsTab");
- 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");
- 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");
- summaryLink.click();
-
- ArrayList<String> summaryMetrics = new ArrayList<String>();
- 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");
- actual = normalizeIfDoubleExpected(expected, actual); // Some LOCALEs encode doubles with coma.
- assertEquals("Incorrect summary metric value for '"+metricName+"'='"+actual+"'," +
- " expected '"+expected+"'", expected, actual);
- }
- }
-
- /**
- * 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.
- */
- protected abstract boolean isMBeanStateDeployedImpl( ObjectName deploymentMBean ) throws JMException, IOException;
-
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-09 23:36:10 UTC (rev 197)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-10 15:41:53 UTC (rev 198)
@@ -173,7 +173,7 @@
if (linkText.contains(linkLabel)) return link;
}
- throw new IllegalStateException("Nav Tree link for '"
+ throw new IllegalStateException("Link for '"
+ linkLabel
+ "' not found.");
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java 2009-03-09 23:36:10 UTC (rev 197)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java 2009-03-10 15:41:53 UTC (rev 198)
@@ -39,11 +39,10 @@
/**
* 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.
+ * configuring, and deleting various types of datasources.
*
- * @author Farah Juma
- *
+ * @author Ondrej Zizka
+ *
*/
public class DatasourceTest extends org.jboss.jopr.jsfunit.DatasourceTestBase {
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-09 23:36:10 UTC (rev 197)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-10 15:41:53 UTC (rev 198)
@@ -33,6 +33,8 @@
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;
/**
* When complete, this class will contain tests for creating,
@@ -45,6 +47,10 @@
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();
/**
* Create a new datasource using the given type, template, and properties.
@@ -156,9 +162,17 @@
menu.setSelectedAttribute(MAX_ITEMS_PER_PAGE, Boolean.TRUE);
}
- HtmlButtonInput deleteButton = getDeleteButton("categorySummaryForm",
- datasourceName);
- deleteButton.click();
+ HtmlButtonInput deleteButton;
+ try {
+ deleteButton = getDeleteButton("categorySummaryForm", datasourceName);
+ deleteButton.click();
+ } catch (IllegalStateException e) {
+
+ // The delete button was not found on this page
+ client.click("nextPage");
+ deleteButton = getDeleteButton("categorySummaryForm", datasourceName);
+ deleteButton.click();
+ }
}
/**
@@ -206,12 +220,77 @@
{
return new TestSuite(DatasourceTest.class);
}
-
+
/*
* DELETION TESTS
*/
+
+ /**
+ * Remove a Local TX Datasource.
+ */
+ public void testDeleteLocalTXDatasource() throws Exception {
+ Map<String, String> propertiesMap = createLocalTXDatasource("DeleteLocalTXDS");
+
+ // The message we expect to see
+ String expectedMessage = "Successfully deleted Local TX Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, 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");
+
+ // The message we expect to see
+ String expectedMessage = "Successfully deleted No TX Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, propertiesMap, NO_TX_COMPONENT_TYPE,
+ DatasourceType.NO_TX_DATASOURCE);
+ }
+
+ /**
+ * Remove an XA Datasource.
+ */
+ public void testDeleteXADatasource() throws Exception {
+ Map<String, String> propertiesMap = createXADatasource("DeleteXADS");
+
+ // The message we should see
+ String expectedMessage = "Successfully deleted XA Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+
+ deleteDS(expectedMessage, propertiesMap,
+ XA_COMPONENT_TYPE, DatasourceType.XA_DATASOURCE);
+ }
+
+ /**
+ * Common code for the testDelete* tests.
+ */
+ private void deleteDS(String expectedMessage, Map<String, String> propertiesMap,
+ ComponentType componentType, DatasourceType datasourceType) throws Exception {
+
+ deleteDatasource(propertiesMap.get("jndi-name"));
+
+ 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.)
@@ -225,6 +304,10 @@
// Check for the appropriate success messages
String expectedMessage = "Successfully deleted No TX Datasource 'NoTX'";
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+ // Make sure the ManagedComponent was removed
+ assertNull("The datasource was not removed after deletion (the ManagedComponent is non-null)",
+ getManagedComponent("NoTX", NO_TX_COMPONENT_TYPE));
// Make sure only the No TX Datasource entry was removed
// from the -ds.xml file
@@ -262,9 +345,6 @@
fillOutForm(propertiesMapChanges);
client.click("resourceConfigurationForm:saveButton");
- // Update our expected property values
- propertiesMap.putAll(propertiesMapChanges);
-
// Check for the appropriate success messages
String expectedMessage = "Successfully updated XA Datasource '"
+ propertiesMap.get("jndi-name") + "'";
@@ -274,7 +354,7 @@
DatasourceType.XA_DATASOURCE));
assertTrue(checkProperties(propertiesMap.get("jndi-name"),
DatasourceType.XA_DATASOURCE,
- propertiesMap));
+ propertiesMapChanges));
// Clean up
deleteDatasource(propertiesMap.get("jndi-name"));
@@ -305,9 +385,6 @@
fillOutForm(propertiesMapChanges);
client.click("resourceConfigurationForm:saveButton");
- // Update our expected property values
- propertiesMap.putAll(propertiesMapChanges);
-
// Check for the appropriate success messages
String expectedMessage = "Successfully updated Local TX Datasource '"
+ propertiesMap.get("jndi-name") + "'";
@@ -317,7 +394,7 @@
DatasourceType.LOCAL_TX_DATASOURCE));
assertTrue(checkProperties(propertiesMap.get("jndi-name"),
DatasourceType.LOCAL_TX_DATASOURCE,
- propertiesMap));
+ propertiesMapChanges));
// Clean up
deleteDatasource(propertiesMap.get("jndi-name"));
@@ -340,13 +417,17 @@
enableOrDisableFormInput("user-name", Boolean.FALSE);
enableOrDisableFormInput("idle-timeout-minutes", Boolean.FALSE);
- enableOrDisableFormInput("prefill", Boolean.FALSE);
+ enableOrDisableFormInput("track-connection-by-tx", Boolean.FALSE);
+ enableOrDisableFormInput("domain", Boolean.FALSE);
+ enableOrDisableFormInput("noTxSeparatePools", Boolean.FALSE);
client.click("resourceConfigurationForm:saveButton");
// Update our expected property values
propertiesMap.remove("user-name");
propertiesMap.remove("idle-timeout-minutes");
- propertiesMap.remove("prefill");
+ propertiesMap.remove("track-connection-by-tx");
+ propertiesMap.remove("domain");
+ propertiesMap.remove("noTxSeparatePools");
// Check for the appropriate success messages
String expectedMessage = "Successfully updated No TX Datasource '"
15 years, 10 months
EMBJOPR SVN: r197 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-09 19:36:10 -0400 (Mon, 09 Mar 2009)
New Revision: 197
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
Log:
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java 2009-03-09 23:30:26 UTC (rev 196)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DebugUtils.java 2009-03-09 23:36:10 UTC (rev 197)
@@ -1,8 +1,10 @@
package org.jboss.jopr.jsfunit;
+import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.channels.FileChannel;
@@ -37,10 +39,26 @@
// TODO: Do this better... Maven surely provides target path.
//sFilePath = "target/"+sFilePath;
- new FileWriter(sFilePath).write(content);
+ //new FileWriter(sFilePath).write(content);
+ new FileOutputStream(sFilePath).write(content.getBytes());
}
+
+ static void writeFile(String sToPath, byte[] bytes) throws FileNotFoundException, IOException {
+ new FileOutputStream(sToPath).write(bytes);
+ }
+ public static String readFileAsString(String filePath) throws java.io.IOException {
+ StringBuilder fileData = new StringBuilder(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ char[] buf = new char[1024];
+ int numRead=0;
+ while((numRead=reader.read(buf)) != -1){
+ fileData.append(buf, 0, numRead);
+ }
+ reader.close();
+ return fileData.toString();
+ }
/**
@@ -84,4 +102,5 @@
+
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-09 23:30:26 UTC (rev 196)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-09 23:36:10 UTC (rev 197)
@@ -151,6 +151,7 @@
// USER B.
+
final WebClient wc = new WebClient(BrowserVersion.FIREFOX_3);
wc.setThrowExceptionOnFailingStatusCode(false);
wc.setConfirmHandler(new SimpleConfirmHandler(true));
@@ -166,13 +167,14 @@
setValue(loginPage, passwordComponent, PASS_B);
clickSubmitComponent(loginPage, submitComponent);
- String pageBText = new WebClientTools(wc).getResponseBodyAsText();
+ String pageBText = sessBclient.getPageAsText();
assertTrue("Page doesn't contain user's name.", pageBText.contains(USER_B) );
assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.", pageBText.contains(LABEL_LOGOUT) );
// Refresh and log USER_A out.
+
((HtmlPage) client.getContentPage()).refresh();
byte[] responseBBody = client.getContentPage().getWebResponse().getResponseBody();
@@ -181,8 +183,9 @@
// Refresh sessB page Check that USER_B is still logged in.
+
((HtmlPage) new WebClientTools(wc).getContentPage()).refresh();
- String pageBText2 = new WebClientTools(wc).getResponseBodyAsText();
+ String pageBText2 = sessBclient.getPageAsText();
assertTrue("Page doesn't contain user's name.", pageBText2.contains(USER_B) );
assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.", pageBText2.contains(LABEL_LOGOUT) );
}
15 years, 10 months
EMBJOPR SVN: r196 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-09 19:30:26 -0400 (Mon, 09 Mar 2009)
New Revision: 196
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
Log:
Multiple login test passes.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-09 22:31:36 UTC (rev 195)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-09 23:30:26 UTC (rev 196)
@@ -25,11 +25,20 @@
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.WebResponse;
import com.gargoylesoftware.htmlunit.html.*;
+import java.io.BufferedReader;
+import java.io.FileReader;
import java.io.IOException;
+import java.io.StringReader;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.xerces.xni.parser.XMLDocumentFilter;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.cyberneko.html.HTMLConfiguration;
+import org.cyberneko.html.filters.DefaultFilter;
+import org.cyberneko.html.filters.Writer;
import org.jboss.jsfunit.framework.WebClientSpec;
import org.jboss.jsfunit.framework.WebConversationFactory;
import org.jboss.jsfunit.jsfsession.JSFClientSession;
@@ -59,7 +68,8 @@
}
private static final String LABEL_LOGOUT = "Logout";
- public void setUp() throws IOException
+
+ public void XsetUp() throws IOException
{
// Announce this test in the JBoss log.
@@ -122,37 +132,30 @@
* Logs in using several
* @throws java.io.IOException
*
- * Fails because the page header is missing for some reason.
- * TODO: Find out why.
+ * PASSED.
*/
public void testMultipleUsersLogin() throws IOException
{
-
+
// USER A.
- log.info("Logging in with first user, '"+USER_A+"'");
- SessionInstance sessA = new SessionInstance(USER_A, PASS_A);
+ String pageText = client.getPageAsText();
+ assertTrue("Page doesn't contain user's name.", pageText.contains(USER_A) );
+ assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.", pageText.contains(LABEL_LOGOUT) );
- //DebugUtils.writeFile("target/asd.html", sessA.client.getPageAsText());///
+ assertEquals("JSF's '#{identity.username}' should be the user name.",
+ USER_A, server.getManagedBeanValue("#{identity.username}") );
+
- assertTrue("Page doesn't contain user's name.",
- sessA.getClient().getPageAsText().contains(USER_A) );
- assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.",
- sessA.getClient().getPageAsText().contains(LABEL_LOGOUT) );
- assertEquals("JSF's '#{identity.username}' should be the user name.",
- USER_A, sessA.getServer().getManagedBeanValue("#{identity.username}") );
- DebugUtils.writeFile("target/multiuser1.html", sessA.getClient().getPageAsText());///
-
-
// USER B.
final WebClient wc = new WebClient(BrowserVersion.FIREFOX_3);
wc.setThrowExceptionOnFailingStatusCode(false);
wc.setConfirmHandler(new SimpleConfirmHandler(true));
final WebClientTools sessBclient = new WebClientTools(wc);
-
+
final String userNameComponent = "login_form:name";
final String passwordComponent = "login_form:password";
final String submitComponent = "login_form:submit";
@@ -163,30 +166,34 @@
setValue(loginPage, passwordComponent, PASS_B);
clickSubmitComponent(loginPage, submitComponent);
- assertTrue("Page doesn't contain user's name.",
- sessBclient.getPageAsText().contains(USER_B) );
- assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.",
- sessBclient.getPageAsText().contains(LABEL_LOGOUT) );
+ String pageBText = new WebClientTools(wc).getResponseBodyAsText();
+ assertTrue("Page doesn't contain user's name.", pageBText.contains(USER_B) );
+ assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.", pageBText.contains(LABEL_LOGOUT) );
// Refresh and log USER_A out.
- ((HtmlPage) sessA.getClient().getContentPage()).refresh();
- DebugUtils.writeFile("target/multiuser2.html", sessA.getClient().getPageAsText());///
+ ((HtmlPage) client.getContentPage()).refresh();
+ byte[] responseBBody = client.getContentPage().getWebResponse().getResponseBody();
- HtmlAnchor logoutLink = (HtmlAnchor) sessA.getClient().getElement("logoutLink");
+ HtmlAnchor logoutLink = (HtmlAnchor) client.getElement("logoutLink");
logoutLink.click();
// Refresh sessB page Check that USER_B is still logged in.
- assertTrue("Page doesn't contain user's name.",
- sessBclient.getPageAsText().contains(USER_B) );
- assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.",
- sessBclient.getPageAsText().contains(LABEL_LOGOUT) );
+ ((HtmlPage) new WebClientTools(wc).getContentPage()).refresh();
+ String pageBText2 = new WebClientTools(wc).getResponseBodyAsText();
+ assertTrue("Page doesn't contain user's name.", pageBText2.contains(USER_B) );
+ assertTrue("Page doesn't contain '"+LABEL_LOGOUT+"'.", pageBText2.contains(LABEL_LOGOUT) );
}
+
+
+
+
+
// These were taken from FomrAuthenticationStrategy.java; unfortunately not reusable from there.
protected Page clickSubmitComponent(HtmlPage page, String elementName) throws IOException
15 years, 10 months