You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2006/01/02 21:49:35 UTC

svn commit: r365427 - in /myfaces/api/trunk: ./ src/main/java/javax/faces/component/ src/test/java/javax/faces/ src/test/java/javax/faces/component/ src/test/java/javax/faces/context/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apach...

Author: schof
Date: Mon Jan  2 12:49:29 2006
New Revision: 365427

URL: http://svn.apache.org/viewcvs?rev=365427&view=rev
Log:
Fixes MYFACES-829 (Patch by John Fallows)

Added:
    myfaces/api/trunk/src/main/java/javax/faces/component/_PrimitiveArrayIterator.java
    myfaces/api/trunk/src/test/java/javax/faces/Messages_xx_TEST.java
    myfaces/api/trunk/src/test/java/javax/faces/component/UISelectManyTest.java
    myfaces/api/trunk/src/test/java/javax/faces/context/
    myfaces/api/trunk/src/test/java/org/
    myfaces/api/trunk/src/test/java/org/apache/
    myfaces/api/trunk/src/test/java/org/apache/myfaces/
    myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/
    myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockApplication.java
    myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockFacesContext.java
    myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockStateManager.java
Modified:
    myfaces/api/trunk/pom.xml
    myfaces/api/trunk/src/main/java/javax/faces/component/UISelectMany.java

Modified: myfaces/api/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/pom.xml?rev=365427&r1=365426&r2=365427&view=diff
==============================================================================
--- myfaces/api/trunk/pom.xml (original)
+++ myfaces/api/trunk/pom.xml Mon Jan  2 12:49:29 2006
@@ -152,6 +152,15 @@
     </dependency>   
 
   </dependencies>
+  
+  <reporting>
+	  <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>surefire-report-maven-plugin</artifactId>
+      </plugin>	  
+  	</plugins>	    
+	</reporting>  	
 <!--
   <licenses>
     <license>

Modified: myfaces/api/trunk/src/main/java/javax/faces/component/UISelectMany.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/main/java/javax/faces/component/UISelectMany.java?rev=365427&r1=365426&r2=365427&view=diff
==============================================================================
--- myfaces/api/trunk/src/main/java/javax/faces/component/UISelectMany.java (original)
+++ myfaces/api/trunk/src/main/java/javax/faces/component/UISelectMany.java Mon Jan  2 12:49:29 2006
@@ -16,8 +16,10 @@
 package javax.faces.component;
 
 import java.lang.reflect.Array;
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -228,11 +230,22 @@
 
     protected void validateValue(FacesContext context, Object convertedValue)
     {
-        boolean empty = convertedValue == null
-                        || ((convertedValue instanceof Object[]) && (((Object[]) convertedValue).length == 0))
-                        || ((convertedValue instanceof List) && ((List) convertedValue).isEmpty());
+        Iterator itemValues = _createItemValuesIterator(convertedValue);
 
-        if (isRequired() && empty)
+        // verify that iterator was successfully created for convertedValue type
+        if (itemValues == null)
+        {
+            _MessageUtils.addErrorMessage(context, this,
+                                          INVALID_MESSAGE_ID,
+                                          new Object[] {getId()});
+            setValid(false);
+            return;
+        }
+
+        boolean hasValues = itemValues.hasNext();
+
+        // if UISelectMany is required, then there must be some selected values
+        if (isRequired() && !hasValues)
         {
             _MessageUtils.addErrorMessage(context, this, REQUIRED_MESSAGE_ID,
                             new Object[] {getId()});
@@ -240,23 +253,16 @@
             return;
         }
 
-        if (!empty)
+        // run the validators only if there are item values to validate
+        if (hasValues)
         {
             _ComponentUtils.callValidators(context, this, convertedValue);
         }
 
-        if (isValid() && convertedValue != null)
+        if (isValid() && hasValues)
         {
             // all selected values must match to the values of the available options
 
-            if (! (convertedValue instanceof Object[]) && ! (convertedValue instanceof List)) {
-                _MessageUtils.addErrorMessage(context, this,
-                                INVALID_MESSAGE_ID,
-                                new Object[] {getId()});
-                setValid(false);
-                return;
-            }
-            
             _ValueConverter converter = new _ValueConverter()
             {
                 public Object getConvertedValue(FacesContext context, String value)
@@ -275,48 +281,24 @@
                 }
             };
 
-            if ( convertedValue instanceof Object[] ){ 
-	            Object[] values = (Object[]) convertedValue;
-	            if (values.length > 0)
-	            {
-	                Collection items = new ArrayList();
-	                for (Iterator iter = new _SelectItemsIterator(this); iter.hasNext();)
-	                {
-	                    items.add( iter.next() );
-	                }
-	                for (int i = 0, size = values.length; i < size; i++)
-	                {
-	                    if (!_SelectItemsUtil.matchValue(context, values[i],
-	                                    items.iterator(), converter))
-	                    {
-	                        _MessageUtils.addErrorMessage(context, this,
-	                                        INVALID_MESSAGE_ID,
-	                                        new Object[] {getId()});
-	                        setValid(false);
-	                    }
-	                }
-	            }
-            }else{ // convertedValue instanceof List
-            	List values = (List) convertedValue;
-	            if ( ! values.isEmpty() )
-	            {
-	                Collection items = new ArrayList();
-	                for (Iterator iter = new _SelectItemsIterator(this); iter.hasNext();)
-	                {
-	                    items.add( iter.next() );
-	                }
-	                for (Iterator i = values.iterator(); i.hasNext();)
-	                {
-	                    if (!_SelectItemsUtil.matchValue(context, i.next(),
-	                                    items.iterator(), converter))
-	                    {
-	                        _MessageUtils.addErrorMessage(context, this,
-	                                        INVALID_MESSAGE_ID,
-	                                        new Object[] {getId()});
-	                        setValid(false);
-	                    }
-	                }
-	            }
+            Collection items = new ArrayList();
+            for (Iterator iter = new _SelectItemsIterator(this); iter.hasNext();)
+            {
+                items.add( iter.next() );
+            }
+            while (itemValues.hasNext())
+            {
+                Object itemValue = itemValues.next();
+
+                if (!_SelectItemsUtil.matchValue(context, itemValue,
+                                                 items.iterator(), converter))
+                {
+                    _MessageUtils.addErrorMessage(context, this,
+                                    INVALID_MESSAGE_ID,
+                                    new Object[] {getId()});
+                    setValid(false);
+                    return;
+                }
             }
         }
     }
@@ -370,6 +352,37 @@
             setValid(false);
         }
         return submittedValue;
+    }
+
+    private Iterator _createItemValuesIterator(Object convertedValue)
+    {
+        if (convertedValue == null)
+        {
+            return Collections.EMPTY_LIST.iterator();
+        }
+        else
+        {
+            Class valueClass = convertedValue.getClass();
+            if (valueClass.isArray())
+            {
+                return new _PrimitiveArrayIterator(convertedValue);
+            }
+            else if (convertedValue instanceof Object[])
+            {
+                Object[] values = (Object[]) convertedValue;
+                return Arrays.asList(values).iterator();
+            }
+            else if (convertedValue instanceof List)
+            {
+                List values = (List) convertedValue;
+                return values.iterator();
+            }
+            else
+            {
+                // unsupported type for iteration
+                return null;
+            }
+        }
     }
 
     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------

Added: myfaces/api/trunk/src/main/java/javax/faces/component/_PrimitiveArrayIterator.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/main/java/javax/faces/component/_PrimitiveArrayIterator.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/main/java/javax/faces/component/_PrimitiveArrayIterator.java (added)
+++ myfaces/api/trunk/src/main/java/javax/faces/component/_PrimitiveArrayIterator.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.faces.component;
+
+import java.lang.reflect.Array;
+import java.util.Iterator;
+
+/**
+ * This utility iterator uses reflection to iterate over primitive arrays.
+ */
+class _PrimitiveArrayIterator implements Iterator
+{
+    public _PrimitiveArrayIterator(Object primitiveArray)
+    {
+        if (primitiveArray == null ||
+            !primitiveArray.getClass().isArray())
+        {
+            throw new IllegalArgumentException("Requires a primitive array");
+        }
+
+        _primitiveArray = primitiveArray;
+        _size = Array.getLength(primitiveArray);
+    }
+
+    public boolean hasNext()
+    {
+        return (_position < _size);
+    }
+
+    public Object next()
+    {
+        return Array.get(_primitiveArray, _position++);
+    }
+
+    public void remove()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    private Object _primitiveArray;
+    private int    _size;
+    private int    _position;
+}

Added: myfaces/api/trunk/src/test/java/javax/faces/Messages_xx_TEST.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/test/java/javax/faces/Messages_xx_TEST.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/test/java/javax/faces/Messages_xx_TEST.java (added)
+++ myfaces/api/trunk/src/test/java/javax/faces/Messages_xx_TEST.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.faces;
+
+import java.util.ListResourceBundle;
+import javax.faces.component.UIInput;
+
+public class Messages_xx_TEST extends ListResourceBundle
+{
+  protected Object[][] getContents()
+  {
+    return _CONTENTS;
+  }
+
+  private static final Object[][] _CONTENTS = {
+      {UIInput.REQUIRED_MESSAGE_ID, "Required value not found for component with id {0}"},
+  };
+
+}

Added: myfaces/api/trunk/src/test/java/javax/faces/component/UISelectManyTest.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/test/java/javax/faces/component/UISelectManyTest.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/test/java/javax/faces/component/UISelectManyTest.java (added)
+++ myfaces/api/trunk/src/test/java/javax/faces/component/UISelectManyTest.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,181 @@
+package javax.faces.component;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.myfaces.mock.MockApplication;
+import org.apache.myfaces.mock.MockFacesContext;
+import javax.faces.component.UIViewRoot;
+
+import junit.framework.TestCase;
+
+public class UISelectManyTest extends TestCase {
+
+  public UISelectManyTest(String name) {
+    super(name);
+  }
+
+  public void testValidateRequiredNull() {
+    UIViewRoot view = new UIViewRoot();
+    view.setLocale(_TEST_LOCALE);
+
+    MockApplication application = new MockApplication();
+    MockFacesContext context = new MockFacesContext();
+    context.setupGetViewRoot(view);
+    context.setupGetApplication(application);
+
+    UISelectMany selectMany = new UISelectMany();
+    selectMany.setId("selectMany");
+    selectMany.setRendererType(null);
+    selectMany.setRequired(true);
+    List children = selectMany.getChildren();
+
+    UISelectItem one = new UISelectItem();
+    one.setItemValue(new Integer(1));
+    children.add(one);
+
+    UISelectItem two = new UISelectItem();
+    two.setItemValue(new Integer(2));
+    children.add(two);
+
+    UISelectItem three = new UISelectItem();
+    three.setItemValue(new Integer(3));
+    children.add(three);
+
+    selectMany.validateValue(context, null);
+
+    assertFalse(selectMany.isValid());
+  }
+
+  public void testValidateRequiredEmptyList() {
+    UIViewRoot view = new UIViewRoot();
+    view.setLocale(_TEST_LOCALE);
+
+    MockApplication application = new MockApplication();
+    MockFacesContext context = new MockFacesContext();
+    context.setupGetViewRoot(view);
+    context.setupGetApplication(application);
+
+    UISelectMany selectMany = new UISelectMany();
+    selectMany.setId("selectMany");
+    selectMany.setRendererType(null);
+    selectMany.setRequired(true);
+    List children = selectMany.getChildren();
+
+    UISelectItem one = new UISelectItem();
+    one.setItemValue(new Integer(1));
+    children.add(one);
+
+    UISelectItem two = new UISelectItem();
+    two.setItemValue(new Integer(2));
+    children.add(two);
+
+    UISelectItem three = new UISelectItem();
+    three.setItemValue(new Integer(3));
+    children.add(three);
+
+    selectMany.validateValue(context, Collections.EMPTY_LIST);
+
+    assertFalse(selectMany.isValid());
+  }
+
+  public void testValidateIntArray() {
+    UIViewRoot view = new UIViewRoot();
+    view.setLocale(_TEST_LOCALE);
+
+    MockApplication application = new MockApplication();
+
+    MockFacesContext context = new MockFacesContext();
+    context.setupGetViewRoot(view);
+    context.setupGetApplication(application);
+
+    UISelectMany selectMany = new UISelectMany();
+    selectMany.setId("selectMany");
+    selectMany.setRendererType(null);
+    List children = selectMany.getChildren();
+
+    UISelectItem one = new UISelectItem();
+    one.setItemValue(new Integer(1));
+    children.add(one);
+
+    UISelectItem two = new UISelectItem();
+    two.setItemValue(new Integer(2));
+    children.add(two);
+
+    UISelectItem three = new UISelectItem();
+    three.setItemValue(new Integer(3));
+    children.add(three);
+
+    selectMany.validateValue(context, new int[] { 2, 3 });
+
+    assertTrue(selectMany.isValid());
+  }
+
+  public void testValidateStringArray() {
+    UIViewRoot view = new UIViewRoot();
+    view.setLocale(_TEST_LOCALE);
+
+    MockApplication application = new MockApplication();
+
+    MockFacesContext context = new MockFacesContext();
+    context.setupGetViewRoot(view);
+    context.setupGetApplication(application);
+
+    UISelectMany selectMany = new UISelectMany();
+    selectMany.setId("selectMany");
+    selectMany.setRendererType(null);
+    List children = selectMany.getChildren();
+
+    UISelectItem one = new UISelectItem();
+    one.setItemValue("1");
+    children.add(one);
+
+    UISelectItem two = new UISelectItem();
+    two.setItemValue("2");
+    children.add(two);
+
+    UISelectItem three = new UISelectItem();
+    three.setItemValue("3");
+    children.add(three);
+
+    selectMany.validateValue(context, new String[] { "2", "3" });
+
+    assertTrue(selectMany.isValid());
+  }
+
+  public void testValidateStringList() {
+    UIViewRoot view = new UIViewRoot();
+    view.setLocale(_TEST_LOCALE);
+
+    MockApplication application = new MockApplication();
+
+    MockFacesContext context = new MockFacesContext();
+    context.setupGetViewRoot(view);
+    context.setupGetApplication(application);
+
+    UISelectMany selectMany = new UISelectMany();
+    selectMany.setId("selectMany");
+    selectMany.setRendererType(null);
+    List children = selectMany.getChildren();
+
+    UISelectItem one = new UISelectItem();
+    one.setItemValue("1");
+    children.add(one);
+
+    UISelectItem two = new UISelectItem();
+    two.setItemValue("2");
+    children.add(two);
+
+    UISelectItem three = new UISelectItem();
+    three.setItemValue("3");
+    children.add(three);
+
+    selectMany.validateValue(context, Arrays.asList(new String[] { "2", "3" }));
+
+    assertTrue(selectMany.isValid());
+  }
+
+  static private final Locale _TEST_LOCALE = new Locale("xx", "TEST");
+}

Added: myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockApplication.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockApplication.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockApplication.java (added)
+++ myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockApplication.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.mock;
+
+import javax.faces.application.*;
+
+public class MockApplication extends Application {
+  public javax.faces.event.ActionListener getActionListener() {
+    return null;
+  }
+
+  public void setActionListener(javax.faces.event.ActionListener p1) {
+  }
+
+  public java.util.Locale getDefaultLocale() {
+    return null;
+  }
+
+  public void setDefaultLocale(java.util.Locale p1) {
+  }
+
+  public java.lang.String getDefaultRenderKitId() {
+	return null;
+  }
+
+  public void setDefaultRenderKitId(java.lang.String p1) {
+  }
+
+  public java.lang.String getMessageBundle() {
+    return null;
+  }
+
+  public void setMessageBundle(java.lang.String p1) {
+  }
+
+  public javax.faces.application.NavigationHandler getNavigationHandler() {
+    return null;
+  }
+
+  public void setNavigationHandler(javax.faces.application.NavigationHandler p1) { }
+
+  public javax.faces.el.PropertyResolver getPropertyResolver() {
+    return null;
+  }
+
+  public void setPropertyResolver(javax.faces.el.PropertyResolver p1) { }
+
+  public javax.faces.el.VariableResolver getVariableResolver() {
+    return null;
+  }
+
+  public void setVariableResolver(javax.faces.el.VariableResolver p1) { }
+
+  public javax.faces.application.ViewHandler getViewHandler() {
+    return null;
+  }
+
+  public void setViewHandler(javax.faces.application.ViewHandler p1) { }
+
+  public javax.faces.application.StateManager getStateManager() {
+    return null;
+  }
+
+  public void setStateManager(javax.faces.application.StateManager p1) { }
+
+  public void addComponent(java.lang.String p1, java.lang.String p2) {
+  }
+
+  public javax.faces.component.UIComponent createComponent(java.lang.String p1) {
+    return null;
+  }
+
+  public javax.faces.component.UIComponent createComponent(javax.faces.el.ValueBinding p1, javax.faces.context.FacesContext p2, java.lang.String p3) {
+    return null;
+  }
+
+  public java.util.Iterator getComponentTypes() {
+    return null;
+  }
+
+  public void addConverter(java.lang.String p1, java.lang.String p2) { }
+
+  public void addConverter(java.lang.Class p1, java.lang.String p2) { }
+
+  public javax.faces.convert.Converter createConverter(java.lang.String p1) {
+    return null;
+  }
+
+  public javax.faces.convert.Converter createConverter(java.lang.Class p1) {
+    return null;
+  }
+
+  public java.util.Iterator getConverterIds() {
+    return null;
+  }
+
+  public java.util.Iterator getConverterTypes() {
+    return null;
+  }
+
+  public javax.faces.el.MethodBinding createMethodBinding(java.lang.String p1, java.lang.Class[] p2) {
+    return null;
+  }
+
+  public java.util.Iterator getSupportedLocales() {
+    return null;
+  }
+
+  public void setSupportedLocales(java.util.Collection p1) { }
+
+  public void addValidator(java.lang.String p1, java.lang.String p2) { }
+
+  public javax.faces.validator.Validator createValidator(java.lang.String p1) {
+    return null;
+  }
+
+  public java.util.Iterator getValidatorIds() {
+    return null;
+  }
+
+  public javax.faces.el.ValueBinding createValueBinding(java.lang.String p1) {
+    return null;
+  }
+}

Added: myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockFacesContext.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockFacesContext.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockFacesContext.java (added)
+++ myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockFacesContext.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.mock;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.*;
+
+// TODO: have real mock implementations with expected/actual support
+public class MockFacesContext extends FacesContext {
+
+  public void setupGetViewRoot(UIViewRoot view) {
+    _view = view;
+  }
+
+  public void setupGetApplication(Application application) {
+    _application = application;
+  }
+
+  public Application getApplication() {
+	return _application;
+  }
+
+  public java.util.Iterator getClientIdsWithMessages() {
+	return null;
+  }
+
+  public javax.faces.context.ExternalContext getExternalContext() {
+	return null;
+  }
+
+  public javax.faces.application.FacesMessage.Severity getMaximumSeverity() {
+	return null;
+  }
+
+  public java.util.Iterator getMessages() {
+	return null;
+  }
+
+  public java.util.Iterator getMessages(String clientId) {
+	return null;
+  }
+
+  public javax.faces.render.RenderKit getRenderKit() {
+	return null;
+  }
+
+  public boolean getRenderResponse() {
+	return false;
+  }
+
+  public boolean getResponseComplete() {
+	return false;
+  }
+
+  public javax.faces.context.ResponseStream getResponseStream() {
+	return null;
+  }
+
+  public void setResponseStream(javax.faces.context.ResponseStream stream) {
+  }
+
+  public javax.faces.context.ResponseWriter getResponseWriter() {
+	return null;
+  }
+
+  public void setResponseWriter(javax.faces.context.ResponseWriter writer) {
+  }
+
+  public javax.faces.component.UIViewRoot getViewRoot() {
+    return _view;
+  }
+
+  public void setViewRoot(javax.faces.component.UIViewRoot view) {
+  }
+
+  public void addMessage(String clientId, javax.faces.application.FacesMessage message) {
+  }
+
+  public void release() {
+  }
+
+  public void renderResponse() {
+  }
+
+  public void responseComplete() {
+  }
+
+  private UIViewRoot  _view;
+  private Application _application;
+}

Added: myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockStateManager.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockStateManager.java?rev=365427&view=auto
==============================================================================
--- myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockStateManager.java (added)
+++ myfaces/api/trunk/src/test/java/org/apache/myfaces/mock/MockStateManager.java Mon Jan  2 12:49:29 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.mock;
+
+import java.io.IOException;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.application.*;
+
+public class MockStateManager extends StateManager {
+
+	public MockStateManager() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public SerializedView saveSerializedView(FacesContext context) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected Object getTreeStructureToSave(FacesContext context) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected Object getComponentStateToSave(FacesContext context) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void writeState(FacesContext context, SerializedView state)
+			throws IOException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public UIViewRoot restoreView(FacesContext context, String viewId,
+			String renderKitId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected UIViewRoot restoreTreeStructure(FacesContext context,
+			String viewId, String renderKitId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	protected void restoreComponentState(FacesContext context,
+			UIViewRoot viewRoot, String renderKitId) {
+		// TODO Auto-generated method stub
+
+	}
+
+}