JBoss Rich Faces SVN: r14969 - in root/framework/trunk/impl/src/test/java/org/ajax4jsf: context and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-20 19:18:35 -0400 (Mon, 20 Jul 2009)
New Revision: 14969
Added:
root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/
root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java
Log:
InitParametersTest added
Copied: root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java (from rev 14967, root/framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/context/InitParametersTest.java)
===================================================================
--- root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/ajax4jsf/context/InitParametersTest.java 2009-07-20 23:18:35 UTC (rev 14969)
@@ -0,0 +1,130 @@
+/**
+ *
+ */
+package org.ajax4jsf.context;
+
+import javax.faces.FacesException;
+
+import org.ajax4jsf.application.AjaxStateManager;
+import org.richfaces.test.AbstractFacesTest;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class InitParametersTest extends AbstractFacesTest {
+
+ private static final String STRING_PARAM = "init";
+ private static final int INT_PARAM = 367;
+ private static final String NO = "no";
+ private static final String TRUE = "true";
+ private static final String ORG_AJAX4JSF_STRING = "org.ajax4jsf.STRING";
+ private static final String ORG_AJAX4JSF_INT = "org.ajax4jsf.INT";
+ private static final String ORG_AJAX4JSF_FALSE = "org.ajax4jsf.FALSE";
+ private static final String ORG_AJAX4JSF_TRUE = "org.ajax4jsf.TRUE";
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ setupFacesRequest();
+ }
+
+ @Override
+ protected void setupJsfInitParameters() {
+ super.setupJsfInitParameters();
+
+ facesServer.addInitParameter(ORG_AJAX4JSF_TRUE, TRUE);
+ facesServer.addInitParameter(ORG_AJAX4JSF_FALSE, NO);
+ facesServer.addInitParameter(ORG_AJAX4JSF_INT, String.valueOf(INT_PARAM));
+ facesServer.addInitParameter(ORG_AJAX4JSF_STRING, STRING_PARAM);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getNumbersOfViewsInSession(javax.faces.context.FacesContext)}.
+ */
+ public void testGetNumbersOfViewsInSession() {
+ assertEquals(AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS, ContextInitParameters.getNumbersOfViewsInSession(facesContext));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getNumbersOfLogicalViews(javax.faces.context.FacesContext)}.
+ */
+ public void testGetNumbersOfLogicalViews() {
+ assertEquals(AjaxStateManager.DEFAULT_NUMBER_OF_VIEWS, ContextInitParameters.getNumbersOfLogicalViews(facesContext));
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getInteger(javax.faces.context.FacesContext, java.lang.String[], int)}.
+ */
+ public void testGetInteger() {
+ String[] params = {"foo.bar",ORG_AJAX4JSF_INT};
+ int value = ContextInitParameters.getInteger(facesContext, params, 12);
+ assertEquals(INT_PARAM, value);
+ String[] params2 = {"foo.bar"};
+ value = ContextInitParameters.getInteger(facesContext, params2, 12);
+ assertEquals(12, value);
+ String[] params3 = {"foo.bar",ORG_AJAX4JSF_STRING};
+ try {
+ value = ContextInitParameters.getInteger(facesContext, params3, 12);
+ } catch (FacesException e) {
+ return;
+ }
+ assertFalse("No exception on invalid parameter",true);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getString(javax.faces.context.FacesContext, java.lang.String[], java.lang.String)}.
+ */
+ public void testGetString() {
+ String[] params = {"foo.bar",ORG_AJAX4JSF_STRING};
+ String value = ContextInitParameters.getString(facesContext, params, "foo");
+ assertEquals(STRING_PARAM, value);
+ String[] params2 = {"foo.bar"};
+ value = ContextInitParameters.getString(facesContext, params2, "foo");
+ assertEquals("foo", value);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getBoolean(javax.faces.context.FacesContext, java.lang.String[], boolean)}.
+ */
+ public void testGetBoolean() {
+ String[] params = {"foo.bar",ORG_AJAX4JSF_TRUE};
+ boolean value = ContextInitParameters.getBoolean(facesContext, params, false);
+ assertTrue(value);
+ String[] params2 = {"foo.bar"};
+ value = ContextInitParameters.getBoolean(facesContext, params2, true);
+ assertTrue(value);
+ String[] params3 = {"foo.bar",ORG_AJAX4JSF_FALSE};
+ value = ContextInitParameters.getBoolean(facesContext, params3, true);
+ assertFalse(value);
+ String[] params4 = {"foo.bar",ORG_AJAX4JSF_STRING};
+ try {
+ value = ContextInitParameters.getBoolean(facesContext, params4, false);
+ } catch (FacesException e) {
+ return;
+ }
+ assertFalse("No exception on invalid parameter",true);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.context.ContextInitParameters#getInitParameter(javax.faces.context.FacesContext, java.lang.String[])}.
+ */
+ public void testGetInitParameter() {
+ String[] params = {"foo.bar",ORG_AJAX4JSF_STRING};
+ String value = ContextInitParameters.getInitParameter(facesContext, params);
+ assertEquals(STRING_PARAM, value);
+ String[] params2 = {"foo.bar"};
+ value = ContextInitParameters.getInitParameter(facesContext, params2);
+ assertNull(value);
+ }
+
+}
15 years, 5 months
JBoss Rich Faces SVN: r14968 - in root/framework/trunk/legacy-tests/src/test/java/org: richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-20 19:10:09 -0400 (Mon, 20 Jul 2009)
New Revision: 14968
Removed:
root/framework/trunk/legacy-tests/src/test/java/org/ajax4jsf/codec/
root/framework/trunk/legacy-tests/src/test/java/org/richfaces/component/
root/framework/trunk/legacy-tests/src/test/java/org/richfaces/model/entity/
root/framework/trunk/legacy-tests/src/test/java/org/richfaces/renderkit/
root/framework/trunk/legacy-tests/src/test/java/org/richfaces/skin/
Log:
Empty packages removed
15 years, 5 months
JBoss Rich Faces SVN: r14967 - root/framework/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-20 17:38:43 -0400 (Mon, 20 Jul 2009)
New Revision: 14967
Modified:
root/framework/trunk/pom.xml
Log:
Clover HTML reports generation switched on
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2009-07-20 18:20:26 UTC (rev 14966)
+++ root/framework/trunk/pom.xml 2009-07-20 21:38:43 UTC (rev 14967)
@@ -98,7 +98,7 @@
<jdk>1.5</jdk>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
- <generateHtml>false</generateHtml>
+ <generateHtml>true</generateHtml>
</configuration>
<executions>
<execution>
15 years, 5 months
JBoss Rich Faces SVN: r14966 - root/framework/trunk/impl/src/test/java/org/ajax4jsf/cache.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-20 14:20:26 -0400 (Mon, 20 Jul 2009)
New Revision: 14966
Modified:
root/framework/trunk/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java
Log:
BaseCacheTest refactored
Modified: root/framework/trunk/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java 2009-07-20 17:25:47 UTC (rev 14965)
+++ root/framework/trunk/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java 2009-07-20 18:20:26 UTC (rev 14966)
@@ -80,11 +80,25 @@
public void testExpiration() throws Exception {
assertNull(cache.get("a"));
- cache.put("a", "value-a", new Date(System.currentTimeMillis() + 3000));
+
+ long sleepTime = 0;
+ long expirationTime = System.currentTimeMillis() + 3000;
+
+ cache.put("a", "value-a", new Date(expirationTime));
assertEquals("value-a", cache.get("a"));
- Thread.sleep(2000);
+
+ //interval to reach 1 second before expiration time
+ sleepTime = expirationTime - 1000 - System.currentTimeMillis();
+ assertTrue(sleepTime > 0);
+ Thread.sleep(sleepTime);
+
assertEquals("value-a", cache.get("a"));
- Thread.sleep(2000);
+
+ //interval to reach 1 second after expiration time
+ sleepTime = expirationTime + 1000 - System.currentTimeMillis();
+ assertTrue(sleepTime > 0);
+
+ Thread.sleep(sleepTime);
assertNull(cache.get("a"));
}
}
15 years, 5 months
JBoss Rich Faces SVN: r14965 - in root/framework/trunk: version-matrix and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-20 13:25:47 -0400 (Mon, 20 Jul 2009)
New Revision: 14965
Modified:
root/framework/trunk/pom.xml
root/framework/trunk/version-matrix/pom.xml
Log:
Added Clover coverage reporting
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2009-07-20 16:48:02 UTC (rev 14964)
+++ root/framework/trunk/pom.xml 2009-07-20 17:25:47 UTC (rev 14965)
@@ -83,4 +83,44 @@
<module>test-base</module>
</modules>
+ <profiles>
+ <profile>
+ <id>clover</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <configuration>
+ <licenseLocation>
+ ${clover.license.path}
+ </licenseLocation>
+ <jdk>1.5</jdk>
+ <generatePdf>false</generatePdf>
+ <generateXml>true</generateXml>
+ <generateHtml>false</generateHtml>
+ </configuration>
+ <executions>
+ <execution>
+ <id>instrument</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>instrument</goal>
+ <goal>check</goal>
+ <goal>clover</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>hudson</id>
+ <properties>
+ <clover.license.path>/home/hudson/config_repository/resources/richfaces/richfaces-clover-license.txt</clover.license.path>
+ </properties>
+ </profile>
+ </profiles>
+
</project>
\ No newline at end of file
Modified: root/framework/trunk/version-matrix/pom.xml
===================================================================
--- root/framework/trunk/version-matrix/pom.xml 2009-07-20 16:48:02 UTC (rev 14964)
+++ root/framework/trunk/version-matrix/pom.xml 2009-07-20 17:25:47 UTC (rev 14965)
@@ -300,7 +300,12 @@
<version>3.3.1.GA</version>
</plugin>
<!-- -->
-
+
+ <plugin>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
15 years, 5 months
JBoss Rich Faces SVN: r14964 - branches/community/3.3.X/ui/scrollableDataTable/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-20 12:48:02 -0400 (Mon, 20 Jul 2009)
New Revision: 14964
Modified:
branches/community/3.3.X/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
Log:
RF-3902
Modified: branches/community/3.3.X/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
--- branches/community/3.3.X/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2009-07-20 11:48:37 UTC (rev 14963)
+++ branches/community/3.3.X/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2009-07-20 16:48:02 UTC (rev 14964)
@@ -95,7 +95,7 @@
/**
* hold list of ranges previously accessed until updates are fully done for them
*/
- private List<Range> ranges;
+ private List<ScrollableTableDataRange> ranges;
private Collection<String> responseData = new ArrayList<String>();
@@ -289,7 +289,7 @@
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[])state;
super.restoreState(context, values[0]);
- ranges = ((List<Range>)values[1]);
+ ranges = ((List<ScrollableTableDataRange>)values[1]);
scrollPos = (String)values[2];
sortListener = (SortListener) restoreAttachedState(context, values[3]);
}
@@ -387,22 +387,54 @@
getFacesContext().renderResponse();
}
- public void walk(FacesContext faces, DataVisitor visitor, Object argument) throws IOException {
+ private void addRange() {
+ ScrollableTableDataRange visitedRange = (ScrollableTableDataRange)getComponentState().getRange();
- Range visitedRange = getComponentState().getRange();
-
if(ranges == null){
- ranges = new ArrayList<Range>();
+ ranges = new ArrayList<ScrollableTableDataRange>();
}
- if(!ranges.contains(visitedRange)){
+ Iterator<ScrollableTableDataRange> iter = ranges.iterator();
+ ScrollableTableDataRange range = null;
+ while (iter.hasNext() && range == null) {
+ ScrollableTableDataRange temp = iter.next();
+ if (temp.getLast() >= visitedRange.getFirst()) {
+ range = temp;
+ }
+ }
+
+ if (range != null) {
+ if (range.getFirst() > visitedRange.getLast()) {
+ ranges.add(0, visitedRange);
+ } else {
+ if (range.getFirst() > visitedRange.getFirst()) {
+ range.setFirst(visitedRange.getFirst());
+ }
+ if (range.getLast() < visitedRange.getLast()) {
+ ScrollableTableDataRange nextRange = null;
+ if (iter.hasNext()) {
+ nextRange = iter.next();
+ }
+ if (nextRange != null && nextRange.getFirst() <= visitedRange.getLast()) {
+ range.setLast(nextRange.getLast());
+ } else {
+ range.setLast(visitedRange.getLast());
+ }
+ }
+ }
+ } else {
ranges.add(visitedRange);
}
+ }
+
+ public void walk(FacesContext faces, DataVisitor visitor, Object argument) throws IOException {
+
+ addRange();
if(useSavedRanges){
- for (Iterator<Range> iter = ranges.iterator(); iter.hasNext();) {
- ScrollableTableDataRange range = (ScrollableTableDataRange) iter.next();
+ for (Iterator<ScrollableTableDataRange> iter = ranges.iterator(); iter.hasNext();) {
+ ScrollableTableDataRange range = iter.next();
if (log.isDebugEnabled()) {
log.debug("Range is: " + range.getFirst() + " - " + range.getLast() + " sortOrder: " + range.getSortOrder() );
15 years, 5 months
JBoss Rich Faces SVN: r14963 - branches/community/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-07-20 07:48:37 -0400 (Mon, 20 Jul 2009)
New Revision: 14963
Modified:
branches/community/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
Log:
Modified: branches/community/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2009-07-17 19:10:15 UTC (rev 14962)
+++ branches/community/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2009-07-20 11:48:37 UTC (rev 14963)
@@ -118,8 +118,8 @@
assertTrue(resultString.indexOf("<title>")<resultString.lastIndexOf("<link"));
assertTrue(resultString.indexOf("</head>")>resultString.lastIndexOf("</script"));
assertTrue(resultString.indexOf("</head>")>resultString.lastIndexOf("<link"));
- assertTrue(resultString.indexOf("<meta")>resultString.lastIndexOf("</script"));
- assertTrue(resultString.indexOf("<meta")>resultString.lastIndexOf("<link"));
+ assertTrue(resultString.indexOf("<meta")<resultString.lastIndexOf("</script"));
+ assertTrue(resultString.indexOf("<meta")<resultString.lastIndexOf("<link"));
}
/**
15 years, 5 months