[richfaces-svn-commits] JBoss Rich Faces SVN: r2513 - in trunk: framework/api/src/main/java/org/richfaces/model/selection and 4 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Mon Aug 27 13:11:47 EDT 2007
Author: maksimkaszynski
Date: 2007-08-27 13:11:46 -0400 (Mon, 27 Aug 2007)
New Revision: 2513
Added:
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/component/html/AbstractScrollableDataTableTestCase.java
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/TestDataGenerator.java
trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
trunk/samples/scrollableDataTableDemo/src/main/webapp/pages/scrollable-grid.xhtml
trunk/ui/scrollableDataTable/pom.xml
trunk/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml
Log:
added component unit tests to support user-defined data types
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/TestDataGenerator.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/TestDataGenerator.java 2007-08-27 15:55:56 UTC (rev 2512)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/TestDataGenerator.java 2007-08-27 17:11:46 UTC (rev 2513)
@@ -116,16 +116,28 @@
}
private String getTestData(String propertyName, String className, int number) {
+
String string = number == 0 ? testData.get(className) : testData1.get(className);
+
if (string != null) {
return string;
}
-
- if (number == 0) {
- return "\"" + propertyName + "\"";
+
+ try {
+ Class<?> clazz = Class.forName(className);
+ if (clazz.isAssignableFrom(String.class)) {
+ if (number == 0) {
+ return "\"" + propertyName + "\"";
+ } else {
+ return "\"" + propertyName + "_" + propertyName + "\"";
+ }
+ }
+
+ } catch(Exception e) {
+
}
-
- return "\"" + propertyName + "_" + propertyName + "\"";
+
+ return "createTestData_" + propertyName + "()";
}
public String getTestData(PropertyBean propertyBean) {
Modified: trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-08-27 15:55:56 UTC (rev 2512)
+++ trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-08-27 17:11:46 UTC (rev 2513)
@@ -40,4 +40,29 @@
public void clear() {
keys.clear();
}
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((keys == null) ? 0 : keys.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final SimpleSelection other = (SimpleSelection) obj;
+ if (keys == null) {
+ if (other.keys != null)
+ return false;
+ } else if (!keys.equals(other.keys))
+ return false;
+ return true;
+ }
+
+
}
Modified: trunk/samples/scrollableDataTableDemo/src/main/webapp/pages/scrollable-grid.xhtml
===================================================================
--- trunk/samples/scrollableDataTableDemo/src/main/webapp/pages/scrollable-grid.xhtml 2007-08-27 15:55:56 UTC (rev 2512)
+++ trunk/samples/scrollableDataTableDemo/src/main/webapp/pages/scrollable-grid.xhtml 2007-08-27 17:11:46 UTC (rev 2513)
@@ -26,6 +26,10 @@
height: 30px;
}
+ .col {
+ color: red;
+ }
+
</style>
</head>
@@ -46,6 +50,7 @@
first="0"
rows="40"
width="800px"
+ columnClasses="col"
height="500px" hideWhenScrolling="false">
Modified: trunk/ui/scrollableDataTable/pom.xml
===================================================================
--- trunk/ui/scrollableDataTable/pom.xml 2007-08-27 15:55:56 UTC (rev 2512)
+++ trunk/ui/scrollableDataTable/pom.xml 2007-08-27 17:11:46 UTC (rev 2513)
@@ -22,7 +22,15 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
+
<configuration>
<library>
<prefix>org.richfaces</prefix>
Modified: trunk/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml
===================================================================
--- trunk/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml 2007-08-27 15:55:56 UTC (rev 2512)
+++ trunk/ui/scrollableDataTable/src/main/config/component/scrollable-data-table.xml 2007-08-27 17:11:46 UTC (rev 2513)
@@ -17,6 +17,10 @@
<description>
<![CDATA[ Scrollable Data Table ]]>
</description>
+ <test>
+ <classname>org.richfaces.component.html.HtmlScrollableDataTableComponentTest</classname>
+ <superclassname>org.richfaces.component.html.AbstractScrollableDataTableTestCase</superclassname>
+ </test>
<renderer generate="true" override="true">
<name>org.richfaces.renderkit.html.ScrollableDataTableRenderer</name>
@@ -28,12 +32,10 @@
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
- <!--
- <test>
+ <!--test>
<classname>org.richfaces.taglib.ScrollableDataTableTagTest</classname>
<superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
- </test>
- -->
+ </test-->
</tag>
<property>
@@ -107,7 +109,7 @@
<classname>java.lang.String</classname>
</property>
- <property attachedstate="true" hidden="true">
+ <property attachedstate="true">
<name>sortOrder</name>
<classname>org.richfaces.model.SortOrder</classname>
</property>
Added: trunk/ui/scrollableDataTable/src/test/java/org/richfaces/component/html/AbstractScrollableDataTableTestCase.java
===================================================================
--- trunk/ui/scrollableDataTable/src/test/java/org/richfaces/component/html/AbstractScrollableDataTableTestCase.java (rev 0)
+++ trunk/ui/scrollableDataTable/src/test/java/org/richfaces/component/html/AbstractScrollableDataTableTestCase.java 2007-08-27 17:11:46 UTC (rev 2513)
@@ -0,0 +1,51 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.html;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.model.SortOrder;
+import org.richfaces.model.selection.Selection;
+import org.richfaces.model.selection.SimpleSelection;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class AbstractScrollableDataTableTestCase extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public AbstractScrollableDataTableTestCase(String name) {
+ super(name);
+
+ }
+
+
+ protected SortOrder createTestData_sortOrder() {
+ return new SortOrder();
+ }
+
+ protected Selection createTestData_selection() {
+ return new SimpleSelection();
+ }
+}
More information about the richfaces-svn-commits
mailing list