Author: ozizka(a)redhat.com
Date: 2009-11-04 21:25:22 -0500 (Wed, 04 Nov 2009)
New Revision: 836
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/hmlunit/
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/hmlunit/HtmlPageBumper.java
Log:
* Introducing HtmlPageBumper - to have a single point of HTMLUnit's incompatible
changes friction point.
Note: Previous commit (RootNodeTest) was still compatible with HTMLUnit 2.3.
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/hmlunit/HtmlPageBumper.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/hmlunit/HtmlPageBumper.java
(rev 0)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/hmlunit/HtmlPageBumper.java 2009-11-05
02:25:22 UTC (rev 836)
@@ -0,0 +1,59 @@
+
+package org.jboss.jopr.jsfunit.util.hmlunit;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.WebResponse;
+import com.gargoylesoftware.htmlunit.WebWindow;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public class HtmlPageBumper extends HtmlPage {
+
+ public HtmlPageBumper(HtmlPage page) {
+ super( safeURL(page.getDocumentURI()), page.getWebResponse(),
page.getEnclosingWindow());
+ }
+
+
+ public HtmlPageBumper(URL originatingUrl, WebResponse webResponse, WebWindow webWindow)
{
+ super(originatingUrl, webResponse, webWindow);
+ }
+
+ @Override
+ public HtmlElement getHtmlElementById(String elementId) {
+ return super.getElementById(elementId);
+ }
+
+ public <E extends HtmlElement> E getHtmlElementByName(String name) throws
ElementNotFoundException {
+ return super.getElementByName(name);
+ }
+
+ public List<HtmlElement> getHtmlElementsByName(String name) {
+ return super.getElementsByName(name);
+ }
+
+
+
+
+
+
+
+ private static URL safeURL( String url ){
+ try {
+ return new URL(url);
+ } catch (MalformedURLException ex) {
+ Logger.getLogger(HtmlPageBumper.class.getName()).error("Original page has invalid
URL: "+url);
+ return null;
+ }
+ }
+
+
+}// class
+
Show replies by date