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 2010/07/14 00:57:42 UTC
svn commit: r963899 [1/7] - in /myfaces/tomahawk/trunk/core20: ./
src/test/java/org/apache/myfaces/component/
src/test/java/org/apache/myfaces/component/html/
src/test/java/org/apache/myfaces/component/html/ext/
src/test/java/org/apache/myfaces/convert...
Author: lu4242
Date: Tue Jul 13 22:57:38 2010
New Revision: 963899
URL: http://svn.apache.org/viewvc?rev=963899&view=rev
Log:
TOMAHAWK-1523 Move all tests in core and core12 branch to core20 and create tests for new introduced stuff (move stuff)
Added:
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlCommandButtonTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlDataTableTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlGraphicImageTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputHiddenTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputSecretTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextareaTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessageTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputLabelTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputTextTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGridTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGroupTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxRendererCactus.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/convert/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/calendar/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/calendar/HtmlCalendarRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/datalist/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/datalist/HtmlListRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/HtmlDateRenderCactus.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/HtmlDateRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/MockBean.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/MockHtmlDateRendererTestRenderKit.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/MockHtmlDateRendererTestRenderKitFactory.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/date/UserDataTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/div/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/div/DivRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/fileupload/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/fileupload/HtmlFileUploadRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/htmltag/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/htmltag/HtmlTagRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/inputTextHelp/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/inputTextHelp/HtmlTextHelpRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/layout/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/layout/HtmlLayoutRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/navigation/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/navigation/HtmlNavigationRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/newspaper/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/newspaper/HtmlNewspaperTableRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/picklist/HtmlPicklistRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/savestate/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/savestate/SaveStateTestBean.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/savestate/UISaveStateTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneCountry/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneCountry/SelectOneCountryRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneLanguage/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneLanguage/SelectOneLanguageRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneRow/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectOneRow/SelectOneRowRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectitems/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectitems/Movie.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItems2Test.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/selectitems/UISelectItemsTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/stylesheet/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/stylesheet/StylesheetRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/swapimage/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/swapimage/HtmlSwapImageRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tabbedpane/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/toggle/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/toggle/ToggleGroupRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/toggle/ToggleLinkRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/toggle/TogglePanelRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/transform/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/transform/ManagedFoo.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/transform/XmlTransformTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/renderkit/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/renderkit/html/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeCheckboxRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeImageCommandLinkRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree/renderkit/html/HtmlTreeRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/HtmlTreeRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/HtmlTreeTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/TreeWalkerBaseTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/tree2/UITreeDataTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/validators/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/validators/AbstractValidatorTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/validators/EmailValidatorTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/validators/EqualValidatorTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/validators/RegExprValidatorTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/dateformat/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/dateformat/TestSimpleDateFormatter.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlButtonRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlLinkRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlListboxRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlMenuRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlMessageRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlMessagesRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlRadioRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlSecretRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlTextRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlTextareaRendererTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/MockBean.java
- copied, changed from r957093, myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestBean.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/MockIntegerConverter.java
- copied, changed from r957093, myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestIntegerConverter.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/util/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/util/AddResourceTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/util/ReducedHTMLParserTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/AbstractClassElementTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/AbstractTagLibTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/AbstractTomahawkViewControllerTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/MyFacesTagLibTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/TomahawkClassElementTestCase.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/utils/
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/utils/HtmlCheckAttributesUtil.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/utils/HtmlRenderedAttr.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/utils/MockTestViewHandler.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
myfaces/tomahawk/trunk/core20/src/test/resources/META-INF/
myfaces/tomahawk/trunk/core20/src/test/resources/META-INF/dtd/
myfaces/tomahawk/trunk/core20/src/test/resources/META-INF/dtd/web-jsptaglibrary_1_2.dtd
myfaces/tomahawk/trunk/core20/src/test/resources/pets.xml
myfaces/tomahawk/trunk/core20/src/test/resources/pets.xsl
Removed:
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestBean.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestIntegerConverter.java
Modified:
myfaces/tomahawk/trunk/core20/pom.xml
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/picklist/HtmlPicklistRendererValueTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRendererValueTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlListboxRendererValueTest.java
myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlMenuRendererValueTest.java
Modified: myfaces/tomahawk/trunk/core20/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/pom.xml?rev=963899&r1=963898&r2=963899&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/pom.xml (original)
+++ myfaces/tomahawk/trunk/core20/pom.xml Tue Jul 13 22:57:38 2010
@@ -188,6 +188,13 @@
<!-- test dependencies -->
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${myfaces-core20-version}</version>
@@ -235,29 +242,12 @@
</dependency>
<dependency>
- <groupId>org.apache.shale</groupId>
- <artifactId>shale-test</artifactId>
- <version>1.0.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.myfaces</groupId>
- <artifactId>myfaces-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.myfaces</groupId>
- <artifactId>myfaces-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>myfaces</groupId>
- <artifactId>myfaces-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>myfaces</groupId>
- <artifactId>myfaces-impl</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.apache.myfaces.test</groupId>
+ <artifactId>myfaces-test20</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>test</scope>
</dependency>
+
<dependency>
<groupId>jmock</groupId>
<artifactId>jmock</artifactId>
@@ -605,7 +595,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.2</version>
+ <version>2.5</version>
<configuration>
<excludes>
<exclude>**/Abstract*.java</exclude>
@@ -722,7 +712,7 @@
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
</plugin>
<!-- This plugin is reffered on myfaces master pom, but
this is needed to set targetJdk to 1.5 -->
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlCommandButtonTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlCommandButtonTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlCommandButtonTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlCommandButtonTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlCommandButtonTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlCommandButtonTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlCommandButton();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlDataTableTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlDataTableTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlDataTableTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlDataTableTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,209 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.model.ListDataModel;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+/**
+ * @author Mathias Br�kelmann (latest modification by $Author: paulsp $)
+ * @version $Revision: 491829 $ $Date: 2007-01-02 11:13:29 -0500 (mar, 02 ene 2007) $
+ */
+public class HtmlDataTableTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ private HtmlDataTable _dataTable;
+
+ public HtmlDataTableTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _dataTable = new HtmlDataTable();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ _dataTable = null;
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.component.html.ext.HtmlDataTable.getClientId(FacesContext)'
+ */
+ public void testGetClientIdFacesContext()
+ {
+ assertEquals(-1, _dataTable.getRowIndex());
+ String baseClientId = _dataTable.getClientId(facesContext);
+ assertNotNull(baseClientId);
+ Collection rowClientIds = new HashSet();
+ for (int i = 0; i < 10; i++)
+ {
+ _dataTable.setRowIndex(i);
+ assertTrue("Duplicate client id while iterating rows", rowClientIds
+ .add(_dataTable.getClientId(facesContext)));
+ }
+ _dataTable.setRowIndex(-1);
+ assertEquals(baseClientId, _dataTable.getClientId(facesContext));
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.component.html.ext.HtmlDataTable.findComponent(String clientId)'
+ */
+ public void testFindComponent()
+ {
+ UIInput input = createInputInTree(facesContext);
+
+ UIData data = (UIData) input.getParent().getParent();
+
+ UIComponent comp = data.findComponent(":data:1:input");
+
+ assertTrue(comp instanceof UIInput);
+
+ UIInput uiInput = (UIInput) comp;
+
+ assertEquals(uiInput.getValue(), "test2");
+
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIData component = new HtmlDataTable();
+ component.setId("TestComponent");
+
+ // Add rows to the table
+ List rows = new ArrayList();
+ rows.add(new TestData("test1", "test1"));
+ rows.add(new TestData("test2", "test2"));
+ rows.add(new TestData("test3", "test3"));
+ component.setValue(new ListDataModel(rows));
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+
+ private UIInput createInputInTree(FacesContext context)
+ {
+
+ UIData uiData = new HtmlDataTable();
+ uiData.setId("data");
+
+ List li = new ArrayList();
+ li.add(new TestData("test1", "test1"));
+ li.add(new TestData("test2", "test2"));
+ li.add(new TestData("test3", "test3"));
+
+ uiData.setValue(new ListDataModel(li));
+ uiData.setVar("detail");
+
+ UIColumn column = new UIColumn();
+
+ uiData.getChildren().add(column);
+
+ UIInput input = new UIInput();
+ input.setId("input");
+ input.setValueBinding("value",
+ createValueBinding("#{detail.description}"));
+
+ column.getChildren().add(input);
+
+ facesContext.getViewRoot().getChildren().add(uiData);
+
+ return input;
+ }
+
+ private ValueBinding createValueBinding(String expr)
+ {
+ return facesContext.getApplication().createValueBinding(expr);
+ }
+
+ public static class TestData implements Serializable
+ {
+ private String _description;
+ private String _value;
+
+ public TestData()
+ {
+
+ }
+
+ TestData(String description, String value)
+ {
+ _description = description;
+ _value = value;
+ }
+
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ public void setDescription(String description)
+ {
+ _description = description;
+ }
+
+ public String getValue()
+ {
+ return _value;
+ }
+
+ public void setValue(String value)
+ {
+ _value = value;
+ }
+ }
+
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlGraphicImageTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlGraphicImageTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlGraphicImageTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlGraphicImageTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlGraphicImageTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlGraphicImageTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ HtmlGraphicImage component = new HtmlGraphicImage();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+ component.setUrl("http://myfaces.apache.org");
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputHiddenTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputHiddenTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputHiddenTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputHiddenTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,63 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlInputHiddenTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlInputHiddenTest(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlInputHidden();
+ component.setId("TestComponent");
+ HtmlForm form = new HtmlForm();
+ form.getChildren().add(component);
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputSecretTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputSecretTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputSecretTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputSecretTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlInputSecretTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlInputSecretTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlInputSecret();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlInputTextTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlInputTextTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlInputText();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextareaTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextareaTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextareaTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlInputTextareaTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlInputTextareaTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlInputTextareaTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlInputTextarea();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessageTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessageTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessageTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessageTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,86 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlMessageTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlMessageTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define required panel group
+ HtmlPanelGroup panelGroup = new HtmlPanelGroup();
+
+ // Define the referenced component
+ UIComponent referencedComponent = new HtmlInputText();
+ referencedComponent.setId("referencedComponent");
+ //referencedComponent.setParent(panelGroup);
+ panelGroup.getChildren().add(referencedComponent);
+ facesContext.addMessage(referencedComponent.getId(), new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "summary", "detail"));
+
+ // Define the component
+ HtmlMessage component = new HtmlMessage();
+ component.setId("TestComponent");
+
+ referencedComponent.setParent(panelGroup);
+ panelGroup.getChildren().add(component);
+ component.setFor(referencedComponent.getId());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, panelGroup);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java Tue Jul 13 22:57:38 2010
@@ -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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlMessagesTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlMessagesTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define required panel group
+ HtmlPanelGroup panelGroup = new HtmlPanelGroup();
+
+ // Define the referenced component
+ UIComponent referencedComponent = new HtmlInputText();
+ referencedComponent.setId("referencedComponent");
+ //referencedComponent.setParent(panelGroup);
+ panelGroup.getChildren().add(referencedComponent);
+ facesContext.addMessage(referencedComponent.getId(), new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "summary", "detail"));
+
+ // Define the component
+ HtmlMessages component = new HtmlMessages();
+ component.setId("TestComponent");
+
+ referencedComponent.setParent(panelGroup);
+ panelGroup.getChildren().add(component);
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputLabelTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputLabelTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputLabelTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputLabelTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlOutputLabelTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlOutputLabelTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlOutputLabel();
+ component.setId("TestComponent");
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputTextTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputTextTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputTextTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlOutputTextTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlOutputTextTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlOutputTextTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlOutputText();
+ component.setId("TestComponent");
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGridTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGridTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGridTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGridTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlPanelGridTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlPanelGridTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlPanelGrid();
+ component.setId("TestComponent");
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGroupTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGroupTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGroupTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlPanelGroupTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlPanelGroupTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlPanelGroupTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlPanelGroup();
+ component.setId("TestComponent");
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlSelectBooleanCheckboxTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlSelectBooleanCheckboxTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlSelectBooleanCheckbox();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxRendererCactus.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxRendererCactus.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxRendererCactus.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxRendererCactus.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,376 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UISelectItems;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextFactory;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.model.SelectItem;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
+import org.apache.cactus.WebResponse;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlResponseWriterImpl;
+import org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer;
+
+/**
+ * Cactus test for the rendering of the
+ * {@link org.apache.myfaces.component.html.ext.HtmlSelectBooleanCheckbox}
+ * component. Various combinations of layouts (lineDirection,pageDirection)
+ * and layoutWidths are tested.
+ * TODO: Test the markup generated when SelectItemGroup's are used in
+ * combination with different layouts and layoutWidths.
+ * @author Ken Weiner
+ */
+public class HtmlSelectManyCheckboxRendererCactus extends ServletTestCase
+{
+ private FacesContext facesContext;
+ private UIViewRoot viewRoot;
+
+ public void setUp() throws Exception
+ {
+ FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ Lifecycle lifecycle = lifecycleFactory
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ facesContext = facesContextFactory.getFacesContext(this.config
+ .getServletContext(), request, response, lifecycle);
+ assertNotNull(facesContext);
+
+ Writer htmlResponseWriter = response.getWriter();
+ facesContext.setResponseWriter(new HtmlResponseWriterImpl(
+ htmlResponseWriter, "text/html", "ISO-8859-1"));
+
+ Application application = facesContext.getApplication();
+ ViewHandler viewHandler = application.getViewHandler();
+ String viewId = "/index.jsp";
+ viewRoot = viewHandler.createView(facesContext, viewId);
+ viewRoot.setViewId(viewId);
+ facesContext.setViewRoot(viewRoot);
+ }
+
+ public void beginEncodeWithLineDirection(WebRequest request)
+ {
+ // Nothing to do
+ }
+
+ public void testEncodeWithLineDirection() throws IOException
+ {
+ // Make component and set its properties
+ HtmlSelectManyCheckbox selectMany = new HtmlSelectManyCheckbox();
+ selectMany.setId("test");
+ selectMany.setLayout("lineDirection");
+ selectMany.setValue(getSelections(2));
+ UISelectItems uiSelectItems = new UISelectItems();
+ uiSelectItems.setParent(selectMany);
+ uiSelectItems.setValue(getSelectManyCheckboxSelections(3));
+ selectMany.getChildren().add(uiSelectItems);
+
+ // Make a renderer, associate it with component, and call encode
+ HtmlCheckboxRenderer renderer = new HtmlCheckboxRenderer();
+ renderer.encodeBegin(facesContext, selectMany);
+ renderer.encodeEnd(facesContext, selectMany);
+ }
+
+ public void endEncodeWithLineDirection(WebResponse response)
+ {
+ // Check the markup produced by the component
+ String htmlMarkup = response.getText();
+ String expected =
+ "<table id=\"test\">" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-0\" />" +
+ " Label-0" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-1\" />" +
+ " Label-1" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-2\" />" +
+ " Label-2" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "</table>";
+ assertEquals(expected, htmlMarkup);
+ }
+
+ public void beginEncodeWithPageDirection(WebRequest request)
+ {
+ // Nothing to do
+ }
+
+ public void testEncodeWithPageDirection() throws IOException
+ {
+ // Make component and set its properties
+ HtmlSelectManyCheckbox selectMany = new HtmlSelectManyCheckbox();
+ selectMany.setId("test");
+ selectMany.setLayout("pageDirection");
+ selectMany.setValue(getSelections(2));
+ UISelectItems uiSelectItems = new UISelectItems();
+ uiSelectItems.setParent(selectMany);
+ uiSelectItems.setValue(getSelectManyCheckboxSelections(3));
+ selectMany.getChildren().add(uiSelectItems);
+
+ // Make a renderer, associate it with component, and call encode
+ HtmlCheckboxRenderer renderer = new HtmlCheckboxRenderer();
+ renderer.encodeBegin(facesContext, selectMany);
+ renderer.encodeEnd(facesContext, selectMany);
+ }
+
+ public void endEncodeWithPageDirection(WebResponse response)
+ {
+ // Check the markup produced by the component
+ String htmlMarkup = response.getText();
+ String expected =
+ "<table id=\"test\">" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-0\" />" +
+ " Label-0" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-1\" />" +
+ " Label-1" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-2\" />" +
+ " Label-2" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "</table>";
+ assertEquals(expected, htmlMarkup);
+ }
+
+ public void beginEncodeWithLineDirectionAndLayoutWidth(WebRequest request)
+ {
+ // Nothing to do
+ }
+
+ public void testEncodeWithLineDirectionAndLayoutWidth() throws IOException
+ {
+ // Make component and set its properties
+ HtmlSelectManyCheckbox selectMany = new HtmlSelectManyCheckbox();
+ selectMany.setId("test");
+ selectMany.setLayout("lineDirection");
+ selectMany.setLayoutWidth("2");
+ selectMany.setValue(getSelections(2));
+ UISelectItems uiSelectItems = new UISelectItems();
+ uiSelectItems.setParent(selectMany);
+ uiSelectItems.setValue(getSelectManyCheckboxSelections(5));
+ selectMany.getChildren().add(uiSelectItems);
+
+ // Make a renderer, associate it with component, and call encode
+ HtmlCheckboxRenderer renderer = new HtmlCheckboxRenderer();
+ renderer.encodeBegin(facesContext, selectMany);
+ renderer.encodeEnd(facesContext, selectMany);
+ }
+
+ public void endEncodeWithLineDirectionAndLayoutWidth(WebResponse response)
+ {
+ // Check the markup produced by the component
+ String htmlMarkup = response.getText();
+ String expected =
+ "<table id=\"test\">" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-0\" />" +
+ " Label-0" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-2\" />" +
+ " Label-2" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-4\" />" +
+ " Label-4" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-1\" />" +
+ " Label-1" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-3\" />" +
+ " Label-3" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ // empty cell
+ "</td>" +
+ "</tr>" +
+ "</table>";
+ assertEquals(expected, htmlMarkup);
+ }
+
+ public void beginEncodeWithPageDirectionAndLayoutWidth(WebRequest request)
+ {
+ // Nothing to do
+ }
+
+ public void testEncodeWithPageDirectionAndLayoutWidth() throws IOException
+ {
+ // Make component and set its properties
+ HtmlSelectManyCheckbox selectMany = new HtmlSelectManyCheckbox();
+ selectMany.setId("test");
+ selectMany.setLayout("pageDirection");
+ selectMany.setLayoutWidth("2");
+ selectMany.setValue(getSelections(2));
+ UISelectItems uiSelectItems = new UISelectItems();
+ uiSelectItems.setParent(selectMany);
+ uiSelectItems.setValue(getSelectManyCheckboxSelections(5));
+ selectMany.getChildren().add(uiSelectItems);
+
+ // Make a renderer, associate it with component, and call encode
+ HtmlCheckboxRenderer renderer = new HtmlCheckboxRenderer();
+ renderer.encodeBegin(facesContext, selectMany);
+ renderer.encodeEnd(facesContext, selectMany);
+ }
+
+ public void endEncodeWithPageDirectionAndLayoutWidth(WebResponse response)
+ {
+ // Check the markup produced by the component
+ String htmlMarkup = response.getText();
+ String expected =
+ "<table id=\"test\">" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-0\" />" +
+ " Label-0" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" checked=\"checked\" value=\"Value-1\" />" +
+ " Label-1" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-2\" />" +
+ " Label-2" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-3\" />" +
+ " Label-3" +
+ "</label>" +
+ "</td>" +
+ "</tr>" +
+ "<tr>" +
+ "<td>" +
+ "<label>" +
+ "<input type=\"checkbox\" name=\"test\" value=\"Value-4\" />" +
+ " Label-4" +
+ "</label>" +
+ "</td>" +
+ "<td>" +
+ // empty cell
+ "</td>" +
+ "</tr>" +
+ "</table>";
+ assertEquals(expected, htmlMarkup);
+ }
+
+ /**
+ * Helper method to generate list of selected checkbox
+ * values. The values will be strings in the form
+ * "Value-X" where X is the 0-based index of the value.
+ * @param numSelected the number of values requested
+ * @return the list of selected checkbox values
+ */
+ protected List getSelections(int numSelected)
+ {
+ List selectedValues = new ArrayList(numSelected);
+ for (int i = 0; i < numSelected; i++)
+ {
+ selectedValues.add("Value-" + i);
+ }
+ return selectedValues;
+ }
+
+ /**
+ * Helper method to generate list of select items that
+ * represent the selection of checkboxes.
+ * The select items will have labels and values in the form
+ * "Label-X", "Value-X" where X is the 0-based index of
+ * the label or value.
+ * @param numItems the number of checkboxes requested
+ * @return the list of checkbox select items
+ */
+ protected List getSelectManyCheckboxSelections(int numItems)
+ {
+ List selectItems = new ArrayList(numItems);
+ for (int i = 0; i < numItems; i++)
+ {
+ selectItems.add(new SelectItem("Value-" + i, "Label-" + i));
+ }
+ return selectItems;
+ }
+
+ public void tearDown()
+ {
+ facesContext = null;
+ viewRoot = null;
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlSelectManyCheckboxTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlSelectManyCheckboxTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlSelectManyCheckbox();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlSelectManyListboxTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlSelectManyListboxTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlSelectManyCheckbox();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlSelectManyMenuTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlSelectManyMenuTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlSelectManyMenu();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTest.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTest.java?rev=963899&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTest.java (added)
+++ myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTest.java Tue Jul 13 22:57:38 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
+import org.apache.myfaces.test.utils.TestUtils;
+
+public class HtmlSelectOneListboxTest extends AbstractTomahawkViewControllerTestCase
+{
+
+ public HtmlSelectOneListboxTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Verify component renders with the default renderer.
+ */
+ public void testDefaultRenderer()
+ {
+ // Define the component
+ UIComponent component = new HtmlSelectOneListbox();
+ component.setId("TestComponent");
+ component.setParent(new HtmlForm());
+
+ // Render the component
+ try
+ {
+ TestUtils.renderComponent(facesContext, component);
+ }
+ catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+
+ // Verify component was rendered
+ assertIdExists(component.getId());
+ }
+}