You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/08/14 00:08:48 UTC
svn commit: r804043 [1/4] - in /myfaces/core/trunk/impl/src:
main/java/org/apache/myfaces/view/facelets/component/
main/java/org/apache/myfaces/view/facelets/tag/jsf/core/
test/java/org/apache/myfaces/view/facelets/
test/java/org/apache/myfaces/view/fa...
Author: lu4242
Date: Thu Aug 13 22:08:44 2009
New Revision: 804043
URL: http://svn.apache.org/viewvc?rev=804043&view=rev
Log:
MYFACES-2327 Move facelets test code to myfaces (and small fix on f:converter and f:validator)
Added:
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/body-page.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/selectOne.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/component.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/controller.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/encoding-child.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/encoding.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/greeting.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/guess.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/home.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/include.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/instructions.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/layout-client.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/layout.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/parser-client.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/parser-template.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/postback-include.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/postback.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/actionListener.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/attribute.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/bundle.properties (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/convertDateTime.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/convertNumber.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/converter.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/facet.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/loadBundle.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/validateDoubleRange.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/validateLength.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/validateLongRange.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/validator.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/valueChangeListener.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/core/view.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/commandButton.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/componentAction.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/componentOwner.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/dataTable.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/nbsp.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/panelGrid.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/selectOne.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/if.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/child-says.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/component-client.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/component.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/composition-template-simple.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/composition-template.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/defineInclude.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/parent.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/repeat.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/s_layout.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/s_page.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/s_popup.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/subdir/
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/subdir/child.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/subdir/template.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template-simple.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/test-tags.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/test0.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/test1.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/test2.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/test3.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/template-client-client.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/template-client.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/template.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/userTag.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/userTagConditional.xhtml
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDelegateHandler.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateDelegateHandler.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java?rev=804043&r1=804042&r2=804043&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java Thu Aug 13 22:08:44 2009
@@ -26,6 +26,11 @@
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
+
+@JSFRenderer(family="facelets",
+ renderKitId="HTML_BASIC",
+ type="facelets.ui.Repeat")
public class RepeatRenderer extends Renderer
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java?rev=804043&r1=804042&r2=804043&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java Thu Aug 13 22:08:44 2009
@@ -50,7 +50,10 @@
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
-@JSFComponent(name="ui:repeat")
+/**
+ * TODO: PartialStateSaving and pluginize this component!
+ */
+@JSFComponent(name="ui:repeat", defaultRendererType="facelets.ui.Repeat")
public class UIRepeat extends UIComponentBase implements NamingContainer
{
public static final String COMPONENT_TYPE = "facelets.ui.Repeat";
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDelegateHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDelegateHandler.java?rev=804043&r1=804042&r2=804043&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDelegateHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ConvertDelegateHandler.java Thu Aug 13 22:08:44 2009
@@ -71,4 +71,10 @@
{
return super.createMetaRuleset(type).ignoreAll();
}
+
+ @Override
+ public String getConverterId(FaceletContext ctx)
+ {
+ return converterId.getValue(ctx);
+ }
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateDelegateHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateDelegateHandler.java?rev=804043&r1=804042&r2=804043&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateDelegateHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateDelegateHandler.java Thu Aug 13 22:08:44 2009
@@ -67,4 +67,10 @@
return super.createMetaRuleset(type).ignoreAll();
}
+ @Override
+ public String getValidatorId(FaceletContext ctx)
+ {
+ return validatorId.getValue(ctx);
+ }
+
}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java Thu Aug 13 22:08:44 2009
@@ -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.view.facelets;
+
+import javax.faces.component.UIViewRoot;
+
+public class BrokenTestCase extends FaceletTestCase {
+
+ public void testBroken() throws Exception {
+
+ }
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/BrokenTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,83 @@
+/*
+ * 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.view.facelets;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class EncodingTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testPattern() throws Exception
+ {
+ Pattern p = Pattern
+ .compile("^<\\?xml.+?version=['\"](.+?)['\"](.+?encoding=['\"]((.+?))['\"])?.*?\\?>");
+ String[] d = new String[] { "<?xml version=\"1.0\" ?>",
+ "<?xml version='1.0' ?>",
+ "<?xml version='1.0' encoding='iso-8859-1'?>" };
+ for (int i = 0; i < d.length; i++)
+ {
+ Matcher m = p.matcher(d[i]);
+ //System.out.println(d[i] + " " + m.matches());
+ if (m.matches())
+ {
+ for (int j = 0; j < m.groupCount(); j++)
+ {
+ //System.out.println('\t' + m.group(j));
+ }
+ }
+ }
+ }
+
+ public void testEncoding() throws Exception
+ {
+ this.servletRequest.setAttribute("name", "Mr. Hookom");
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "encoding.xml");
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/EncodingTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,335 @@
+/*
+ * 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.view.facelets;
+
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.net.URL;
+
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.context.ResponseWriter;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.ResponseStateManager;
+
+import junit.framework.TestCase;
+
+import org.apache.myfaces.application.ApplicationFactoryImpl;
+import org.apache.myfaces.application.ApplicationImpl;
+import org.apache.myfaces.config.FacesConfigDispenser;
+import org.apache.myfaces.config.FacesConfigUnmarshaller;
+import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.config.element.Renderer;
+import org.apache.myfaces.config.impl.digester.DigesterFacesConfigDispenserImpl;
+import org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl;
+import org.apache.myfaces.config.impl.digester.elements.FacesConfig;
+import org.apache.myfaces.context.PartialViewContextFactoryImpl;
+import org.apache.myfaces.renderkit.html.HtmlResponseStateManager;
+import org.apache.myfaces.shared_impl.util.ClassUtils;
+import org.apache.myfaces.shared_impl.util.StateUtils;
+import org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.view.facelets.compiler.Compiler;
+import org.apache.myfaces.view.facelets.compiler.SAXCompiler;
+import org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory;
+import org.apache.myfaces.view.facelets.impl.ResourceResolver;
+import org.apache.myfaces.view.facelets.mock.MockHttpServletRequest;
+import org.apache.myfaces.view.facelets.mock.MockHttpServletResponse;
+import org.apache.myfaces.view.facelets.mock.MockServletContext;
+import org.apache.myfaces.view.facelets.mock.MockViewDeclarationLanguageFactory;
+import org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
+import org.apache.shale.test.el.MockExpressionFactory;
+import org.apache.shale.test.mock.MockExternalContext;
+import org.apache.shale.test.mock.MockFacesContext;
+import org.apache.shale.test.mock.MockFacesContextFactory;
+import org.apache.shale.test.mock.MockPropertyResolver;
+import org.apache.shale.test.mock.MockRenderKit;
+import org.apache.shale.test.mock.MockVariableResolver;
+import org.apache.shale.test.mock.lifecycle.MockLifecycle;
+import org.apache.shale.test.mock.lifecycle.MockLifecycleFactory;
+
+public abstract class FaceletTestCase extends TestCase implements
+ ResourceResolver
+{
+ private final String filePath = this.getDirectory();
+ protected MockServletContext servletContext;
+ protected MockHttpServletRequest servletRequest;
+ protected MockHttpServletResponse servletResponse;
+ protected MockExternalContext externalContext;
+ protected MockFacesContext facesContext;
+ protected MockFacesContextFactory facesContextFactory;
+ protected MockLifecycle lifecycle;
+ protected MockLifecycleFactory lifecycleFactory;
+ protected ApplicationImpl application;
+ protected MockRenderKit renderKit;
+ protected MockFaceletViewDeclarationLanguage vdl;
+
+ protected FacesConfigDispenser<FacesConfig> dispenser = null;
+
+ protected URI getContext()
+ {
+ try
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource(this.filePath);
+ if (url == null)
+ {
+ throw new FileNotFoundException(cl.getResource("").getFile()
+ + this.filePath + " was not found");
+ }
+ else
+ {
+ return new URI(url.toString());
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error Initializing Context", e);
+ }
+ }
+
+ protected URL getLocalFile(String name) throws FileNotFoundException
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource(this.filePath + "/" + name);
+ if (url == null)
+ {
+ throw new FileNotFoundException(cl.getResource("").getFile() + name
+ + " was not found");
+ }
+ return url;
+ }
+
+ private String getDirectory()
+ {
+ return this.getClass().getName().substring(0,
+ this.getClass().getName().lastIndexOf('.')).replace('.', '/')
+ + "/";
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ URI context = this.getContext();
+
+ this.servletContext = new MockServletContext(context);
+ this.servletRequest = new MockHttpServletRequest(this.servletContext,
+ context);
+ this.servletResponse = new MockHttpServletResponse();
+
+ externalContext = new MockExternalContext(servletContext,
+ servletRequest, servletResponse);
+
+ // Set up JSF API Objects
+ FactoryFinder.releaseFactories();
+
+ setupRuntimeConfigAndFactories();
+
+ lifecycleFactory = (MockLifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ lifecycle = (MockLifecycle) lifecycleFactory
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ facesContextFactory = (MockFacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ facesContext = (MockFacesContext) facesContextFactory.getFacesContext(
+ servletContext, servletRequest, servletResponse, lifecycle);
+ externalContext = (MockExternalContext) facesContext
+ .getExternalContext();
+ ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder
+ .getFactory(FactoryFinder.APPLICATION_FACTORY);
+ application = (ApplicationImpl) applicationFactory.getApplication();
+ facesContext.setApplication(application);
+ StateUtils.initSecret(servletContext);
+ externalContext.getApplicationMap().put(StateUtils.SERIAL_FACTORY,
+ new DefaultSerialFactory());
+
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ renderKit = new MockRenderKit()
+ {
+ ResponseStateManager rsm = new HtmlResponseStateManager();
+
+ @Override
+ public ResponseStateManager getResponseStateManager()
+ {
+ return rsm;
+ }
+ };
+ renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT,
+ renderKit);
+
+ setupComponents();
+ setupConvertersAndValidators();
+ setupRenderers();
+
+ //Compiler c = new SAXCompiler();
+ //c.setTrimmingWhitespace(true);
+ //FaceletFactory factory = new DefaultFaceletFactory(c, this);
+ //FaceletFactory.setInstance(factory);
+
+ facesContext.setViewRoot(facesContext.getApplication().getViewHandler()
+ .createView(facesContext, "/test"));
+
+ vdl = (MockFaceletViewDeclarationLanguage) application.getViewHandler().
+ getViewDeclarationLanguage(facesContext,"/test");
+
+ ResponseWriter rw = facesContext.getRenderKit().createResponseWriter(
+ new StringWriter(), null, null);
+ facesContext.setResponseWriter(rw);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ this.servletContext = null;
+ servletRequest = null;
+ servletResponse = null;
+ externalContext = null;
+ facesContext = null;
+ facesContextFactory = null;
+ lifecycle = null;
+ lifecycleFactory = null;
+ application = null;
+ renderKit = null;
+ vdl = null;
+ }
+
+ protected void setupRuntimeConfigAndFactories()
+ {
+ RuntimeConfig.getCurrentInstance(externalContext).setPropertyResolver(
+ new MockPropertyResolver());
+ RuntimeConfig.getCurrentInstance(externalContext).setVariableResolver(
+ new MockVariableResolver());
+ RuntimeConfig.getCurrentInstance(externalContext).setExpressionFactory(
+ new MockExpressionFactory());
+ //To make work ValueExpressions
+
+ FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
+ ApplicationFactoryImpl.class.getName());
+ FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
+ "org.apache.shale.test.mock.MockFacesContextFactory");
+ FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
+ "org.apache.shale.test.mock.lifecycle.MockLifecycleFactory");
+ FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
+ "org.apache.shale.test.mock.MockRenderKitFactory");
+ FactoryFinder.setFactory(
+ FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY,
+ MockViewDeclarationLanguageFactory.class.getName());
+ FactoryFinder.setFactory(FactoryFinder.TAG_HANDLER_DELEGATE_FACTORY,
+ TagHandlerDelegateFactoryImpl.class.getName());
+ FactoryFinder.setFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY,
+ PartialViewContextFactoryImpl.class.getName());
+ }
+
+ protected void loadStandardFacesConfig() throws Exception
+ {
+ if (dispenser == null)
+ {
+ InputStream stream = ClassUtils
+ .getResourceAsStream("META-INF/standard-faces-config.xml");
+ FacesConfigUnmarshaller<? extends FacesConfig> unmarshaller = new DigesterFacesConfigUnmarshallerImpl(
+ externalContext);
+ dispenser = new DigesterFacesConfigDispenserImpl();
+ dispenser.feed(unmarshaller.getFacesConfig(stream,
+ "META-INF/standard-faces-config.xml"));
+ }
+ }
+
+ /**
+ * Override this methods and add just what it is necessary
+ * reduce execution time.
+ */
+ protected void setupComponents() throws Exception
+ {
+ loadStandardFacesConfig();
+ for (String componentType : dispenser.getComponentTypes())
+ {
+ application.addComponent(componentType, dispenser
+ .getComponentClass(componentType));
+ }
+ }
+
+ /**
+ * Override this methods and add just what it is necessary
+ * reduce execution time.
+ */
+ protected void setupRenderers() throws Exception
+ {
+ loadStandardFacesConfig();
+ for (Renderer element : dispenser
+ .getRenderers(RenderKitFactory.HTML_BASIC_RENDER_KIT))
+ {
+ javax.faces.render.Renderer renderer;
+ try
+ {
+ renderer = (javax.faces.render.Renderer) ClassUtils
+ .newInstance(element.getRendererClass());
+ }
+ catch (Throwable e)
+ {
+ // ignore the failure so that the render kit is configured
+ continue;
+ }
+
+ renderKit.addRenderer(element.getComponentFamily(), element
+ .getRendererType(), renderer);
+ }
+ }
+
+ /**
+ * Override this methods and add just what it is necessary
+ * reduce execution time.
+ */
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ loadStandardFacesConfig();
+ for (String validatorId : dispenser.getValidatorIds())
+ {
+ application.addValidator(validatorId, dispenser
+ .getValidatorClass(validatorId));
+ }
+ for (String converterId : dispenser.getConverterIds())
+ {
+ application.addConverter(converterId, dispenser
+ .getConverterClassById(converterId));
+ }
+ for (String validatorId : dispenser.getValidatorIds())
+ {
+ application.addValidator(validatorId, dispenser
+ .getValidatorClass(validatorId));
+ }
+ }
+
+ public URL resolveUrl(String path)
+ {
+ try
+ {
+ return new URL(this.getContext().toURL(), path.substring(1));
+ }
+ catch (Exception e)
+ {
+ throw new FacesException(e);
+ }
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class InstructionsTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testInstructions() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "instructions.xhtml");
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/InstructionsTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,157 @@
+/*
+ * 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.view.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.apache.myfaces.view.facelets.compiler.Compiler;
+
+/**
+ * Expose protected api of FaceletViewDeclarationLanguage to
+ * junit tests.
+ *
+ * @author Leonardo
+ *
+ */
+public class MockFaceletViewDeclarationLanguage extends
+ FaceletViewDeclarationLanguage
+{
+
+ public MockFaceletViewDeclarationLanguage(FacesContext context)
+ {
+ super(context);
+ }
+
+ private String _renderedViewId;
+
+ public void buildView(FacesContext context, UIViewRoot view, String xmlFile) throws IOException
+ {
+ _renderedViewId = xmlFile;
+ buildView(context, view);
+ }
+ @Override
+ public String getRenderedViewId(FacesContext context, String actionId)
+ {
+ return _renderedViewId;//super.getRenderedViewId(context, actionId);
+ }
+
+ @Override
+ public String calculateViewId(FacesContext context, String viewId)
+ {
+ return super.calculateViewId(context, viewId);
+ }
+
+ @Override
+ public Compiler createCompiler(FacesContext context)
+ {
+ return super.createCompiler(context);
+ }
+
+ @Override
+ public FaceletFactory createFaceletFactory(FacesContext context,
+ Compiler compiler)
+ {
+ return super.createFaceletFactory(context, compiler);
+ }
+
+ @Override
+ public ResponseWriter createResponseWriter(FacesContext context)
+ throws IOException, FacesException
+ {
+ return super.createResponseWriter(context);
+ }
+
+ @Override
+ public String getDefaultSuffix(FacesContext context)
+ throws FacesException
+ {
+ return super.getDefaultSuffix(context);
+ }
+
+ @Override
+ public String getResponseContentType(FacesContext context, String orig)
+ {
+ return super.getResponseContentType(context, orig);
+ }
+
+ @Override
+ public String getResponseEncoding(FacesContext context, String orig)
+ {
+ return super.getResponseEncoding(context, orig);
+ }
+
+ @Override
+ public void handleFaceletNotFound(FacesContext context, String viewId)
+ throws FacesException, IOException
+ {
+ super.handleFaceletNotFound(context, viewId);
+ }
+
+ @Override
+ public void handleRenderException(FacesContext context, Exception e)
+ throws IOException, ELException, FacesException
+ {
+ super.handleRenderException(context, e);
+ }
+
+ @Override
+ public void initialize(FacesContext context)
+ {
+ super.initialize(context);
+ }
+
+ @Override
+ public void loadDecorators(FacesContext context, Compiler compiler)
+ {
+ super.loadDecorators(context, compiler);
+ }
+
+ @Override
+ public void loadLibraries(FacesContext context, Compiler compiler)
+ {
+ super.loadLibraries(context, compiler);
+ }
+
+ @Override
+ public void loadOptions(FacesContext context, Compiler compiler)
+ {
+ super.loadOptions(context, compiler);
+ }
+
+ @Override
+ public void sendSourceNotFound(FacesContext context, String message)
+ {
+ super.sendSourceNotFound(context, message);
+ }
+
+ //public Facelet getFacelet(String viewId) throws IOException
+ //{
+ // return super._getFacelet(viewId);
+ //}
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/MockFaceletViewDeclarationLanguage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,76 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class TagTestCase extends FaceletTestCase {
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "javax.faces.Text", new HtmlTextRenderer());
+ }
+
+ public void testTagBody() throws Exception {
+ this.servletRequest.setAttribute("name", "Mr. Hookom");
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root,"userTag.xhtml");
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+ public void testConditionalInsert() throws Exception {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root,"userTagConditional.xhtml");
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TagTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +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.view.facelets;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class TemplateClientTestCase extends FaceletTestCase {
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testClientClient() throws Exception {
+ this.servletRequest.setAttribute("name", "Mr. Hookom");
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root,"template-client-client.xhtml");
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+ /*
+ public void testLayoutClient() throws Exception {
+ FaceletFactory ff = FaceletFactory.getInstance();
+ FacesContext faces = FacesContext.getCurrentInstance();
+
+ Facelet f = ff.getFacelet("layout-client.xhtml");
+
+ this.servletRequest.setAttribute("name", "Mr. Hookom");
+
+ UIViewRoot root = faces.getViewRoot();
+ f.apply(faces, root);
+
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ faces.setResponseWriter(mrw);
+ root.encodeAll(faces);
+ System.out.println(fw);
+ }
+ */
+
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/TemplateClientTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.view.facelets.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class Company {
+
+ private List departments;
+ private String name;
+ private Employee president;
+
+ public Company() {
+ super();
+ this.departments = new ArrayList();
+ }
+
+ public List getDepartments() {
+ return departments;
+ }
+
+ public void setDepartments(List departments) {
+ this.departments = departments;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Employee getPresident() {
+ return president;
+ }
+
+ public void setPresident(Employee president) {
+ this.president = president;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Company.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.view.facelets.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class Department {
+
+ private String name;
+ private List employees;
+ private Employee director;
+
+ public Department() {
+ super();
+ this.employees = new ArrayList();
+ }
+
+ public Employee getDirector() {
+ return director;
+ }
+
+ public void setDirector(Employee director) {
+ this.director = director;
+ }
+
+ public List getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(List employees) {
+ this.employees = employees;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Department.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java Thu Aug 13 22:08:44 2009
@@ -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.view.facelets.bean;
+
+public final class Employee {
+
+ private String firstName;
+ private String lastName;
+ private long id;
+ private boolean management;
+
+ public Employee() {
+ super();
+ }
+
+ public Employee(long id, String lastName, String firstName, boolean management) {
+ this.id = id;
+ this.lastName = lastName;
+ this.firstName = firstName;
+ this.management = management;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public boolean isManagement() {
+ return management;
+ }
+
+ public void setManagement(boolean management) {
+ this.management = management;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Employee.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,62 @@
+/*
+ * 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.view.facelets.bean;
+
+public class Example {
+
+ private static String[] Departments = new String[] { "HR", "RD" };
+
+ public Example() {
+ super();
+ }
+
+ public static Company createCompany() {
+ Company c = new Company();
+ c.setName("Enverio");
+ c.setPresident(new Employee(1, "Hookom", "Jacob", true));
+ c.getDepartments().add(createHR());
+ c.getDepartments().add(createRD());
+ return c;
+ }
+
+ public static Department createDepartment() {
+ return createRD();
+ }
+
+ public static Department createHR() {
+ Department d = new Department();
+ d.setDirector(new Employee(2, "Ashenbrener", "Aubrey", true));
+ d.setName("HR");
+ d.getEmployees().add(new Employee(3, "Ellen", "Sue", false));
+ d.getEmployees().add(new Employee(4, "Scooner", "Mary", false));
+ return d;
+ }
+
+ public static Department createRD() {
+ Department d = new Department();
+ d.setDirector(new Employee(5, "Winer", "Adam", true));
+ d.setName("RD");
+ d.getEmployees().add(new Employee(6, "Burns", "Ed", false));
+ d.getEmployees().add(new Employee(7, "Lubke", "Ryan", false));
+ d.getEmployees().add(new Employee(8, "Kitain", "Roger", false));
+ return d;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/bean/Example.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,87 @@
+/*
+ * 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.view.facelets.compiler;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class ELParserTestCase extends FaceletTestCase {
+
+ private UIComponent target;
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "javax.faces.Text", new HtmlTextRenderer());
+ }
+
+ public void testSelectOneMenu() throws Exception {
+ this.servletRequest.setAttribute("test", this);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "elparser.xml");
+
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.target = null;
+ }
+
+ public UIComponent getTarget() {
+ return target;
+ }
+
+ public void setTarget(UIComponent target) {
+ this.target = target;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/ELParserTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,133 @@
+/*
+ * 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.view.facelets.compiler;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIPanel;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectOne;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
+import org.apache.myfaces.renderkit.html.HtmlGridRenderer;
+import org.apache.myfaces.renderkit.html.HtmlMenuRenderer;
+import org.apache.myfaces.renderkit.html.HtmlRadioRenderer;
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class WhitespaceTestCase extends FaceletTestCase {
+
+ private UIComponent target;
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlForm.COMPONENT_TYPE,
+ HtmlForm.class.getName());
+ application.addComponent(HtmlPanelGrid.COMPONENT_TYPE,
+ HtmlPanelGrid.class.getName());
+ application.addComponent(HtmlSelectOneMenu.COMPONENT_TYPE,
+ HtmlSelectOneMenu.class.getName());
+ application.addComponent(UISelectItem.COMPONENT_TYPE,
+ UISelectItem.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIForm.COMPONENT_FAMILY,
+ "javax.faces.Form", new HtmlFormRenderer());
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "javax.faces.Text", new HtmlTextRenderer());
+ renderKit.addRenderer(UISelectOne.COMPONENT_FAMILY,
+ "javax.faces.Menu", new HtmlMenuRenderer());
+ renderKit.addRenderer(UIPanel.COMPONENT_FAMILY,
+ "javax.faces.Grid", new HtmlGridRenderer());
+
+ }
+
+ public void testSelectOneMenu() throws Exception {
+ this.servletRequest.setAttribute("test", this);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "selectOne.xml");
+
+ assertNotNull("target binding", target);
+ assertEquals("children", 2, this.target.getChildCount());
+
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+ public void testPanelGrid() throws Exception {
+ this.servletRequest.setAttribute("test", this);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "panelGrid.xml");
+
+ assertNotNull("target binding", target);
+ assertEquals("children", 3, this.target.getChildCount());
+
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.target = null;
+ }
+
+ public UIComponent getTarget() {
+ return target;
+ }
+
+ public void setTarget(UIComponent target) {
+ this.target = target;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/WhitespaceTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,309 @@
+/*
+ * 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.view.facelets.mock;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpSession;
+
+import org.apache.shale.test.mock.MockHttpSession;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id$
+ */
+public class MockHttpServletRequest extends org.apache.shale.test.mock.MockHttpServletRequest {
+
+ private final ServletContext servletContext;
+
+ private final URI uri;
+
+ private final String method;
+
+ private Cookie[] cookies = new Cookie[0];
+
+ private String servletPath;
+
+ private HttpSession session;
+
+ private final Properties param = new Properties();
+
+ private String characterEncoding = "ISO-8859-1";
+
+ private String contentType = "text/html";
+
+ private int contentLength = 0;
+
+ private String protocol = "HTTP/1.1";
+
+ private String localName = "localhost";
+
+ private int localPort = 80;
+
+ private String remoteAddr = "127.0.0.1";
+
+ private String remoteHost = "localhost";
+
+ private Locale locale = Locale.getDefault();
+
+ private Vector locales = new Vector(Arrays.asList(Locale
+ .getAvailableLocales()));
+
+ private boolean secure = false;
+
+ private int remotePort = 1024;
+
+ private String localAddr = "127.0.0.1";
+
+ private ServletInputStream inputStream = new MockServletInputStream();
+
+ public MockHttpServletRequest(ServletContext servletContext, URI uri) {
+ this(servletContext, "GET", uri);
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String uri) {
+ this(servletContext, "GET", uri);
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String method,
+ String uri) {
+ this(servletContext, method, URI.create(uri));
+ }
+
+ public MockHttpServletRequest(ServletContext servletContext, String method,
+ URI uri) {
+ this.servletContext = servletContext;
+ this.uri = uri;
+ this.method = method;
+
+ String q = this.uri.getRawQuery();
+ if (q != null) {
+ String[] p = q.split("(&|=)");
+ for (int i = 0; i < p.length; i += 2) {
+ this.param.put(p[i], p[i + 1]);
+ }
+ }
+ }
+
+ @Override
+ public String getAuthType() {
+ return BASIC_AUTH;
+ }
+
+ @Override
+ public Cookie[] getCookies() {
+ return this.cookies;
+ }
+
+ @Override
+ public String getMethod() {
+ return this.method;
+ }
+
+ @Override
+ public String getPathInfo() {
+ return this.uri.getPath();
+ }
+
+ @Override
+ public String getPathTranslated() {
+ return this.servletContext.getRealPath(this.uri.getPath());
+ }
+
+ @Override
+ public String getContextPath() {
+ return this.uri.getPath();
+ }
+
+ @Override
+ public String getQueryString() {
+ return this.uri.getQuery();
+ }
+
+ @Override
+ public String getRequestedSessionId() {
+ return this.getParameter("jsessionid");
+ }
+
+ @Override
+ public String getRequestURI() {
+ return this.uri.getPath();
+ }
+
+ @Override
+ public StringBuffer getRequestURL() {
+ return new StringBuffer(this.uri.toString());
+ }
+
+ @Override
+ public String getServletPath() {
+ return this.servletPath;
+ }
+
+ @Override
+ public HttpSession getSession(boolean create) {
+ if (this.session == null && create) {
+ this.session = new MockHttpSession(this.servletContext);
+ }
+ return this.session;
+ }
+
+ @Override
+ public HttpSession getSession() {
+ return this.getSession(true);
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return this.characterEncoding;
+ }
+
+ @Override
+ public void setCharacterEncoding(String characterEncoding){
+ this.characterEncoding = characterEncoding;
+ }
+
+ @Override
+ public int getContentLength() {
+ return this.contentLength;
+ }
+
+ @Override
+ public String getContentType() {
+ return this.contentType;
+ }
+
+ @Override
+ public ServletInputStream getInputStream(){
+ return this.inputStream;
+ }
+
+ public void setParameter(String name, String value) {
+ this.getParameterMap().put(name, value);
+ }
+
+ @Override
+ public String getProtocol() {
+ return this.protocol;
+ }
+
+ @Override
+ public String getScheme() {
+ return this.uri.getScheme();
+ }
+
+ @Override
+ public String getServerName() {
+ return this.localName;
+ }
+
+ @Override
+ public int getServerPort() {
+ return this.localPort;
+ }
+
+ @Override
+ public BufferedReader getReader(){
+ if (this.inputStream != null) {
+ try{
+ Reader sourceReader = (this.characterEncoding != null) ? new InputStreamReader(
+ this.inputStream, this.characterEncoding)
+ : new InputStreamReader(this.inputStream);
+ return new BufferedReader(sourceReader);
+ }
+ catch(UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ return this.remoteAddr;
+ }
+
+ @Override
+ public String getRemoteHost() {
+ return this.remoteHost;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return this.locale;
+ }
+
+ @Override
+ public Enumeration getLocales() {
+ return this.locales.elements();
+ }
+
+ @Override
+ public boolean isSecure() {
+ return this.secure;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return this.servletContext.getRequestDispatcher(path);
+ }
+
+ @Override
+ public String getRealPath(String path) {
+ return this.servletContext.getRealPath(path);
+ }
+
+ @Override
+ public int getRemotePort() {
+ return this.remotePort;
+ }
+
+ @Override
+ public String getLocalName() {
+ return this.localName;
+ }
+
+ @Override
+ public String getLocalAddr() {
+ return this.localAddr;
+ }
+
+ @Override
+ public int getLocalPort() {
+ return this.localPort;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletRequest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,105 @@
+/*
+ * 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.view.facelets.mock;
+
+import java.util.Locale;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id$
+ */
+public class MockHttpServletResponse extends org.apache.shale.test.mock.MockHttpServletResponse{
+
+ private boolean committed = false;
+ private int status;
+ private String message;
+ private long contentLength = 0;
+ private int bufferSize = 0;
+ private Locale locale = Locale.getDefault();
+
+ public MockHttpServletResponse() {
+ super();
+ setCharacterEncoding("ISO-8859-1");
+ setContentType("text/html");
+ }
+
+ public void sendError(int status, String message){
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.status = status;
+ this.message = message;
+ this.committed = true;
+ }
+
+ public void sendError(int status){
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.status = status;
+ this.committed = true;
+ }
+
+ public void sendRedirect(String path){
+ if (this.committed) {
+ throw new IllegalStateException("Response is already committed");
+ }
+ this.committed = true;
+ }
+
+ public void setStatus(int sc) {
+ this.status = sc;
+ }
+
+ public void setStatus(int sc, String message) {
+ this.status = sc;
+ this.message = message;
+ }
+
+ public void setContentLength(int contentLength) {
+ this.contentLength = contentLength;
+ }
+
+ public void setBufferSize(int sz) {
+ this.bufferSize = sz;
+ }
+
+ public int getBufferSize() {
+ return this.bufferSize;
+ }
+
+ public void flushBuffer(){
+
+ }
+
+ public void resetBuffer() {
+
+ }
+
+ public boolean isCommitted() {
+ return this.committed;
+ }
+
+ public void reset() {
+
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockHttpServletResponse.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL