JBoss Rich Faces SVN: r11050 - trunk/sandbox/samples/editorSeam-sample.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-06 13:16:58 -0500 (Thu, 06 Nov 2008)
New Revision: 11050
Modified:
trunk/sandbox/samples/editorSeam-sample/pom.xml
Log:
seam 2.1.0 SP1
Modified: trunk/sandbox/samples/editorSeam-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/editorSeam-sample/pom.xml 2008-11-06 18:15:19 UTC (rev 11049)
+++ trunk/sandbox/samples/editorSeam-sample/pom.xml 2008-11-06 18:16:58 UTC (rev 11050)
@@ -27,7 +27,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -70,7 +70,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ui</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -93,7 +93,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ioc</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -116,7 +116,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-debug</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -139,7 +139,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-mail</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -162,7 +162,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-pdf</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
@@ -185,7 +185,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-remoting</artifactId>
- <version>2.0.2.GA</version>
+ <version>2.1.0.SP1</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
17 years, 1 month
JBoss Rich Faces SVN: r11049 - in trunk/sandbox/ui/editor: src/main/antlr and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-06 13:15:19 -0500 (Thu, 06 Nov 2008)
New Revision: 11049
Modified:
trunk/sandbox/ui/editor/pom.xml
trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
Log:
healing grammar alfa version
Modified: trunk/sandbox/ui/editor/pom.xml
===================================================================
--- trunk/sandbox/ui/editor/pom.xml 2008-11-06 18:01:04 UTC (rev 11048)
+++ trunk/sandbox/ui/editor/pom.xml 2008-11-06 18:15:19 UTC (rev 11049)
@@ -73,7 +73,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
- <version>2.1.0.CR1</version>
+ <version>2.1.0.SP1</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g
===================================================================
--- trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-06 18:01:04 UTC (rev 11048)
+++ trunk/sandbox/ui/editor/src/main/antlr/html-seamtext.g 2008-11-06 18:15:19 UTC (rev 11049)
@@ -78,8 +78,11 @@
SEAM_CLOSE, SEAM_GT
));
+
protected java.util.Set<String> htmlSeamTextElements = new java.util.HashSet(java.util.Arrays.asList(
"del", "sup", "pre","p", "q" ,"h1" ,"h2" ,"h3" ,"h4" ,"ul" ,"ol" ,"li" ,"i" ,"tt" ,"u" ,"a"));
+ protected java.util.Set<String> simpleHtmlSeamTextElements = new java.util.HashSet(java.util.Arrays.asList(
+ "del", "sup", "pre","p", "q" ,"i" ,"tt" ,"u" ,"a"));
private Sanitizer sanitizer = new DefaultSanitizer();
@@ -189,50 +192,47 @@
return seamText != null ? seamText : "";
}
- // validate lists and headers'
- public void validateNestedMarkup(Token name, java.util.Stack <Token> htmlElementStack) throws SemanticException {
+ public boolean isPlainHMTLRequired(Token name, java.util.Stack <Token> htmlElementStack) throws SemanticException {
+ boolean require = false;
if(!htmlElementStack.isEmpty()) {
for(Token token : htmlElementStack) {
-
if(token.getText().equals("h1") || token.getText().equals("h2") || token.getText().equals("h3")
- || token.getText().equals("h4") || token.getText().equals("ol") || token.getText().equals("ul")) {
- String message = "<" + token.getText() + "> contains nested <" + name.getText() + "> token";
- throw new SemanticException( message, name.getFilename(), name.getLine(), name.getColumn());
+ || token.getText().equals("h4") || token.getText().equals("li")) {
+ require = true;
}
}
}
+
+
+ return require;
}
- public void validateHeaderMarkup(Token token, java.util.Stack <Token> htmlElementStack) throws TokenStreamException, SemanticException{
+ public void healingHeaderMarkup(java.util.Stack <Token> htmlElementStack) throws TokenStreamException, SemanticException{
int EOF = 1;
int ALPHANUMERICWORD = 4;
int i = 0;
- int type;
+ Token token;
boolean containText = false;
-
- Token element = htmlElementStack.peek();
- String header = element.getText();
-
- if (header.equals("h1") || header.equals("h2") || header.equals("h3") || header.equals("h4")) {
- do {
- i++;
- type = LT(i).getType();
- if (type == ALPHANUMERICWORD) {
- containText = true;
- break;
- }
-
- } while ( type != EOF);
+
+ do {
+ i++;
+ token = LT(i);
- if (!containText) {
- String message = "You must have some text following a heading";
- throw new SemanticException( message, element.getFilename(), element.getLine(), element.getColumn());
- }
- }
-
- }
+ if (token.getType() == ALPHANUMERICWORD) {
+ if(!isHeader(token)) {
+ containText = true;
+ }
+ break;
+ }
+
+ } while ( token.getType() != EOF);
+
+ if (!containText) {
+ append("<span></span>");
+ }
+ }
public String createSimpleSeamText(Token token) throws SemanticException{
@@ -267,7 +267,13 @@
String name = element.getText().toLowerCase();
return htmlSeamTextElements.contains(name);
}
-
+
+
+ public boolean isSimpleSeamTextElement(Token element){
+ String name = element.getText().toLowerCase();
+ return simpleHtmlSeamTextElements.contains(name);
+ }
+
public String escapeSeamText(Token token, java.util.Stack <Token> parentHtmlTokens) throws TokenStreamException {
@@ -316,7 +322,8 @@
| lt:ESCAPED_LT {append(escapeSeamText(lt, htmlElementStack));}
| gt:ESCAPED_GT {append(escapeSeamText(gt, htmlElementStack));}
| amp:ESCAPED_AMP {append(escapeSeamText(amp, htmlElementStack));}
- | qout:ESCAPED_QOUT {append(escapeSeamText(qout, htmlElementStack));}
+ | qout:ESCAPED_QOUT {append(escapeSeamText(qout, htmlElementStack));}
+ | nbsp:NBSP {append(nbsp.getText());}
;
eof: EOF;
@@ -424,23 +431,24 @@
LT name:ALPHANUMERICWORD
{
-
sanitizer.validateHtmlElement(name);
- if (isSeamTextElement(name)) {
- if (isList(name)) {
- validateNestedMarkup(name, htmlElementStack);
- } else if (isListItem(name)) {
- append(createSeamTextList(name,htmlElementStack));
- } else if (isHeader(name)) {
- validateNestedMarkup(name, htmlElementStack);
+
+ Token token = null;
+
+ if (isSeamTextElement(name) && !isPlainHMTLRequired(name, htmlElementStack)) {
+ if (isListItem(name)) {
+ append(createSeamTextList(name, htmlElementStack));
+ } else if (isHeader(name)) {
append(createSeamTextHeader(name));
- }
+ }
- } else {
- append("<");
- append(name.getText());
+ } else if(!isSimpleSeamTextElement(name)){
+ append("<");
+ append(name.getText());
+
}
+
htmlElementStack.push(name);
}
@@ -458,12 +466,19 @@
beforeBody: GT {
- Token name = htmlElementStack.peek();
+ Token name = htmlElementStack.pop();
if(isSeamTextElement(name)){
- append(createSimpleSeamText(name));
+ if(isSimpleSeamTextElement(name)) {
+ append(createSimpleSeamText(name));
+ } else if( isPlainHMTLRequired(name,htmlElementStack)) {
+ append(">");
+
+ }
} else {
append(">");
}
+ htmlElementStack.push(name);
+
}
;
exception
@@ -479,19 +494,30 @@
closeTagWithBody:
LT SLASH name:ALPHANUMERICWORD GT
- {
+ {
+ htmlElementStack.pop();
+
if(isSeamTextElement(name)){
- if(isLink(name)){
+
+ if(isLink(name)){
append(createSeamTextLink(linkHolder,linkValueCollector.toString().trim()));
} else {
append(createSimpleSeamText(name));
}
- if(isListItem(name) || isHeader(name)) {
- append("\n");
- validateHeaderMarkup(name,htmlElementStack);
- }
-
+
+ if(!isPlainHMTLRequired(name, htmlElementStack)) {
+ if(isHeader(name)) {
+ append("\n");
+ healingHeaderMarkup(htmlElementStack);
+ }
+
+ } else if(isHeader(name)|| isList(name) || isListItem(name)) {
+ append("</");
+ append(name.getText());
+ append(">");
+ }
+
} else {
append("</");
append(name.getText());
@@ -499,7 +525,6 @@
}
- htmlElementStack.pop();
}
;
@@ -775,6 +800,8 @@
ESCAPED_QOUT : """
;
+NBSP : " "
+ ;
17 years, 1 month
JBoss Rich Faces SVN: r11048 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/tree and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-11-06 13:01:04 -0500 (Thu, 06 Nov 2008)
New Revision: 11048
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Log:
Tree test
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-06 16:39:16 UTC (rev 11047)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-06 18:01:04 UTC (rev 11048)
@@ -29,6 +29,8 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import org.richfaces.component.UITree;
+import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeNodeImpl;
@@ -43,6 +45,10 @@
private static final String DATA_PATH = "/simple-tree-data.properties";
+ public void processSelection(NodeSelectedEvent event) {
+ UITree tree = (UITree) event.getComponent();
+ }
+
private void addNodes(String path, TreeNode<String> node, Properties properties) {
boolean end = false;
int counter = 1;
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-06 16:39:16 UTC (rev 11047)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-06 18:01:04 UTC (rev 11048)
@@ -1,5 +1,8 @@
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
@@ -7,6 +10,14 @@
public class TreeTest extends SeleniumTestBase {
+ private static Map<String, String> params = new HashMap<String, String>();
+
+ static {
+ params.put("parameter1", "value1");
+ params.put("parameter2", "value2");
+ params.put("parameter3", "value3");
+ }
+
@Test
public void testRenderedAttribute(Template template) {
AutoTester tester = getAutoTester(this);
@@ -15,7 +26,26 @@
tester.testRendered();
}
+ @Test
+ public void testNestedParams(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component encodes nested f:param tags and their values are present as request parameters");
+ tester.testRequestParameters(params);
+ }
+
@Override
+ public void sendAjax() {
+ String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ //String node1Id = compId + ":1::_defaultNodeFaceOutput";
+ String node1Id = compId + ":1::_defaultNodeFace:text";
+ //String node1Id = compId + ":1::_defaultNodeFace";
+ selenium.mouseOver(node1Id);
+ selenium.mouseDown(node1Id);
+ waitForAjaxCompletion();
+ }
+
+ @Override
public String getTestUrl() {
return "pages/tree/treeTest.xhtml";
}
17 years, 1 month
JBoss Rich Faces SVN: r11047 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-06 11:39:16 -0500 (Thu, 06 Nov 2008)
New Revision: 11047
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
Log:
RF-4842
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-06 16:13:31 UTC (rev 11046)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-06 16:39:16 UTC (rev 11047)
@@ -71,6 +71,31 @@
private String showButtonLabelsId;
/**
+ * JS API is present and works
+ */
+ @Test
+ public void testJSAPI(Template template) {
+ renderPage(template, initMethod);
+ initFields();
+ selenium.runScript("var listShuttle = ($('" + orderingListId + "')).component;");
+ Assert.assertTrue("4".equals(selenium.getEval("window.listShuttle.getItems().length")));
+ Assert.assertTrue("0".equals(selenium.getEval("window.listShuttle.getSelection().length")));
+ _checkOrdering(new String[]{"0", "1", "2", "3"});
+ selenium.click(firstRow);
+ Assert.assertTrue("1".equals(selenium.getEval("window.listShuttle.getSelection().length")));
+ selenium.runScript("listShuttle.down()");
+ _checkOrdering(new String[]{"1", "0", "2", "3"});
+ selenium.runScript("listShuttle.bottom()");
+ _checkOrdering(new String[]{"1", "2", "3", "0"});
+ selenium.runScript("listShuttle.up()");
+ _checkOrdering(new String[]{"1", "2", "0", "3"});
+ selenium.runScript("listShuttle.top()");
+ _checkOrdering(new String[]{"0", "1", "2", "3"});
+
+
+ }
+
+ /**
* Check 'fastOrderControlsVisible' and 'orderControlsVisible' attributes
*/
@Test
@@ -246,6 +271,15 @@
}
}
+ private void _checkOrdering(String[] ordering) {
+ for (int i = 0; i < ordering.length; i++) {
+ Assert.assertEquals(selenium.
+ getAttribute("xpath=id('" + orderingListId +"tbody')/tr[" + (i + 1) + "]@id"),
+ orderingListId + ":" + ordering[i]);
+ }
+
+ }
+
private void initFields() {
String formId = getParentId() + "_form:";
String attrFormId = getParentId() + "attrFormId";
17 years, 1 month
JBoss Rich Faces SVN: r11046 - in trunk/framework/impl/src: test/java/org/ajax4jsf/io/parser and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-06 11:13:31 -0500 (Thu, 06 Nov 2008)
New Revision: 11046
Added:
trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferOutputStreamTest.java
trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferWriterTest.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/io/ByteBuffer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/CharBuffer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferOutputStream.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferWriter.java
Log:
Reset methods implemented for FastBufferOutputStream and FastWriter
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/ByteBuffer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/ByteBuffer.java 2008-11-06 13:58:51 UTC (rev 11045)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/ByteBuffer.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -205,4 +205,13 @@
return new CharBuffer(s.toCharArray());
}
+ /**
+ * Resets this byte buffer to empty state
+ * @since 3.3.0
+ */
+ public void reset() {
+ usedSize = 0;
+ next = null;
+ prev = null;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/CharBuffer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/CharBuffer.java 2008-11-06 13:58:51 UTC (rev 11045)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/CharBuffer.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -208,4 +208,13 @@
return new ByteBuffer(bs);
}
+ /**
+ * Resets this char buffer to empty state
+ * @since 3.3.0
+ */
+ public void reset() {
+ usedSize = 0;
+ next = null;
+ prev = null;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferOutputStream.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferOutputStream.java 2008-11-06 13:58:51 UTC (rev 11045)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferOutputStream.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -204,4 +204,15 @@
return new FastBufferWriter(first);
}
+ /**
+ * Resets stream to empty state
+ *
+ * @since 3.3.0
+ */
+ public void reset() {
+ this.firstBuffer.reset();
+ this.lastBuffer = this.firstBuffer;
+
+ this.length = 0;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferWriter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferWriter.java 2008-11-06 13:58:51 UTC (rev 11045)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/FastBufferWriter.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -78,6 +78,7 @@
*/
public void write(int c) throws IOException {
lastBuffer = lastBuffer.append((char)c);
+ length++;
}
/**
@@ -132,7 +133,7 @@
public void flush() throws IOException {
}
-
+
/**
* Writes all data written up to the moment to string buffer.
* @param out
@@ -212,5 +213,16 @@
}
return new FastBufferOutputStream(first);
}
+
+ /**
+ * Resets writer to empty state
+ *
+ * @since 3.3.0
+ */
+ public void reset() {
+ this.firstBuffer.reset();
+ this.lastBuffer = this.firstBuffer;
+ this.length = 0;
+ }
}
Added: trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferOutputStreamTest.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferOutputStreamTest.java (rev 0)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferOutputStreamTest.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.io.parser;
+
+import junit.framework.TestCase;
+
+import org.ajax4jsf.io.ByteBuffer;
+import org.ajax4jsf.io.FastBufferOutputStream;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class FastBufferOutputStreamTest extends TestCase {
+
+ /**
+ * Test method for {@link org.ajax4jsf.io.FastBufferOutputStream#reset()}.
+ */
+ public void testResetOneBuffer() throws Exception {
+ FastBufferOutputStream stream = new FastBufferOutputStream(256);
+ for (int i = 0; i < 255; i++) {
+ stream.write(i);
+ }
+
+ assertEquals(255, stream.getLength());
+ ByteBuffer firstBuffer = stream.getFirstBuffer();
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+
+ stream.reset();
+
+ assertEquals(0, stream.getLength());
+ firstBuffer = stream.getFirstBuffer();
+ assertEquals(0, firstBuffer.getUsedSize());
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.io.FastBufferOutputStream#reset()}.
+ */
+ public void testResetTwoBuffers() throws Exception {
+ FastBufferOutputStream stream = new FastBufferOutputStream(256);
+ for (int i = 0; i < 257; i++) {
+ stream.write(i);
+ }
+
+ assertEquals(257, stream.getLength());
+ ByteBuffer firstBuffer = stream.getFirstBuffer();
+ assertNotNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+
+ stream.reset();
+
+ assertEquals(0, stream.getLength());
+ firstBuffer = stream.getFirstBuffer();
+ assertEquals(0, firstBuffer.getUsedSize());
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+ }
+
+}
Added: trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferWriterTest.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferWriterTest.java (rev 0)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastBufferWriterTest.java 2008-11-06 16:13:31 UTC (rev 11046)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.io.parser;
+
+import junit.framework.TestCase;
+
+import org.ajax4jsf.io.CharBuffer;
+import org.ajax4jsf.io.FastBufferWriter;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class FastBufferWriterTest extends TestCase {
+
+ /**
+ * Test method for {@link org.ajax4jsf.io.FastBufferWriter#reset()}.
+ */
+ public void testResetOneBuffer() throws Exception {
+ FastBufferWriter stream = new FastBufferWriter(256);
+ for (int i = 0; i < 255; i++) {
+ stream.write(i);
+ }
+
+ assertEquals(255, stream.getLength());
+ CharBuffer firstBuffer = stream.getFirstBuffer();
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+
+ stream.reset();
+
+ assertEquals(0, stream.getLength());
+ firstBuffer = stream.getFirstBuffer();
+ assertEquals(0, firstBuffer.getUsedSize());
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.io.FastBufferWriter#reset()}.
+ */
+ public void testResetTwoBuffers() throws Exception {
+ FastBufferWriter stream = new FastBufferWriter(256);
+ for (int i = 0; i < 257; i++) {
+ stream.write(i);
+ }
+
+ assertEquals(257, stream.getLength());
+ CharBuffer firstBuffer = stream.getFirstBuffer();
+ assertNotNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+
+ stream.reset();
+
+ assertEquals(0, stream.getLength());
+ firstBuffer = stream.getFirstBuffer();
+ assertEquals(0, firstBuffer.getUsedSize());
+ assertNull(firstBuffer.getNext());
+ assertNull(firstBuffer.getPrevious());
+ }
+
+}
17 years, 1 month
JBoss Rich Faces SVN: r11044 - Plan and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-11-06 08:24:43 -0500 (Thu, 06 Nov 2008)
New Revision: 11044
Modified:
trunk/test-applications/qa/Test Plan/AutomatedAttributesTestApp.doc
Log:
Modified: trunk/test-applications/qa/Test Plan/AutomatedAttributesTestApp.doc
===================================================================
(Binary files differ)
17 years, 1 month
JBoss Rich Faces SVN: r11043 - trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/resources.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-11-06 07:43:15 -0500 (Thu, 06 Nov 2008)
New Revision: 11043
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java
Log:
Editor html resource renderer implementation
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java 2008-11-06 11:53:32 UTC (rev 11042)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java 2008-11-06 12:43:15 UTC (rev 11043)
@@ -27,6 +27,8 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.faces.context.FacesContext;
@@ -46,6 +48,8 @@
private final static String SPECIFIC_SCRIPT_RESOURCE_NAME = "org/richfaces/renderkit/html/1$1.js";
private final static String SPECIFIC_XCSS_RESOURCE_NAME = "org/richfaces/renderkit/html/1$1.xcss";
+ private final static String REGEXP = "\\<(script|link|img)\\s+.*(?:src|href)\\s*=\\s*[\"']([^'\"]+)\\.([^\\'\"]+)[\"'][^>]*\\>";
+
/**
* @see org.ajax4jsf.resource.BaseResourceRenderer#getCommonAttrs()
*/
@@ -105,37 +109,43 @@
*/
private int updateAndSendResource(InputStream in, OutputStream out) throws IOException {
- //TODO Pasha, replace with regular expression if needed?
-
int total = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
String scriptSuffix = getSriptMappingSuffix();
String cssSuffix = getCssMappingSuffix();
+
+ Pattern pattern = Pattern.compile(REGEXP, Pattern.CASE_INSENSITIVE);
+
try {
while (br.ready()) {
String line = br.readLine();
- if(scriptSuffix != null && line.indexOf("script") != -1 && line.indexOf("src=") != -1){
- if (line.indexOf(".js") != -1) {
- line = line.replace(".js", ".js" + scriptSuffix);
+
+
+ Matcher matcher = pattern.matcher(line);
+ if (matcher.find()){
+ String tagName = matcher.group(1);
+
+ if(scriptSuffix != null && tagName.toLowerCase().equals("script")){
+ String path = matcher.group(2);
+ String extension = matcher.group(3);
+ line = line.replace(path + "." + extension, path + "." + extension + scriptSuffix);
}
- }
- if(scriptSuffix != null && line.indexOf("img") != -1 && line.indexOf("src=") != -1 && line.indexOf("src=\"http:") == -1){
- if (line.indexOf(".gif") != -1) {
- line = line.replace(".gif", ".gif" + scriptSuffix);
+
+ if(scriptSuffix != null && tagName.toLowerCase().equals("img")){
+ String path = matcher.group(2);
+ String extension = matcher.group(3);
+ if(path.indexOf("http://") == -1){
+ line = line.replace(path + "." + extension, path + "." + extension + scriptSuffix);
+ }
}
- if (line.indexOf(".png") != -1) {
- line = line.replace(".png", ".png" + scriptSuffix);
+
+ if(cssSuffix != null && tagName.toLowerCase().equals("link")){
+ String path = matcher.group(2);
+ String extension = matcher.group(3);
+ line = line.replace(path + "." + extension, path + "." + "xcss" + cssSuffix);
}
- if (line.indexOf(".jpg") != -1) {
- line = line.replace(".jpg", ".jpg" + scriptSuffix);
- }
}
- if(cssSuffix != null && line.indexOf("link") != -1 && line.indexOf("href=") != -1){
- if (line.indexOf(".css") != -1) {
- line = line.replace(".css", ".xcss" + cssSuffix);
- }
- }
bw.write(line);
bw.newLine();
total += line.getBytes().length;
17 years, 1 month
JBoss Rich Faces SVN: r11042 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/contextMenu and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-06 06:53:32 -0500 (Thu, 06 Nov 2008)
New Revision: 11042
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ContextMenuTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenuAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
Log:
Context Menu test
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ContextMenuTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ContextMenuTestBean.java 2008-11-06 08:27:13 UTC (rev 11041)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ContextMenuTestBean.java 2008-11-06 11:53:32 UTC (rev 11042)
@@ -35,6 +35,7 @@
private String submitMode = "none";
private Boolean attached = false;
private String attacheTo = "";
+ private Boolean disableDefault = true;
public ContextMenuTestBean() {
value = "";
@@ -68,6 +69,11 @@
attached = true;
return null;
}
+
+ public String testDisableDefault() {
+ disableDefault = false;
+ return null;
+ }
public String getValue() {
return value;
@@ -95,6 +101,7 @@
attached = false;
attacheTo = "";
status = null;
+ disableDefault = true;
}
public int getValue2() {
@@ -170,4 +177,18 @@
this.status = status;
}
+ /**
+ * @return the disableDefault
+ */
+ public Boolean getDisableDefault() {
+ return disableDefault;
+ }
+
+ /**
+ * @param disableDefault the disableDefault to set
+ */
+ public void setDisableDefault(Boolean disableDefault) {
+ this.disableDefault = disableDefault;
+ }
+
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenuAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenuAutoTest.xhtml 2008-11-06 08:27:13 UTC (rev 11041)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenuAutoTest.xhtml 2008-11-06 11:53:32 UTC (rev 11042)
@@ -11,14 +11,14 @@
<rich:contextMenu id="componentId"
immediate="#{autoTestBean.immediate}"
ajaxSingle="#{autoTestBean.ajaxSingle}"
-
+ reRender="#{autoTestBean.reRender}"
limitToList="#{autoTestBean.limitToList}"
bypassUpdates="#{autoTestBean.bypassUpdate}"
+ actionListener="#{autoTestBean.actionListener}"
rendered="#{autoTestBean.rendered}"
submitMode="ajax"
>
<rich:menuItem id="item1"
- actionListener="#{autoTestBean.actionListener}"
value="Item1"
oncomplete="#{autoTestBean.oncomplete}" />
<f:param name="parameter1" value="value1" />
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-06 08:27:13 UTC (rev 11041)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-06 11:53:32 UTC (rev 11042)
@@ -44,6 +44,12 @@
String contextMenuId;
String autoCreatedId;
String contextMenuBody;
+
+ final static Map<String, String> PARAMS = new HashMap<String, String>();
+ static {
+ PARAMS.put("parameter1", "value1");
+ PARAMS.put("parameter2", "value2");
+ }
void initIds(String parentId, String contextMenuId) {
parentId = getParentId() + FORMID;
@@ -75,8 +81,56 @@
}
+ @Test
+ public void testLimitToList(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testLimitToList();
+ }
@Test
+ public void testByPassUpdate(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testBypassUpdate();
+ }
+
+ @Test
+ public void testReRender(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testReRender();
+ }
+
+ @Test
+ public void testNestedParams(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testRequestParameters(PARAMS);
+ }
+
+ @Test
+ public void testDisableDefault(Template template) {
+ renderPage(template, RESET_METHOD);
+ initIds(getParentId(), "contextMenu2");
+
+ String menuScript = getContextMenuScript(contextMenuId);
+ Assert.assertTrue(menuScript.indexOf("Richfaces.disableDefaultHandler") != -1, "DisableDefaultMenu = true does not work");
+
+ String controlId = getParentId() + "_controls:testDisableDefault";
+ clickCommandAndWait(controlId);
+
+ menuScript = getContextMenuScript(contextMenuId);
+ Assert.assertTrue(menuScript.indexOf("Richfaces.disableDefaultHandler") == -1, "DisableDefaultMenu = false does not work");
+
+ }
+
+
+ @Test
public void testRendered(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -256,8 +310,13 @@
Assert.fail(message + e.getMessage());
}
}
+
+ private String getContextMenuScript(String id) {
+ return getHTMLById(id);
+
+ }
- @Test
+ @Test
public void testContextMenuStandAlone(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -279,7 +338,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ @Test
public void testComponentControlManagement(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -301,7 +360,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ @Test
public void testMacrodefinitions(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
17 years, 1 month
JBoss Rich Faces SVN: r11041 - trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2008-11-06 03:27:13 -0500 (Thu, 06 Nov 2008)
New Revision: 11041
Modified:
trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
Log:
sort image width and height attributes moved to extdt-header-sort-img CSS class
Modified: trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
===================================================================
--- trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2008-11-06 08:27:00 UTC (rev 11040)
+++ trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2008-11-06 08:27:13 UTC (rev 11041)
@@ -488,6 +488,8 @@
.extdt-header-sort-img {
vertical-align: middle;
+ width: 15px;
+ height: 15px;
}
</f:verbatim>
17 years, 1 month