You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/01/07 20:26:16 UTC

svn commit: r896975 [1/2] - in /myfaces/portlet-bridge/testsuite/trunk: ./ src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/ src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/ src/main/java/or...

Author: mfreedman
Date: Thu Jan  7 19:26:15 2010
New Revision: 896975

URL: http://svn.apache.org/viewvc?rev=896975&view=rev
Log:
Added Chapter 3 tests
Switched to use selenium 1.0.1

Added:
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationFactoryImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleFactoryImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeDestroyTestPortlet.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/PortletSetsViewTestPortlet.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/Tests.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/ModeViewIdResult.jsp
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/ModeViewIdTest.jsp
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/PortletSetsViewIdTestFailed.jsp
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/PortletSetsViewIdTestSuccess.jsp
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/tests/RedisplayRenderRequestTest.jsp
Removed:
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/EncodeActionURLRenderViewHandler.java
Modified:
    myfaces/portlet-bridge/testsuite/trunk/pom.xml
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextFactoryImpl.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/FacesContextFactoryServiceProviderTest.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/Tests.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_2/Tests.java
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/portlet-bridge/testsuite/trunk/src/main/webapp/WEB-INF/portlet.xml

Modified: myfaces/portlet-bridge/testsuite/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/pom.xml?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/pom.xml (original)
+++ myfaces/portlet-bridge/testsuite/trunk/pom.xml Thu Jan  7 19:26:15 2010
@@ -58,7 +58,7 @@
     <jetty.version>6.1.10</jetty.version>
     <pluto-embedded.version>1.0.1</pluto-embedded.version>
     <pluto.version>1.1.7</pluto.version>    
-    <selenium.version>1.0-beta-1</selenium.version>
+    <selenium.version>1.0.1</selenium.version>
     <junit.version>4.7</junit.version>
     
     <!-- TCK Test Application Configuration -->
@@ -180,7 +180,7 @@
     </dependency>
 
     <dependency>
-      <groupId>org.openqa.selenium.client-drivers</groupId>
+      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
       <artifactId>selenium-java-client-driver</artifactId>
       <version>${selenium.version}</version>
       <scope>test</scope>

Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/portlet/GenericFacesTestSuitePortlet.java Thu Jan  7 19:26:15 2010
@@ -28,6 +28,7 @@
 import javax.portlet.PortletRequest;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
+import javax.portlet.faces.Bridge;
 import javax.portlet.faces.GenericFacesPortlet;
 
 import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
@@ -86,5 +87,14 @@
   {
     portletRequest.setAttribute(Constants.TEST_BEAN_NAME, mTestBeanName);
     portletRequest.setAttribute(Constants.TEST_NAME, mTestName);
+    
+    if (portletRequest.getParameter(Bridge.VIEW_ID) != null)
+    {
+      portletRequest.setAttribute(Bridge.VIEW_ID, portletRequest.getParameter(Bridge.VIEW_ID));
+    }
+    else if (portletRequest.getParameter(Bridge.VIEW_PATH) != null)
+    {
+      portletRequest.setAttribute(Bridge.VIEW_PATH, portletRequest.getParameter(Bridge.VIEW_PATH));
+    }
   }
 }
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationFactoryImpl.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationFactoryImpl.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationFactoryImpl.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,45 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.common.util.faces.application;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+
+public class TestSuiteApplicationFactoryImpl extends ApplicationFactory
+{
+  private ApplicationFactory mHandler;
+  
+  public TestSuiteApplicationFactoryImpl(ApplicationFactory handler)
+  {
+    mHandler = handler;
+  }
+  
+  public Application getApplication()
+  {
+    return new TestSuiteApplicationImpl(mHandler.getApplication());
+  }
+  
+  public void setApplication(Application app)
+  {
+    mHandler.setApplication(app);
+  }
+   
+}
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,379 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.common.util.faces.application;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ReferenceSyntaxException;
+
+import javax.portlet.faces.BridgeUtil;
+import javax.portlet.faces.annotation.ExcludeFromManagedRequestScope;
+import javax.portlet.faces.annotation.PortletNamingContainer;
+import javax.portlet.faces.component.PortletNamingContainerUIViewRoot;
+
+
+public class TestSuiteApplicationImpl extends Application
+{
+  private Application mWrapped;
+  private boolean mAddedViewHandler = false;
+  
+  public TestSuiteApplicationImpl(Application app)
+  {
+    mWrapped = app;
+  }
+  
+  // The following concrete methods were added for JSF 1.2.  They supply default 
+  // implementations that throw UnsupportedOperationException.  
+  // This allows old Application implementations to still work.
+  public void addELResolver(ELResolver resolver) {
+      mWrapped.addELResolver(resolver);
+  }
+  
+  public ELResolver getELResolver() {
+      return mWrapped.getELResolver();
+  }
+  
+  public ResourceBundle getResourceBundle(FacesContext ctx, String name) 
+          throws FacesException, NullPointerException {
+      return mWrapped.getResourceBundle(ctx, name);
+  }
+  
+  public UIComponent createComponent(ValueExpression componentExpression,
+                                     FacesContext facesContext,
+                                     String componentType) 
+          throws FacesException, NullPointerException {
+      return mWrapped.createComponent(componentExpression, facesContext, componentType);
+  }
+
+  public ExpressionFactory getExpressionFactory() {
+      return mWrapped.getExpressionFactory();
+  }
+  
+  public void addELContextListener(ELContextListener listener) {
+      mWrapped.addELContextListener(listener);
+  }
+  
+  public void removeELContextListener(ELContextListener listener) {
+      mWrapped.removeELContextListener(listener);
+  }
+  
+  public ELContextListener[] getELContextListeners() {
+      return mWrapped.getELContextListeners();
+  }
+  
+  public Object evaluateExpressionGet(FacesContext context,
+                                      String expression,
+                                      Class expectedType)
+           throws ELException {
+      return mWrapped.evaluateExpressionGet(context, expression, expectedType);
+  }
+  
+  public javax.faces.event.ActionListener getActionListener()
+  {
+    return mWrapped.getActionListener();
+  }
+
+  public void setActionListener(javax.faces.event.ActionListener listener)
+  {
+    mWrapped.setActionListener(listener);
+  }
+
+  public Locale getDefaultLocale()
+  {
+    return mWrapped.getDefaultLocale();
+  }
+
+  public void setDefaultLocale(Locale locale)
+  {
+    mWrapped.setDefaultLocale(locale);
+  }
+
+  public String getDefaultRenderKitId()
+  {
+    return mWrapped.getDefaultRenderKitId();
+  }
+
+  public void setDefaultRenderKitId(String renderKitId)
+  {
+    mWrapped.setDefaultRenderKitId(renderKitId);
+  }
+
+  public String getMessageBundle()
+  {
+    return mWrapped.getMessageBundle();
+  }
+
+  public void setMessageBundle(String bundle)
+  {
+    mWrapped.setMessageBundle(bundle);
+  }
+
+  /**
+   * Return the NavigationHandler object which is responsible for mapping from
+   * a logical (viewid, fromAction, outcome) to the URL of a view to be rendered.
+   */
+  public javax.faces.application.NavigationHandler getNavigationHandler()
+  {
+    return mWrapped.getNavigationHandler();
+  }
+
+  public void setNavigationHandler(javax.faces.application.NavigationHandler handler)
+  {
+    mWrapped.setNavigationHandler(handler);
+  }
+
+  /**
+   * Get the object used by the VariableResolver to read and write named properties
+   * on java beans, Arrays, Lists and Maps. This object is used by the ValueBinding
+   * implementation, and during the process of configuring "managed bean" properties.
+   *
+   * @deprecated
+   */
+  public javax.faces.el.PropertyResolver getPropertyResolver()
+  {
+    return mWrapped.getPropertyResolver();
+  }
+
+  /**
+   * @deprecated
+   */
+  public void setPropertyResolver(javax.faces.el.PropertyResolver resolver)
+  {
+    mWrapped.setPropertyResolver(resolver);
+  }
+
+  /**
+   * Get the object used to resolve expressions of form "#{...}".
+   *
+   * @deprecated
+   */
+  public javax.faces.el.VariableResolver getVariableResolver()
+  {
+    return mWrapped.getVariableResolver();
+  }
+
+  /**
+   * @deprecated
+   */
+  public void setVariableResolver(javax.faces.el.VariableResolver resolver)
+  {
+    mWrapped.setVariableResolver(resolver);
+  }
+  
+  public javax.faces.application.ViewHandler getViewHandler()
+  {
+    return mWrapped.getViewHandler();
+  }
+
+  public void setViewHandler(javax.faces.application.ViewHandler handler)
+  {
+    if (!mAddedViewHandler)
+    {
+      // create our own ViewHandler and insert before anything else
+      ViewHandler testHandler = new TestSuiteViewHandlerImpl(handler);
+      mWrapped.setViewHandler(testHandler);
+      mAddedViewHandler = true;
+    }
+    else
+    {   
+      mWrapped.setViewHandler(handler);
+    }
+  }
+
+  public javax.faces.application.StateManager getStateManager()
+  {
+    return mWrapped.getStateManager();
+  }
+
+  public void setStateManager(javax.faces.application.StateManager manager)
+  {
+    mWrapped.setStateManager(manager);
+  }
+
+  /**
+   * Define a new mapping from a logical "component type" to an actual java class name.
+   * This controls what type is created when method createComponent of this class is
+   * called.
+   * <p>
+   * Param componentClass must be the fully-qualified class name of some class
+   * extending the UIComponent class. The class must have a default constructor,
+   * as instances of it will be created using Class.newInstance.
+   * <p> 
+   * It is permitted to override a previously defined mapping, ie to call this
+   * method multiple times with the same componentType string. The createComponent
+   * method will simply use the last defined mapping.
+   */
+  public void addComponent(String componentType,
+                                    String componentClass)
+  {
+    mWrapped.addComponent(componentType, componentClass);
+  }
+
+  
+  /**
+   * Create a new UIComponent subclass, using the mappings defined by previous
+   * calls to the addComponent method of this class.
+   * <p>
+   * @throws FacesException if there is no mapping defined for the specified
+   * componentType, or if an instance of the specified type could not be
+   * created for any reason.
+   */
+  public javax.faces.component.UIComponent createComponent(String componentType)
+          throws FacesException
+  {
+    return mWrapped.createComponent(componentType);
+  }
+
+  /**
+   * Create an object which has an associating "binding" expression tying the component
+   * to a user property.
+   * <p>
+   * First the specified value-binding is evaluated; if it returns a non-null value then
+   * the component "already exists" and so the resulting value is simply returned.
+   * <p>
+   * Otherwise a new UIComponent instance is created using the specified componentType,
+   * and the new object stored via the provided value-binding before being returned.
+   *
+   * @deprecated
+   */
+  public javax.faces.component.UIComponent createComponent(
+          javax.faces.el.ValueBinding componentBinding,
+          javax.faces.context.FacesContext context,
+          String componentType)
+          throws FacesException
+  {
+    return mWrapped.createComponent(componentBinding, context, componentType);
+  }
+  
+  public Iterator<String> getComponentTypes()
+  {
+    return mWrapped.getComponentTypes();
+  }
+
+  public void addConverter(String converterId,
+                                    String converterClass)
+  {
+    mWrapped.addConverter(converterId, converterClass);
+  }
+
+  public void addConverter(Class targetClass,
+                                    String converterClass)
+  {
+    mWrapped.addConverter(targetClass, converterClass);
+  }
+
+  public javax.faces.convert.Converter createConverter(String converterId)
+  {
+    return mWrapped.createConverter(converterId);
+  }
+
+  public javax.faces.convert.Converter createConverter(Class targetClass)
+  {
+    return mWrapped.createConverter(targetClass);
+  }
+
+  public Iterator<String> getConverterIds()
+  {
+    return mWrapped.getConverterIds();
+  }
+
+  public Iterator<Class> getConverterTypes()
+  {
+    return mWrapped.getConverterTypes();
+  }
+
+  /**
+   * Create an object which can be used to invoke an arbitrary method via an
+   * EL expression at a later time. This is similar to createValueBinding 
+   * except that it can invoke an arbitrary method (with parameters) rather
+   * than just get/set a javabean property.
+   * <p>
+   * This is used to invoke ActionListener method, and ValueChangeListener
+   * methods.
+   *
+   * @deprecated
+   */
+  public javax.faces.el.MethodBinding createMethodBinding(
+          String ref, Class[] params)
+          throws ReferenceSyntaxException
+  {
+    return mWrapped.createMethodBinding(ref, params);
+  }
+
+  public Iterator<Locale> getSupportedLocales()
+  {
+    return mWrapped.getSupportedLocales();
+  }
+
+  public void setSupportedLocales(Collection<Locale> locales)
+  {
+    mWrapped.setSupportedLocales(locales);
+  }
+
+  public void addValidator(String validatorId,
+                                    String validatorClass)
+  {
+    mWrapped.addValidator(validatorId, validatorClass);
+  }
+
+  public javax.faces.validator.Validator createValidator(String validatorId)
+          throws FacesException
+  {
+    return mWrapped.createValidator(validatorId);
+  }
+
+  public Iterator<String> getValidatorIds()
+  {
+    return mWrapped.getValidatorIds();
+  }
+
+  /**
+   * Create an object which can be used to invoke an arbitrary method via an
+   * EL expression at a later time. This is similar to createValueBinding 
+   * except that it can invoke an arbitrary method (with parameters) rather
+   * than just get/set a javabean property.
+   * <p>
+   * This is used to invoke ActionListener method, and ValueChangeListener
+   * methods.
+   *
+   * @deprecated
+   */
+  public javax.faces.el.ValueBinding createValueBinding(String ref)
+          throws ReferenceSyntaxException
+  {
+    return mWrapped.createValueBinding(ref);
+  }
+  
+}
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleFactoryImpl.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleFactoryImpl.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleFactoryImpl.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,68 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.common.util.faces.application;
+
+import java.util.Iterator;
+
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+
+
+public class TestSuiteLifecycleFactoryImpl extends LifecycleFactory
+{
+  private LifecycleFactory mHandler;
+  
+  /**
+   * The id of the intercepting lifecycle.
+   */
+  public static final String TCK_LIFECYCLE_ID = "TCKLifecycle";
+
+  /**
+   * Delegate injecting constructor.
+   *
+   * @param defaultFactory
+   *          the injected delegate LifecycleFactory.
+   */
+  public TestSuiteLifecycleFactoryImpl(LifecycleFactory defaultFactory) {
+    mHandler = defaultFactory;
+
+    // 1. get default lifecycle to be wrapped by our lifecycle
+    Lifecycle defaultLifecycle = mHandler.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+
+    // 2. register intercepting lifecycle implementation.
+    addLifecycle(TCK_LIFECYCLE_ID, new TestSuiteLifecycleImpl(defaultLifecycle));
+  }
+
+  @Override
+  public void addLifecycle(String lifecycleId, Lifecycle lifecycle) {
+    mHandler.addLifecycle(lifecycleId, lifecycle);
+  }
+
+  @Override
+  public Lifecycle getLifecycle(String lifecycleId) {
+    return mHandler.getLifecycle(lifecycleId);
+  }
+
+  @Override
+  public Iterator<String> getLifecycleIds() {
+    return mHandler.getLifecycleIds();
+  }
+
+}
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleImpl.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleImpl.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteLifecycleImpl.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,72 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.common.util.faces.application;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+
+
+public class TestSuiteLifecycleImpl extends Lifecycle
+{
+  private Lifecycle mWrapped;
+
+  public TestSuiteLifecycleImpl(Lifecycle parent)
+  {
+    mWrapped = parent;
+  }
+
+  Lifecycle getWrapped()
+  {
+    return mWrapped;
+  }
+
+  @Override
+  public void addPhaseListener(PhaseListener listener)
+  {
+    getWrapped().addPhaseListener(listener);
+  }
+
+  @Override
+  public void execute(FacesContext context) throws FacesException
+  {
+    getWrapped().execute(context);
+  }
+
+  @Override
+  public PhaseListener[] getPhaseListeners()
+  {
+    return getWrapped().getPhaseListeners();
+  }
+
+  @Override
+  public void removePhaseListener(PhaseListener listener)
+  {
+    getWrapped().removePhaseListener(listener);
+  }
+
+  @Override
+  public void render(FacesContext context) throws FacesException
+  {
+    getWrapped().render(context);
+  }
+
+}
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,425 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.common.util.faces.application;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+
+import javax.portlet.PortletContext;
+import javax.portlet.RenderResponse;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUtil;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+
+
+/**
+ * View handler implementation for JSF portlet bridge.
+ * 
+ * The only method we override here is getActionURL().
+ * 
+ * TODO JSF 1.2 note: JSF 1.2 RI implements ViewHandler.renderView() differently in order to handle
+ * emitting non-JSF markup that follows the JSF tags after the JSF renders correctly. Unfortunately,
+ * the RI handles this by introducing several servlet dependencies. Currently, the bridge handles
+ * this by overriding the renderView() and ignoring (not interleafing) the non-JSF markup - see HACK
+ * below
+ */
+public class TestSuiteViewHandlerImpl extends ViewHandlerWrapper
+{
+
+  // the ViewHandler to delegate to
+  private ViewHandler mDelegate;
+  private Bridge.BridgeRenderPolicy mRenderPolicy = null;
+
+  public TestSuiteViewHandlerImpl(ViewHandler handler)
+  {
+    mDelegate = handler;
+  }
+  
+  protected ViewHandler getWrapped()
+  {
+    return mDelegate;
+  }
+
+
+  @Override
+  public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException,
+                                                                       FacesException
+  {
+    // Do nothing when not running in portlet request
+    if (!BridgeUtil.isPortletRequest())
+    {
+      super.renderView(context, viewToRender);
+      return;
+    }
+    else
+    {
+      ExternalContext extCtx = context.getExternalContext();
+      Map m = extCtx.getRequestMap();
+      // Check to see what the render rule is
+      PortletContext pCtx = (PortletContext) extCtx.getContext();
+      String policyStr = pCtx.getInitParameter(Bridge.RENDER_POLICY);
+      Bridge.BridgeRenderPolicy policy = (policyStr != null) ? Bridge.BridgeRenderPolicy.valueOf(policyStr) : null;
+
+      if (policy == null)
+      {
+        // no policy so we are to do the default
+        m.put("javax.portlet.faces.tck.testRenderPolicyPass", "Bridge correctly delegated first as no render policy was set.");
+        throw new FacesException("Can't do a portlet render -- but we expect the bridge to catch this and complete the render itself");
+      }
+      else if (policy == Bridge.BridgeRenderPolicy.DEFAULT)
+      {
+        // no policy so we are to do the default
+        m.put("javax.portlet.faces.tck.testRenderPolicyPass", "Bridge correctly delegated first as the render policy was DEFAULT.");
+        throw new FacesException("Can't do a portlet render -- but we expect the bridge to catch this and complete the render itself");
+      }
+      else if (policy == Bridge.BridgeRenderPolicy.ALWAYS_DELEGATE)
+      {
+        m.put("javax.portlet.faces.tck.testRenderPolicyPass", "Bridge correctly delegated as the render policy is ALWAYS_DELEGATE.");
+        renderSelf(context, viewToRender);
+        return;
+      }
+      else if (policy == Bridge.BridgeRenderPolicy.NEVER_DELEGATE)
+      {
+        m.put("javax.portlet.faces.tck.testRenderPolicyFail", "Bridge incorrectly delegated when render policy was NEVER_DELEGATE.");
+        renderSelf(context, viewToRender);
+      }
+    }
+
+  }
+  
+  private void renderSelf(FacesContext context, UIViewRoot viewToRender) throws IOException,
+                                                                       FacesException
+  {
+    ExternalContext extContext = context.getExternalContext();
+    RenderResponse renderResponse = (RenderResponse) extContext.getResponse();
+
+    try
+    {
+
+      // set request attribute indicating we can deal with content
+      // that is supposed to be delayed until after JSF tree is ouput.
+      extContext.getRequestMap().put(Bridge.RENDER_CONTENT_AFTER_VIEW, Boolean.TRUE);
+      // TODO JSF 1.2 - executePageToBuildView() creates
+      // ViewHandlerResponseWrapper
+      // to handle error page and text that exists after the <f:view> tag
+      // among other things which have lots of servlet dependencies -
+      // we're skipping this for now for portlet
+      
+      
+      // Bridge has had to set this attribute so  Faces RI will skip servlet dependent
+      // code when mapping from request paths to viewIds -- however we need to remove it
+      // as it screws up the dispatch
+      extContext.getRequestMap().remove("javax.servlet.include.servlet_path");
+      extContext.dispatch(viewToRender.getViewId());
+
+    }
+    catch (IOException e)
+    {
+      throw new FacesException(e);
+    }
+    
+    // set up the ResponseWriter
+    RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder
+                                                                     .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+    RenderKit renderKit = renderFactory.getRenderKit(context, viewToRender.getRenderKitId());
+
+    ResponseWriter oldWriter = context.getResponseWriter();
+    StringBuilderWriter strWriter = new StringBuilderWriter(context, 4096);
+    ResponseWriter newWriter;
+    if (null != oldWriter)
+    {
+      newWriter = oldWriter.cloneWithWriter(strWriter);
+    }
+    else
+    {
+      newWriter = renderKit.createResponseWriter(strWriter, null,
+                                                 renderResponse.getCharacterEncoding());
+    }
+    context.setResponseWriter(newWriter);
+
+    newWriter.startDocument();
+
+    doRenderView(context, viewToRender);
+
+    newWriter.endDocument();
+
+    // replace markers in the body content and write it to response.
+
+    ResponseWriter responseWriter;
+
+    // Dispatch may have output to an OutputStream instead of a Writer
+    Writer renderResponseWriter = null;
+    try {
+      renderResponseWriter = renderResponse.getWriter();
+    } 
+    catch (IllegalStateException ise) {     
+      // got this exception because we've called getOutputStream() previously
+      renderResponseWriter = new BufferedWriter(
+                          new OutputStreamWriter(
+                               renderResponse.getPortletOutputStream(),
+                               renderResponse.getCharacterEncoding()));
+    }
+    if (null != oldWriter)
+    {
+      responseWriter = oldWriter.cloneWithWriter(renderResponseWriter);
+    }
+    else
+    {
+      responseWriter = newWriter.cloneWithWriter(renderResponseWriter);
+    }
+    context.setResponseWriter(responseWriter);
+
+    strWriter.write(responseWriter);
+    renderResponseWriter.flush();
+
+    if (null != oldWriter)
+    {
+      context.setResponseWriter(oldWriter);
+    }
+
+    Object content = extContext.getRequestMap().get(Bridge.AFTER_VIEW_CONTENT);
+    if (content != null)
+    {
+      if (content instanceof char[])
+      {
+        renderResponse.getWriter().write(new String((char[]) content));
+      }
+      else if (content instanceof byte[])
+      {
+        renderResponse.getWriter().write(new String((byte[]) content));
+      }
+      else
+      {
+        throw new IOException("PortletViewHandlerImpl: invalid" + "AFTER_VIEW_CONTENT buffer type");
+      }
+    }
+    renderResponse.flushBuffer();
+  }
+  
+  public String getActionURL(FacesContext context, String viewId)
+  {
+    // Call super to get the actionURL
+    String resultURL = super.getActionURL(context, viewId);
+    
+    // Then test to see if we are in a render and this is an encodeActionURL test that 
+    // tests the render encoding -- if so add the appropriate parameters to test.
+    if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE)
+    {
+      String testName = (String) context.getExternalContext().getRequestMap().get(Constants.TEST_NAME);
+      if (testName == null) return resultURL;
+      if (testName.equals("encodeActionURLWithParamRenderTest"))
+        return appendQueryString(resultURL, "param1=testValue");
+      else if (testName.equals("encodeActionURLWithModeRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.PortletMode=edit&param1=testValue");
+      else if (testName.equals("encodeActionURLWithInvalidModeRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.PortletMode=blue&param1=testValue");
+      else if (testName.equals("encodeActionURLWithWindowStateRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.WindowState=maximized&param1=testValue");
+      else if (testName.equals("encodeActionURLWithInvalidWindowStateRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.WindowState=blue&param1=testValue");
+      else if (testName.equals("encodeActionURLWithSecurityRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.Secure=true&param1=testValue");
+      else if (testName.equals("encodeActionURLWithInvalidSecurityRenderTest"))
+        return appendQueryString(resultURL, "javax.portlet.faces.Secure=blue&param1=testValue");
+    }
+    return resultURL;
+  }
+  
+  private String appendQueryString(String url, String params)
+  {
+    if (url.indexOf('?') < 0)
+      return url + "?" + params;
+    else
+      return url + "&" + params;
+  }
+  
+  private void doRenderView(FacesContext context, UIViewRoot viewToRender) throws IOException,
+                                                                          FacesException
+  {
+    viewToRender.encodeAll(context);
+  }
+
+  private static final class StringBuilderWriter extends Writer
+  {
+    private StringBuilder       mBuilder;
+    private FacesContext        mContext;
+
+    // TODO: These bridge needs to use it's own constants here. This will
+    // confine
+    // us to only work with the R.I.
+    private static final String RI_SAVESTATE_FIELD_MARKER = "~com.sun.faces.saveStateFieldMarker~";
+    private static final String MYFACES_SAVESTATE_FIELD_MARKER = "<!-...@-->";
+    private static String sSaveStateFieldMarker = null;
+
+    public StringBuilderWriter(FacesContext context, int initialCapacity)
+    {
+      if (initialCapacity < 0)
+      {
+        throw new IllegalArgumentException();
+      }
+      mBuilder = new StringBuilder(initialCapacity);
+      mContext = context;
+    }
+
+    @Override
+    public void write(char[] cbuf, int off, int len) throws IOException
+    {
+      if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0)
+      {
+        throw new IndexOutOfBoundsException();
+      }
+      else if (len == 0)
+      {
+        return;
+      }
+      mBuilder.append(cbuf, off, len);
+    }
+
+    @Override
+    public void flush() throws IOException
+    {
+    }
+
+    @Override
+    public void close() throws IOException
+    {
+    }
+
+    /**
+     * Write a string.
+     * 
+     * @param str
+     *          String to be written
+     */
+    @Override
+    public void write(String str)
+    {
+      mBuilder.append(str);
+    }
+
+    @Override
+    public void write(String str, int off, int len)
+    {
+      write(str.substring(off, off + len));
+    }
+
+    public StringBuilder getBuffer()
+    {
+      return mBuilder;
+    }
+
+    @Override
+    public String toString()
+    {
+      return mBuilder.toString();
+    }
+
+    public void write(Writer writer) throws IOException
+    {
+
+      // See if we already have determined the SAVESTATE_FIELD_MARKER in use
+      // If not then determine it and set for future use
+      if (sSaveStateFieldMarker == null)
+      {
+        sSaveStateFieldMarker = determineSaveStateFieldMarker();
+      }
+      
+      // TODO: Buffer?
+      int pos = 0;
+      
+      // First we need to make sure we save the view
+      StateManager stateManager = mContext.getApplication().getStateManager();
+      Object stateToWrite = stateManager.saveView(mContext);
+      
+      // If we didn't find a savestate_field_marker don't search to replace for one.
+      if (sSaveStateFieldMarker != null)
+      {
+        int markLen = sSaveStateFieldMarker.length();
+        int tildeIdx = mBuilder.indexOf(sSaveStateFieldMarker);
+        while (tildeIdx > 0)
+        {
+          writer.write(mBuilder.substring(pos, tildeIdx));
+          stateManager.writeState(mContext, stateToWrite);
+          pos = tildeIdx + markLen;
+          tildeIdx = mBuilder.indexOf(sSaveStateFieldMarker, pos);
+        }
+      }
+      
+      writer.write(mBuilder.substring(pos));
+    }
+    
+    private String determineSaveStateFieldMarker() throws IOException
+    {
+      // First check to see if there is one set in the configuration - if so test it first
+      String marker = ((PortletContext)FacesContext.getCurrentInstance().
+                    getExternalContext().getContext()).getInitParameter(Bridge.SAVESTATE_FIELD_MARKER);
+
+      if (isMarker(marker))
+      {
+        return marker;
+      }
+      // wasn't that one so test the Faces RI marker
+      else if (isMarker(RI_SAVESTATE_FIELD_MARKER))
+      {
+        return RI_SAVESTATE_FIELD_MARKER;
+      }
+      // wasn't that one so test the MyFaces marker
+      else if (isMarker(MYFACES_SAVESTATE_FIELD_MARKER))
+      {
+        return MYFACES_SAVESTATE_FIELD_MARKER;
+      }
+      
+      // log that we didn't find a marker 
+      // However ignore this "exceptional" situation because its not so exceptional
+      // MyFaces actually directly writes the state into the response more commonly
+      // than it writes the Marker.  
+      mContext.getExternalContext().log("Unable to locate a SAVESTATE_FIELD_MARKER in response.  This could be because your Faces environment doesn't write such a marker or because the bridge doesn't know the marker in use.  If the later, configure the appropriate application init parameter javax.portlet.faces.SAVESTATE_FIELD_MARKER.");
+      return null;
+    }
+    
+    private boolean isMarker(String marker)
+    {
+      return marker != null && mBuilder.indexOf(marker) >= 0;
+    }
+  }
+  
+
+
+}

Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextFactoryImpl.java?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextFactoryImpl.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextFactoryImpl.java Thu Jan  7 19:26:15 2010
@@ -21,10 +21,13 @@
 
 
 import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.FacesContextFactory;
 import javax.faces.lifecycle.Lifecycle;
 
+import javax.faces.lifecycle.LifecycleFactory;
+
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
@@ -58,6 +61,9 @@
     // including that the bridge doesn't depend on its impl class being the instance
     if (isPortletRequest(request))
     {
+      // Verify we are using the right lifecycle
+      verifyLifecycle((PortletContext) context, (PortletRequest) request, lifecycle);
+      
       return new TCK_FacesContextImpl(ctx);
     }
     else
@@ -86,4 +92,35 @@
 
     return false;
   }
+  
+  private void verifyLifecycle(PortletContext context, PortletRequest request, Lifecycle lifecycle)
+  {
+    String id = context.getInitParameter("javax.faces.LIFECYCLE_ID");
+    LifecycleFactory lifecycleFactory = 
+      (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+    if (id != null)
+    {
+      Lifecycle l = lifecycleFactory.getLifecycle(id);
+      if (l == lifecycle)
+      {
+        request.setAttribute("javax.portlet.faces.tck.testLifecyclePass", "Correctly used the configured lifcycle: " + id);
+      }
+      else
+      {
+        request.setAttribute("javax.portlet.faces.tck.testLifecycleFail", "Didn't use the configured lifecycle: " + id);
+      }
+    }
+    else
+    {
+      Lifecycle l = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+      if (l == lifecycle)
+      {
+        request.setAttribute("javax.portlet.faces.tck.testLifecyclePass", "Correctly used the default lifcycle as none was configured.");
+      }
+      else
+      {
+        request.setAttribute("javax.portlet.faces.tck.testLifecycleFail", "Didn't use the default lifecycle when none was configured.");
+      }
+    }
+  }
 }

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeDestroyTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeDestroyTestPortlet.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeDestroyTestPortlet.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeDestroyTestPortlet.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,248 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.tests.chapter_3;
+
+import java.io.IOException;
+
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUninitializedException;
+import javax.portlet.faces.GenericFacesPortlet;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+import org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet;
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+public class BridgeDestroyTestPortlet extends GenericFacesTestSuitePortlet
+{
+  final static String DESTROY_ACTION_TEST = "destroyActionTest";
+  final static String DESTROY_RENDER_TEST = "destroyRenderTest";
+  final static String DESTROY_DOUBLE_TEST = "destroyDoubleTest";
+  final static String NULLREQUEST_RENDER_TEST = "nullRequestRenderTest";
+  final static String NULLREQUEST_ACTION_TEST = "nullRequestActionTest";
+  
+  private String mActionResult = null;
+  
+  public void init(PortletConfig config)
+    throws PortletException
+  {
+    super.init(config);
+
+  }
+  public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
+    throws PortletException, IOException
+  {
+    if (getTestName().equals(DESTROY_ACTION_TEST))
+    {
+      runActionDestroyTest(actionRequest, actionResponse);
+    }
+    else if (getTestName().equals(NULLREQUEST_ACTION_TEST))
+    {
+      runNullRequestActionTest(actionRequest, actionResponse);
+    }
+    else
+    {
+      super.processAction(actionRequest, actionResponse);
+    }
+  }
+  
+  public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
+    throws PortletException, IOException
+  {
+    if (getTestName().equals(DESTROY_RENDER_TEST))
+    {
+      runRenderDestroyTest(renderRequest, renderResponse);
+    }
+    else if (getTestName().equals(DESTROY_DOUBLE_TEST))
+    {
+      runDoubleDestroyTest(renderRequest, renderResponse);
+    }
+    else if (getTestName().equals(DESTROY_ACTION_TEST) && mActionResult != null)
+    {
+      outputActionResult(renderRequest, renderResponse);
+    }
+    else if (getTestName().equals(NULLREQUEST_RENDER_TEST))
+    {
+      runNullRequestRenderTest(renderRequest, renderResponse);
+    }
+    else if (getTestName().equals(NULLREQUEST_ACTION_TEST) && mActionResult != null)
+    {
+      outputActionResult(renderRequest, renderResponse);
+    }
+    else
+    {    
+      super.doDispatch(renderRequest, renderResponse);
+    }
+  }
+
+
+  private void runActionDestroyTest(ActionRequest request, ActionResponse response) throws PortletException, IOException
+  {
+    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_ACTION_TEST);
+    
+    // Run test
+    Bridge bridge = getFacesBridge(request, response);
+    bridge.destroy();
+    try
+    {
+      bridge.doFacesRequest(request, response);
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(action) when passed a destroyed bridge. Instead the request completed without an exception.");
+    }
+    catch (BridgeUninitializedException bue)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+      resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(action) when passed a destroyed bridge.");
+    }
+    catch (Exception e)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(action) when passed a destroyed bridge. Instead it threw: " + e.toString());        
+    }
+    
+    mActionResult = resultWriter.toString();
+  }
+  
+  private void runNullRequestActionTest(ActionRequest request, ActionResponse response) throws PortletException, IOException
+  {
+    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(NULLREQUEST_ACTION_TEST);
+    
+    // Run test
+    try
+    {
+      Bridge bridge = getFacesBridge(request, response);
+      bridge.doFacesRequest((ActionRequest) null, (ActionResponse) null);
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(action) when passed a null request/response. Instead the request completed without an exception.");
+    }
+    catch (NullPointerException bue)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+      resultWriter.setDetail("Correctly threw NullPointerException from doFacesRequest(action) when passed a null request/response.");
+    }
+    catch (Exception e)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(action) when passed a null request/response. Instead it threw: " + e.toString());        
+    }
+    
+    mActionResult = resultWriter.toString();
+  }
+  
+  private void outputActionResult(RenderRequest request, RenderResponse response) throws PortletException, IOException
+  {
+    response.setContentType("text/html");
+    PrintWriter out = response.getWriter();
+    out.println(mActionResult);
+    mActionResult = null;
+  }
+  
+  
+  
+  private void runRenderDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
+  {
+    response.setContentType("text/html");
+    PrintWriter out = response.getWriter();
+    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_RENDER_TEST);
+    
+    // Run test
+    Bridge bridge = getFacesBridge(request, response);
+    bridge.destroy();
+    try
+    {
+      bridge.doFacesRequest(request, response);
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead the request completed without an exception.");
+    }
+    catch (BridgeUninitializedException bue)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+      resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge.");
+    }
+    catch (Exception e)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead it threw: " + e.toString());        
+    }
+    
+    out.println(resultWriter.toString());
+  }
+  
+  private void runNullRequestRenderTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
+  {
+    response.setContentType("text/html");
+    PrintWriter out = response.getWriter();
+    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(NULLREQUEST_RENDER_TEST);
+    
+    // Run test
+    try
+    {
+      Bridge bridge = getFacesBridge(request, response);
+      bridge.doFacesRequest((RenderRequest) null, (RenderResponse) null);
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(render) when passed a null request/response. Instead the request completed without an exception.");
+    }
+    catch (NullPointerException bue)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+      resultWriter.setDetail("Correctly threw NullPointerException from doFacesRequest(render) when passed a null request/response.");
+    }
+    catch (Exception e)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Didn't throw the NullPointerException from doFacesRequest(render) when passed a null request/response. Instead it threw: " + e.toString());        
+    }
+    
+    out.println(resultWriter.toString());
+  }
+  
+  private void runDoubleDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException
+  {
+    response.setContentType("text/html");
+    PrintWriter out = response.getWriter();
+    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_DOUBLE_TEST);
+    
+    // Run test
+    Bridge bridge = getFacesBridge(request, response);
+    bridge.destroy();
+    try
+    {
+      bridge.destroy();
+      resultWriter.setStatus(BridgeTCKResultWriter.PASS);
+      resultWriter.setDetail("Calling destroy on a destroyed bridge correctly completed without exception.");
+    }
+    catch (Exception e)
+    {
+      resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
+      resultWriter.setDetail("Calling destroy on a destroyed bridge incorrectly threw an exception: " +  e.toString());        
+    }
+    
+    out.println(resultWriter.toString());
+  }
+}
\ No newline at end of file

Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java Thu Jan  7 19:26:15 2010
@@ -34,6 +34,7 @@
  * can read that attribute back using PortletRequest.getAttribute()
  */
 
+// Test #3.1
 
 public class BridgeVersionTestPortlet extends GenericPortlet {
     public static String TEST_NAME="bridgeVersionTest";    

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/PortletSetsViewTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/PortletSetsViewTestPortlet.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/PortletSetsViewTestPortlet.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/PortletSetsViewTestPortlet.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,71 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.tests.chapter_3;
+
+import java.io.IOException;
+
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUninitializedException;
+import javax.portlet.faces.GenericFacesPortlet;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+import org.apache.myfaces.portlet.faces.testsuite.common.portlet.GenericFacesTestSuitePortlet;
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+public class PortletSetsViewTestPortlet extends GenericFacesTestSuitePortlet
+{
+  private final static String SETSVIEWID_TEST = "portletSetsViewIdTest";
+  private final static String SETSVIEWPATH_TEST = "portletSetsViewPathTest";
+  
+  public void init(PortletConfig config)
+    throws PortletException
+  {
+    super.init(config);
+
+  }
+
+  
+  public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
+    throws PortletException, IOException
+  {
+    if (getTestName().equals(SETSVIEWID_TEST))
+    {
+      renderRequest.setAttribute(Bridge.VIEW_ID, "/tests/PortletSetsViewIdTestSuccess.jsp");
+    }
+    else if (getTestName().equals(SETSVIEWPATH_TEST))
+    {
+      renderRequest.setAttribute(Bridge.VIEW_PATH, "/tests/PortletSetsViewIdTestSuccess.jsf");
+    }
+   
+    super.doDispatch(renderRequest, renderResponse);
+  }
+  
+
+}
\ No newline at end of file

Added: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/Tests.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/Tests.java?rev=896975&view=auto
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/Tests.java (added)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/Tests.java Thu Jan  7 19:26:15 2010
@@ -0,0 +1,273 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.portlet.faces.testsuite.tests.chapter_3;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.BridgeUtil;
+
+import org.apache.myfaces.portlet.faces.testsuite.annotation.BridgeTest;
+import org.apache.myfaces.portlet.faces.testsuite.beans.TestRunnerBean;
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+
+public class Tests
+  extends Object
+{
+  
+  /*
+   * Because RenderPolicy is a web.xml (application) config setting we need a different portlet app for
+   * each test.  Because of this we can test all policies in a single test method.
+   */
+  @BridgeTest(test = "renderPolicyTest")
+  public String renderPolicyTest(TestRunnerBean testRunner)
+  {
+    Boolean pass = false;
+    String msg = null;
+    // Get the configured render policy
+    ExternalContext extCtx = FacesContext.getCurrentInstance().getExternalContext();
+    Map m = extCtx.getRequestMap();
+    // Check to see what the render rule is
+    PortletContext pCtx = (PortletContext) extCtx.getContext();
+    String policyStr = pCtx.getInitParameter(Bridge.RENDER_POLICY);
+    Bridge.BridgeRenderPolicy policy = (policyStr != null) ? Bridge.BridgeRenderPolicy.valueOf(policyStr) : null;
+    
+    if (policy == null)
+    {
+      // no policy so we are to do the default
+      msg = (String) m.get("javax.portlet.faces.tck.testRenderPolicyPass");
+      if (msg != null) pass = true;
+      else msg = "Failed to delegate render with render policy not set (DEFAULT).";
+    }
+    else if (policy == Bridge.BridgeRenderPolicy.DEFAULT)
+    {
+      // no policy so we are to do the default
+      msg = (String) m.get("javax.portlet.faces.tck.testRenderPolicyPass");
+      if (msg != null) pass = true;
+      else msg = "Failed to delegate render with render policy of DEFAULT.";
+    }
+    else if (policy == Bridge.BridgeRenderPolicy.ALWAYS_DELEGATE)
+    {
+      msg = (String) m.get("javax.portlet.faces.tck.testRenderPolicyPass");
+      if (msg != null) pass = true;
+      else msg = "Failed to delegate render with render policy of ALWAYS_DELEGATE.";
+    }
+    else if (policy == Bridge.BridgeRenderPolicy.NEVER_DELEGATE)
+    {
+      msg = (String) m.get("javax.portlet.faces.tck.testRenderPolicyFail");
+      if (msg == null)
+      {
+        pass = true;
+        msg = "Correctly didn't delegate with render policy of NEVER_DELEGATE";
+      }
+    }
+    
+    // remove them in case we are called to render more than once
+    m.remove("javax.portlet.faces.tck.testRenderPolicyPass");
+    m.remove("javax.portlet.faces.tck.testRenderPolicyFail");
+    
+
+    testRunner.setTestResult(pass, msg);
+    if (pass)
+    {
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      return Constants.TEST_FAILED;
+    }
+  }
+  
+  /*
+   * Because Lifecycle_ID is a web.xml (application) config setting we need a different portlet app for
+   * each test.  Because of this we can test all policies in a single test method.
+   */
+  @BridgeTest(test = "lifecycleTest")
+  public String lifecycleTest(TestRunnerBean testRunner)
+  {
+    Boolean pass = false;
+    String msg = null;
+    // Get the configured render policy
+    ExternalContext extCtx = FacesContext.getCurrentInstance().getExternalContext();
+    Map m = extCtx.getRequestMap();
+    // Check to see what the render rule is
+    PortletContext pCtx = (PortletContext) extCtx.getContext();
+    
+
+    // Lifecycle check done in the FacesContextFactory -- so test/results set on every request
+    msg = (String) m.get("javax.portlet.faces.tck.testLifecyclePass");
+    if (msg != null) pass = true;
+    else msg = (String) m.get("javax.portlet.faces.tck.testLifecycleFail");
+    
+    // remove them in case we are called to render more than once
+    m.remove("javax.portlet.faces.tck.testLifecyclePass");
+    m.remove("javax.portlet.faces.tck.testLifecycleFail");
+    
+
+    testRunner.setTestResult(pass, msg);
+    if (pass)
+    {
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      return Constants.TEST_FAILED;
+    }
+  }
+  
+
+  @BridgeTest(test = "modeViewIDTest")
+  public String modeViewIDTest(TestRunnerBean testRunner)
+  {
+    FacesContext ctx = FacesContext.getCurrentInstance();
+    ExternalContext extCtx = ctx.getExternalContext();
+    PortletRequest req = (PortletRequest) extCtx.getRequest();
+    
+    testRunner.setTestComplete(true);
+    
+    // Are we in the rightview???
+    String s = ctx.getViewRoot().getViewId();
+    if (!s.contains("ModeViewIdResult"))
+    {
+      testRunner.setTestResult(false,
+                               "defaultViewId test failed:  entered EDIT mode at view: " + s + " but the default is: " + "ModeViewIdResult.jsp");
+      return Constants.TEST_FAILED;
+    }
+    
+    // Are we in edit mode???
+    if (!req.getPortletMode().equals(PortletMode.EDIT))
+    {
+      testRunner.setTestResult(false,
+                               "defaultViewId test failed:  though in the correct view we aren't in EDIT mode.  So why did we get here?");
+      return Constants.TEST_FAILED;
+    }
+    
+
+    testRunner.setTestResult(true,
+                             "defaultViewId for EDIT mode was correctly used: " + s);
+    return Constants.TEST_SUCCESS;
+  }
+  
+  // Test is MultiRequest -- Render/Action
+  // Should never get to the render portion of this
+  @BridgeTest(test = "actionDestroyTest")
+  public String actionDestroyTest(TestRunnerBean testRunner)
+  {
+    // This tests that we can encode a new mode in an actionURL
+    // done by navigation rule.
+    if (BridgeUtil.getPortletRequestPhase() ==
+        Bridge.PortletPhase.ACTION_PHASE)
+    {
+      return "actionDestroyTest"; // action Navigation result
+    }
+    else
+    {
+      testRunner.setTestComplete(true);
+      testRunner.setTestResult(false,
+                               "unexpectedly got to a render JSP in this test -- should have been handled by the test portlet.");
+      return Constants.TEST_FAILED;
+    }
+  }
+  
+  @BridgeTest(test = "portletSetsViewIdTest")
+  public String portletSetsViewIdTest(TestRunnerBean testRunner)
+  {
+    FacesContext ctx = FacesContext.getCurrentInstance();
+    ExternalContext extCtx = ctx.getExternalContext();
+    PortletRequest req = (PortletRequest) extCtx.getRequest();
+    
+    testRunner.setTestComplete(true);
+    
+    // Are we in the rightview???
+    String s = ctx.getViewRoot().getViewId();
+    if (s.contains("Success"))
+    {
+      testRunner.setTestResult(true,
+                               "correctly rendered the view explicitly set by the portlet: " + s);
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      testRunner.setTestResult(false,
+                               "didn't render the view 'PorletSetsViewIdSuccess.jsp' explicitly set by the portlet, instead rendered: " + s);
+      return Constants.TEST_FAILED;
+    }
+  }
+  
+  @BridgeTest(test = "portletSetsViewPathTest")
+  public String portletSetsViewPathTest(TestRunnerBean testRunner)
+  {
+    FacesContext ctx = FacesContext.getCurrentInstance();
+    ExternalContext extCtx = ctx.getExternalContext();
+    PortletRequest req = (PortletRequest) extCtx.getRequest();
+    
+    testRunner.setTestComplete(true);
+    
+    // Are we in the rightview???
+    String s = ctx.getViewRoot().getViewId();
+    if (s.contains("Success"))
+    {
+      testRunner.setTestResult(true,
+                               "correctly rendered the view explicitly set by the portlet: " + s);
+      return Constants.TEST_SUCCESS;
+    }
+    else
+    {
+      testRunner.setTestResult(false,
+                               "didn't render the view 'PorletSetsViewIdSuccess.jsp' explicitly set by the portlet, instead rendered: " + s);
+      return Constants.TEST_FAILED;
+    }
+  }
+
+  // Test is MultiRequest -- Render/Action
+  // Should never get to the render portion of this
+  @BridgeTest(test = "actionNullRequestTest")
+  public String actionNullRequestTest(TestRunnerBean testRunner)
+  {
+    // This tests that we can encode a new mode in an actionURL
+    // done by navigation rule.
+    if (BridgeUtil.getPortletRequestPhase() ==
+        Bridge.PortletPhase.ACTION_PHASE)
+    {
+      return "actionNullRequestTest"; // action Navigation result
+    }
+    else
+    {
+      testRunner.setTestComplete(true);
+      testRunner.setTestResult(false,
+                               "unexpectedly got to a render JSP in this test -- should have been handled by the test portlet.");
+      return Constants.TEST_FAILED;
+    }
+  }
+  
+}

Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/FacesContextFactoryServiceProviderTest.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/FacesContextFactoryServiceProviderTest.java?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/FacesContextFactoryServiceProviderTest.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/FacesContextFactoryServiceProviderTest.java Thu Jan  7 19:26:15 2010
@@ -45,7 +45,7 @@
  * can read that attribute back using PortletRequest.getAttribute()
  */
 
-
+/* Test #6.1 */
 public class FacesContextFactoryServiceProviderTest extends GenericPortlet {
     public static String TEST_NAME="facesContextFactoryServiceProviderTest";    
 

Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/Tests.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/Tests.java?rev=896975&r1=896974&r2=896975&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/Tests.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_1/Tests.java Thu Jan  7 19:26:15 2010
@@ -73,7 +73,7 @@
 {
 
   // Test is MultiRequest -- Render/Action
-
+  // Test #6.2
   @BridgeTest(test = "wrappedFacesContextTest")
   public String wrappedFacesContextTest(TestRunnerBean testRunner)
   {