You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/08/28 20:59:24 UTC
svn commit: r990408 [3/10] - in /myfaces/test/trunk:
test12/src/main/java/org/apache/myfaces/test/base/
test12/src/main/java/org/apache/myfaces/test/base/junit4/
test12/src/main/java/org/apache/myfaces/test/cargo/
test12/src/main/java/org/apache/myface...
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableMapper.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableMapper.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableMapper.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableMapper.java Sat Aug 28 18:59:21 2010
@@ -28,52 +28,51 @@ import javax.el.VariableMapper;
* @since 1.0.0
*/
-public class MockVariableMapper extends VariableMapper {
-
+public class MockVariableMapper extends VariableMapper
+{
// ------------------------------------------------------------ Constructors
-
/** Creates a new instance of MockVariableMapper */
- public MockVariableMapper() {
+ public MockVariableMapper()
+ {
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>Map of <code>ValueExpression</code>s, keyed by variable name.</p>
*/
private Map expressions = new HashMap();
-
// ----------------------------------------------------- Mock Object Methods
-
// -------------------------------------------------- FunctionMapper Methods
-
/** {@inheritDoc} */
- public ValueExpression resolveVariable(String variable) {
+ public ValueExpression resolveVariable(String variable)
+ {
return (ValueExpression) expressions.get(variable);
}
-
/** {@inheritDoc} */
- public ValueExpression setVariable(String variable, ValueExpression expression) {
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression)
+ {
ValueExpression original = (ValueExpression) expressions.get(variable);
- if (expression == null) {
+ if (expression == null)
+ {
expressions.remove(variable);
- } else {
+ }
+ else
+ {
expressions.put(variable, expression);
}
return original;
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableValueExpression.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableValueExpression.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/el/MockVariableValueExpression.java Sat Aug 28 18:59:21 2010
@@ -27,27 +27,27 @@ import javax.faces.context.FacesContext;
*
* @since 1.0.0
*/
-public class MockVariableValueExpression extends ValueExpression {
-
+public class MockVariableValueExpression extends ValueExpression
+{
// ------------------------------------------------------------ Constructors
-
/**
* Serial version UID.
*/
private static final long serialVersionUID = 4475919948345298291L;
-
/**
* <p>Construct a new expression for the specified instance.</p>
*
* @param instance Variable instance to be wrapped
* @param expectedType Expected type of the result
*/
- public MockVariableValueExpression(Object instance, Class expectedType) {
+ public MockVariableValueExpression(Object instance, Class expectedType)
+ {
- if (instance == null) {
+ if (instance == null)
+ {
throw new NullPointerException("Instance cannot be null");
}
this.instance = instance;
@@ -55,88 +55,86 @@ public class MockVariableValueExpression
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The expected result type for <code>getValue()</code> calls.</p>
*/
private Class expectedType = null;
-
/**
* <p>The variable instance being wrapped by this expression.</p>
*/
private Object instance = null;
-
// ------------------------------------------------------ Expression Methods
-
/**
* <p>Return <code>true</code> if this expression is equal to the
* specified expression.</p>
*
* @param obj Object to be compared
*/
- public boolean equals(Object obj) {
+ public boolean equals(Object obj)
+ {
- if ((obj != null) & (obj instanceof ValueExpression)) {
- return instance.toString().equals(((ValueExpression) obj).getExpressionString());
- } else {
+ if ((obj != null) & (obj instanceof ValueExpression))
+ {
+ return instance.toString().equals(
+ ((ValueExpression) obj).getExpressionString());
+ }
+ else
+ {
return false;
}
}
-
/**
* <p>Return the original String used to create this expression,
* unmodified.</p>
*/
- public String getExpressionString() {
+ public String getExpressionString()
+ {
return this.instance.toString();
}
-
/**
* <p>Return the hash code for this expression.</p>
*/
- public int hashCode() {
+ public int hashCode()
+ {
return this.instance.toString().hashCode();
}
-
/**
* <p>Return <code>true</code> if the expression string for this expression
* contains only literal text.</p>
*/
- public boolean isLiteralText() {
+ public boolean isLiteralText()
+ {
return true;
}
-
// ------------------------------------------------- ValueExpression Methods
-
/**
* <p>Return the type that the result of this expression will
* be coerced to.</p>
*/
- public Class getExpectedType() {
+ public Class getExpectedType()
+ {
return this.expectedType;
}
-
/**
* <p>Evaluate this expression relative to the specified context,
* and return the most general type that is acceptable for the
@@ -144,33 +142,37 @@ public class MockVariableValueExpression
*
* @param context ELContext for this evaluation
*/
- public Class getType(ELContext context) {
+ public Class getType(ELContext context)
+ {
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException();
}
return this.instance.getClass();
}
-
/**
* <p>Evaluate this expression relative to the specified context,
* and return the result.</p>
*
* @param context ELContext for this evaluation
*/
- public Object getValue(ELContext context) {
+ public Object getValue(ELContext context)
+ {
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException();
}
- FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class);
- return fcontext.getApplication().getExpressionFactory().coerceToType(instance, expectedType);
+ FacesContext fcontext = (FacesContext) context
+ .getContext(FacesContext.class);
+ return fcontext.getApplication().getExpressionFactory().coerceToType(
+ instance, expectedType);
}
-
/**
* <p>Evaluate this expression relative to the specified context,
* and return <code>true</code> if a call to <code>setValue()</code>
@@ -178,17 +180,17 @@ public class MockVariableValueExpression
*
* @param context ELContext for this evaluation
*/
- public boolean isReadOnly(ELContext context) {
+ public boolean isReadOnly(ELContext context)
+ {
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException();
}
return true;
}
-
-
/**
* <p>Evaluate this expression relative to the specified context,
* and set the result to the specified value.</p>
@@ -196,9 +198,11 @@ public class MockVariableValueExpression
* @param context ELContext for this evaluation
* @param value Value to which the result should be set
*/
- public void setValue(ELContext context, Object value) {
+ public void setValue(ELContext context, Object value)
+ {
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException();
}
@@ -206,5 +210,4 @@ public class MockVariableValueExpression
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/AbstractHtmlUnitTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/AbstractHtmlUnitTestCase.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/AbstractHtmlUnitTestCase.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/AbstractHtmlUnitTestCase.java Sat Aug 28 18:59:21 2010
@@ -33,8 +33,6 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
-
/**
* <p>Abstract base class for system integration tests based on HtmlUnit.
* These tests will expect a system property named <code>url</code> to be
@@ -43,33 +41,30 @@ import junit.framework.TestSuite;
*
* @since 1.0.0
*/
-public abstract class AbstractHtmlUnitTestCase extends TestCase {
-
+public abstract class AbstractHtmlUnitTestCase extends TestCase
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a new instance of this test case.</p>
*
* @param name Name of the new test case
*/
- public AbstractHtmlUnitTestCase(String name) {
+ public AbstractHtmlUnitTestCase(String name)
+ {
super(name);
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The most recently retrieved page from the server.</p>
*/
protected HtmlPage page = null;
-
/**
* <p>The calculated URL for the installed "systest" web application.
* This value is based on a system property named <code>url</code>,
@@ -78,22 +73,20 @@ public abstract class AbstractHtmlUnitTe
*/
protected URL url = null;
-
/**
* <p>The web client for this test case.</p>
*/
protected WebClient webClient = null;
-
// ------------------------------------------------------ Test Setup Methods
-
/**
* <p>Set up the instance variables required for this test case.</p>
*
* @exception Exception if an error occurs
*/
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception
+ {
// Calculate the URL for the installed "systest" web application
String url = System.getProperty("url");
@@ -104,21 +97,21 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the set of tests included in this test suite.</p>
*/
- public static Test suite() {
+ public static Test suite()
+ {
return (new TestSuite(AbstractHtmlUnitTestCase.class));
}
-
/**
* <p>Tear down instance variables required by this test case.</p>
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception
+ {
page = null;
url = null;
@@ -126,23 +119,23 @@ public abstract class AbstractHtmlUnitTe
}
-
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Return the body element for the most recently retrieved page.
* If there is no such element, return <code>null</code>.</p>
*
* @exception Exception if an error occurs
*/
- protected HtmlBody body() throws Exception {
+ protected HtmlBody body() throws Exception
+ {
Iterator elements = page.getAllHtmlChildElements();
- while (elements.hasNext()) {
+ while (elements.hasNext())
+ {
HtmlElement element = (HtmlElement) elements.next();
- if (element instanceof HtmlBody) {
+ if (element instanceof HtmlBody)
+ {
return ((HtmlBody) element);
}
}
@@ -150,7 +143,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the HTML element with the specified <code>id</code> from the
* most recently retrieved page. If there is no such element, return
@@ -160,17 +152,20 @@ public abstract class AbstractHtmlUnitTe
*
* @exception Exception if an error occurs
*/
- protected HtmlElement element(String id) throws Exception {
+ protected HtmlElement element(String id) throws Exception
+ {
- try {
+ try
+ {
return (page.getHtmlElementById(id));
- } catch (ElementNotFoundException e) {
+ }
+ catch (ElementNotFoundException e)
+ {
return (null);
}
}
-
/**
* <p>Return the form with the specified <code>id</code> from the most
* recently retrieved page. If there is no such form, return
@@ -180,12 +175,15 @@ public abstract class AbstractHtmlUnitTe
*
* @exception Exception if an error occurs
*/
- protected HtmlForm form(String id) throws Exception {
+ protected HtmlForm form(String id) throws Exception
+ {
Iterator forms = page.getForms().iterator();
- while (forms.hasNext()) {
+ while (forms.hasNext())
+ {
HtmlForm form = (HtmlForm) forms.next();
- if (id.equals(form.getAttributeValue("id"))) {
+ if (id.equals(form.getAttributeValue("id")))
+ {
return (form);
}
}
@@ -193,19 +191,21 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the head element for the most recently retrieved page.
* If there is no such element, return <code>null</code>.</p>
*
* @exception Exception if an error occurs
*/
- protected HtmlHead head() throws Exception {
+ protected HtmlHead head() throws Exception
+ {
Iterator elements = page.getAllHtmlChildElements();
- while (elements.hasNext()) {
+ while (elements.hasNext())
+ {
HtmlElement element = (HtmlElement) elements.next();
- if (element instanceof HtmlHead) {
+ if (element instanceof HtmlHead)
+ {
return ((HtmlHead) element);
}
}
@@ -213,7 +213,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Click the specified hyperlink, and retrieve the subsequent page,
* saving a reference so that other utility methods may be used to
@@ -223,7 +222,8 @@ public abstract class AbstractHtmlUnitTe
*
* @exception IOException if an input/output error occurs
*/
- protected HtmlPage link(HtmlAnchor anchor) throws IOException {
+ protected HtmlPage link(HtmlAnchor anchor) throws IOException
+ {
HtmlPage page = (HtmlPage) anchor.click();
this.page = page;
@@ -231,17 +231,16 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the currently stored page reference.</p>
*/
- protected HtmlPage page() {
+ protected HtmlPage page()
+ {
return this.page;
}
-
/**
* <p>Retrieve and return the page at the specified context relative path.
* Save a reference to this page so that other utility methods may be used
@@ -253,7 +252,8 @@ public abstract class AbstractHtmlUnitTe
* does not begin with a '/' character
* @exception Exception if a different error occurs
*/
- protected HtmlPage page(String path) throws Exception {
+ protected HtmlPage page(String path) throws Exception
+ {
HtmlPage page = (HtmlPage) webClient.getPage(url(path));
this.page = page;
@@ -261,7 +261,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Reset the stored page reference to the specified value. This is
* useful for scenarios testing resubmit of the same page (simulating the
@@ -269,13 +268,13 @@ public abstract class AbstractHtmlUnitTe
*
* @param page Previously saved page to which to reset
*/
- protected void reset(HtmlPage page) {
+ protected void reset(HtmlPage page)
+ {
this.page = page;
}
-
/**
* <p>Submit the current page, using the specified component, and retrieve
* the subsequent page, saving a reference so that other utility methods
@@ -285,7 +284,8 @@ public abstract class AbstractHtmlUnitTe
*
* @exception IOException if an input/output error occurs
*/
- protected HtmlPage submit(HtmlSubmitInput submit) throws IOException {
+ protected HtmlPage submit(HtmlSubmitInput submit) throws IOException
+ {
HtmlPage page = (HtmlPage) submit.click();
this.page = page;
@@ -293,20 +293,19 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the page title from the most recently retrieved page.
* Any leading and trailing whitespace will be trimmed.</p>
*
* @exception Exception if an error occurs
*/
- protected String title() throws Exception {
+ protected String title() throws Exception
+ {
return (page.getTitleText().trim());
}
-
/**
* <p>Calculate and return an absolute URL for the specified context
* relative path, which must begin with a '/' character.</p>
@@ -317,15 +316,16 @@ public abstract class AbstractHtmlUnitTe
* does not begin with a '/' character
* @exception Exception if a different error ocurs
*/
- protected URL url(String path) throws Exception {
+ protected URL url(String path) throws Exception
+ {
- if (path.charAt(0) != '/') {
+ if (path.charAt(0) != '/')
+ {
throw new IllegalArgumentException("Context path '" + path
- + "' does not start with '/'");
+ + "' does not start with '/'");
}
return new URL(url, path.substring(1));
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/junit4/AbstractHtmlUnitTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/junit4/AbstractHtmlUnitTestCase.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/junit4/AbstractHtmlUnitTestCase.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/htmlunit/junit4/AbstractHtmlUnitTestCase.java Sat Aug 28 18:59:21 2010
@@ -34,8 +34,6 @@ import com.gargoylesoftware.htmlunit.htm
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
-
/**
* <p>Abstract base class for system integration tests based on HtmlUnit.
* These tests will expect a system property named <code>url</code> to be
@@ -44,12 +42,11 @@ import com.gargoylesoftware.htmlunit.htm
*
* @since 1.0.0
*/
-public abstract class AbstractHtmlUnitTestCase {
-
+public abstract class AbstractHtmlUnitTestCase
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a new instance of this test case.</p>
*
@@ -59,16 +56,13 @@ public abstract class AbstractHtmlUnitTe
{
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The most recently retrieved page from the server.</p>
*/
protected HtmlPage page = null;
-
/**
* <p>The calculated URL for the installed "systest" web application.
* This value is based on a system property named <code>url</code>,
@@ -77,23 +71,21 @@ public abstract class AbstractHtmlUnitTe
*/
protected URL url = null;
-
/**
* <p>The web client for this test case.</p>
*/
protected WebClient webClient = null;
-
// ------------------------------------------------------ Test Setup Methods
-
/**
* <p>Set up the instance variables required for this test case.</p>
*
* @exception Exception if an error occurs
*/
@Before
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception
+ {
// Calculate the URL for the installed "systest" web application
String url = System.getProperty("url");
@@ -108,7 +100,8 @@ public abstract class AbstractHtmlUnitTe
* <p>Tear down instance variables required by this test case.</p>
*/
@After
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception
+ {
page = null;
url = null;
@@ -116,23 +109,23 @@ public abstract class AbstractHtmlUnitTe
}
-
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Return the body element for the most recently retrieved page.
* If there is no such element, return <code>null</code>.</p>
*
* @exception Exception if an error occurs
*/
- protected HtmlBody body() throws Exception {
+ protected HtmlBody body() throws Exception
+ {
Iterator elements = page.getAllHtmlChildElements();
- while (elements.hasNext()) {
+ while (elements.hasNext())
+ {
HtmlElement element = (HtmlElement) elements.next();
- if (element instanceof HtmlBody) {
+ if (element instanceof HtmlBody)
+ {
return ((HtmlBody) element);
}
}
@@ -140,7 +133,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the HTML element with the specified <code>id</code> from the
* most recently retrieved page. If there is no such element, return
@@ -150,17 +142,20 @@ public abstract class AbstractHtmlUnitTe
*
* @exception Exception if an error occurs
*/
- protected HtmlElement element(String id) throws Exception {
+ protected HtmlElement element(String id) throws Exception
+ {
- try {
+ try
+ {
return (page.getHtmlElementById(id));
- } catch (ElementNotFoundException e) {
+ }
+ catch (ElementNotFoundException e)
+ {
return (null);
}
}
-
/**
* <p>Return the form with the specified <code>id</code> from the most
* recently retrieved page. If there is no such form, return
@@ -170,12 +165,15 @@ public abstract class AbstractHtmlUnitTe
*
* @exception Exception if an error occurs
*/
- protected HtmlForm form(String id) throws Exception {
+ protected HtmlForm form(String id) throws Exception
+ {
Iterator forms = page.getForms().iterator();
- while (forms.hasNext()) {
+ while (forms.hasNext())
+ {
HtmlForm form = (HtmlForm) forms.next();
- if (id.equals(form.getAttributeValue("id"))) {
+ if (id.equals(form.getAttributeValue("id")))
+ {
return (form);
}
}
@@ -183,19 +181,21 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the head element for the most recently retrieved page.
* If there is no such element, return <code>null</code>.</p>
*
* @exception Exception if an error occurs
*/
- protected HtmlHead head() throws Exception {
+ protected HtmlHead head() throws Exception
+ {
Iterator elements = page.getAllHtmlChildElements();
- while (elements.hasNext()) {
+ while (elements.hasNext())
+ {
HtmlElement element = (HtmlElement) elements.next();
- if (element instanceof HtmlHead) {
+ if (element instanceof HtmlHead)
+ {
return ((HtmlHead) element);
}
}
@@ -203,7 +203,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Click the specified hyperlink, and retrieve the subsequent page,
* saving a reference so that other utility methods may be used to
@@ -213,7 +212,8 @@ public abstract class AbstractHtmlUnitTe
*
* @exception IOException if an input/output error occurs
*/
- protected HtmlPage link(HtmlAnchor anchor) throws IOException {
+ protected HtmlPage link(HtmlAnchor anchor) throws IOException
+ {
HtmlPage page = (HtmlPage) anchor.click();
this.page = page;
@@ -221,17 +221,16 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the currently stored page reference.</p>
*/
- protected HtmlPage page() {
+ protected HtmlPage page()
+ {
return this.page;
}
-
/**
* <p>Retrieve and return the page at the specified context relative path.
* Save a reference to this page so that other utility methods may be used
@@ -243,7 +242,8 @@ public abstract class AbstractHtmlUnitTe
* does not begin with a '/' character
* @exception Exception if a different error occurs
*/
- protected HtmlPage page(String path) throws Exception {
+ protected HtmlPage page(String path) throws Exception
+ {
HtmlPage page = (HtmlPage) webClient.getPage(url(path));
this.page = page;
@@ -251,7 +251,6 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Reset the stored page reference to the specified value. This is
* useful for scenarios testing resubmit of the same page (simulating the
@@ -259,13 +258,13 @@ public abstract class AbstractHtmlUnitTe
*
* @param page Previously saved page to which to reset
*/
- protected void reset(HtmlPage page) {
+ protected void reset(HtmlPage page)
+ {
this.page = page;
}
-
/**
* <p>Submit the current page, using the specified component, and retrieve
* the subsequent page, saving a reference so that other utility methods
@@ -275,7 +274,8 @@ public abstract class AbstractHtmlUnitTe
*
* @exception IOException if an input/output error occurs
*/
- protected HtmlPage submit(HtmlSubmitInput submit) throws IOException {
+ protected HtmlPage submit(HtmlSubmitInput submit) throws IOException
+ {
HtmlPage page = (HtmlPage) submit.click();
this.page = page;
@@ -283,20 +283,19 @@ public abstract class AbstractHtmlUnitTe
}
-
/**
* <p>Return the page title from the most recently retrieved page.
* Any leading and trailing whitespace will be trimmed.</p>
*
* @exception Exception if an error occurs
*/
- protected String title() throws Exception {
+ protected String title() throws Exception
+ {
return (page.getTitleText().trim());
}
-
/**
* <p>Calculate and return an absolute URL for the specified context
* relative path, which must begin with a '/' character.</p>
@@ -307,15 +306,16 @@ public abstract class AbstractHtmlUnitTe
* does not begin with a '/' character
* @exception Exception if a different error ocurs
*/
- protected URL url(String path) throws Exception {
+ protected URL url(String path) throws Exception
+ {
- if (path.charAt(0) != '/') {
+ if (path.charAt(0) != '/')
+ {
throw new IllegalArgumentException("Context path '" + path
- + "' does not start with '/'");
+ + "' does not start with '/'");
}
return new URL(url, path.substring(1));
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/jmock/AbstractJmockJsfTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/jmock/AbstractJmockJsfTestCase.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/jmock/AbstractJmockJsfTestCase.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/jmock/AbstractJmockJsfTestCase.java Sat Aug 28 18:59:21 2010
@@ -71,34 +71,36 @@ import org.jmock.cglib.MockObjectTestCas
*
* @since 1.0.0
*/
-public abstract class AbstractJmockJsfTestCase extends MockObjectTestCase {
-
+public abstract class AbstractJmockJsfTestCase extends MockObjectTestCase
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a new instance of this test case.</p>
*
* @param name Name of this test case
*/
- public AbstractJmockJsfTestCase(String name) {
+ public AbstractJmockJsfTestCase(String name)
+ {
setName(name);
}
-
// ---------------------------------------------------- Overall Test Methods
-
/**
* <p>Set up instance variables required by this test case.</p>
*/
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception
+ {
// Set up a new thread context class loader
- threadContextClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0],
- this.getClass().getClassLoader()));
+ threadContextClassLoader = Thread.currentThread()
+ .getContextClassLoader();
+ Thread.currentThread()
+ .setContextClassLoader(
+ new URLClassLoader(new URL[0], this.getClass()
+ .getClassLoader()));
// Set up Servlet API Objects
setUpServletObjects();
@@ -110,7 +112,7 @@ public abstract class AbstractJmockJsfTe
setUpJSFObjects();
}
-
+
/**
* <p>Setup JSF object used for the test. By default it calls to the following
* methods in this order:</p>
@@ -126,7 +128,7 @@ public abstract class AbstractJmockJsfTe
*
* @throws Exception
*/
- protected void setUpJSFObjects() throws Exception
+ protected void setUpJSFObjects() throws Exception
{
setUpExternalContext();
setUpLifecycle();
@@ -135,7 +137,7 @@ public abstract class AbstractJmockJsfTe
setUpApplication();
setUpRenderKit();
}
-
+
/**
* <p>Setup servlet objects that will be used for the test:</p>
*
@@ -149,7 +151,7 @@ public abstract class AbstractJmockJsfTe
*
* @throws Exception
*/
- protected void setUpServletObjects() throws Exception
+ protected void setUpServletObjects() throws Exception
{
servletContext = new MockServletContext();
config = new MockServletConfig(servletContext);
@@ -159,22 +161,22 @@ public abstract class AbstractJmockJsfTe
request.setServletContext(servletContext);
response = new MockHttpServletResponse();
}
-
+
/**
* <p>Set JSF factories using FactoryFinder method setFactory.</p>
*
* @throws Exception
*/
- protected void setFactories() throws Exception
+ protected void setFactories() throws Exception
{
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
- "org.apache.myfaces.test.mock.MockApplicationFactory");
+ "org.apache.myfaces.test.mock.MockApplicationFactory");
FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
- "org.apache.myfaces.test.mock.MockFacesContextFactory");
+ "org.apache.myfaces.test.mock.MockFacesContextFactory");
FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
- "org.apache.myfaces.test.mock.lifecycle.MockLifecycleFactory");
+ "org.apache.myfaces.test.mock.lifecycle.MockLifecycleFactory");
FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
- "org.apache.myfaces.test.mock.MockRenderKitFactory");
+ "org.apache.myfaces.test.mock.MockRenderKitFactory");
}
/**
@@ -185,8 +187,8 @@ public abstract class AbstractJmockJsfTe
*/
protected void setUpExternalContext() throws Exception
{
- externalContext =
- new MockExternalContext(servletContext, request, response);
+ externalContext = new MockExternalContext(servletContext, request,
+ response);
}
/**
@@ -197,12 +199,12 @@ public abstract class AbstractJmockJsfTe
*/
protected void setUpLifecycle() throws Exception
{
- lifecycleFactory = (MockLifecycleFactory)
- FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- lifecycle = (MockLifecycle)
- lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ lifecycleFactory = (MockLifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ lifecycle = (MockLifecycle) lifecycleFactory
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
}
-
+
/**
* Setup the <code>facesContextFactory</code> and <code>facesContext</code>
* variable. Before end, by default it override <code>externalContext</code>
@@ -214,16 +216,14 @@ public abstract class AbstractJmockJsfTe
*/
protected void setUpFacesContext() throws Exception
{
- facesContextFactory = (MockFacesContextFactory)
- FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
- facesContext = (MockFacesContext)
- facesContextFactory.getFacesContext(servletContext,
- request,
- response,
- lifecycle);
+ facesContextFactory = (MockFacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ facesContext = (MockFacesContext) facesContextFactory.getFacesContext(
+ servletContext, request, response, lifecycle);
if (facesContext.getExternalContext() != null)
{
- externalContext = (MockExternalContext) facesContext.getExternalContext();
+ externalContext = (MockExternalContext) facesContext
+ .getExternalContext();
}
}
@@ -240,7 +240,7 @@ public abstract class AbstractJmockJsfTe
root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
facesContext.setViewRoot(root);
}
-
+
/**
* Setup the <code>application</code> variable and before
* the end by default it is assigned to the <code>facesContext</code>
@@ -250,12 +250,12 @@ public abstract class AbstractJmockJsfTe
*/
protected void setUpApplication() throws Exception
{
- ApplicationFactory applicationFactory = (ApplicationFactory)
- FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder
+ .getFactory(FactoryFinder.APPLICATION_FACTORY);
application = (MockApplication) applicationFactory.getApplication();
facesContext.setApplication(application);
}
-
+
/**
* Setup the <code>renderKit</code> variable. This is a good place to use
* <code>ConfigParser</code> to register converters, validators, components
@@ -265,21 +265,24 @@ public abstract class AbstractJmockJsfTe
*/
protected void setUpRenderKit() throws Exception
{
- RenderKitFactory renderKitFactory = (RenderKitFactory)
- FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
renderKit = new MockRenderKit();
- renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, renderKit);
+ renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT,
+ renderKit);
}
/**
* <p>Tear down instance variables required by this test case.</p>
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception
+ {
application = null;
config = null;
externalContext = null;
- if (facesContext != null) {
+ if (facesContext != null)
+ {
facesContext.release();
}
facesContext = null;
@@ -297,23 +300,21 @@ public abstract class AbstractJmockJsfTe
}
-
// ------------------------------------------------------ Instance Variables
-
// Mock object instances for our tests
- protected MockApplication application = null;
- protected MockServletConfig config = null;
- protected MockExternalContext externalContext = null;
- protected MockFacesContext facesContext = null;
+ protected MockApplication application = null;
+ protected MockServletConfig config = null;
+ protected MockExternalContext externalContext = null;
+ protected MockFacesContext facesContext = null;
protected MockFacesContextFactory facesContextFactory = null;
- protected MockLifecycle lifecycle = null;
- protected MockLifecycleFactory lifecycleFactory = null;
- protected MockRenderKit renderKit = null;
- protected MockHttpServletRequest request = null;
+ protected MockLifecycle lifecycle = null;
+ protected MockLifecycleFactory lifecycleFactory = null;
+ protected MockRenderKit renderKit = null;
+ protected MockHttpServletRequest request = null;
protected MockHttpServletResponse response = null;
- protected MockServletContext servletContext = null;
- protected MockHttpSession session = null;
+ protected MockServletContext servletContext = null;
+ protected MockHttpSession session = null;
// Thread context class loader saved and restored after each test
private ClassLoader threadContextClassLoader = null;
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockActionListener.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockActionListener.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockActionListener.java Sat Aug 28 18:59:21 2010
@@ -28,28 +28,24 @@ import javax.faces.event.ActionListener;
* @since 1.0.0
*/
-public class MockActionListener implements ActionListener {
-
+public class MockActionListener implements ActionListener
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a default instance.</p>
*/
- public MockActionListener() {
+ public MockActionListener()
+ {
}
-
// ----------------------------------------------------- Mock Object Methods
-
// ------------------------------------------------------ Instance Variables
-
// -------------------------------------------------- ActionListener Methods
-
/**
* <p>Process the specified <code>ActionEvent</code>.</p>
*
@@ -58,9 +54,10 @@ public class MockActionListener implemen
* @exception AbortProcessingException if further event firing
* should be skipped
*/
- public void processAction(ActionEvent event) throws AbortProcessingException {
+ public void processAction(ActionEvent event)
+ throws AbortProcessingException
+ {
// FIXME - provide default implementation
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication.java Sat Aug 28 18:59:21 2010
@@ -47,15 +47,16 @@ import javax.faces.validator.Validator;
* @since 1.0.0
*/
-public class MockApplication extends Application {
-
+public class MockApplication extends Application
+{
// ------------------------------------------------------------ Constructors
/**
* <p>Construct a default instance.</p>
*/
- public MockApplication() {
+ public MockApplication()
+ {
setActionListener(new MockActionListener());
components = new HashMap();
@@ -72,46 +73,51 @@ public class MockApplication extends App
setViewHandler(new MockViewHandler());
// Register the standard by-id converters
- addConverter("javax.faces.BigDecimal", "javax.faces.convert.BigDecimalConverter");
- addConverter("javax.faces.BigInteger", "javax.faces.convert.BigIntegerConverter");
- addConverter("javax.faces.Boolean", "javax.faces.convert.BooleanConverter");
- addConverter("javax.faces.Byte", "javax.faces.convert.ByteConverter");
- addConverter("javax.faces.Character", "javax.faces.convert.CharacterConverter");
- addConverter("javax.faces.DateTime", "javax.faces.convert.DateTimeConverter");
- addConverter("javax.faces.Double", "javax.faces.convert.DoubleConverter");
- addConverter("javax.faces.Float", "javax.faces.convert.FloatConverter");
- addConverter("javax.faces.Integer", "javax.faces.Convert.IntegerConverter");
- addConverter("javax.faces.Long", "javax.faces.convert.LongConverter");
- addConverter("javax.faces.Number", "javax.faces.convert.NumberConverter");
- addConverter("javax.faces.Short", "javax.faces.convert.ShortConverter");
+ addConverter("javax.faces.BigDecimal",
+ "javax.faces.convert.BigDecimalConverter");
+ addConverter("javax.faces.BigInteger",
+ "javax.faces.convert.BigIntegerConverter");
+ addConverter("javax.faces.Boolean",
+ "javax.faces.convert.BooleanConverter");
+ addConverter("javax.faces.Byte", "javax.faces.convert.ByteConverter");
+ addConverter("javax.faces.Character",
+ "javax.faces.convert.CharacterConverter");
+ addConverter("javax.faces.DateTime",
+ "javax.faces.convert.DateTimeConverter");
+ addConverter("javax.faces.Double",
+ "javax.faces.convert.DoubleConverter");
+ addConverter("javax.faces.Float", "javax.faces.convert.FloatConverter");
+ addConverter("javax.faces.Integer",
+ "javax.faces.Convert.IntegerConverter");
+ addConverter("javax.faces.Long", "javax.faces.convert.LongConverter");
+ addConverter("javax.faces.Number",
+ "javax.faces.convert.NumberConverter");
+ addConverter("javax.faces.Short", "javax.faces.convert.ShortConverter");
// Register the standard by-type converters
- addConverter(Boolean.class, "javax.faces.convert.BooleanConverter");
- addConverter(Boolean.TYPE, "javax.faces.convert.BooleanConverter");
- addConverter(Byte.class, "javax.faces.convert.ByteConverter");
- addConverter(Byte.TYPE, "javax.faces.convert.ByteConverter");
- addConverter(Character.class, "javax.faces.convert.CharacterConverter");
- addConverter(Character.TYPE, "javax.faces.convert.CharacterConverter");
- addConverter(Double.class, "javax.faces.convert.DoubleConverter");
- addConverter(Double.TYPE, "javax.faces.convert.DoubleConverter");
- addConverter(Float.class, "javax.faces.convert.FloatConverter");
- addConverter(Float.TYPE, "javax.faces.convert.FloatConverter");
- addConverter(Integer.class, "javax.faces.convert.IntegerConverter");
- addConverter(Integer.TYPE, "javax.faces.convert.IntegerConverter");
- addConverter(Long.class, "javax.faces.convert.LongConverter");
- addConverter(Long.TYPE, "javax.faces.convert.LongConverter");
- addConverter(Short.class, "javax.faces.convert.ShortConverter");
- addConverter(Short.TYPE, "javax.faces.convert.ShortConverter");
+ addConverter(Boolean.class, "javax.faces.convert.BooleanConverter");
+ addConverter(Boolean.TYPE, "javax.faces.convert.BooleanConverter");
+ addConverter(Byte.class, "javax.faces.convert.ByteConverter");
+ addConverter(Byte.TYPE, "javax.faces.convert.ByteConverter");
+ addConverter(Character.class, "javax.faces.convert.CharacterConverter");
+ addConverter(Character.TYPE, "javax.faces.convert.CharacterConverter");
+ addConverter(Double.class, "javax.faces.convert.DoubleConverter");
+ addConverter(Double.TYPE, "javax.faces.convert.DoubleConverter");
+ addConverter(Float.class, "javax.faces.convert.FloatConverter");
+ addConverter(Float.TYPE, "javax.faces.convert.FloatConverter");
+ addConverter(Integer.class, "javax.faces.convert.IntegerConverter");
+ addConverter(Integer.TYPE, "javax.faces.convert.IntegerConverter");
+ addConverter(Long.class, "javax.faces.convert.LongConverter");
+ addConverter(Long.TYPE, "javax.faces.convert.LongConverter");
+ addConverter(Short.class, "javax.faces.convert.ShortConverter");
+ addConverter(Short.TYPE, "javax.faces.convert.ShortConverter");
}
-
// ----------------------------------------------------- Mock Object Methods
-
// ------------------------------------------------------ Instance Variables
-
private ActionListener actionListener = null;
private Map components = null;
private Map converters = null; // By id
@@ -127,338 +133,364 @@ public class MockApplication extends App
private VariableResolver variableResolver = null;
private ViewHandler viewHandler = null;
-
// ----------------------------------------------------- Application Methods
-
/** {@inheritDoc} */
- public ActionListener getActionListener() {
+ public ActionListener getActionListener()
+ {
return this.actionListener;
}
-
/** {@inheritDoc} */
- public void setActionListener(ActionListener actionListener) {
+ public void setActionListener(ActionListener actionListener)
+ {
this.actionListener = actionListener;
}
-
/** {@inheritDoc} */
- public Locale getDefaultLocale() {
+ public Locale getDefaultLocale()
+ {
return this.defaultLocale;
}
/** {@inheritDoc} */
- public void setDefaultLocale(Locale defaultLocale) {
+ public void setDefaultLocale(Locale defaultLocale)
+ {
this.defaultLocale = defaultLocale;
}
/** {@inheritDoc} */
- public String getDefaultRenderKitId() {
+ public String getDefaultRenderKitId()
+ {
return this.defaultRenderKitId;
}
/** {@inheritDoc} */
- public void setDefaultRenderKitId(String defaultRenderKitId) {
+ public void setDefaultRenderKitId(String defaultRenderKitId)
+ {
this.defaultRenderKitId = defaultRenderKitId;
}
-
/** {@inheritDoc} */
- public String getMessageBundle() {
+ public String getMessageBundle()
+ {
return this.messageBundle;
}
-
/** {@inheritDoc} */
- public void setMessageBundle(String messageBundle) {
+ public void setMessageBundle(String messageBundle)
+ {
this.messageBundle = messageBundle;
}
-
/** {@inheritDoc} */
- public NavigationHandler getNavigationHandler() {
+ public NavigationHandler getNavigationHandler()
+ {
return this.navigationHandler;
}
-
/** {@inheritDoc} */
- public void setNavigationHandler(NavigationHandler navigationHandler) {
+ public void setNavigationHandler(NavigationHandler navigationHandler)
+ {
this.navigationHandler = navigationHandler;
}
-
/** {@inheritDoc} */
- public PropertyResolver getPropertyResolver() {
+ public PropertyResolver getPropertyResolver()
+ {
return this.propertyResolver;
}
-
/** {@inheritDoc} */
- public void setPropertyResolver(PropertyResolver propertyResolver) {
+ public void setPropertyResolver(PropertyResolver propertyResolver)
+ {
this.propertyResolver = propertyResolver;
}
-
/** {@inheritDoc} */
- public StateManager getStateManager() {
+ public StateManager getStateManager()
+ {
return this.stateManager;
}
-
/** {@inheritDoc} */
- public void setStateManager(StateManager stateManager) {
+ public void setStateManager(StateManager stateManager)
+ {
this.stateManager = stateManager;
}
-
/** {@inheritDoc} */
- public Iterator getSupportedLocales() {
+ public Iterator getSupportedLocales()
+ {
return this.supportedLocales.iterator();
}
-
/** {@inheritDoc} */
- public void setSupportedLocales(Collection supportedLocales) {
+ public void setSupportedLocales(Collection supportedLocales)
+ {
this.supportedLocales = supportedLocales;
}
-
/** {@inheritDoc} */
- public VariableResolver getVariableResolver() {
+ public VariableResolver getVariableResolver()
+ {
return this.variableResolver;
}
-
/** {@inheritDoc} */
- public void setVariableResolver(VariableResolver variableResolver) {
+ public void setVariableResolver(VariableResolver variableResolver)
+ {
this.variableResolver = variableResolver;
}
-
/** {@inheritDoc} */
- public ViewHandler getViewHandler() {
+ public ViewHandler getViewHandler()
+ {
return this.viewHandler;
}
-
/** {@inheritDoc} */
- public void setViewHandler(ViewHandler viewHandler) {
+ public void setViewHandler(ViewHandler viewHandler)
+ {
this.viewHandler = viewHandler;
}
-
/** {@inheritDoc} */
- public void addComponent(String componentType, String componentClass) {
+ public void addComponent(String componentType, String componentClass)
+ {
components.put(componentType, componentClass);
}
-
/** {@inheritDoc} */
- public UIComponent createComponent(String componentType) {
+ public UIComponent createComponent(String componentType)
+ {
- if (componentType == null) {
+ if (componentType == null)
+ {
throw new NullPointerException("Requested component type is null");
}
String componentClass = (String) components.get(componentType);
- if (componentClass == null) {
- throw new FacesException("No component class registered for component type '"
- + componentType + "'");
+ if (componentClass == null)
+ {
+ throw new FacesException(
+ "No component class registered for component type '"
+ + componentType + "'");
}
- try {
+ try
+ {
Class clazz = Class.forName(componentClass);
return ((UIComponent) clazz.newInstance());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
}
-
/** {@inheritDoc} */
public UIComponent createComponent(ValueBinding componentBinding,
- FacesContext context,
- String componentType)
- throws FacesException {
+ FacesContext context, String componentType) throws FacesException
+ {
UIComponent component = null;
- try {
+ try
+ {
component = (UIComponent) componentBinding.getValue(context);
- if (component == null) {
+ if (component == null)
+ {
component = createComponent(componentType);
componentBinding.setValue(context, component);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
return component;
}
-
/** {@inheritDoc} */
- public Iterator getComponentTypes() {
+ public Iterator getComponentTypes()
+ {
return (components.keySet().iterator());
}
-
/** {@inheritDoc} */
- public void addConverter(String converterId, String converterClass) {
+ public void addConverter(String converterId, String converterClass)
+ {
converters.put(converterId, converterClass);
}
-
/** {@inheritDoc} */
- public void addConverter(Class targetClass, String converterClass) {
+ public void addConverter(Class targetClass, String converterClass)
+ {
converters1.put(targetClass, converterClass);
}
-
/** {@inheritDoc} */
- public Converter createConverter(String converterId) {
+ public Converter createConverter(String converterId)
+ {
String converterClass = (String) converters.get(converterId);
- if (converterClass == null) {
+ if (converterClass == null)
+ {
return null;
}
- try {
+ try
+ {
Class clazz = Class.forName(converterClass);
return ((Converter) clazz.newInstance());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
}
-
/** {@inheritDoc} */
- public Converter createConverter(Class targetClass) {
+ public Converter createConverter(Class targetClass)
+ {
String converterClass = (String) converters1.get(targetClass);
- if (converterClass == null) {
+ if (converterClass == null)
+ {
return null;
}
- try {
+ try
+ {
Class clazz = Class.forName(converterClass);
return ((Converter) clazz.newInstance());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
}
-
/** {@inheritDoc} */
- public Iterator getConverterIds() {
+ public Iterator getConverterIds()
+ {
return (converters.keySet().iterator());
}
-
/** {@inheritDoc} */
- public Iterator getConverterTypes() {
+ public Iterator getConverterTypes()
+ {
return (converters1.keySet().iterator());
}
-
/** {@inheritDoc} */
- public MethodBinding createMethodBinding(String ref, Class[] params) {
+ public MethodBinding createMethodBinding(String ref, Class[] params)
+ {
- if (ref == null) {
+ if (ref == null)
+ {
throw new NullPointerException();
- } else {
+ }
+ else
+ {
return (new MockMethodBinding(this, ref, params));
}
}
-
/** {@inheritDoc} */
- public ValueBinding createValueBinding(String ref) {
+ public ValueBinding createValueBinding(String ref)
+ {
- if (ref == null) {
+ if (ref == null)
+ {
throw new NullPointerException();
- } else {
+ }
+ else
+ {
return (new MockValueBinding(this, ref));
}
}
-
/** {@inheritDoc} */
- public void addValidator(String validatorId, String validatorClass) {
+ public void addValidator(String validatorId, String validatorClass)
+ {
validators.put(validatorId, validatorClass);
}
-
/** {@inheritDoc} */
- public Validator createValidator(String validatorId) {
+ public Validator createValidator(String validatorId)
+ {
String validatorClass = (String) validators.get(validatorId);
- try {
+ try
+ {
Class clazz = Class.forName(validatorClass);
return ((Validator) clazz.newInstance());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
}
-
/** {@inheritDoc} */
- public Iterator getValidatorIds() {
+ public Iterator getValidatorIds()
+ {
return (validators.keySet().iterator());
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication12.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication12.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication12.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplication12.java Sat Aug 28 18:59:21 2010
@@ -56,16 +56,16 @@ import org.apache.myfaces.test.el.MockEx
*
* @since 1.0.0
*/
-public class MockApplication12 extends MockApplication {
-
+public class MockApplication12 extends MockApplication
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a default instance.</p>
*/
- public MockApplication12() {
+ public MockApplication12()
+ {
super();
@@ -74,44 +74,36 @@ public class MockApplication12 extends M
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>A list of resource bundles configured for this application.</p>
*/
private Map bundles = new HashMap();
-
/**
* <p>The set of configured ELContextListener instances.</p>
*/
private List elContextListeners = new ArrayList();
-
/**
* <p>Expression factory for this instance.</p>
*/
private ExpressionFactory expressionFactory = null;
-
/**
* <p>The configured composite resolver to be returned by <code>getELResolver()</code>.
* This value is lazily instantiated.</p>
*/
private ELResolver resolver = null;
-
/**
* <p>The set of ELResolver instances configured on this instance.</p>
*/
private List resolvers = new ArrayList();
-
// ----------------------------------------------------- Mock Object Methods
-
/**
* <p>Add the specified resource bundle to those associated with
* this application.</p>
@@ -119,37 +111,38 @@ public class MockApplication12 extends M
* @param name Name under which to add this resource bundle
* @param bundle ResourceBundle to add
*/
- public void addResourceBundle(String name, ResourceBundle bundle) {
+ public void addResourceBundle(String name, ResourceBundle bundle)
+ {
bundles.put(name, bundle);
}
-
/**
* <p>Return a <code>Map</code> of the resource bundles configured
* for this application, keyed by name.</p>
*/
- public Map getResourceBundles() {
+ public Map getResourceBundles()
+ {
return bundles;
}
-
// ----------------------------------------------------- Application Methods
-
/** {@inheritDoc} */
- public void addELContextListener(ELContextListener listener) {
+ public void addELContextListener(ELContextListener listener)
+ {
elContextListeners.add(listener);
}
-
/** {@inheritDoc} */
- public void addELResolver(ELResolver resolver) {
+ public void addELResolver(ELResolver resolver)
+ {
// Simulate the restriction that you cannot add resolvers after
// the first request has been processed.
- if (this.resolver != null) {
+ if (this.resolver != null)
+ {
throw new IllegalStateException("Cannot add resolvers now");
}
@@ -157,53 +150,57 @@ public class MockApplication12 extends M
}
-
/** {@inheritDoc} */
public UIComponent createComponent(ValueExpression expression,
- FacesContext context,
- String componentType) {
+ FacesContext context, String componentType)
+ {
UIComponent component = null;
- try {
- component = (UIComponent) expression.getValue(context.getELContext());
- if (component == null) {
+ try
+ {
+ component = (UIComponent) expression.getValue(context
+ .getELContext());
+ if (component == null)
+ {
component = createComponent(componentType);
expression.setValue(context.getELContext(), component);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
return component;
}
-
/** {@inheritDoc} */
public Object evaluateExpressionGet(FacesContext context,
- String expression,
- Class expectedType) throws ELException {
+ String expression, Class expectedType) throws ELException
+ {
- ValueExpression ve = getExpressionFactory().createValueExpression
- (context.getELContext(), expression, expectedType);
+ ValueExpression ve = getExpressionFactory().createValueExpression(
+ context.getELContext(), expression, expectedType);
return ve.getValue(context.getELContext());
}
-
/** {@inheritDoc} */
- public ELContextListener[] getELContextListeners() {
+ public ELContextListener[] getELContextListeners()
+ {
- return (ELContextListener[])
- elContextListeners.toArray(new ELContextListener[elContextListeners.size()]);
+ return (ELContextListener[]) elContextListeners
+ .toArray(new ELContextListener[elContextListeners.size()]);
}
-
/** {@inheritDoc} */
- public ELResolver getELResolver() {
+ public ELResolver getELResolver()
+ {
- if (resolver == null) {
+ if (resolver == null)
+ {
// Configure a default ELResolver per Section 5.6.2 of JSF 1.2
CompositeELResolver composite = new CompositeELResolver();
@@ -215,7 +212,8 @@ public class MockApplication12 extends M
nested.add(new FacesVariableResolverChainWrapper());
nested.add(new FacesPropertyResolverChainWrapper());
Iterator items = resolvers.iterator();
- while (items.hasNext()) {
+ while (items.hasNext())
+ {
nested.add((ELResolver) items.next());
}
composite.add(nested);
@@ -237,46 +235,48 @@ public class MockApplication12 extends M
}
-
/** {@inheritDoc} */
- public ExpressionFactory getExpressionFactory() {
+ public ExpressionFactory getExpressionFactory()
+ {
return this.expressionFactory;
}
-
/** {@inheritDoc} */
- public ResourceBundle getResourceBundle(FacesContext context, String name) {
+ public ResourceBundle getResourceBundle(FacesContext context, String name)
+ {
- if ((context == null) || (name == null)) {
+ if ((context == null) || (name == null))
+ {
throw new NullPointerException();
}
Locale locale = null;
UIViewRoot viewRoot = context.getViewRoot();
- if (viewRoot != null) {
+ if (viewRoot != null)
+ {
locale = viewRoot.getLocale();
}
- if (locale == null) {
+ if (locale == null)
+ {
locale = Locale.getDefault();
}
- try
+ try
{
return ResourceBundle.getBundle(name, locale);
}
- catch (MissingResourceException e)
+ catch (MissingResourceException e)
{
return null;
}
}
-
/** {@inheritDoc} */
- public void removeELContextListener(ELContextListener listener) {
+ public void removeELContextListener(ELContextListener listener)
+ {
elContextListeners.remove(listener);
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java Sat Aug 28 18:59:21 2010
@@ -28,62 +28,74 @@ import javax.faces.application.Applicati
* @since 1.0.0
*/
-public class MockApplicationFactory extends ApplicationFactory {
-
+public class MockApplicationFactory extends ApplicationFactory
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a default instance.</p>
*/
- public MockApplicationFactory() {
+ public MockApplicationFactory()
+ {
}
-
// ----------------------------------------------------- Mock Object Methods
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The <code>Application</code> instance to be returned by
* this factory.</p>
*/
private Application application = null;
-
// --------------------------------------------- AppolicationFactory Methods
-
/** {@inheritDoc} */
- public Application getApplication() {
+ public Application getApplication()
+ {
- if (this.application == null) {
+ if (this.application == null)
+ {
Class clazz = null;
- try {
- clazz = this.getClass().getClassLoader().loadClass
- ("org.apache.myfaces.test.mock.MockApplication12");
+ try
+ {
+ clazz = this.getClass().getClassLoader().loadClass(
+ "org.apache.myfaces.test.mock.MockApplication12");
this.application = (MockApplication) clazz.newInstance();
- } catch (NoClassDefFoundError e) {
+ }
+ catch (NoClassDefFoundError e)
+ {
clazz = null; // We are not running in a JSF 1.2 environment
- } catch (ClassNotFoundException e) {
+ }
+ catch (ClassNotFoundException e)
+ {
clazz = null; // Same as above
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
throw e;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
- if (clazz == null) {
- try {
- clazz = this.getClass().getClassLoader().loadClass
- ("org.apache.myfaces.test.mock.MockApplication");
+ if (clazz == null)
+ {
+ try
+ {
+ clazz = this.getClass().getClassLoader().loadClass(
+ "org.apache.myfaces.test.mock.MockApplication");
this.application = (MockApplication) clazz.newInstance();
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
throw e;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new FacesException(e);
}
}
@@ -92,13 +104,12 @@ public class MockApplicationFactory exte
}
-
/** {@inheritDoc} */
- public void setApplication(Application application) {
+ public void setApplication(Application application)
+ {
this.application = application;
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockEnumeration.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockEnumeration.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockEnumeration.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockEnumeration.java Sat Aug 28 18:59:21 2010
@@ -28,53 +28,48 @@ import java.util.Iterator;
* @since 1.0.0
*/
-class MockEnumeration implements Enumeration {
-
+class MockEnumeration implements Enumeration
+{
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct a wrapper instance.</p>
*
* @param iterator The <code>Iterator</code> to be wrapped
*/
- public MockEnumeration(Iterator iterator) {
+ public MockEnumeration(Iterator iterator)
+ {
this.iterator = iterator;
}
-
// ----------------------------------------------------- Mock Object Methods
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The <code>Iterator</code> we are wrapping.</p>
*/
private Iterator iterator;
-
// ----------------------------------------------------- Enumeration Methods
-
/** {@inheritDoc} */
- public boolean hasMoreElements() {
+ public boolean hasMoreElements()
+ {
return iterator.hasNext();
}
-
/** {@inheritDoc} */
- public Object nextElement() {
+ public Object nextElement()
+ {
return iterator.next();
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java Sat Aug 28 18:59:21 2010
@@ -56,8 +56,7 @@ public class MockExternalContext extends
* @param response <code>HttpServletResponse</code> for this request
*/
public MockExternalContext(ServletContext context,
- HttpServletRequest request,
- HttpServletResponse response)
+ HttpServletRequest request, HttpServletResponse response)
{
this.context = context;
@@ -101,10 +100,10 @@ public class MockExternalContext extends
public void addRequestCookieMap(Cookie cookie)
{
Map map = getRequestCookieMap();
- if (request instanceof MockHttpServletRequest &&
- map instanceof _CookieMap)
+ if (request instanceof MockHttpServletRequest
+ && map instanceof _CookieMap)
{
- ((MockHttpServletRequest)request).addCookie(cookie);
+ ((MockHttpServletRequest) request).addCookie(cookie);
}
else
{
@@ -131,10 +130,10 @@ public class MockExternalContext extends
public void addRequestParameterMap(String key, String value)
{
Map map = getRequestParameterMap();
- if (request instanceof MockHttpServletRequest &&
- map instanceof _RequestParameterMap)
+ if (request instanceof MockHttpServletRequest
+ && map instanceof _RequestParameterMap)
{
- ((MockHttpServletRequest)request).addParameter(key, value);
+ ((MockHttpServletRequest) request).addParameter(key, value);
}
else
{
@@ -161,10 +160,10 @@ public class MockExternalContext extends
public void addRequestHeader(String key, String value)
{
Map map = getRequestHeaderMap();
- if (request instanceof MockHttpServletRequest &&
- map instanceof _RequestHeaderMap)
+ if (request instanceof MockHttpServletRequest
+ && map instanceof _RequestHeaderMap)
{
- ((MockHttpServletRequest)request).addHeader(key, value);
+ ((MockHttpServletRequest) request).addHeader(key, value);
}
else
{
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext12.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext12.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext12.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext12.java Sat Aug 28 18:59:21 2010
@@ -30,90 +30,86 @@ import javax.servlet.http.HttpServletRes
*
* @since 1.0.0
*/
-public class MockExternalContext12 extends MockExternalContext {
-
+public class MockExternalContext12 extends MockExternalContext
+{
// ------------------------------------------------------------ Constructors
-
public MockExternalContext12(ServletContext context,
- HttpServletRequest request,
- HttpServletResponse response) {
+ HttpServletRequest request, HttpServletResponse response)
+ {
super(context, request, response);
}
-
// ------------------------------------------------------ Instance Variables
-
// ----------------------------------------------------- Mock Object Methods
-
// ------------------------------------------------- ExternalContext Methods
-
/** {@inheritDoc} */
- public String getRequestCharacterEncoding() {
+ public String getRequestCharacterEncoding()
+ {
return this.request.getCharacterEncoding();
}
-
/** {@inheritDoc} */
- public String getRequestContentType() {
+ public String getRequestContentType()
+ {
return this.request.getContentType();
}
-
/** {@inheritDoc} */
- public String getResponseCharacterEncoding() {
+ public String getResponseCharacterEncoding()
+ {
return this.response.getCharacterEncoding();
}
-
/** {@inheritDoc} */
- public String getResponseContentType() {
+ public String getResponseContentType()
+ {
return this.response.getContentType();
}
-
/** {@inheritDoc} */
- public void setRequest(Object request) {
+ public void setRequest(Object request)
+ {
this.request = (HttpServletRequest) request;
}
-
/** {@inheritDoc} */
- public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException {
+ public void setRequestCharacterEncoding(String encoding)
+ throws UnsupportedEncodingException
+ {
this.request.setCharacterEncoding(encoding);
}
-
/** {@inheritDoc} */
- public void setResponse(Object response) {
+ public void setResponse(Object response)
+ {
this.response = (HttpServletResponse) response;
}
-
/** {@inheritDoc} */
- public void setResponseCharacterEncoding(String encoding) {
+ public void setResponseCharacterEncoding(String encoding)
+ {
this.response.setCharacterEncoding(encoding);
}
-
}
Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockFacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockFacesContext.java?rev=990408&r1=990407&r2=990408&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockFacesContext.java (original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockFacesContext.java Sat Aug 28 18:59:21 2010
@@ -36,79 +36,75 @@ import javax.faces.lifecycle.Lifecycle;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
-
/**
* <p>Mock implementation of <code>FacesContext</code>.</p>
*
* $Id$
* @since 1.0.0
*/
-public class MockFacesContext extends FacesContext {
-
+public class MockFacesContext extends FacesContext
+{
// ------------------------------------------------------------ Constructors
-
- public MockFacesContext() {
+ public MockFacesContext()
+ {
super();
setCurrentInstance(this);
}
-
- public MockFacesContext(ExternalContext externalContext) {
+ public MockFacesContext(ExternalContext externalContext)
+ {
setExternalContext(externalContext);
setCurrentInstance(this);
}
-
- public MockFacesContext(ExternalContext externalContext, Lifecycle lifecycle) {
+ public MockFacesContext(ExternalContext externalContext, Lifecycle lifecycle)
+ {
this(externalContext);
this.lifecycle = lifecycle;
}
-
// ----------------------------------------------------- Mock Object Methods
-
/**
* <p>Set the <code>Application</code> instance for this instance.</p>
*
* @param application The new Application
*/
- public void setApplication(Application application) {
+ public void setApplication(Application application)
+ {
this.application = application;
}
-
/**
* <p>Set the <code>ExternalContext</code> instance for this instance.</p>
*
* @param externalContext The new ExternalContext
*/
- public void setExternalContext(ExternalContext externalContext) {
+ public void setExternalContext(ExternalContext externalContext)
+ {
this.externalContext = externalContext;
}
-
/**
* <p>Set the <code>FacesContext</code> instance for this instance.</p>
*
* @param facesContext The new FacesContext
*/
- public static void setCurrentInstance(FacesContext facesContext) {
+ public static void setCurrentInstance(FacesContext facesContext)
+ {
FacesContext.setCurrentInstance(facesContext);
}
-
// ------------------------------------------------------ Instance Variables
-
private Application application = null;
private ExternalContext externalContext = null;
private Lifecycle lifecycle = null;
@@ -119,44 +115,47 @@ public class MockFacesContext extends Fa
private ResponseWriter responseWriter = null;
private UIViewRoot viewRoot = null;
-
// ---------------------------------------------------- FacesContext Methods
-
/** {@inheritDoc} */
- public Application getApplication() {
+ public Application getApplication()
+ {
return this.application;
}
-
/** {@inheritDoc} */
- public Iterator getClientIdsWithMessages() {
+ public Iterator getClientIdsWithMessages()
+ {
return messages.keySet().iterator();
}
-
/** {@inheritDoc} */
- public ExternalContext getExternalContext() {
+ public ExternalContext getExternalContext()
+ {
return this.externalContext;
}
-
/** {@inheritDoc} */
- public Severity getMaximumSeverity() {
+ public Severity getMaximumSeverity()
+ {
Severity severity = null;
Iterator messages = getMessages();
- while (messages.hasNext()) {
+ while (messages.hasNext())
+ {
FacesMessage message = (FacesMessage) messages.next();
- if (severity == null) {
+ if (severity == null)
+ {
severity = message.getSeverity();
- } else if (message.getSeverity().getOrdinal() > severity.getOrdinal()) {
+ }
+ else if (message.getSeverity().getOrdinal() > severity.getOrdinal())
+ {
severity = message.getSeverity();
}
}
@@ -164,13 +163,14 @@ public class MockFacesContext extends Fa
}
-
/** {@inheritDoc} */
- public Iterator getMessages() {
+ public Iterator getMessages()
+ {
ArrayList results = new ArrayList();
Iterator clientIds = messages.keySet().iterator();
- while (clientIds.hasNext()) {
+ while (clientIds.hasNext())
+ {
String clientId = (String) clientIds.next();
results.addAll((List) messages.get(clientId));
}
@@ -178,109 +178,114 @@ public class MockFacesContext extends Fa
}
-
/** {@inheritDoc} */
- public Iterator getMessages(String clientId) {
+ public Iterator getMessages(String clientId)
+ {
List list = (List) messages.get(clientId);
- if (list == null) {
+ if (list == null)
+ {
list = new ArrayList();
}
return list.iterator();
}
-
/** {@inheritDoc} */
- public RenderKit getRenderKit() {
+ public RenderKit getRenderKit()
+ {
UIViewRoot vr = getViewRoot();
- if (vr == null) {
+ if (vr == null)
+ {
return null;
}
String renderKitId = vr.getRenderKitId();
- if (renderKitId == null) {
+ if (renderKitId == null)
+ {
return null;
}
- RenderKitFactory rkFactory = (RenderKitFactory)
- FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKitFactory rkFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
return rkFactory.getRenderKit(this, renderKitId);
}
-
/** {@inheritDoc} */
- public boolean getRenderResponse() {
+ public boolean getRenderResponse()
+ {
return this.renderResponse;
}
-
/** {@inheritDoc} */
- public boolean getResponseComplete() {
+ public boolean getResponseComplete()
+ {
return this.responseComplete;
}
-
/** {@inheritDoc} */
- public ResponseStream getResponseStream() {
+ public ResponseStream getResponseStream()
+ {
return this.responseStream;
}
-
/** {@inheritDoc} */
- public void setResponseStream(ResponseStream responseStream) {
+ public void setResponseStream(ResponseStream responseStream)
+ {
this.responseStream = responseStream;
}
-
/** {@inheritDoc} */
- public ResponseWriter getResponseWriter() {
+ public ResponseWriter getResponseWriter()
+ {
return this.responseWriter;
}
-
/** {@inheritDoc} */
- public void setResponseWriter(ResponseWriter responseWriter) {
+ public void setResponseWriter(ResponseWriter responseWriter)
+ {
this.responseWriter = responseWriter;
}
-
/** {@inheritDoc} */
- public UIViewRoot getViewRoot() {
+ public UIViewRoot getViewRoot()
+ {
return this.viewRoot;
}
-
/** {@inheritDoc} */
- public void setViewRoot(UIViewRoot viewRoot) {
+ public void setViewRoot(UIViewRoot viewRoot)
+ {
this.viewRoot = viewRoot;
}
-
/** {@inheritDoc} */
- public void addMessage(String clientId, FacesMessage message) {
+ public void addMessage(String clientId, FacesMessage message)
+ {
- if (message == null) {
+ if (message == null)
+ {
throw new NullPointerException();
}
List list = (List) messages.get(clientId);
- if (list == null) {
+ if (list == null)
+ {
list = new ArrayList();
messages.put(clientId, list);
}
@@ -288,9 +293,9 @@ public class MockFacesContext extends Fa
}
-
/** {@inheritDoc} */
- public void release() {
+ public void release()
+ {
application = null;
externalContext = null;
@@ -304,21 +309,20 @@ public class MockFacesContext extends Fa
}
-
/** {@inheritDoc} */
- public void renderResponse() {
+ public void renderResponse()
+ {
this.renderResponse = true;
}
-
/** {@inheritDoc} */
- public void responseComplete() {
+ public void responseComplete()
+ {
this.responseComplete = true;
}
-
}