[Yanel-commits] rev 40531 - in
public/yanel/trunk/src/test/htmlunit: . org/wyona/yanel/htmlunit
org/wyona/yanel/htmlunit/yanelwebsite
simon at wyona.com
simon at wyona.com
Tue Dec 16 12:13:11 CET 2008
Author: simon
Date: 2008-12-16 12:13:10 +0100 (Tue, 16 Dec 2008)
New Revision: 40531
Modified:
public/yanel/trunk/src/test/htmlunit/htmlunit-properties.xml
public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/AbstractHtmlUnitTest.java
public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/yanelwebsite/GlobalDataWebTest.java
Log:
fixes test to work with a configured prefix. also allow local.properties file. thanks to guillaume
Modified: public/yanel/trunk/src/test/htmlunit/htmlunit-properties.xml
===================================================================
--- public/yanel/trunk/src/test/htmlunit/htmlunit-properties.xml 2008-12-16 09:52:05 UTC (rev 40530)
+++ public/yanel/trunk/src/test/htmlunit/htmlunit-properties.xml 2008-12-16 11:13:10 UTC (rev 40531)
@@ -1,4 +1,3 @@
-<?xml version="1.0"?>
<config>
<htmlunit>
<!--
@@ -12,6 +11,7 @@
-->
<debugLevel>4</debugLevel>
<baseUrl>http://localhost:8080/yanel/</baseUrl>
+ <reservedPrefix>yanel/</reservedPrefix>
<language>en</language>
<!--
<language>en-us</language>
Modified: public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/AbstractHtmlUnitTest.java
===================================================================
--- public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/AbstractHtmlUnitTest.java 2008-12-16 09:52:05 UTC (rev 40530)
+++ public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/AbstractHtmlUnitTest.java 2008-12-16 11:13:10 UTC (rev 40531)
@@ -109,8 +109,13 @@
protected File baseDir;
- protected List collectedAlerts = new ArrayList();
+ protected List<Object> collectedAlerts = new ArrayList<Object>();
+ /**
+ * The prefix reserved by Yanel just at the start of the realm URI to host pages like about.html, the repository browser, etc.
+ */
+ protected String reservedPrefix;
+
/*
* (non-Javadoc)
*
@@ -119,14 +124,18 @@
protected void setUp() throws Exception {
super.setUp();
- // read the config file
- URL configURL = this.getClass().getClassLoader().getResource("htmlunit-properties.xml");
+ // read the configuration file
+ URL configURL = this.getClass().getClassLoader().getResource("local.htmlunit-properties.xml");
+ if (configURL == null) {
+ configURL = this.getClass().getClassLoader().getResource("htmlunit-properties.xml");
+ }
config = new XMLConfiguration(configURL);
SimpleLog log = new SimpleLog("htmlunit log");
log.setLevel(Integer.parseInt(this.config.getString("htmlunit.debugLevel")));
this.logger = log;
this.baseURL = this.config.getString("htmlunit.baseUrl");
+ this.reservedPrefix = this.config.getString("htmlunit.reservedPrefix");
// this.webClient = new WebClient(BrowserVersion.MOZILLA_1_0);
// this.webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_6_0);
this.webClient = new WebClient();
@@ -279,7 +288,7 @@
protected void clickLink(String linkPath) throws Exception {
final HtmlElement documentElement = currentPage.getDocumentElement();
- final List links = documentElement.getHtmlElementsByAttribute("a", "href", linkPath);
+ final List<?> links = documentElement.getHtmlElementsByAttribute("a", "href", linkPath);
HtmlAnchor link = (HtmlAnchor) links.get(0);
click(link);
}
Modified: public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/yanelwebsite/GlobalDataWebTest.java
===================================================================
--- public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/yanelwebsite/GlobalDataWebTest.java 2008-12-16 09:52:05 UTC (rev 40530)
+++ public/yanel/trunk/src/test/htmlunit/org/wyona/yanel/htmlunit/yanelwebsite/GlobalDataWebTest.java 2008-12-16 11:13:10 UTC (rev 40531)
@@ -23,7 +23,6 @@
public class GlobalDataWebTest extends AbstractHtmlUnitTest {
private String getReservedURL(String resourceRelativeURL) throws Exception {
- String reservedPrefix = "yanel/";//XXX HACK
return reservedPrefix + resourceRelativeURL;
}
@@ -70,13 +69,13 @@
public void testResourceTypesPages() throws Exception {
loadReservedErrorPage("resource-types/dummy", /* XXX: should be 404: */500);
- loadReservedErrorPage("resource-types/http%3a%2f%2fwww.wyona.org%2fyanel%2fresource%2f1.0%3a%3afile/yanel/icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
- loadReservedErrorPage("resource-types/^http^3a^2f^2fwww.wyona.org^2fyanel^2fresource^2f1.0::file/yanel/icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
- loadReservedErrorPage("resource-types/http://www.wyona.org/yanel/resource/1.0::file/yanel/icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
+ loadReservedErrorPage("resource-types/http%3a%2f%2fwww.wyona.org%2fyanel%2fresource%2f1.0%3a%3afile/"+reservedPrefix+"icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
+ loadReservedErrorPage("resource-types/^http^3a^2f^2fwww.wyona.org^2fyanel^2fresource^2f1.0::file/"+reservedPrefix+"icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
+ loadReservedErrorPage("resource-types/http://www.wyona.org/yanel/resource/1.0::file/"+reservedPrefix+"icons/1x1/rt-icon.png", /* XXX: should be 404: */500);
- loadReservedResource("resource-types/http%3a%2f%2fwww.wyona.org%2fyanel%2fresource%2f1.0%3a%3afile/yanel/icons/32x32/rt-icon.png");
- loadReservedResource("resource-types/^http^3a^2f^2fwww.wyona.org^2fyanel^2fresource^2f1.0::file/yanel/icons/32x32/rt-icon.png");
- loadReservedResource("resource-types/http://www.wyona.org/yanel/resource/1.0::file/yanel/icons/32x32/rt-icon.png");
+ loadReservedResource("resource-types/http%3a%2f%2fwww.wyona.org%2fyanel%2fresource%2f1.0%3a%3afile/"+reservedPrefix+"icons/32x32/rt-icon.png");
+ loadReservedResource("resource-types/^http^3a^2f^2fwww.wyona.org^2fyanel^2fresource^2f1.0::file/"+reservedPrefix+"icons/32x32/rt-icon.png");
+ loadReservedResource("resource-types/http://www.wyona.org/yanel/resource/1.0::file/"+reservedPrefix+"icons/32x32/rt-icon.png");
assertNotNull(response.getResponseHeaderValue("Last-Modified"));
//TODO: test 304 handling
More information about the Yanel-commits
mailing list