You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by so...@apache.org on 2009/10/07 23:19:01 UTC
svn commit: r822919 - in
/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite:
annotation/ beans/ common/ common/portlet/ common/util/faces/context/
common/util/faces/render/
Author: sobryan
Date: Wed Oct 7 21:18:57 2009
New Revision: 822919
URL: http://svn.apache.org/viewvc?rev=822919&view=rev
Log:
Changed CR/LF and created some POM updates
Modified:
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/annotation/BridgeTest.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean1.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean2.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/TestRunnerBean.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/Constants.java
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/common/util/faces/context/TCK_FacesContextImpl.java
myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/render/TCK_PortletUrlRenderer.java
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/annotation/BridgeTest.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/annotation/BridgeTest.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/annotation/BridgeTest.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/annotation/BridgeTest.java Wed Oct 7 21:18:57 2009
@@ -1,42 +1,42 @@
-/* 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.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for marking a method for handling
- * a specific test.
- */
-@Target(ElementType.METHOD)
-@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
-public @interface BridgeTest {
- /**
- * TestName.
- *
- * Expected to match the TestName portion of the portletName
- * @return test name.
- */
- String test() default "";
-
-}
+/* 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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for marking a method for handling
+ * a specific test.
+ */
+@Target(ElementType.METHOD)
+@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+public @interface BridgeTest {
+ /**
+ * TestName.
+ *
+ * Expected to match the TestName portion of the portletName
+ * @return test name.
+ */
+ String test() default "";
+
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean1.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean1.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean1.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean1.java Wed Oct 7 21:18:57 2009
@@ -1,77 +1,77 @@
-/* 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.beans;
-
-import javax.annotation.PreDestroy;
-
-import javax.faces.context.FacesContext;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.faces.annotation.BridgePreDestroy;
-import javax.portlet.faces.annotation.BridgeRequestScopeAttributeAdded;
-
-public class PreDestroyBean1
-{
- PortletRequest mRequest;
- boolean mInBridgeRequestScope = false;
-
- public PreDestroyBean1()
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- mRequest = (PortletRequest) ctx.getExternalContext().getRequest();
- }
-
- public Boolean getInBridgeRequestScope()
- {
- if (mInBridgeRequestScope)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- @BridgeRequestScopeAttributeAdded
- public void attributeAddedToBridgeRequestScope()
- {
- mRequest.setAttribute("PreDestroyBean1.attributeAdded", Boolean.TRUE);
- mInBridgeRequestScope = true;
- }
-
- @PreDestroy
- public void servletPredestroy()
- {
- if (!mInBridgeRequestScope)
- {
- mRequest.setAttribute("PreDestroyBean1.servletPreDestroy", Boolean.TRUE); // indicates we would do the destroy
- }
- else
- {
- mRequest.setAttribute("PreDestroyBean1.servletPreDestroy", Boolean.FALSE); // indicates we would not do the destroy
- }
-
- }
-
-
- @BridgePreDestroy
- public void bridgePredestroy()
- {
- mRequest.setAttribute("PreDestroyBean1.bridgePreDestroy", Boolean.TRUE);
- mInBridgeRequestScope = false;
- }
-}
+/* 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.beans;
+
+import javax.annotation.PreDestroy;
+
+import javax.faces.context.FacesContext;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.faces.annotation.BridgePreDestroy;
+import javax.portlet.faces.annotation.BridgeRequestScopeAttributeAdded;
+
+public class PreDestroyBean1
+{
+ PortletRequest mRequest;
+ boolean mInBridgeRequestScope = false;
+
+ public PreDestroyBean1()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ mRequest = (PortletRequest) ctx.getExternalContext().getRequest();
+ }
+
+ public Boolean getInBridgeRequestScope()
+ {
+ if (mInBridgeRequestScope)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ @BridgeRequestScopeAttributeAdded
+ public void attributeAddedToBridgeRequestScope()
+ {
+ mRequest.setAttribute("PreDestroyBean1.attributeAdded", Boolean.TRUE);
+ mInBridgeRequestScope = true;
+ }
+
+ @PreDestroy
+ public void servletPredestroy()
+ {
+ if (!mInBridgeRequestScope)
+ {
+ mRequest.setAttribute("PreDestroyBean1.servletPreDestroy", Boolean.TRUE); // indicates we would do the destroy
+ }
+ else
+ {
+ mRequest.setAttribute("PreDestroyBean1.servletPreDestroy", Boolean.FALSE); // indicates we would not do the destroy
+ }
+
+ }
+
+
+ @BridgePreDestroy
+ public void bridgePredestroy()
+ {
+ mRequest.setAttribute("PreDestroyBean1.bridgePreDestroy", Boolean.TRUE);
+ mInBridgeRequestScope = false;
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean2.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean2.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean2.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/PreDestroyBean2.java Wed Oct 7 21:18:57 2009
@@ -1,78 +1,78 @@
-/* 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.beans;
-
-import javax.annotation.PreDestroy;
-
-import javax.faces.context.FacesContext;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.faces.annotation.BridgePreDestroy;
-import javax.portlet.faces.annotation.BridgeRequestScopeAttributeAdded;
-
-public class PreDestroyBean2
-{
- PortletRequest mRequest;
- boolean mInBridgeRequestScope = false;
-
- public PreDestroyBean2()
- {
- FacesContext ctx = FacesContext.getCurrentInstance();
- mRequest = (PortletRequest) ctx.getExternalContext().getRequest();
- mInBridgeRequestScope = true;
- }
-
- public Boolean isInBridgeRequestScope()
- {
- if (mInBridgeRequestScope)
- return Boolean.TRUE;
- else
- return Boolean.FALSE;
- }
-
- @BridgeRequestScopeAttributeAdded
- public void attributeAddedToBridgeRequestScope()
- {
- mRequest.setAttribute("PreDestroyBean2.attributeAdded", Boolean.TRUE);
-
- }
-
- @PreDestroy
- public void servletPredestroy()
- {
- if (!mInBridgeRequestScope)
- {
- mRequest.setAttribute("PreDestroyBean2.servletPreDestroy", Boolean.TRUE); // indicates we would do the destroy
- }
- else
- {
- mRequest.setAttribute("PreDestroyBean2.servletPreDestroy", Boolean.FALSE); // indicates we would not do the destroy
- }
-
- }
-
-
- @BridgePreDestroy
- public void bridgePredestroy()
- {
- mRequest.setAttribute("PreDestroyBean2.bridgePreDestroy", Boolean.TRUE);
- mInBridgeRequestScope = false;
- }
-}
+/* 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.beans;
+
+import javax.annotation.PreDestroy;
+
+import javax.faces.context.FacesContext;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.faces.annotation.BridgePreDestroy;
+import javax.portlet.faces.annotation.BridgeRequestScopeAttributeAdded;
+
+public class PreDestroyBean2
+{
+ PortletRequest mRequest;
+ boolean mInBridgeRequestScope = false;
+
+ public PreDestroyBean2()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ mRequest = (PortletRequest) ctx.getExternalContext().getRequest();
+ mInBridgeRequestScope = true;
+ }
+
+ public Boolean isInBridgeRequestScope()
+ {
+ if (mInBridgeRequestScope)
+ return Boolean.TRUE;
+ else
+ return Boolean.FALSE;
+ }
+
+ @BridgeRequestScopeAttributeAdded
+ public void attributeAddedToBridgeRequestScope()
+ {
+ mRequest.setAttribute("PreDestroyBean2.attributeAdded", Boolean.TRUE);
+
+ }
+
+ @PreDestroy
+ public void servletPredestroy()
+ {
+ if (!mInBridgeRequestScope)
+ {
+ mRequest.setAttribute("PreDestroyBean2.servletPreDestroy", Boolean.TRUE); // indicates we would do the destroy
+ }
+ else
+ {
+ mRequest.setAttribute("PreDestroyBean2.servletPreDestroy", Boolean.FALSE); // indicates we would not do the destroy
+ }
+
+ }
+
+
+ @BridgePreDestroy
+ public void bridgePredestroy()
+ {
+ mRequest.setAttribute("PreDestroyBean2.bridgePreDestroy", Boolean.TRUE);
+ mInBridgeRequestScope = false;
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/TestRunnerBean.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/TestRunnerBean.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/TestRunnerBean.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/beans/TestRunnerBean.java Wed Oct 7 21:18:57 2009
@@ -1,200 +1,200 @@
-/* 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.beans;
-
-import java.lang.IllegalStateException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-
-import java.util.Map;
-
-
-import javax.faces.context.FacesContext;
-
-
-import org.apache.myfaces.portlet.faces.testsuite.annotation.BridgeTest;
-
-import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
-import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
-
-
-public class TestRunnerBean
- extends Object
-{
-
- // The portlet's name is testGroup-testName-portlet. For example encodeActionURL_absoluteURLTest-portlet.
- // testGroup corresponds to the managedBean name that holds the object containing the test.
- // testName corresponds to the name of the Test that is the value of the
- // test method annotation we look for to determine which method is called to run the test.
- private String mTestGroup;
- private String mTestName;
-
- private Object mTest;
-
- private BridgeTCKResultWriter mResultWriter;
- private boolean mStatus = false;
- private boolean mTestComplete = false;
- private Method mTestMethod;
-
- public TestRunnerBean()
- {
- // Get the Test information from the request (attributes)
- // Placed into the request by the GenericFacesTestSuitePortlet
- FacesContext context = FacesContext.getCurrentInstance();
- Map<String, Object> m = context.getExternalContext().getRequestMap();
- mTestGroup = (String) m.get(Constants.TEST_BEAN_NAME);
- mTestName = (String) m.get(Constants.TEST_NAME);
-
-
- if (mTestGroup == null || mTestName == null)
- {
- throw new IllegalStateException("Couldn't locate the TestGroup or TestName in the request. Did you use the GenericFacesTestSuitePortlet?");
- }
-
- // Now lookup the object that implements the test. There should be a managedBean with the same name as
- // the testGroup.
- mTest = context.getELContext()
- .getELResolver().getValue(context.getELContext(), null, mTestGroup);
-
- if (mTest == null)
- {
- throw new IllegalStateException("Couldn't locate managed bean containing the test: " + mTestGroup);
- }
-
- // The test is annotated by a method annotation with a parameter value = mTestName -- so
- // look it up.
- mTestMethod = getAnnotatedTestMethod(mTestName, mTest);
-
-
-
- if (mTestMethod == null)
- throw new IllegalStateException("Couldn't locate (annotation for) test: " + mTestName + "Test in the test object.");
- }
-
- public String runActionTest()
- {
-
- // Called either because the action is submitted
- return runTest();
- }
-
- public boolean getTestStatus()
- {
- return mStatus;
- }
-
- public boolean isTestComplete()
- {
- return mTestComplete;
- }
-
- public void setTestComplete(boolean complete)
- {
- mTestComplete = complete;
- }
-
- public String getRenderTestResult()
- {
- runTest();
- return getTestResult();
- }
-
- public void setTestResult(boolean passed, String detail)
- {
- mResultWriter = new BridgeTCKResultWriter(mTestName);
- mResultWriter.setStatus(passed);
- mResultWriter.addDetail(detail);
-
- mStatus = passed;
- }
-
-
- public String getTestResult()
- {
- if (mResultWriter == null)
- setTestResult(false, "Test failed: A test result hasn't been set! Usually this indicates the request flow broken due to bridge failure.");
-
-
- return mResultWriter.toString();
- }
-
- public void appendTestDetail(String detail)
- {
- if (mResultWriter != null)
- {
- mResultWriter.addDetail(detail);
- }
- }
-
- private String runTest()
- {
- // Only run the test once
- if (mTestComplete)
- {
- return (mStatus) ? Constants.TEST_SUCCESS : Constants.TEST_FAILED;
- }
-
- // run the test and return the result.
- if (mTestMethod != null)
- {
- try
- {
- return (String) mTestMethod.invoke(mTest, this);
- }
- catch (Exception e)
- {
- setTestResult(false, "Test failed: " + e.toString() + " thrown during invocation");
- return Constants.TEST_FAILED;
- }
- }
- else
- {
- setTestResult(false, "Test failed: unable to determine test method to call. Is the portletName properly encoded? Syntax: testBean-testMethodName-portlet");
- return Constants.TEST_FAILED;
- }
- }
-
- private Method getAnnotatedTestMethod(String testName, Object testObj)
- {
- // search methods for one annotated by the BridgeTest annotation and
- // with a test (parameter) value = portletNameTest
- for (Method method: testObj.getClass().getMethods())
- {
- Annotation[] annotations = method.getAnnotations();
- if (annotations != null)
- {
- for (Annotation annotation: annotations)
- {
- Class<? extends Annotation> annotationType =
- annotation.annotationType();
- if (BridgeTest.class.equals(annotationType))
- {
- String annotatedTestName = ((BridgeTest) annotation).test();
- if (annotatedTestName != null && annotatedTestName.length() > 0
- && annotatedTestName.equalsIgnoreCase(testName))
- return method;
- }
- }
- }
- }
- return null;
- }
-}
+/* 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.beans;
+
+import java.lang.IllegalStateException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+
+import java.util.Map;
+
+
+import javax.faces.context.FacesContext;
+
+
+import org.apache.myfaces.portlet.faces.testsuite.annotation.BridgeTest;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+import org.apache.myfaces.portlet.faces.testsuite.common.util.BridgeTCKResultWriter;
+
+
+public class TestRunnerBean
+ extends Object
+{
+
+ // The portlet's name is testGroup-testName-portlet. For example encodeActionURL_absoluteURLTest-portlet.
+ // testGroup corresponds to the managedBean name that holds the object containing the test.
+ // testName corresponds to the name of the Test that is the value of the
+ // test method annotation we look for to determine which method is called to run the test.
+ private String mTestGroup;
+ private String mTestName;
+
+ private Object mTest;
+
+ private BridgeTCKResultWriter mResultWriter;
+ private boolean mStatus = false;
+ private boolean mTestComplete = false;
+ private Method mTestMethod;
+
+ public TestRunnerBean()
+ {
+ // Get the Test information from the request (attributes)
+ // Placed into the request by the GenericFacesTestSuitePortlet
+ FacesContext context = FacesContext.getCurrentInstance();
+ Map<String, Object> m = context.getExternalContext().getRequestMap();
+ mTestGroup = (String) m.get(Constants.TEST_BEAN_NAME);
+ mTestName = (String) m.get(Constants.TEST_NAME);
+
+
+ if (mTestGroup == null || mTestName == null)
+ {
+ throw new IllegalStateException("Couldn't locate the TestGroup or TestName in the request. Did you use the GenericFacesTestSuitePortlet?");
+ }
+
+ // Now lookup the object that implements the test. There should be a managedBean with the same name as
+ // the testGroup.
+ mTest = context.getELContext()
+ .getELResolver().getValue(context.getELContext(), null, mTestGroup);
+
+ if (mTest == null)
+ {
+ throw new IllegalStateException("Couldn't locate managed bean containing the test: " + mTestGroup);
+ }
+
+ // The test is annotated by a method annotation with a parameter value = mTestName -- so
+ // look it up.
+ mTestMethod = getAnnotatedTestMethod(mTestName, mTest);
+
+
+
+ if (mTestMethod == null)
+ throw new IllegalStateException("Couldn't locate (annotation for) test: " + mTestName + "Test in the test object.");
+ }
+
+ public String runActionTest()
+ {
+
+ // Called either because the action is submitted
+ return runTest();
+ }
+
+ public boolean getTestStatus()
+ {
+ return mStatus;
+ }
+
+ public boolean isTestComplete()
+ {
+ return mTestComplete;
+ }
+
+ public void setTestComplete(boolean complete)
+ {
+ mTestComplete = complete;
+ }
+
+ public String getRenderTestResult()
+ {
+ runTest();
+ return getTestResult();
+ }
+
+ public void setTestResult(boolean passed, String detail)
+ {
+ mResultWriter = new BridgeTCKResultWriter(mTestName);
+ mResultWriter.setStatus(passed);
+ mResultWriter.addDetail(detail);
+
+ mStatus = passed;
+ }
+
+
+ public String getTestResult()
+ {
+ if (mResultWriter == null)
+ setTestResult(false, "Test failed: A test result hasn't been set! Usually this indicates the request flow broken due to bridge failure.");
+
+
+ return mResultWriter.toString();
+ }
+
+ public void appendTestDetail(String detail)
+ {
+ if (mResultWriter != null)
+ {
+ mResultWriter.addDetail(detail);
+ }
+ }
+
+ private String runTest()
+ {
+ // Only run the test once
+ if (mTestComplete)
+ {
+ return (mStatus) ? Constants.TEST_SUCCESS : Constants.TEST_FAILED;
+ }
+
+ // run the test and return the result.
+ if (mTestMethod != null)
+ {
+ try
+ {
+ return (String) mTestMethod.invoke(mTest, this);
+ }
+ catch (Exception e)
+ {
+ setTestResult(false, "Test failed: " + e.toString() + " thrown during invocation");
+ return Constants.TEST_FAILED;
+ }
+ }
+ else
+ {
+ setTestResult(false, "Test failed: unable to determine test method to call. Is the portletName properly encoded? Syntax: testBean-testMethodName-portlet");
+ return Constants.TEST_FAILED;
+ }
+ }
+
+ private Method getAnnotatedTestMethod(String testName, Object testObj)
+ {
+ // search methods for one annotated by the BridgeTest annotation and
+ // with a test (parameter) value = portletNameTest
+ for (Method method: testObj.getClass().getMethods())
+ {
+ Annotation[] annotations = method.getAnnotations();
+ if (annotations != null)
+ {
+ for (Annotation annotation: annotations)
+ {
+ Class<? extends Annotation> annotationType =
+ annotation.annotationType();
+ if (BridgeTest.class.equals(annotationType))
+ {
+ String annotatedTestName = ((BridgeTest) annotation).test();
+ if (annotatedTestName != null && annotatedTestName.length() > 0
+ && annotatedTestName.equalsIgnoreCase(testName))
+ return method;
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/Constants.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/Constants.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/Constants.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/Constants.java Wed Oct 7 21:18:57 2009
@@ -1,28 +1,28 @@
-/* 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;
-
-public class Constants extends Object
-{
- public final static String TEST_BEAN_NAME = "org.apache.myfaces.portlet.faces.testsuite.common.testBean";
- public final static String TEST_NAME = "org.apache.myfaces.portlet.faces.testsuite.common.testName";
- public final static String TEST_FAILED = "FAILED";
- public final static String TEST_SUCCESS = "SUCCESS";
+/* 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;
+
+public class Constants extends Object
+{
+ public final static String TEST_BEAN_NAME = "org.apache.myfaces.portlet.faces.testsuite.common.testBean";
+ public final static String TEST_NAME = "org.apache.myfaces.portlet.faces.testsuite.common.testName";
+ public final static String TEST_FAILED = "FAILED";
+ public final static String TEST_SUCCESS = "SUCCESS";
}
\ No newline at end of file
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=822919&r1=822918&r2=822919&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 Wed Oct 7 21:18:57 2009
@@ -1,85 +1,85 @@
-/* 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.portlet;
-
-import java.io.IOException;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.faces.GenericFacesPortlet;
-
-import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
-
-public class GenericFacesTestSuitePortlet extends GenericFacesPortlet
-{
-
- private String mTestBeanName;
- private String mTestName;
-
- public void init(PortletConfig config)
- throws PortletException
- {
- super.init(config);
- // parse the portlet name to extract the testName and bean we use to during this test
- // This information is subsequently attached to each request (as an attribute).
- // The generic TestRunnerBean uses this information to execute the bean and properly
- // reference the test in any result.
-
- // portletName syntax: testGroup-testName-portlet
- String portletName = config.getPortletName();
- String [] parts = portletName.split("-");
- if (parts.length != 3)
- {
- throw new IllegalStateException("Incorrect portletName syntax for a test: should be testGroup-testName-portlet");
- }
- mTestBeanName = parts[0];
- mTestName = parts[1];
- if (!mTestName.endsWith("Test"))
- {
- mTestName = mTestName.concat("Test");
- }
- }
- public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
- throws PortletException, IOException
- {
- initTestRequest(actionRequest);
- // add an additional attribute -- so one of the tests can verify its excluded in render
- actionRequest.setAttribute("verifyPreBridgeExclusion", "avalue");
- super.processAction(actionRequest, actionResponse);
- }
-
- public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
- throws PortletException, IOException
- {
- initTestRequest(renderRequest);
- super.doDispatch(renderRequest, renderResponse);
- }
-
- private void initTestRequest(PortletRequest portletRequest)
- {
- portletRequest.setAttribute(Constants.TEST_BEAN_NAME, mTestBeanName);
- portletRequest.setAttribute(Constants.TEST_NAME, mTestName);
- }
+/* 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.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.faces.GenericFacesPortlet;
+
+import org.apache.myfaces.portlet.faces.testsuite.common.Constants;
+
+public class GenericFacesTestSuitePortlet extends GenericFacesPortlet
+{
+
+ private String mTestBeanName;
+ private String mTestName;
+
+ public void init(PortletConfig config)
+ throws PortletException
+ {
+ super.init(config);
+ // parse the portlet name to extract the testName and bean we use to during this test
+ // This information is subsequently attached to each request (as an attribute).
+ // The generic TestRunnerBean uses this information to execute the bean and properly
+ // reference the test in any result.
+
+ // portletName syntax: testGroup-testName-portlet
+ String portletName = config.getPortletName();
+ String [] parts = portletName.split("-");
+ if (parts.length != 3)
+ {
+ throw new IllegalStateException("Incorrect portletName syntax for a test: should be testGroup-testName-portlet");
+ }
+ mTestBeanName = parts[0];
+ mTestName = parts[1];
+ if (!mTestName.endsWith("Test"))
+ {
+ mTestName = mTestName.concat("Test");
+ }
+ }
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
+ throws PortletException, IOException
+ {
+ initTestRequest(actionRequest);
+ // add an additional attribute -- so one of the tests can verify its excluded in render
+ actionRequest.setAttribute("verifyPreBridgeExclusion", "avalue");
+ super.processAction(actionRequest, actionResponse);
+ }
+
+ public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
+ throws PortletException, IOException
+ {
+ initTestRequest(renderRequest);
+ super.doDispatch(renderRequest, renderResponse);
+ }
+
+ private void initTestRequest(PortletRequest portletRequest)
+ {
+ portletRequest.setAttribute(Constants.TEST_BEAN_NAME, mTestBeanName);
+ portletRequest.setAttribute(Constants.TEST_NAME, mTestName);
+ }
}
\ No newline at end of file
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=822919&r1=822918&r2=822919&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 Wed Oct 7 21:18:57 2009
@@ -1,89 +1,89 @@
-/* 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.context;
-
-
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-import javax.faces.context.FacesContextFactory;
-import javax.faces.lifecycle.Lifecycle;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.faces.Bridge;
-
-import javax.servlet.ServletRequest;
-
-/**
- * A factory object that creates (if needed) and returns new FacesContext instance for running in
- * portlet environment (PortletFacesContextImpl)
- *
- * The class is defined in <faces-context-factory> tag in faces-config.xml
- */
-public class TCK_FacesContextFactoryImpl extends FacesContextFactory
-{
- private FacesContextFactory mHandler;
-
- public TCK_FacesContextFactoryImpl(FacesContextFactory handler)
- {
- mHandler = handler;
- }
-
- @Override
- public FacesContext getFacesContext(Object context, Object request, Object response,
- Lifecycle lifecycle) throws FacesException
- {
- FacesContext ctx = mHandler.getFacesContext(context, request, response, lifecycle);
- // Only wrap the FacesContext if running in a portlet request
- // Purpose of this wrapping is to test the various FacesContext requirements
- // including that the bridge doesn't depend on its impl class being the instance
- if (isPortletRequest(request))
- {
- return new TCK_FacesContextImpl(ctx);
- }
- else
- {
- return ctx;
- }
- }
-
-
- private boolean isPortletRequest(Object request)
- {
- // could be either a servlet or portlet request object (or both)
- // Check servlet side first in case we are packaged in an application
- // that is running as a servlet in an environment that doesn't contain
- // a portlet container.
- if (request instanceof ServletRequest)
- {
- ServletRequest sr = (ServletRequest) request;
- Bridge.PortletPhase phase =
- (Bridge.PortletPhase) sr.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE);
- return (phase != null);
- } else if (request instanceof PortletRequest)
- {
- return true;
- }
-
- return false;
- }
-}
+/* 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.context;
+
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextFactory;
+import javax.faces.lifecycle.Lifecycle;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.faces.Bridge;
+
+import javax.servlet.ServletRequest;
+
+/**
+ * A factory object that creates (if needed) and returns new FacesContext instance for running in
+ * portlet environment (PortletFacesContextImpl)
+ *
+ * The class is defined in <faces-context-factory> tag in faces-config.xml
+ */
+public class TCK_FacesContextFactoryImpl extends FacesContextFactory
+{
+ private FacesContextFactory mHandler;
+
+ public TCK_FacesContextFactoryImpl(FacesContextFactory handler)
+ {
+ mHandler = handler;
+ }
+
+ @Override
+ public FacesContext getFacesContext(Object context, Object request, Object response,
+ Lifecycle lifecycle) throws FacesException
+ {
+ FacesContext ctx = mHandler.getFacesContext(context, request, response, lifecycle);
+ // Only wrap the FacesContext if running in a portlet request
+ // Purpose of this wrapping is to test the various FacesContext requirements
+ // including that the bridge doesn't depend on its impl class being the instance
+ if (isPortletRequest(request))
+ {
+ return new TCK_FacesContextImpl(ctx);
+ }
+ else
+ {
+ return ctx;
+ }
+ }
+
+
+ private boolean isPortletRequest(Object request)
+ {
+ // could be either a servlet or portlet request object (or both)
+ // Check servlet side first in case we are packaged in an application
+ // that is running as a servlet in an environment that doesn't contain
+ // a portlet container.
+ if (request instanceof ServletRequest)
+ {
+ ServletRequest sr = (ServletRequest) request;
+ Bridge.PortletPhase phase =
+ (Bridge.PortletPhase) sr.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE);
+ return (phase != null);
+ } else if (request instanceof PortletRequest)
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/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/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/context/TCK_FacesContextImpl.java Wed Oct 7 21:18:57 2009
@@ -1,152 +1,152 @@
-/* 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.context;
-
-import java.util.Iterator;
-
-import javax.el.ELContext;
-
-import javax.faces.application.Application;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseStream;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-
-
-import org.apache.myfaces.portlet.faces.testsuite.common.util.faces.render.TCK_PortletUrlRenderer;
-
-public class TCK_FacesContextImpl extends FacesContext
-{
- private FacesContext mWrapped;
-
- public TCK_FacesContextImpl(FacesContext ctx)
- {
- mWrapped = ctx;
-
- }
-
- // Start of JSF 1.2 API
-
- public ELContext getELContext()
- {
- return mWrapped.getELContext();
- }
-
- 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()
- {
- mWrapped.release();
- }
-
- public void renderResponse()
- {
- mWrapped.renderResponse();
- }
-
- public void responseComplete()
- {
- mWrapped.responseComplete();
- }
-}
+/* 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.context;
+
+import java.util.Iterator;
+
+import javax.el.ELContext;
+
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseStream;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+
+
+import org.apache.myfaces.portlet.faces.testsuite.common.util.faces.render.TCK_PortletUrlRenderer;
+
+public class TCK_FacesContextImpl extends FacesContext
+{
+ private FacesContext mWrapped;
+
+ public TCK_FacesContextImpl(FacesContext ctx)
+ {
+ mWrapped = ctx;
+
+ }
+
+ // Start of JSF 1.2 API
+
+ public ELContext getELContext()
+ {
+ return mWrapped.getELContext();
+ }
+
+ 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()
+ {
+ mWrapped.release();
+ }
+
+ public void renderResponse()
+ {
+ mWrapped.renderResponse();
+ }
+
+ public void responseComplete()
+ {
+ mWrapped.responseComplete();
+ }
+}
Modified: myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/render/TCK_PortletUrlRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/render/TCK_PortletUrlRenderer.java?rev=822919&r1=822918&r2=822919&view=diff
==============================================================================
--- myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/render/TCK_PortletUrlRenderer.java (original)
+++ myfaces/portlet-bridge/testsuite/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/common/util/faces/render/TCK_PortletUrlRenderer.java Wed Oct 7 21:18:57 2009
@@ -1,89 +1,89 @@
-/* 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.render;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.ConverterException;
-import javax.faces.render.Renderer;
-
-public class TCK_PortletUrlRenderer extends Renderer
-{
- private Renderer mWrapped;
-
- public TCK_PortletUrlRenderer(Renderer r)
- {
- mWrapped = r;
- }
-
- public void decode(FacesContext context,
- UIComponent component)
- {
- mWrapped.decode(context, component);
- }
-
- public void encodeBegin(FacesContext context,
- UIComponent component)
- throws IOException
- {
- ResponseWriter writer = context.getResponseWriter();
- writer.write("<tck-portlet><portlet-url>");
- mWrapped.encodeBegin(context, component);
- }
-
- public void encodeChildren(FacesContext context,
- UIComponent component)
- throws IOException
- {
- mWrapped.encodeChildren(context, component);
- }
-
- public void encodeEnd(FacesContext context,
- UIComponent component)
- throws IOException
- {
- mWrapped.encodeEnd(context, component);
- ResponseWriter writer = context.getResponseWriter();
- writer.write("</portlet-url></tck-portlet>");
- }
-
- public String convertClientId(FacesContext context,
- String clientId)
- {
- return mWrapped.convertClientId(context, clientId);
- }
-
- public boolean getRendersChildren()
- {
- return mWrapped.getRendersChildren();
- }
-
- public Object getConvertedValue(FacesContext context,
- UIComponent component,
- Object submittedValue)
- throws ConverterException
- {
- return mWrapped.getConvertedValue(context, component, submittedValue);
- }
-
-}
+/* 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.render;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+
+public class TCK_PortletUrlRenderer extends Renderer
+{
+ private Renderer mWrapped;
+
+ public TCK_PortletUrlRenderer(Renderer r)
+ {
+ mWrapped = r;
+ }
+
+ public void decode(FacesContext context,
+ UIComponent component)
+ {
+ mWrapped.decode(context, component);
+ }
+
+ public void encodeBegin(FacesContext context,
+ UIComponent component)
+ throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.write("<tck-portlet><portlet-url>");
+ mWrapped.encodeBegin(context, component);
+ }
+
+ public void encodeChildren(FacesContext context,
+ UIComponent component)
+ throws IOException
+ {
+ mWrapped.encodeChildren(context, component);
+ }
+
+ public void encodeEnd(FacesContext context,
+ UIComponent component)
+ throws IOException
+ {
+ mWrapped.encodeEnd(context, component);
+ ResponseWriter writer = context.getResponseWriter();
+ writer.write("</portlet-url></tck-portlet>");
+ }
+
+ public String convertClientId(FacesContext context,
+ String clientId)
+ {
+ return mWrapped.convertClientId(context, clientId);
+ }
+
+ public boolean getRendersChildren()
+ {
+ return mWrapped.getRendersChildren();
+ }
+
+ public Object getConvertedValue(FacesContext context,
+ UIComponent component,
+ Object submittedValue)
+ throws ConverterException
+ {
+ return mWrapped.getConvertedValue(context, component, submittedValue);
+ }
+
+}