Author: alexsmirnov
Date: 2009-02-03 16:12:47 -0500 (Tue, 03 Feb 2009)
New Revision: 12555
Added:
branches/jsf2.0/examples/repeater/src/main/java/javax/
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/BehaviorRenderer.java
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/ClientSideBehavior.java
Modified:
branches/jsf2.0/framework/jsf-test/pom.xml
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/AbstractServerResource.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ClasspathServerResource.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ServerResourcesDirectory.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaggingJspApplicationContext.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpRequest.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpResponse.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpSession.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServletContext.java
branches/jsf2.0/framework/jsf-test/src/main/javadoc/org/richfaces/test/package.html
branches/jsf2.0/framework/jsf-test/src/main/javadoc/overview.html
branches/jsf2.0/framework/pom.xml
branches/jsf2.0/tests/ajax/pom.xml
Log:
Upgrade Jsf-Test dependencies, merge with trunk.
Added:
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/BehaviorRenderer.java
===================================================================
---
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/BehaviorRenderer.java
(rev 0)
+++
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/BehaviorRenderer.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package javax.faces.ajax;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface BehaviorRenderer {
+
+ /**
+ * @param context
+ * @param behavior
+ */
+ public void decode(FacesContext context, ClientSideBehavior behavior);
+
+ /**
+ * @param context
+ * @param behavior
+ * @return
+ */
+ public String getCode(FacesContext context, ClientSideBehavior behavior);
+}
Property changes on:
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/BehaviorRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/ClientSideBehavior.java
===================================================================
---
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/ClientSideBehavior.java
(rev 0)
+++
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/ClientSideBehavior.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -0,0 +1,42 @@
+/**
+ *
+ */
+package javax.faces.ajax;
+
+import java.io.Serializable;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface ClientSideBehavior extends Serializable {
+ /**
+ * This method called during the Ajaxifiable#addAjaxBehavior(String eventName,
AjaxBehavior behavior)
+ * to inform behavior implementation for that component it belongs to.
+ * @param component
+ */
+ public void setComponent(UIComponent component);
+
+ /**
+ * @return component for which behavior belongs.
+ */
+ public UIComponent getComponent();
+
+ /**
+ * Create client-side listener call body. In the common case, behavior should delegate
this call to its renderer.
+ * @param context current JSF context
+ * @return client-side function call body.
+ */
+ public String getCode(FacesContext context);
+
+ /**
+ * Return renderer for the this behavior. implementation should get appropriate
renderer
+ * from the current RenderKit by randerer type.
+ * @param context
+ * @return corresponding renderer instance from the current RenderKit.
+ */
+ public BehaviorRenderer getRenderer(FacesContext context);
+}
Property changes on:
branches/jsf2.0/examples/repeater/src/main/java/javax/faces/ajax/ClientSideBehavior.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/jsf2.0/framework/jsf-test/pom.xml
===================================================================
--- branches/jsf2.0/framework/jsf-test/pom.xml 2009-02-03 16:34:38 UTC (rev 12554)
+++ branches/jsf2.0/framework/jsf-test/pom.xml 2009-02-03 21:12:47 UTC (rev 12555)
@@ -20,24 +20,19 @@
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
- <version>2.3</version>
+ <version>2.4</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.0-b05</version>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
- <artifactId>mojarra-jsf-impl</artifactId>
+ <artifactId>jsf-impl</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>el-impl</groupId>
- <artifactId>el-impl</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
@@ -45,7 +40,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>
@@ -70,14 +65,30 @@
<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>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <!--
+ <exclusion> <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId> </exclusion>
+ -->
+ </exclusions>
+
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
- <version>1.0</version>
+ <version>1.2</version>
</dependency>
<dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
@@ -97,10 +108,27 @@
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>de.berlios.jsunit</groupId>
+ <artifactId>jsunit</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebConnection.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -5,8 +5,6 @@
import java.io.IOException;
-import javax.servlet.ServletException;
-
import org.apache.commons.httpclient.NameValuePair;
import org.richfaces.test.staging.HttpMethod;
import org.richfaces.test.staging.StagingConnection;
@@ -59,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:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -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;
}
/*
@@ -179,7 +185,46 @@
headers.add(new NameValuePair(entry.getKey(), value));
}
}
- ;
+ int contentLength = serverConnection.getResponseContentLength();
+ if(contentLength>=0){
+ headers.add(new NameValuePair("Content-Length",
String.valueOf(contentLength)));
+ }
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
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/AbstractServerResource.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/AbstractServerResource.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/AbstractServerResource.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -4,7 +4,6 @@
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
-import java.util.Collections;
import java.util.Set;
import java.util.logging.Logger;
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ClasspathServerResource.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ClasspathServerResource.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ClasspathServerResource.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -7,7 +7,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.richfaces.test.TestException;
+
/**
* This class represents file from classpath in the virtual web application
* content.
@@ -51,8 +53,11 @@
.getContextClassLoader();
if (null == classLoader) {
classLoader = this.getClass().getClassLoader();
+ }
+ url = classLoader.getResource(classpath);
+ if(null == url){
+ throw new TestException("Virtual server resource can't be loaded from
"+classpath);
}
- url = classLoader.getResource(classpath);
}
}
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ServerResourcesDirectory.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ServerResourcesDirectory.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/ServerResourcesDirectory.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -6,7 +6,6 @@
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaggingJspApplicationContext.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaggingJspApplicationContext.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaggingJspApplicationContext.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -9,21 +9,35 @@
import javax.servlet.ServletContext;
import javax.servlet.jsp.JspApplicationContext;
-import com.sun.el.ExpressionFactoryImpl;
+import org.richfaces.test.TestException;
+
/**
* @author asmirnov
*
*/
public class StaggingJspApplicationContext implements JspApplicationContext {
+ private static final String
DEFAULT_EXPRESSION_FACTORY="com.sun.el.ExpressionFactoryImpl";
+
private final ExpressionFactory expressionFactory ;
private final ServletContext servletContext;
public StaggingJspApplicationContext(ServletContext servletContext) {
this.servletContext = servletContext;
- expressionFactory = ExpressionFactory.newInstance();
+ String elFactoryClass =
servletContext.getInitParameter("com.sun.faces.expressionFactory");
+ if(null == elFactoryClass){
+ elFactoryClass =
servletContext.getInitParameter("com.sun.el.ExpressionFactoryImpl");
+ }
+ if(null == elFactoryClass){
+ elFactoryClass = DEFAULT_EXPRESSION_FACTORY;
+ }
+ try {
+ expressionFactory =
Class.forName(elFactoryClass).asSubclass(ExpressionFactory.class).newInstance();
+ } catch (Exception e) {
+ throw new TestException("Couldn't instantiate EL expression
factory",e);
+ }
}
/* (non-Javadoc)
@@ -37,7 +51,6 @@
* @see javax.servlet.jsp.JspApplicationContext#addELResolver(javax.el.ELResolver)
*/
public void addELResolver(ELResolver resolver) {
-
}
/* (non-Javadoc)
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -150,17 +150,17 @@
return started;
}
- private void checkStarted() {
- if (!isFinished()) {
- throw new TestException("request have not been started");
- }
- }
+// private void checkStarted() {
+// if (!isFinished()) {
+// throw new TestException("request have not been started");
+// }
+// }
- private void checkNotStarted() {
- if (isStarted()) {
- throw new TestException("request was started, no parameters changes
allowed");
- }
- }
+// private void checkNotStarted() {
+// if (isStarted()) {
+// throw new TestException("request was started, no parameters changes
allowed");
+// }
+// }
/**
* Execute this connection request on the associated servlet or filter chain.
@@ -215,11 +215,9 @@
* Set request HTTP methos ( GET, POST etc ).
* @param method
* the method to set
- * @throws TestException
- * if connection have already been started.
*/
public void setRequestMethod(HttpMethod method) {
- checkNotStarted();
+// checkNotStarted();
this.method = method;
}
@@ -235,11 +233,9 @@
* Append additional request parameter.
* @param name
* @param value
- * @throws TestException
- * if connection have already been started.
*/
public void addRequestParameter(String name, String value) {
- checkNotStarted();
+// checkNotStarted();
String[] values = requestParameters.get(name);
if (null == values) {
values = new String[1];
@@ -256,10 +252,10 @@
* Get content of the response as String.
* @return content of the response writer or String created from the ServletOutputStream
with current response encoding.
* @throws TestException
- * if connection have not been started or response has an unsupported
encoding.
+ * if has an unsupported encoding.
*/
public String getContentAsString() {
- checkStarted();
+// checkStarted();
String content = response.getWriterContent();
if (null == content) {
byte[] streamContent = response.getStreamContent();
@@ -283,10 +279,10 @@
* Get content of the response as byte array.
* @return content of the ServletOutputStream or convert String, collected by response
writer, with current response encoding.
* @throws TestException
- * if connection have not been started or response has unsupported encoding.
+ * if response has unsupported encoding.
*/
public byte[] getResponseBody() {
- checkStarted();
+// checkStarted();
byte[] content = response.getStreamContent();
if (null == content) {
String writerContent = response.getWriterContent();
@@ -330,41 +326,33 @@
/**
* @return encoding used to write response.
- * @throws TestException
- * if connection have not been started .
*/
public String getResponseCharacterEncoding() {
- checkStarted();
+// checkStarted();
return response.getCharacterEncoding();
}
/**
* @return content type ( eg 'text/html' ) of the response.
- * @throws TestException
- * if connection have not been started .
*/
public String getResponseContentType() {
- checkStarted();
+// checkStarted();
return response.getContentType();
}
/**
* @return HTTP status code of the response.
- * @throws TestException
- * if connection have not been started .
*/
public int getResponseStatus() {
- checkStarted();
+// checkStarted();
return response.getStatus();
}
/**
* @return HTTP error message.
- * @throws TestException
- * if connection have not been started .
*/
public String getErrorMessage() {
- checkStarted();
+// checkStarted();
return response.getErrorMessage();
}
@@ -372,11 +360,9 @@
* Set request Query string. This method does not parse query string, {@link
#parseFormParameters(String)} should be used.
* @param queryString
* the queryString to set
- * @throws TestException
- * if connection have already been started .
*/
public void setQueryString(String queryString) {
- checkNotStarted();
+// checkNotStarted();
this.queryString = queryString;
}
@@ -390,11 +376,9 @@
/**
* Get HTTP response headers.
* @return headers name-values map.
- * @throws TestException
- * if connection have not been started .
*/
public Map<String, String[]> getResponseHeaders() {
- checkStarted();
+// checkStarted();
return response.getHeaders();
}
@@ -404,7 +388,7 @@
* @throws UnsupportedEncodingException
*/
public void setRequestCharacterEncoding(String charset) throws
UnsupportedEncodingException {
- checkNotStarted();
+// checkNotStarted();
request.setCharacterEncoding(charset);
}
@@ -413,7 +397,7 @@
* @param body
*/
public void setRequestBody(String body) {
- checkNotStarted();
+// checkNotStarted();
request.setRequestBody(body);
}
@@ -422,7 +406,7 @@
* @param contentType
*/
public void setRequestContentType(String contentType) {
- checkNotStarted();
+// checkNotStarted();
request.setContentType(contentType);
}
@@ -432,7 +416,7 @@
* @param headers
*/
public void addRequestHeaders(Map<String, String> headers) {
- checkNotStarted();
+// checkNotStarted();
request.addHeaders(headers);
}
@@ -633,4 +617,8 @@
}
+ public int getResponseContentLength() {
+ return response.getContentLength();
+ }
+
}
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpRequest.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpRequest.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpRequest.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -15,7 +15,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpResponse.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpResponse.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpResponse.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -7,22 +7,15 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.text.DateFormat;
-import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Logger;
import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.httpclient.HttpStatus;
-import org.junit.internal.matchers.SubstringMatcher;
-
/**
* @author asmirnov
*
@@ -53,6 +46,8 @@
private String contentType="text";
+ private int contentLength = Integer.MIN_VALUE;
+
private String encoding = StagingHttpRequest.UTF8;
@@ -404,8 +399,7 @@
* @see javax.servlet.ServletResponse#setContentLength(int)
*/
public void setContentLength(int len) {
- // TODO Auto-generated method stub
- log.info("unimplemented response method setContentLenght");
+ this.contentLength = len;
}
/*
@@ -449,6 +443,13 @@
}
/**
+ * @return the contentLength
+ */
+ int getContentLength() {
+ return contentLength;
+ }
+
+ /**
* @return the redirectLocation
*/
String getRedirectLocation() {
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpSession.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpSession.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingHttpSession.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -4,14 +4,11 @@
package org.richfaces.test.staging;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
@@ -21,6 +18,7 @@
* @author asmirnov
*
*/
+@SuppressWarnings("deprecation")
abstract class StagingHttpSession implements HttpSession {
private static final int DEFAULT_INACTIVE_TIME = 30;
@@ -119,7 +117,6 @@
*
* @see javax.servlet.http.HttpSession#getSessionContext()
*/
- @SuppressWarnings("deprecation")
public HttpSessionContext getSessionContext() {
throw new NotImplementedException("Session context is not implemented");
}
@@ -151,7 +148,7 @@
*/
public void invalidate() {
checkValid();
- unboundAttributes();
+ destroy();
this.valid=false;
}
@@ -168,7 +165,6 @@
*/
public boolean isNew() {
checkValid();
- // TODO Auto-generated method stub
return false;
}
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -13,6 +13,7 @@
import java.util.Enumeration;
import java.util.EventListener;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -44,17 +45,19 @@
import org.richfaces.test.TestException;
/**
- * This class implements limited Http servlet container 2.5 functionality. It is designed
for a test purposes only ,so that has a limitations:
+ * This class implements limited Http servlet container 2.5 functionality. It is
+ * designed for a test purposes only ,so that has a limitations:
* <ul>
* <li>supports local calls only.</li>
* <li>java code only configuration ( no xml files processed ).</li>
* <li>just one web application, 'deployed' in the root
context.</li>
* <li>only one client session</li>
* <li>communicates by the local java calls only, no network connection</li>
- * <li>no JSP compilator support ( but it is possible to register pre-compiled
pages as servlets)</li>
+ * <li>no JSP compilator support ( but it is possible to register pre-compiled
+ * pages as servlets)</li>
* <li>...</li>
* </ul>
- * It is main part of the test framework.
+ * It is main part of the test framework.
*
*/
public class StagingServer {
@@ -73,7 +76,8 @@
private final List<RequestChain> servlets = new ArrayList<RequestChain>();
- private RequestChain defaultServlet= new ServletContainer(null, new StaticServlet());
+ private RequestChain defaultServlet = new ServletContainer(null,
+ new StaticServlet());
private final List<EventListener> contextListeners = new
ArrayList<EventListener>();
@@ -89,16 +93,22 @@
private ServletContext contextProxy;
- private ServerHttpSession session=null;
+ private HttpSession currentSession = null;
+
+ private ThreadLocal<HttpSession> sessions = new ThreadLocal<HttpSession>();
+
+ private List<ServerHttpSession> sessionInstances = new
ArrayList<ServerHttpSession>();
+
+ private boolean sessionPerThread = false;
- private HttpSession sessionProxy=null;
- private boolean initialised=false;
+ private boolean initialised = false;
/**
* This inner class links ServletContext calls to the server instance.
+ *
* @author asmirnov
- *
+ *
*/
private class LocalContext extends StagingServletContext {
@@ -116,8 +126,12 @@
return mimeTypes.get(file);
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingServletContext#valueBound(javax.servlet.ServletContextAttributeEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingServletContext#valueBound(javax
+ * .servlet.ServletContextAttributeEvent)
*/
@Override
protected void valueBound(ServletContextAttributeEvent event) {
@@ -130,8 +144,12 @@
}
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingServletContext#valueReplaced(javax.servlet.ServletContextAttributeEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingServletContext#valueReplaced(javax
+ * .servlet.ServletContextAttributeEvent)
*/
@Override
protected void valueReplaced(ServletContextAttributeEvent event) {
@@ -144,8 +162,12 @@
}
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingServletContext#valueUnbound(javax.servlet.ServletContextAttributeEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingServletContext#valueUnbound(javax
+ * .servlet.ServletContextAttributeEvent)
*/
@Override
protected void valueUnbound(ServletContextAttributeEvent event) {
@@ -158,8 +180,12 @@
}
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingServletContext#getServerResource(java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingServletContext#getServerResource
+ * (java.lang.String)
*/
@Override
protected ServerResource getServerResource(String path) {
@@ -170,20 +196,27 @@
/**
* This inner class links session object calls to the server instance.
+ *
* @author asmirnov
- *
+ *
*/
private class ServerHttpSession extends StagingHttpSession {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see javax.servlet.http.HttpSession#getServletContext()
*/
public ServletContext getServletContext() {
return context;
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingHttpSession#valueBound(javax.servlet.http.HttpSessionBindingEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingHttpSession#valueBound(javax.servlet
+ * .http.HttpSessionBindingEvent)
*/
@Override
protected void valueBound(
@@ -197,8 +230,12 @@
});
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingHttpSession#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingHttpSession#valueUnbound(javax.
+ * servlet.http.HttpSessionBindingEvent)
*/
@Override
protected void valueUnbound(
@@ -212,8 +249,12 @@
});
}
- /* (non-Javadoc)
- * @see
org.richfaces.test.staging.StagingHttpSession#valueReplaced(javax.servlet.http.HttpSessionBindingEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.richfaces.test.staging.StagingHttpSession#valueReplaced(javax
+ * .servlet.http.HttpSessionBindingEvent)
*/
@Override
protected void valueReplaced(
@@ -226,6 +267,12 @@
}
});
}
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ setCurrentSession(null);
+ }
}
/**
@@ -239,11 +286,13 @@
invoker.invoke((T) listener);
}
}
+
+
}
/**
- * Append executable server object ( {@link Filter} or {@link Servlet}
- * to the server.
+ * Append executable server object ( {@link Filter} or {@link Servlet} to
+ * the server.
*
* @param servlet
*/
@@ -268,8 +317,9 @@
*
* @param path
* request path relative to web application context.
- * @return Appropriate Filter or Servlet executable object to serve given request. If no
servlet was registered for the given path,
- * try to send requested object directly.
+ * @return Appropriate Filter or Servlet executable object to serve given
+ * request. If no servlet was registered for the given path, try to
+ * send requested object directly.
*/
public RequestChain getServlet(String path) {
RequestChain result = null;
@@ -288,7 +338,7 @@
result = defaultServlet;
}
} catch (MalformedURLException e) {
- log.warning("Mailformed request URL "+e.getMessage());
+ log.warning("Mailformed request URL " + e.getMessage());
}
}
return result;
@@ -296,6 +346,7 @@
/**
* Add web application init parameter.
+ *
* @param name
* @param value
*/
@@ -304,7 +355,8 @@
}
/**
- * Add default mime type for serve files with given extension.
+ * Add default mime type for serve files with given extension.
+ *
* @param extension
* @param mimeType
*/
@@ -313,9 +365,14 @@
}
/**
- * Add java resource to the virtual web application content. This method makes all
parent directories as needed.
- * @param path path to the file in the virtual web server.
- * @param resource path to the resource in the classpath, as required by the {@link
ClassLoader#getResource(String)}.
+ * Add java resource to the virtual web application content. This method
+ * makes all parent directories as needed.
+ *
+ * @param path
+ * path to the file in the virtual web server.
+ * @param resource
+ * path to the resource in the classpath, as required by the
+ * {@link ClassLoader#getResource(String)}.
*/
public void addResource(String path, String resource) {
ServerResourcePath resourcePath = new ServerResourcePath(path);
@@ -324,9 +381,13 @@
}
/**
- * Add resource to the virtual veb application content. This method makes all parent
directories as needed.
- * @param path path to the file in the virtual web server.
- * @param resource {@code URL} to the file content.
+ * Add resource to the virtual veb application content. This method makes
+ * all parent directories as needed.
+ *
+ * @param path
+ * path to the file in the virtual web server.
+ * @param resource
+ * {@code URL} to the file content.
*/
public void addResource(String path, URL resource) {
serverRoot.addResource(new ServerResourcePath(path),
@@ -334,9 +395,18 @@
}
/**
- * Add all resources from the directory to the virtual web application content.
- * @param path name of the target directory in the virtual web application. If no such
directory exists, it will be created, as well as all parent directories as needed.
- * @param resource {@code URL} to the source directory or any file in the source
directory. Only 'file' or 'jar' protocols are supported. If this parameter
points to a file, it will be converted to a enclosing directory.
+ * Add all resources from the directory to the virtual web application
+ * content.
+ *
+ * @param path
+ * name of the target directory in the virtual web application.
+ * If no such directory exists, it will be created, as well as
+ * all parent directories as needed.
+ * @param resource
+ * {@code URL} to the source directory or any file in the source
+ * directory. Only 'file' or 'jar' protocols are supported.
If
+ * this parameter points to a file, it will be converted to a
+ * enclosing directory.
*/
public void addResourcesFromDirectory(String path, URL resource) {
ServerResourcePath resourcePath = new ServerResourcePath(path);
@@ -357,10 +427,46 @@
}
/**
- * Internal method used by the {@link #addResourcesFromDirectory(String, URL)} to
process 'file' protocol.
- * @param resource source directory.
- * @param baseDirectory target virtual directory.
+ * Add all files from the directory to the virtual web application
+ * content.
+ *
+ * @param path
+ * name of the target directory in the virtual web application.
+ * If no such directory exists, it will be created, as well as
+ * all parent directories as needed.
+ * @param resource
+ * {@code File} of the source directory or any file in the source
+ * directory. If this parameter points to a file, it will be converted to a
+ * enclosing directory.
*/
+ public void addResourcesFromDirectory(String path, File directory) {
+ ServerResourcePath resourcePath = new ServerResourcePath(path);
+ ServerResource baseDirectory = serverRoot.getResource(resourcePath);
+ if (null == baseDirectory) {
+ // Create target directory.
+ baseDirectory = new ServerResourcesDirectory();
+ serverRoot.addResource(resourcePath, baseDirectory);
+ }
+ if (!directory.isDirectory()) {
+ directory = directory.getParentFile();
+ }
+ try {
+ addFiles(baseDirectory, directory);
+ } catch (MalformedURLException e) {
+ throw new TestException(e);
+ }
+ }
+
+ /**
+ * Internal method used by the
+ * {@link #addResourcesFromDirectory(String, URL)} to process 'file'
+ * protocol.
+ *
+ * @param resource
+ * source directory.
+ * @param baseDirectory
+ * target virtual directory.
+ */
protected void addResourcesFromFile(URL resource,
ServerResource baseDirectory) {
File file = new File(resource.getPath());
@@ -375,9 +481,14 @@
}
/**
- * Internal method used by the {@link #addResourcesFromDirectory(String, URL)} to
process 'jar' protocol.
- * @param resource URL to the any object in the source directory.
- * @param baseDirectory target virtual directory.
+ * Internal method used by the
+ * {@link #addResourcesFromDirectory(String, URL)} to process 'jar'
+ * protocol.
+ *
+ * @param resource
+ * URL to the any object in the source directory.
+ * @param baseDirectory
+ * target virtual directory.
*/
protected void addResourcesFromJar(URL resource,
ServerResource baseDirectory) {
@@ -402,14 +513,16 @@
}
} catch (IOException e) {
- throw new TestException("Error read Jar content",e);
+ throw new TestException("Error read Jar content", e);
} catch (URISyntaxException e) {
throw new TestException(e);
}
}
/**
- * Internal reccursive method process directory content and all subdirectories.
+ * Internal reccursive method process directory content and all
+ * subdirectories.
+ *
* @param baseDirectory
* @param file
* @throws MalformedURLException
@@ -435,8 +548,8 @@
/**
* Add web-application wide listenes, same as it is defined by the
- * <listener> element in the web.xml file for a real server.
- * Supported listener types:
+ * <listener> element in the web.xml file for a real server. Supported
+ * listener types:
* <ul>
* <li>{@link ServletContextListener}</li>
* <li>{@link ServletContextAttributeListener}</li>
@@ -445,7 +558,9 @@
* <li>{@link ServletRequestListener}</li>
* <li>{@link ServletRequestAttributeListener}</li>
* </ul>
- * @param listener web listener instance.
+ *
+ * @param listener
+ * web listener instance.
*/
public void addWebListener(EventListener listener) {
contextListeners.add(listener);
@@ -453,6 +568,7 @@
/**
* Getter method for 'interceptor' events listener.
+ *
* @return the invocationListener
*/
public InvocationListener getInvocationListener() {
@@ -460,8 +576,11 @@
}
/**
- * Set listener which gets events on all calls to any methods of the {@link
ServletContext}, {@link HttpSession}, {@link HttpServletRequest}, {@link
HttpServletResponse} instances
- * in the virtual server. this interceptor can be used to check internal calls in the
tests .
+ * Set listener which gets events on all calls to any methods of the
+ * {@link ServletContext}, {@link HttpSession}, {@link HttpServletRequest},
+ * {@link HttpServletResponse} instances in the virtual server. this
+ * interceptor can be used to check internal calls in the tests .
+ *
* @param invocationListener
* the invocationListener to set
*/
@@ -470,8 +589,10 @@
}
/**
- * Create instance of the {@link InvocationHandler} for the proxy objects. This handler
fire events to the
- * registered {@link InvocationListener} ( if present ) after target object method
call.
+ * Create instance of the {@link InvocationHandler} for the proxy objects.
+ * This handler fire events to the registered {@link InvocationListener} (
+ * if present ) after target object method call.
+ *
* @return the invocationHandler
*/
InvocationHandler getInvocationHandler(final Object target) {
@@ -500,8 +621,35 @@
}
+ public boolean isSessionPerThread() {
+ return sessionPerThread;
+ }
+
+ public void setSessionPerThread(boolean sessionPerThread) {
+ this.sessionPerThread = sessionPerThread;
+ }
+
+
+ HttpSession getCurrentSession() {
+ if (isSessionPerThread()) {
+ return sessions.get();
+ } else {
+ return currentSession;
+ }
+ }
+
+ void setCurrentSession(HttpSession session) {
+ if (isSessionPerThread()) {
+ sessions.set(session);
+ } else {
+ this.currentSession=session;
+ }
+
+ }
+
/**
* Get virtual server session object. Create new one if necessary.
+ *
* @return instance of the virtual server session.
*/
public HttpSession getSession() {
@@ -509,60 +657,64 @@
}
/**
- *
- * Returns the current <code>HttpSession</code>
- * associated with this server or, if there is no
- * current session and <code>create</code> is true, returns
- * a new session. Staging server supports only one session per instance,
- * different clients for the same server instance does not supported.
- *
- * <p>If <code>create</code> is <code>false</code>
- * and the request has no valid <code>HttpSession</code>,
- * this method returns <code>null</code>.
- *
- *
- * @param create <code>true</code> to create
- * a new session for this request if necessary;
- * <code>false</code> to return <code>null</code>
- * if there's no current session
- *
- *
- * @return the <code>HttpSession</code> associated
- * with this server instance or <code>null</code> if
- * <code>create</code> is <code>false</code>
- * and the server has no session
- *
+ *
+ * Returns the current <code>HttpSession</code> associated with this server
+ * or, if there is no current session and <code>create</code> is true,
+ * returns a new session. Staging server supports only one session per
+ * instance, different clients for the same server instance does not
+ * supported.
+ *
+ * <p>
+ * If <code>create</code> is <code>false</code> and the request
has no valid
+ * <code>HttpSession</code>, this method returns
<code>null</code>.
+ *
+ *
+ * @param create
+ * <code>true</code> to create a new session for this request if
+ * necessary; <code>false</code> to return
<code>null</code> if
+ * there's no current session
+ *
+ *
+ * @return the <code>HttpSession</code> associated with this server
instance
+ * or <code>null</code> if <code>create</code> is
<code>false</code>
+ * and the server has no session
+ *
*/
public synchronized HttpSession getSession(boolean create) {
- if(!initialised){
+ if (!initialised) {
throw new TestException("Staging server have not been initialised");
}
- if (null == this.session && create) {
- this.session = new ServerHttpSession();
+ HttpSession httpSession = this.getCurrentSession();
+ if (null == httpSession && create) {
+ ServerHttpSession sessionImpl = new ServerHttpSession();
// Create proxy objects.
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (null == loader) {
loader = this.getClass().getClassLoader();
}
- this.sessionProxy = (HttpSession) Proxy.newProxyInstance(loader,
+ httpSession = (HttpSession) Proxy.newProxyInstance(loader,
new Class[] { HttpSession.class },
- getInvocationHandler(session));
+ getInvocationHandler(sessionImpl));
+ setCurrentSession(httpSession);
// inform session listeners.
- final HttpSessionEvent event = new HttpSessionEvent(session);
+ final HttpSessionEvent event = new HttpSessionEvent(httpSession);
fireEvent(SESSION_LISTENER_CLASS,
new EventInvoker<HttpSessionListener>() {
public void invoke(HttpSessionListener listener) {
listener.sessionCreated(event);
}
});
+ sessionInstances.add(sessionImpl);
}
- return sessionProxy;
+ return httpSession;
}
/**
- * Virtual server initialization. This method creates instances of the {@link
ServletContext}, {@link JspFactory},
- * informs {@link ServletContextListener} ind inits all {@link Filter} and {@link
Servlet} instances.
- * It should be called from test setUp method to prepare testing environment.
+ * Virtual server initialization. This method creates instances of the
+ * {@link ServletContext}, {@link JspFactory}, informs
+ * {@link ServletContextListener} ind inits all {@link Filter} and
+ * {@link Servlet} instances. It should be called from test setUp method to
+ * prepare testing environment.
*/
public void init() {
log.info("Init staging server");
@@ -595,23 +747,27 @@
}
defaultServlet.init(context);
} catch (ServletException e) {
- throw new TestException("Servlet initialisation error ",e);
+ throw new TestException("Servlet initialisation error ", e);
}
this.initialised = true;
}
/**
- * Stop wirtual server. This method informs {@link ServletContextListener} ind inits all
{@link Filter} and {@link Servlet} instances, as well remove all internal objects.
- * It should be called from the testt thearDown method to clean up testing environment.
- *
+ * Stop wirtual server. This method informs {@link ServletContextListener}
+ * ind inits all {@link Filter} and {@link Servlet} instances, as well
+ * remove all internal objects. It should be called from the testt thearDown
+ * method to clean up testing environment.
+ *
*/
public void destroy() {
- if(!initialised){
+ if (!initialised) {
throw new TestException("Staging server have not been initialised");
}
this.initialised = false;
// Destroy session
- if (null != this.session) {
+ // TODO - destroy all threads.
+ for (Iterator<ServerHttpSession> sessionIterator = sessionInstances.iterator();
sessionIterator.hasNext();) {
+ ServerHttpSession session = sessionIterator.next();
// inform session listeners.
final HttpSessionEvent event = new HttpSessionEvent(session);
fireEvent(SESSION_LISTENER_CLASS,
@@ -620,9 +776,10 @@
listener.sessionDestroyed(event);
}
});
- session.destroy();
- session = null;
+ session.invalidate();
+ sessionIterator.remove();
}
+ setCurrentSession(null);
// Inform listeners
final ServletContextEvent event = new ServletContextEvent(context);
fireEvent(CONTEXT_LISTENER_CLASS,
@@ -643,14 +800,18 @@
}
/**
- * Get virtual connection to the given URL. Even thought for an http request to the
- * external servers, only local connection to the virtual server will be created.
- * @param url request url.
- * @return local connection to the appropriate servlet in the virtual server.
+ * Get virtual connection to the given URL. Even thought for an http request
+ * to the external servers, only local connection to the virtual server will
+ * be created.
+ *
+ * @param url
+ * request url.
+ * @return local connection to the appropriate servlet in the virtual
+ * server.
* @throws {@link TestException} if no servlet found to process given URL.
*/
public StagingConnection getConnection(URL url) {
- if(!initialised){
+ if (!initialised) {
throw new TestException("Staging server have not been initialised");
}
return new StagingConnection(this, url);
@@ -658,10 +819,11 @@
/**
* Get instance of virtual web application context.
+ *
* @return context instance.
*/
public ServletContext getContext() {
- if(!initialised){
+ if (!initialised) {
throw new TestException("Staging server have not been initialised");
}
return contextProxy;
@@ -669,7 +831,9 @@
/**
* Inform {@link ServletRequestListener} instances. For internal use only.
- * @param request started request.
+ *
+ * @param request
+ * started request.
*/
void requestStarted(ServletRequest request) {
final ServletRequestEvent event = new ServletRequestEvent(context,
@@ -685,7 +849,9 @@
/**
* Inform {@link ServletRequestListener} instances. For internal use only.
- * @param request finished request.
+ *
+ * @param request
+ * finished request.
*/
void requestFinished(ServletRequest request) {
final ServletRequestEvent event = new ServletRequestEvent(context,
@@ -698,8 +864,7 @@
});
}
- void requestAttributeAdded(ServletRequest request, String name,
- Object o) {
+ void requestAttributeAdded(ServletRequest request, String name, Object o) {
final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(
context, request, name, o);
fireEvent(REQUEST_ATTRIBUTE_LISTENER_CLASS,
Modified:
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServletContext.java
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServletContext.java 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServletContext.java 2009-02-03
21:12:47 UTC (rev 12555)
@@ -7,7 +7,6 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -21,7 +20,6 @@
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletException;
Modified:
branches/jsf2.0/framework/jsf-test/src/main/javadoc/org/richfaces/test/package.html
===================================================================
---
branches/jsf2.0/framework/jsf-test/src/main/javadoc/org/richfaces/test/package.html 2009-02-03
16:34:38 UTC (rev 12554)
+++
branches/jsf2.0/framework/jsf-test/src/main/javadoc/org/richfaces/test/package.html 2009-02-03
21:12:47 UTC (rev 12555)
@@ -5,6 +5,8 @@
<title>Insert title here</title>
</head>
<body>
-
+<p>This packcage contains <a
href="AbstractFacesTest.html">AbstractFacesTest</a> class, wich can be
used as a base point for all JSF-related test cases.</p>
+<p>The <a href="LocalWebClient.html">LocalWebClient</a>
class, whether is subclass of the HtmlUnit <a
href="http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/h...
class used
+as client to the local staging server <a
href="org/richfaces/test/staging/StagingServer.html">StagingServer</a>.</p>
</body>
</html>
\ No newline at end of file
Modified: branches/jsf2.0/framework/jsf-test/src/main/javadoc/overview.html
===================================================================
--- branches/jsf2.0/framework/jsf-test/src/main/javadoc/overview.html 2009-02-03 16:34:38
UTC (rev 12554)
+++ branches/jsf2.0/framework/jsf-test/src/main/javadoc/overview.html 2009-02-03 21:12:47
UTC (rev 12555)
@@ -5,6 +5,25 @@
<title>Insert title here</title>
</head>
<body>
-
+<h1>Java web application testing framework</h1>
+<p>This is a testing framework desibned ( but not limited to ) for test JSF
components and applications</p>
+<p>Though best strategy for alow-level black box testing is to use a Mock objects,
+ writing integration tests required a more real environment.
+ On the other hand, running tests on the real web, or, even more, full JEE server takes a
lot of the resoures and has a own limitations.
+</p>
+<p>This framework designed as an intermediate solution. It contains <a
href="org/richfaces/test/staging/StagingServer.html">staging Java Web
server</a>, where is real
+ JSF framework running. This is at most Servlet 2.5 / JSP 2.1 compatible container, wich
allows to run at most all JSF applications. But, in difference with real web container,
+ it is "in process" only server. That does not have network connector, session
management, does not process any configuration files etc. Its advantage for a unit
testing:
+ <ul>
+ <li>It has a minimal startup time, because no configuration files processed and no
resource pools or other heavy objects created.</li>
+ <li>It is extremally flexible. It uses a 'virtual' web application
content, that can be builded from any objects:
+ files, java resource, even dynamic classes those generate content 'on the fly'.
Every test is able to use individual application content.</li>
+ <li>Not only content, but any other configuration aspects, like servlets,
filters, configuration parameters can be changed from the test code.</li>
+ <li>Tests runs as a web server clients in the same JVM and thread as a
server-side code does. It allows to inspect any objects on the both sides from the same
code. No thread syncronisation is necessary in the test code.</li>
+ <li>It is possible to make test runs "inside" web request. For example,
only one JSF lifecycle phase can be tested.
+ </ul>
+ <p>Other important part of the framework is <a
href="org/richfaces/test/LocalWebClient.html">LocalWebClient</a>,
subclass of the HtmlUnit <a
href="http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/h...;.
+ In difference with the original client it always making local call to the staging server
instead of real network protocol use. This client allows to use all HtmlUnit HTML and
JavaScript testing features, even client side JavaScript test runs.</p>
+ <p>To make tests are easest, we provide <a
href="org/richfaces/test/AbstractFacesTest.html">the base abstract
class</a> for a Junit test with set of the template method for a fine virtual server
tuning.</p>
</body>
</html>
\ No newline at end of file
Modified: branches/jsf2.0/framework/pom.xml
===================================================================
--- branches/jsf2.0/framework/pom.xml 2009-02-03 16:34:38 UTC (rev 12554)
+++ branches/jsf2.0/framework/pom.xml 2009-02-03 21:12:47 UTC (rev 12555)
@@ -94,7 +94,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.0-b05</version>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
Modified: branches/jsf2.0/tests/ajax/pom.xml
===================================================================
--- branches/jsf2.0/tests/ajax/pom.xml 2009-02-03 16:34:38 UTC (rev 12554)
+++ branches/jsf2.0/tests/ajax/pom.xml 2009-02-03 21:12:47 UTC (rev 12555)
@@ -65,7 +65,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.0-b05</version>
+ <version>2.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.jvnet.wagon-svn</groupId>
@@ -75,7 +75,7 @@
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
- <artifactId>mojarra-jsf-impl</artifactId>
+ <artifactId>jsf-impl</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>