Author: alexsmirnov
Date: 2009-01-27 20:25:39 -0500 (Tue, 27 Jan 2009)
New Revision: 12446
Added:
trunk/test-applications/ajaxTest/src/test/resources/richfaces-web.xml
trunk/test-applications/ajaxTest/src/test/resources/test-faces-config.xml
trunk/test-applications/ajaxTest/src/test/resources/webapp.properties
Modified:
trunk/framework/jsf-test/pom.xml
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
Log:
Update test framework dependencies to the HtmlUnit 2.4
Modified: trunk/framework/jsf-test/pom.xml
===================================================================
--- trunk/framework/jsf-test/pom.xml 2009-01-27 19:27:36 UTC (rev 12445)
+++ trunk/framework/jsf-test/pom.xml 2009-01-28 01:25:39 UTC (rev 12446)
@@ -20,12 +20,12 @@
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
- <version>2.3</version>
+ <version>2.4</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>1.2_11</version>
+ <version>1.2_12</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -41,7 +41,7 @@
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit-core-js</artifactId>
- <version>2.2</version>
+ <version>2.4</version>
</dependency>
<dependency>
<groupId>net.sourceforge.cssparser</groupId>
@@ -66,7 +66,7 @@
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
- <version>1.9.9</version>
+ <version>1.9.11</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
@@ -101,7 +101,7 @@
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>1.2_11</version>
+ <version>1.2_12</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -112,7 +112,7 @@
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
- <version>2.7.0</version>
+ <version>2.7.1</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
Modified:
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java
===================================================================
---
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java 2009-01-27
19:27:36 UTC (rev 12445)
+++
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java 2009-01-28
01:25:39 UTC (rev 12446)
@@ -57,7 +57,8 @@
if(null != body &&
FormEncodingType.URL_ENCODED.getName().equals(contentType)){
connection.parseFormParameters(body);
}
+ long startTime = System.currentTimeMillis();
connection.execute();
- return new LocalWebResponse(settings,connection);
+ return new LocalWebResponse(settings,connection,System.currentTimeMillis()-startTime);
}
}
\ No newline at end of file
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
===================================================================
---
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2009-01-27
19:27:36 UTC (rev 12445)
+++
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2009-01-28
01:25:39 UTC (rev 12446)
@@ -6,6 +6,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -39,16 +40,21 @@
*
*/
public class LocalWebResponse implements WebResponse {
+
private WebRequestSettings settings;
+
private final StagingConnection serverConnection;
+
+ private final long loadTime;
- public LocalWebResponse(StagingConnection serverConnection) {
+ public LocalWebResponse(StagingConnection serverConnection,long l) {
this.serverConnection = serverConnection;
+ this.loadTime = l;
}
public LocalWebResponse(WebRequestSettings settings,
- StagingConnection connection) {
- this(connection);
+ StagingConnection connection, long l) {
+ this(connection,l);
this.settings = settings;
}
@@ -90,7 +96,7 @@
* com.gargoylesoftware.htmlunit.WebResponse#getLoadTimeInMilliSeconds()
*/
public long getLoadTimeInMilliSeconds() {
- return 0;
+ return loadTime;
}
/*
@@ -185,4 +191,40 @@
}
return headers;
}
+
+ /* (non-Javadoc)
+ * @see com.gargoylesoftware.htmlunit.WebResponse#getContentAsBytes()
+ */
+ public byte[] getContentAsBytes() {
+ return serverConnection.getResponseBody();
+ }
+
+ /* (non-Javadoc)
+ * @see com.gargoylesoftware.htmlunit.WebResponse#getContentAsString(java.lang.String)
+ */
+ public String getContentAsString(String encoding) {
+ byte[] body = serverConnection.getResponseBody();
+ String content;
+ try {
+ content = new String(body,encoding);
+ } catch (UnsupportedEncodingException e) {
+ content = new String(body);
+ }
+ return content;
+ }
+
+ /* (non-Javadoc)
+ * @see com.gargoylesoftware.htmlunit.WebResponse#getLoadTime()
+ */
+ public long getLoadTime() {
+ return loadTime;
+ }
+
+ /* (non-Javadoc)
+ * @see com.gargoylesoftware.htmlunit.WebResponse#getRequestUrl()
+ */
+ public URL getRequestUrl() {
+ // TODO Auto-generated method stub
+ return serverConnection.getUrl();
+ }
}
\ No newline at end of file
Added: trunk/test-applications/ajaxTest/src/test/resources/richfaces-web.xml
===================================================================
--- trunk/test-applications/ajaxTest/src/test/resources/richfaces-web.xml
(rev 0)
+++ trunk/test-applications/ajaxTest/src/test/resources/richfaces-web.xml 2009-01-28
01:25:39 UTC (rev 12446)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <display-name>ajaxTest</display-name>
+ <description>ajax simple repeater test</description>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Property changes on:
trunk/test-applications/ajaxTest/src/test/resources/richfaces-web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-applications/ajaxTest/src/test/resources/test-faces-config.xml
===================================================================
--- trunk/test-applications/ajaxTest/src/test/resources/test-faces-config.xml
(rev 0)
+++ trunk/test-applications/ajaxTest/src/test/resources/test-faces-config.xml 2009-01-28
01:25:39 UTC (rev 12446)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <application>
+ <!--
+ <message-bundle>messages</message-bundle>
+ -->
+ <locale-config>
+ <default-locale>en</default-locale>
+ </locale-config>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Property changes on:
trunk/test-applications/ajaxTest/src/test/resources/test-faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-applications/ajaxTest/src/test/resources/webapp.properties
===================================================================
--- trunk/test-applications/ajaxTest/src/test/resources/webapp.properties
(rev 0)
+++ trunk/test-applications/ajaxTest/src/test/resources/webapp.properties 2009-01-28
01:25:39 UTC (rev 12446)
@@ -0,0 +1 @@
+webroot=../../main/webapp
Property changes on:
trunk/test-applications/ajaxTest/src/test/resources/webapp.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain