Revision: 827
http://jwebunit.svn.sourceforge.net/jwebunit/?rev=827&view=rev
Author: jevonwright
Date: 2010-03-10 06:45:14 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
creating a protected method, createWebClient(), allowing the created web client
to be modified if necessary - related to issue 2697234
Modified Paths:
--------------
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
2010-03-03 21:26:11 UTC (rev 826)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
2010-03-10 06:45:14 UTC (rev 827)
@@ -2748,7 +2748,7 @@
* @return the value found in a field for the given label/ID, or
* <code>null</code> if none was found
*/
- protected String getLabeledFieldValue(String identifier, IElement label) {
+ public String getLabeledFieldValue(String identifier, IElement label) {
List<IElement> fields = getFieldsForLabel(label);
Assert.assertFalse("No field found for label [" + identifier + "]",
fields.isEmpty());
Modified:
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
===================================================================
---
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
2010-03-03 21:26:11 UTC (rev 826)
+++
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
2010-03-10 06:45:14 UTC (rev 827)
@@ -744,10 +744,19 @@
}
}
}
-
- private void initWebClient() {
-
- /**
+
+ /**
+ * Create the {...@link WebClient} that will be used for this test.
+ * Subclasses should only override this method if they need to override
+ * the default {...@link WebClient}.
+ *
+ * <p>Also see issue 2697234.
+ *
+ * @author Jevon
+ * @return A newly created {...@link WebClient}
+ */
+ protected WebClient createWebClient() {
+ /*
* The user agent string is now provided by default to new test cases.
* It can still be overridden if testContext.getUserAgent() is not
* null (i.e. has been set manually.)
@@ -764,13 +773,21 @@
bv = defaultBrowserVersion; // use default (which
includes a full UserAgent string)
}
- if (getTestContext().getProxyHost()!=null &&
getTestContext().getProxyPort()>0) {
- //Proxy
- wc = new WebClient(bv, getTestContext().getProxyHost(),
getTestContext().getProxyPort());
+ if (getTestContext().getProxyHost() != null &&
getTestContext().getProxyPort() > 0) {
+ // Proxy configuration
+ return new WebClient(bv, getTestContext().getProxyHost(),
getTestContext().getProxyPort());
+ } else {
+ return new WebClient(bv);
}
- else {
- wc = new WebClient(bv);
- }
+ }
+
+ /**
+ * Initialise the web client before accessing a page.
+ */
+ private void initWebClient() {
+
+ wc = createWebClient();
+
wc.setJavaScriptEnabled(jsEnabled);
wc.setThrowExceptionOnScriptError(throwExceptionOnScriptError);
wc.setRedirectEnabled(true);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development