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/12/29 23:28:48 UTC
svn commit: r1053759 - in /myfaces/portlet-bridge/tck/trunk_3.0.x: ./
portlet-bridge-tck-main/
src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/
src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/...
Author: mfreedman
Date: Wed Dec 29 22:28:47 2010
New Revision: 1053759
URL: http://svn.apache.org/viewvc?rev=1053759&view=rev
Log:
First checkin that Fixes 2.0 TCK to run in 3.0 (JSF 2.0) bridge environment.
Modified:
myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml
myfaces/portlet-bridge/tck/trunk_3.0.x/portlet-bridge-tck-main/pom.xml
myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java
myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java
myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java
Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/pom.xml Wed Dec 29 22:28:47 2010
@@ -1,3 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +24,7 @@
<artifactId>portlet-bridge-tck</artifactId>
<packaging>pom</packaging>
<name>MyFaces Portlet Bridge Test Suite</name>
- <version>jsr329-1.0.0-SNAPSHOT</version>
+ <version>TCK-3.0.0-SNAPSHOT</version>
<inceptionYear>2010</inceptionYear>
<description>
Portlet 2.0 Bridge for JavaServer Faces is a subproject of Apache MyFaces which provides an
@@ -15,7 +34,7 @@
actually build and test the web applications themselves.
</description>
- <url>http://myfaces.apache.org/portlet-bridge/2.0</url>
+ <url>http://myfaces.apache.org/portlet-bridge/3.0</url>
<parent>
<artifactId>portlet-bridge-master-pom</artifactId>
@@ -24,13 +43,15 @@
</parent>
<properties>
+ <latestRelease>TCK-3.0.0-SNAPSHOT</latestRelease>
+
<!-- Specification Configurations -->
<servlet.version>2.5</servlet.version>
<portlet.version>2.0</portlet.version>
<jsp.version>2.1</jsp.version>
<!-- Bridge Configurations -->
- <portlet-bridge.version>2.0.0-SNAPSHOT</portlet-bridge.version>
+ <portlet-bridge.version>3.0-SNAPSHOT</portlet-bridge.version>
<portlet-bridge.groupId>${project.groupId}</portlet-bridge.groupId>
<portlet-bridge.api.groupId>${portlet-bridge.groupId}</portlet-bridge.api.groupId>
@@ -41,17 +62,17 @@
<portlet-bridge.impl.version>${portlet-bridge.version}</portlet-bridge.impl.version>
<!-- Faces Implementation Default Version Numbers -->
- <mojarra.version>1.2_03</mojarra.version>
- <myfaces.version>1.2.2</myfaces.version>
+ <mojarra.version>2.0.1</mojarra.version>
+ <myfaces.version>2.0.1</myfaces.version>
<!-- Trinidad Ids -->
<trinidad.groupId>org.apache.myfaces.trinidad</trinidad.groupId>
<trinidad.api.artifactId>trinidad-api</trinidad.api.artifactId>
<trinidad.impl.artifactId>trinidad-impl</trinidad.impl.artifactId>
- <trinidad.version>1.2.13</trinidad.version>
+ <trinidad.version>2.0.0-alpha-2</trinidad.version>
<!-- JSF Implementation in use -->
- <jsf.groupId>javax.faces</jsf.groupId>
+ <jsf.groupId>com.sun.faces</jsf.groupId>
<jsf.version>${mojarra.version}</jsf.version>
<jsf.api.groupId>${jsf.groupId}</jsf.api.groupId>
@@ -209,10 +230,44 @@
<scope>provided</scope>
</dependency>
+
+<!--
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+
+ <version>${mojarra.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+
+ <version>${mojarra.version}</version>
+ <scope>provided</scope>
+ </dependency>
+-->
+
<dependency>
<groupId>${jsf.api.groupId}</groupId>
<artifactId>${jsf.api.artifactId}</artifactId>
</dependency>
+
<dependency>
<groupId>${portlet-bridge.api.groupId}</groupId>
@@ -381,8 +436,10 @@
<modules>
<module>portlet-bridge-tck-main</module>
+<!--
<module>portlet-bridge-tck-section3-2-lifecycle-set</module>
<module>portlet-bridge-tck-section6-2-configured-response-wrapper</module>
+-->
<!-- Render Policy tests are excluded because its mechanism relies on a Mojarra impl dependency (doesn't work on MyFaces)
If you are testing with Mojarra uncomment these out to get the additional test apps built
Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/portlet-bridge-tck-main/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/portlet-bridge-tck-main/pom.xml?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/portlet-bridge-tck-main/pom.xml (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/portlet-bridge-tck-main/pom.xml Wed Dec 29 22:28:47 2010
@@ -1,146 +1,146 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <artifactId>portlet-bridge-tck-main</artifactId>
- <packaging>war</packaging>
- <name>MyFaces Portlet Bridge Test Suite Main</name>
- <description>
- This project builds and tests a testsuite web application containing all of
- the test portlets with no portlet context parameters set.
- </description>
-
-
- <parent>
- <artifactId>portlet-bridge-tck</artifactId>
- <groupId>org.apache.myfaces.portlet-bridge</groupId>
- <version>jsr329-1.0.0-SNAPSHOT</version>
- </parent>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>selenium-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>start</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>start-server</goal>
- </goals>
- <configuration>
- <background>true</background>
- <logOutput>true</logOutput>
- <multiWindow>true</multiWindow>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <executions>
- <execution>
- <id>start-jetty</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <scanIntervalSeconds>0</scanIntervalSeconds>
- <daemon>true</daemon>
- </configuration>
- </execution>
- <execution>
- <id>stop-jetty</id>
- <phase>test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>${pluto.version}</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>maven-pluto-plugin</artifactId>
- <version>2.0.0</version>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>assemble</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <outputName>${artifactId}-report</outputName>
- <outputDirectory>../target</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
-
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <id>add-ts-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/../src/main/java</source>
- </sources>
- </configuration>
- </execution>
- <execution>
- <id>add-tck-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/../src/test/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xml-maven-plugin</artifactId>
- </plugin>
-
- </plugins>
- </build>
-
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge-tck-main</artifactId>
+ <packaging>war</packaging>
+ <name>MyFaces Portlet Bridge Test Suite Main</name>
+ <description>
+ This project builds and tests a testsuite web application containing all of
+ the test portlets with no portlet context parameters set.
+ </description>
+
+
+ <parent>
+ <artifactId>portlet-bridge-tck</artifactId>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <version>TCK-3.0.0-SNAPSHOT</version>
+ </parent>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>selenium-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>start-server</goal>
+ </goals>
+ <configuration>
+ <background>true</background>
+ <logOutput>true</logOutput>
+ <multiWindow>true</multiWindow>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>${pluto.version}</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <configuration>
+ <outputName>${artifactId}-report</outputName>
+ <outputDirectory>../target</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <id>add-ts-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/../src/main/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-tck-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/../src/test/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteApplicationImpl.java Wed Dec 29 22:28:47 2010
@@ -76,7 +76,7 @@ public class TestSuiteApplicationImpl ex
throws FacesException, NullPointerException {
return mWrapped.createComponent(componentExpression, facesContext, componentType);
}
-
+
public ExpressionFactory getExpressionFactory() {
return mWrapped.getExpressionFactory();
}
@@ -309,7 +309,7 @@ public class TestSuiteApplicationImpl ex
return mWrapped.getConverterIds();
}
- public Iterator<Class> getConverterTypes()
+ public Iterator<Class<?>> getConverterTypes()
{
return mWrapped.getConverterTypes();
}
Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/application/TestSuiteViewHandlerImpl.java Wed Dec 29 22:28:47 2010
@@ -71,7 +71,7 @@ public class TestSuiteViewHandlerImpl ex
mDelegate = handler;
}
- protected ViewHandler getWrapped()
+ public ViewHandler getWrapped()
{
return mDelegate;
}
@@ -128,127 +128,18 @@ public class TestSuiteViewHandlerImpl ex
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);
+ getViewDeclarationLanguage(context,viewToRender.getViewId()).renderView(context, viewToRender);
}
- 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
@@ -292,149 +183,6 @@ public class TestSuiteViewHandlerImpl ex
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/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java Wed Dec 29 22:28:47 2010
@@ -28,6 +28,7 @@ import javax.faces.application.FacesMess
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextWrapper;
import javax.faces.context.ResponseStream;
import javax.faces.context.ResponseWriter;
import javax.faces.render.RenderKit;
@@ -35,7 +36,7 @@ import javax.faces.render.RenderKit;
import org.apache.myfaces.portlet.faces.testsuite.common.util.faces.render.TCK_PortletUrlRenderer;
-public class TCK_FacesContextImpl extends FacesContext
+public class TCK_FacesContextImpl extends FacesContextWrapper
{
private FacesContext mWrapped;
@@ -48,107 +49,17 @@ public class TCK_FacesContextImpl extend
// Start of JSF 1.2 API
- public ELContext getELContext()
+ public FacesContext getWrapped()
{
- return mWrapped.getELContext();
+ return mWrapped;
}
- public ExternalContext getExternalContext()
- {
- return mWrapped.getExternalContext();
- }
-
- public FacesMessage.Severity getMaximumSeverity()
- {
- return mWrapped.getMaximumSeverity();
- }
-
- public Iterator<FacesMessage> getMessages()
- {
- return mWrapped.getMessages();
- }
-
-
- public Application getApplication()
- {
- return mWrapped.getApplication();
- }
-
- public Iterator<String> getClientIdsWithMessages()
- {
- return mWrapped.getClientIdsWithMessages();
- }
-
- public Iterator<FacesMessage> getMessages(String clientId)
- {
- return mWrapped.getMessages(clientId);
- }
-
- public RenderKit getRenderKit()
- {
- return mWrapped.getRenderKit();
-
- }
-
- public boolean getRenderResponse()
- {
- return mWrapped.getRenderResponse();
- }
-
- public boolean getResponseComplete()
- {
- return mWrapped.getResponseComplete();
- }
-
- public void setResponseStream(ResponseStream responseStream)
- {
- mWrapped.setResponseStream(responseStream);
- }
-
- public ResponseStream getResponseStream()
- {
- return mWrapped.getResponseStream();
- }
-
- public void setResponseWriter(ResponseWriter responseWriter)
- {
- mWrapped.setResponseWriter(responseWriter);
- }
-
- public ResponseWriter getResponseWriter()
- {
- return mWrapped.getResponseWriter();
- }
-
- public void setViewRoot(UIViewRoot viewRoot)
- {
- mWrapped.setViewRoot(viewRoot);
- }
-
- public UIViewRoot getViewRoot()
- {
- return mWrapped.getViewRoot();
- }
-
-
- public void addMessage(String clientId, FacesMessage message)
- {
- mWrapped.addMessage(clientId, message);
- }
public void release()
{
getExternalContext().getSessionMap().put("org.apache.portlet.faces.tck.facesContextReleased", Boolean.TRUE);
- mWrapped.release();
+ super.release();
}
- public void renderResponse()
- {
- mWrapped.renderResponse();
- }
- public void responseComplete()
- {
- mWrapped.responseComplete();
- }
}
Modified: myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java?rev=1053759&r1=1053758&r2=1053759&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java (original)
+++ myfaces/portlet-bridge/tck/trunk_3.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_3/BridgeVersionTestPortlet.java Wed Dec 29 22:28:47 2010
@@ -53,15 +53,15 @@ public class BridgeVersionTestPortlet ex
String name = c.getPackage().getSpecificationTitle();
String version = c.getPackage().getSpecificationVersion();
- if (name == null || !name.equals("Portlet 2.0 Bridge for JavaServer Faces 1.2"))
+ if (name == null || !name.equals("Portlet 2.0 Bridge for JavaServer Faces 2.0"))
{
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
- resultWriter.setDetail("Incorrect Specification Title: " + name + " should be 'Portlet 2.0 Bridge for JavaServer Faces 1.2'");
+ resultWriter.setDetail("Incorrect Specification Title: " + name + " should be 'Portlet 2.0 Bridge for JavaServer Faces 2.0'");
}
else if (version == null || !version.equals("1.0"))
{
resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
- resultWriter.setDetail("Incorrect Specification Version: " + version + " should be '2.0'");
+ resultWriter.setDetail("Incorrect Specification Version: " + version + " should be '1.0'");
}
else
{