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 [2/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...
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,59 @@
+/*
+ * 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.IOException;
+import java.net.URL;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id$
+ */
+public class MockRequestDispatcher implements RequestDispatcher
+{
+
+ protected final URL url;
+
+ public MockRequestDispatcher(URL url)
+ {
+ this.url = url;
+ }
+
+ public void forward(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void include(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockRequestDispatcher.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,176 @@
+/*
+ * 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.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id$
+ */
+public class MockServletContext extends
+ org.apache.shale.test.mock.MockServletContext
+{
+
+ private static Log log = LogFactory.getLog(MockServletContext.class);
+
+ protected final URI base;
+
+ public MockServletContext(URI base)
+ {
+ this.base = base;
+ File f = new File(base);
+ if (!f.exists())
+ {
+ throw new IllegalArgumentException("File: " + base.getPath()
+ + " doesn't exist");
+ }
+ }
+
+ public Set getResourcePaths(String path)
+ {
+ URI uri = this.resolve(path);
+ if (uri != null)
+ {
+ File f = new File(uri);
+ if (f.exists() && f.isDirectory())
+ {
+ File[] c = f.listFiles();
+ Set s = new HashSet();
+ int start = f.getAbsolutePath().length();
+ for (int i = 0; i < c.length; i++)
+ {
+ s.add(c[i].getAbsolutePath().substring(start));
+ }
+ return s;
+ }
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public URL getResource(String path) throws MalformedURLException
+ {
+ URI uri = this.resolve(path);
+ if (uri != null)
+ {
+ File f = new File(uri);
+ if (f.exists())
+ {
+ return uri.toURL();
+ }
+ }
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String path)
+ {
+ URI uri = this.resolve(path);
+ if (uri != null)
+ {
+ try
+ {
+ File f = new File(uri);
+ if (f.exists())
+ {
+ return uri.toURL().openStream();
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ this.log.error(e.getMessage());
+ return null;
+ }
+ catch (IOException e)
+ {
+ this.log.error(e.getMessage());
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ URI uri = this.resolve(path);
+ if (uri != null)
+ {
+ File f = new File(uri);
+ if (f.exists())
+ {
+ try
+ {
+ return new MockRequestDispatcher(uri.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ this.log.error(e.getMessage());
+ return null;
+ }
+ }
+
+ }
+ return null;
+ }
+
+ public String getRealPath(String path)
+ {
+ URI uri = this.resolve(path);
+ if (uri != null)
+ {
+ File f = new File(uri);
+ if (f.exists())
+ {
+ return f.getAbsolutePath();
+ }
+ }
+ return null;
+ }
+
+ private final URI resolve(String path)
+ {
+ if (path == null)
+ {
+ throw new NullPointerException("Path cannot be null");
+ }
+ if (path.charAt(0) == '/')
+ {
+ if (path.length() > 1)
+ {
+ return this.base.resolve(path.substring(1));
+ }
+ return this.base;
+ }
+ return null;
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ *
+ * @author Jacob Hookom
+ * @version $Id$
+ */
+public class MockServletInputStream extends ServletInputStream
+{
+
+ private final InputStream source;
+
+ public MockServletInputStream()
+ {
+ this.source = new ByteArrayInputStream(new byte[0]);
+ }
+
+ public MockServletInputStream(InputStream source)
+ {
+ this.source = source;
+ }
+
+ public int read() throws IOException
+ {
+ return this.source.read();
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+import javax.faces.view.ViewDeclarationLanguageFactory;
+
+import org.apache.myfaces.view.ViewDeclarationLanguageStrategy;
+import org.apache.myfaces.view.facelets.MockFaceletViewDeclarationLanguage;
+
+public class MockViewDeclarationLanguageFactory extends ViewDeclarationLanguageFactory
+{
+
+ private ViewDeclarationLanguageStrategy _strategy;
+
+ public MockViewDeclarationLanguageFactory()
+ {
+ super();
+ _strategy = new MockViewDeclarationLanguageStrategy();
+ }
+
+ @Override
+ public ViewDeclarationLanguage getViewDeclarationLanguage(String viewId)
+ {
+ return _strategy.getViewDeclarationLanguage();
+ }
+
+ public static class MockViewDeclarationLanguageStrategy
+ implements ViewDeclarationLanguageStrategy
+ {
+ private ViewDeclarationLanguage _language;
+
+ @Override
+ public boolean handles(String viewId)
+ {
+ return true;
+ }
+
+ @Override
+ public ViewDeclarationLanguage getViewDeclarationLanguage()
+ {
+ if (_language == null)
+ {
+ _language = new MockFaceletViewDeclarationLanguage(FacesContext.getCurrentInstance());
+ }
+ return _language;
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockViewDeclarationLanguageFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.tag.jsf.core;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+public class ActionListenerImpl implements ActionListener {
+
+ public ActionListenerImpl() {
+ }
+
+ public void processAction(ActionEvent e) throws AbortProcessingException {
+
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ActionListenerImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,343 @@
+/*
+ * 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.tag.jsf.core;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlGraphicImage;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.convert.DateTimeConverter;
+import javax.faces.convert.NumberConverter;
+import javax.faces.event.ActionListener;
+import javax.faces.validator.DoubleRangeValidator;
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.LongRangeValidator;
+import javax.faces.validator.Validator;
+
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+
+public class CoreTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ application.addComponent(HtmlCommandLink.COMPONENT_TYPE,
+ HtmlCommandLink.class.getName());
+ application.addComponent(HtmlGraphicImage.COMPONENT_TYPE,
+ HtmlGraphicImage.class.getName());
+ application.addComponent(HtmlForm.COMPONENT_TYPE, HtmlForm.class
+ .getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ application.addComponent(HtmlInputText.COMPONENT_TYPE,
+ HtmlInputText.class.getName());
+ application.addComponent(HtmlDataTable.COMPONENT_TYPE,
+ HtmlDataTable.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ application.addConverter(DateTimeConverter.CONVERTER_ID,
+ DateTimeConverter.class.getName());
+ application.addConverter(NumberConverter.CONVERTER_ID,
+ NumberConverter.class.getName());
+ application.addValidator(LengthValidator.VALIDATOR_ID,
+ LengthValidator.class.getName());
+ application.addValidator(DoubleRangeValidator.VALIDATOR_ID,
+ DoubleRangeValidator.class.getName());
+ application.addValidator(LongRangeValidator.VALIDATOR_ID,
+ LongRangeValidator.class.getName());
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY, "javax.faces.Text",
+ new HtmlTextRenderer());
+ }
+
+ public void testActionListenerHandler() throws Exception
+ {
+ ActionListener listener = new ActionListenerImpl();
+
+ facesContext.getExternalContext().getRequestMap().put("actionListener",
+ listener);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "actionListener.xml");
+
+ UICommand action1 = (UICommand) root.findComponent("action1");
+ UICommand action2 = (UICommand) root.findComponent("action2");
+
+ assertNotNull("action1", action1);
+ assertNotNull("action2", action2);
+
+ assertEquals("action1 listeners", 1,
+ action1.getActionListeners().length);
+ assertEquals("action2 listeners", 2,
+ action2.getActionListeners().length);
+
+ //assertEquals("action2 binding", listener,
+ // action2.getActionListeners()[0]);
+ }
+
+ public void testAttributeHandler() throws Exception
+ {
+ String title = "Dog in a Funny Hat";
+ facesContext.getExternalContext().getRequestMap().put("title", title);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "attribute.xml");
+
+ HtmlGraphicImage graphic1 = (HtmlGraphicImage) root
+ .findComponent("graphic1");
+ HtmlGraphicImage graphic2 = (HtmlGraphicImage) root
+ .findComponent("graphic2");
+
+ assertNotNull("graphic1", graphic1);
+ assertNotNull("graphic2", graphic2);
+
+ assertEquals("graphic1 title", "literal", graphic1.getTitle());
+ assertEquals("graphic2 title", title, graphic2.getTitle());
+ }
+
+ public void testConvertDateTimeHandler() throws Exception
+ {
+ Date now = new Date(1000 * 360 * 60 * 24 * 7);
+ facesContext.getExternalContext().getRequestMap().put("now", now);
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "convertDateTime.xml");
+
+ UIOutput out1 = (UIOutput) root.findComponent("form:out1");
+ UIOutput out2 = (UIOutput) root.findComponent("form:out2");
+ UIOutput out3 = (UIOutput) root.findComponent("form:out3");
+ UIOutput out4 = (UIOutput) root.findComponent("form:out4");
+ UIOutput out5 = (UIOutput) root.findComponent("form:out5");
+ UIOutput out6 = (UIOutput) root.findComponent("form:out6");
+
+ assertNotNull("out1", out1);
+ assertNotNull("out2", out2);
+ assertNotNull("out3", out3);
+ assertNotNull("out4", out4);
+ assertNotNull("out5", out5);
+ assertNotNull("out6", out6);
+
+ assertNotNull("out1 converter", out1.getConverter());
+ assertNotNull("out2 converter", out2.getConverter());
+ assertNotNull("out3 converter", out3.getConverter());
+ assertNotNull("out4 converter", out4.getConverter());
+ assertNotNull("out5 converter", out5.getConverter());
+ DateTimeConverter converter6 = (DateTimeConverter) out6.getConverter();
+
+ assertEquals("out1 value", "12/24/69", out1.getConverter().getAsString(
+ facesContext, out1, now));
+ assertEquals("out2 value", "12/24/69 6:57:12 AM", out2.getConverter()
+ .getAsString(facesContext, out2, now));
+ assertEquals("out3 value", "Dec 24, 1969", out3.getConverter()
+ .getAsString(facesContext, out3, now));
+ assertEquals("out4 value", "6:57:12 AM", out4.getConverter()
+ .getAsString(facesContext, out4, now));
+ assertEquals("out5 value", "0:57 AM, CST", out5.getConverter()
+ .getAsString(facesContext, out5, now));
+ assertEquals("Timezone should be GMT", TimeZone.getTimeZone("GMT"),
+ converter6.getTimeZone());
+ }
+
+ public void testConvertDelegateHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "converter.xml");
+
+ UIOutput out1 = (UIOutput) root.findComponent("out1");
+
+ assertNotNull("out1", out1);
+
+ assertNotNull("out1 converter", out1.getConverter());
+
+ assertEquals("out1 value", new Double(42.5), out1.getConverter()
+ .getAsObject(facesContext, out1, out1.getLocalValue().toString()));
+ }
+
+ public void testConvertNumberHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "convertNumber.xml");
+
+ UIOutput out1 = (UIOutput) root.findComponent("out1");
+ UIOutput out2 = (UIOutput) root.findComponent("out2");
+ UIOutput out3 = (UIOutput) root.findComponent("out3");
+ UIOutput out4 = (UIOutput) root.findComponent("out4");
+ UIOutput out5 = (UIOutput) root.findComponent("out5");
+
+ assertNotNull("out1", out1);
+ assertNotNull("out2", out2);
+ assertNotNull("out3", out3);
+ assertNotNull("out4", out4);
+ assertNotNull("out5", out5);
+
+ assertNotNull("out1 converter", out1.getConverter());
+ assertNotNull("out2 converter", out2.getConverter());
+ assertNotNull("out3 converter", out3.getConverter());
+ assertNotNull("out4 converter", out4.getConverter());
+ assertNotNull("out5 converter", out5.getConverter());
+
+ assertEquals("out1 value", "12", out1.getConverter().getAsString(facesContext,
+ out1, new Double(12.001)));
+ assertEquals("out2 value", "$12.00", out2.getConverter().getAsString(
+ facesContext, out2, new Double(12.00)));
+ assertEquals("out3 value", "00,032", out3.getConverter().getAsString(
+ facesContext, out3, new Double(32)));
+ assertEquals("out4 value", "0.67", out4.getConverter().getAsString(
+ facesContext, out4, new Double(2.0 / 3.0)));
+ assertEquals("out5 value", "67%", out5.getConverter().getAsString(
+ facesContext, out5, new Double(0.67)));
+ }
+
+ public void testFacetHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "facet.xml");
+
+ UIData data = (UIData) root.findComponent("table");
+
+ assertNotNull("data", data);
+
+ UIComponent footer = data.getFooter();
+
+ assertNotNull("footer", footer);
+ }
+
+ public void testLoadBundleHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "loadBundle.xml");
+
+ Object value = facesContext.getExternalContext().getRequestMap().get("foo");
+
+ assertNotNull("bundle loaded into request", value);
+ assertTrue(value instanceof Map);
+ String result = (String) ((Map) value).get("some.not.found.key");
+ assertTrue(result.contains("???"));
+ }
+
+ public void testValidateDelegateHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "validator.xml");
+
+ UIInput input = (UIInput) root.findComponent("form:input");
+
+ assertNotNull("input", input);
+
+ assertEquals("input validator", 1, input.getValidators().length);
+
+ Validator v = input.getValidators()[0];
+
+ v.validate(facesContext, input, "4333");
+ }
+
+ public void testValidateDoubleRangeHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "validateDoubleRange.xml");
+
+ UIInput input = (UIInput) root.findComponent("form:input");
+
+ assertNotNull("input", input);
+
+ assertEquals("input validator", 1, input.getValidators().length);
+
+ Validator v = input.getValidators()[0];
+
+ v.validate(facesContext, input, new Double(1.8));
+ }
+
+ public void testValidateLengthHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "validateLength.xml");
+
+ UIInput input = (UIInput) root.findComponent("form:input");
+
+ assertNotNull("input", input);
+
+ assertEquals("input validator", 1, input.getValidators().length);
+
+ Validator v = input.getValidators()[0];
+
+ v.validate(facesContext, input, "beans");
+ }
+
+ public void testValidateLongRangeHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "validateLongRange.xml");
+
+ UIInput input = (UIInput) root.findComponent("form:input");
+
+ assertNotNull("input", input);
+
+ assertEquals("input validator", 1, input.getValidators().length);
+
+ Validator v = input.getValidators()[0];
+
+ v.validate(facesContext, input, new Long(2000));
+ }
+
+ public void testValueChangeListenerHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "valueChangeListener.xml");
+
+ UIInput input = (UIInput) root.findComponent("form:input");
+
+ assertNotNull("input", input);
+
+ assertEquals("input listener", 1,
+ input.getValueChangeListeners().length);
+ }
+
+ public void testViewHandler() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "view.xml");
+
+ assertEquals("german locale", Locale.GERMAN, root.getLocale());
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.tag.jsf.core;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+
+public class ValueChangeListenerImpl implements ValueChangeListener {
+
+ public ValueChangeListenerImpl() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public void processValueChange(ValueChangeEvent event)
+ throws AbortProcessingException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValueChangeListenerImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +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.view.facelets.tag.jsf.html;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIData;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlColumn;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.renderkit.html.HtmlTableRenderer;
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.bean.Example;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class DataTableTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ application.addComponent(HtmlDataTable.COMPONENT_TYPE,
+ HtmlDataTable.class.getName());
+ application.addComponent(UIColumn.COMPONENT_TYPE,
+ UIColumn.class.getName());
+ application.addComponent(HtmlColumn.COMPONENT_TYPE,
+ HtmlColumn.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());
+ renderKit.addRenderer(UIData.COMPONENT_FAMILY,
+ "javax.faces.Table", new HtmlTableRenderer());
+ }
+
+ public void testDataTable() throws Exception
+ {
+ facesContext.getExternalContext().getRequestMap().put("company",
+ Example.createCompany());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "dataTable.xml");
+
+ 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/tag/jsf/html/DataTableTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.tag.jsf.html;
+
+import javax.el.MethodExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+
+public class HtmlTestCase extends FaceletTestCase {
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlCommandButton.COMPONENT_TYPE,
+ HtmlCommandButton.class.getName());
+ application.addComponent(HtmlForm.COMPONENT_TYPE,
+ HtmlForm.class.getName());
+ application.addComponent(HtmlPanelGrid.COMPONENT_TYPE,
+ HtmlPanelGrid.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ application.addComponent(UIParameter.COMPONENT_TYPE,
+ UIParameter.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testCommandComponent() throws Exception {
+ this.servletRequest.getSession().setAttribute("test", new TestBean());
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "componentOwner.xml");
+
+ UIComponent c = root.findComponent("cmd");
+ assertNotNull("cmd", c);
+
+ Object v = c.getAttributes().get("id");
+ assertEquals("id", "cmd", v);
+
+ ActionSource2 as2 = (ActionSource2) c;
+ MethodExpression me = as2.getActionExpression();
+ assertNotNull("method", me);
+
+ String result = (String) me.invoke(facesContext.getELContext(), null);
+ //System.out.println(result);
+ }
+
+ public void testCommandButton() throws Exception {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "commandButton.xml");
+
+ UIComponent c = root.findComponent("form:button");
+ assertNotNull("button", c);
+
+ Object v = c.getAttributes().get("id");
+ assertEquals("id", "button", v);
+ }
+
+ public void testPanelGrid() throws Exception {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "panelGrid.xml");
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +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.view.facelets.tag.jsf.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectOne;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlMessages;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.IntegerConverter;
+
+import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
+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;
+
+public class SelectTestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlForm.COMPONENT_TYPE,
+ HtmlForm.class.getName());
+ application.addComponent(HtmlSelectOneMenu.COMPONENT_TYPE,
+ HtmlSelectOneMenu.class.getName());
+ application.addComponent(UISelectItem.COMPONENT_TYPE,
+ UISelectItem.class.getName());
+ application.addComponent(HtmlCommandButton.COMPONENT_TYPE,
+ HtmlCommandButton.class.getName());
+ application.addComponent(HtmlMessages.COMPONENT_TYPE,
+ HtmlMessages.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ application.addConverter(IntegerConverter.CONVERTER_ID,
+ IntegerConverter.class.getName());
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "javax.faces.Text", new HtmlTextRenderer());
+ renderKit.addRenderer(UIForm.COMPONENT_FAMILY,
+ "javax.faces.Form", new HtmlFormRenderer());
+ }
+
+ public void testSelectOne() throws Exception
+ {
+ this.servletRequest.getSession().setAttribute("test", new TestBean());
+ this.servletRequest.setParameter("testForm:alignment", "10");
+
+ UIViewRoot root = new UIViewRoot();
+ vdl.buildView(facesContext, root,"selectOne.xml");
+ UISelectOne one = (UISelectOne) root
+ .findComponent("testForm:alignment");
+ root.processDecodes(facesContext);
+ root.processValidators(facesContext);
+ //System.out.println(facesContext.getMessages().hasNext());
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,44 @@
+/*
+ * 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.tag.jsf.html;
+
+public class TestBean
+{
+ private int _integerVal = 10;
+
+ public int getIntegerVal()
+ {
+ return _integerVal;
+ }
+
+ public void setIntegerVal(int value)
+ {
+ this._integerVal = value;
+ }
+
+ public String testAction()
+ {
+ return "runFasta";
+ }
+
+ public String method()
+ {
+ return "Hello World!";
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,64 @@
+/*
+ * 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.tag.jsf.html;
+
+import java.io.PrintWriter;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class TestNbsp 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 testNbsp() throws Exception
+ {
+ UIViewRoot root = new UIViewRoot();
+ vdl.buildView(facesContext, root,"nbsp.xml");
+
+ PrintWriter pw = new PrintWriter(System.out);
+ MockResponseWriter rw = new MockResponseWriter(pw);
+ facesContext.setResponseWriter(rw);
+
+ root.encodeAll(facesContext);
+
+ pw.close();
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,112 @@
+/*
+ * 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.tag.jstl.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+
+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.bean.Employee;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public final class JstlCoreTestCase extends FaceletTestCase {
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlForm.COMPONENT_TYPE,
+ HtmlForm.class.getName());
+ application.addComponent(HtmlCommandButton.COMPONENT_TYPE,
+ HtmlCommandButton.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testIf() throws Exception {
+ Map session = facesContext.getExternalContext().getSessionMap();
+ Employee e = new Employee();
+ session.put("employee", e);
+
+ UIViewRoot root = facesContext.getViewRoot();
+
+ // make sure the form is there
+ e.setManagement(true);
+ vdl.buildView(facesContext, root,"if.xml");
+ UIComponent c = root.findComponent("form");
+ assertNotNull("form is null", c);
+
+ // now make sure it isn't
+ e.setManagement(false);
+
+ facesContext.setViewRoot(facesContext.getApplication().getViewHandler()
+ .createView(facesContext, "/test"));
+ root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root,"if.xml");
+ c = root.findComponent("form");
+ assertNull("form is not null", c);
+ }
+
+ public void testForEach() throws Exception {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Map session = facesContext.getExternalContext().getSessionMap();
+ Collection c = new ArrayList();
+ for (int i = 0; i < 10; i++) {
+ c.add(new Character((char)('A' + i)));
+ }
+ session.put("list", c);
+ Map m = new HashMap();
+ for (int i = 0; i < 10; i++) {
+ m.put("" + i, "" + i);
+ }
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root,"forEach.xml");
+
+ FastWriter fw = new FastWriter();
+ MockResponseWriter mrw = new MockResponseWriter(fw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+
+ //System.out.println(root);
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.tag.ui;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class DefineIncludeTestCase 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 testDefineInclude() throws Exception {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "defineInclude.xml");
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ sw.flush();
+
+ //System.out.println("************************");
+ //System.out.println(sw.toString());
+ //System.out.println("************************");
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,91 @@
+/*
+ * 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.tag.ui;
+
+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.tag.jsf.ComponentSupport;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class IncludeParamTestCase 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 testCaching() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+
+ this.servletRequest.setAttribute("test", "test2.xml");
+ vdl.buildView(facesContext, root, "test1.xml");
+
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+
+ ComponentSupport.removeTransient(root);
+
+ this.servletRequest.setAttribute("test", "test3.xml");
+
+ facesContext.setViewRoot(facesContext.getApplication().getViewHandler()
+ .createView(facesContext, "/test"));
+ root = facesContext.getViewRoot();
+
+ vdl.buildView(facesContext, root, "test1.xml");
+
+ fw = new FastWriter();
+ 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/tag/ui/IncludeParamTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,81 @@
+/*
+ * 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.tag.ui;
+
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+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.bean.Company;
+import org.apache.myfaces.view.facelets.bean.Example;
+import org.apache.myfaces.view.facelets.component.RepeatRenderer;
+import org.apache.myfaces.view.facelets.component.UIRepeat;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class RepeatTestCase extends FaceletTestCase {
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE,
+ UIViewRoot.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ application.addComponent(UIRepeat.COMPONENT_TYPE,
+ UIRepeat.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "javax.faces.Text", new HtmlTextRenderer());
+ renderKit.addRenderer(UIRepeat.COMPONENT_FAMILY,
+ "facelets.ui.Repeat", new RepeatRenderer());
+ }
+
+ public void testRepeat() throws Exception {
+
+
+ Company c = Example.createCompany();
+ facesContext.getExternalContext().getRequestMap().put("company", c);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "repeat.xml");
+
+ 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/tag/ui/RepeatTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.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.tag.ui;
+
+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.FaceletTestCase;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+
+public class TemplateTestCase 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 testOutput() throws Exception {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "s_page.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/tag/ui/TemplateTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,69 @@
+/*
+ * 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.tag.ui;
+
+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.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class TestUserTags 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 testClientClient() throws Exception {
+ this.servletRequest.setAttribute("test", "foo");
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "test-tags.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/tag/ui/TestUserTags.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java Thu Aug 13 22:08:44 2009
@@ -0,0 +1,110 @@
+/*
+ * 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.tag.ui;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+public class UITestCase extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ application.addComponent(ComponentRef.COMPONENT_TYPE,
+ ComponentRef.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ }
+
+ public void testRelativePaths() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "parent.xml");
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ sw.flush();
+ //System.out.println("************************");
+ //System.out.println(sw.toString());
+ //System.out.println("************************");
+ }
+
+ public void testCompositionTemplate() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "composition-template.xml");
+ }
+
+ public void testCompositionTemplateSimple() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "composition-template-simple.xml");
+ }
+
+ public void testComponent() throws Exception
+ {
+ Map map = new HashMap();
+ facesContext.getExternalContext().getRequestMap().put("map", map);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "component.xml");
+
+ assertEquals("only one child, the component", 1, root.getChildCount());
+ assertNotNull("bound to map", map.get("c"));
+ }
+
+ /*
+ public void testComponentClient() throws Exception {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ Map map = new HashMap();
+ faces.getExternalContext().getRequestMap().put("map", map);
+
+ FaceletFactory f = FaceletFactory.getInstance();
+ Facelet at = f.getFacelet("component-client.xml");
+
+ UIViewRoot root = faces.getViewRoot();
+ at.apply(faces, root);
+
+ assertEquals("4 children, the component", 4, root.getChildCount());
+ assertNotNull("bound to map", map.get("c"));
+ }*/
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/body-page.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/body-page.xhtml?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/body-page.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/body-page.xhtml Thu Aug 13 22:08:44 2009
@@ -0,0 +1,30 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: body-page.xhtml,v 1.3 2008/07/13 19:01:37 rlubke Exp $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:e="http://www.enverio.com/jsf/samples">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>TEST</title>
+</head>
+
+<body>
+<e:body id="me" class="text" title="foo">
+SOME BODY
+</e:body>
+</body>
+</html>
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml Thu Aug 13 22:08:44 2009
@@ -0,0 +1,32 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jstl/core">
+<body>
+
+<ui:composition>
+<h:outputText value="#{'\''}"/>
+<span>#{'\''}</span>
+<span>\#{'some text'}</span>
+<span>\${'some text'}</span>
+</ui:composition>
+
+
+</body>
+</html>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/elparser.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml Thu Aug 13 22:08:44 2009
@@ -0,0 +1,33 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jstl/core">
+<body>
+
+<ui:composition>
+<h:panelGrid columns="2" binding="#{test.target}">
+ <!-- foobar -->
+ <h:outputText value="column1"/>
+ <h:outputText value="column2"/>
+</h:panelGrid>
+</ui:composition>
+
+
+</body>
+</html>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/panelGrid.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/selectOne.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/selectOne.xml?rev=804043&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/selectOne.xml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/compiler/selectOne.xml Thu Aug 13 22:08:44 2009
@@ -0,0 +1,41 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml22-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+<body>
+
+<ui:composition>
+<!-- form jsfc="h:form" id="testForm"> -->
+ <h:selectOneMenu value="#{blah}" binding="#{test.target}">
+
+ <f:selectItem itemValue="1" itemLabel="1"/>
+
+ <f:selectItem itemValue="1" itemLabel="1"/>
+
+ </h:selectOneMenu>
+
+ I am
+ Sam f
+ <span>YES</span>
+<!--</form> -->
+</ui:composition>
+
+
+</body>
+</html>
\ No newline at end of file