JBoss Rich Faces SVN: r11300 - in trunk: framework/api/src/main/java/org/ajax4jsf/component and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-21 17:17:26 -0500 (Fri, 21 Nov 2008)
New Revision: 11300
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
Log:
https://jira.jboss.org/jira/browse/RF-4960
Modified: trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent 2008-11-21 22:17:26 UTC (rev 11300)
@@ -101,6 +101,10 @@
<classname>int</classname>
<description>Response waiting time on a particular request. If a response is not received during this time, the request is aborted</description>
</property>
+ <property>
+ <name>similarityGroupingId</name>
+ <classname>java.lang.String</classname>
+ </property>
<!--
<property >
<name></name>
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2008-11-21 22:17:26 UTC (rev 11300)
@@ -216,4 +216,14 @@
*/
public abstract String getFocus();
+ /**
+ *
+ */
+ public abstract void setSimilarityGroupingId(String similarityGroupingId);
+
+ /**
+ *
+ */
+ public abstract String getSimilarityGroupingId();
+
}
\ No newline at end of file
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-11-21 22:17:26 UTC (rev 11300)
@@ -167,6 +167,10 @@
public abstract void setRequestDelay(int requestDelay);
+ public abstract String getSimilarityGroupingId();
+
+ public abstract void setSimilarityGroupingId(String similarityGroupingId);
+
public abstract String getTableStyleClass();
public abstract void setTableStyleClass(String tableStyleClass);
Modified: trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
===================================================================
--- trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2008-11-21 22:17:26 UTC (rev 11300)
@@ -248,6 +248,13 @@
public void setRequestDelay(int newvalue) {
}
+ public String getSimilarityGroupingId() {
+ return null;
+ }
+
+ public void setSimilarityGroupingId(String similarityGroupingId) {
+ }
+
public int getTimeout() {
return 0;
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-11-21 22:17:26 UTC (rev 11300)
@@ -802,6 +802,10 @@
public abstract void setAdviseNodeSelected(MethodBinding adviseNodeSelected);
+ public abstract String getSimilarityGroupingId();
+
+ public abstract void setSimilarityGroupingId(String similarityGroupingId);
+
public void addChangeExpandListener(NodeExpandedListener listener) {
addFacesListener(listener);
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2008-11-21 19:55:04 UTC (rev 11299)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2008-11-21 22:17:26 UTC (rev 11300)
@@ -61,6 +61,7 @@
private Object reRender = null;
private String status = null;
private String eventsQueue = null;
+ private String similarityGroupingId = null;
private int requestDelay = Integer.MIN_VALUE;
private String oncomplete = null;
private String focus = null;
@@ -346,7 +347,7 @@
}
public Object saveState(FacesContext context) {
- Object[] state = new Object[16];
+ Object[] state = new Object[17];
state[0] = super.saveState(context);
state[1] = this.dragType;
state[2] = this.acceptedTypes;
@@ -363,6 +364,7 @@
state[13] = this.data;
state[14] = new Boolean(this.ignoreDupResponses);
state[15] = new Integer(this.timeout);
+ state[16] = this.similarityGroupingId;
return state;
}
@@ -385,6 +387,7 @@
this.data = _state[13];
this.ignoreDupResponses = ((Boolean)_state[14]).booleanValue();
this.timeout = ((Integer)_state[15]).intValue();
+ this.similarityGroupingId = (String) _state[16];
}
public void setDragIndicator(String dragIndicator) {
@@ -710,6 +713,32 @@
}
/**
+ * @param similarityGroupingId - new value
+ */
+ public void setSimilarityGroupingId(String __similarityGroupingId) {
+ this.similarityGroupingId = __similarityGroupingId;
+ }
+
+ /**
+ * @return similarityGroupingId value from local variable or value bindings
+ */
+ public String getSimilarityGroupingId() {
+ if (null != this.similarityGroupingId) {
+ return this.similarityGroupingId;
+ }
+ ValueBinding vb = getValueBinding("similarityGroupingId");
+ if (null != vb) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ UITree tree = getUITree();
+ if (tree != null) {
+ return tree.getSimilarityGroupingId();
+ }
+ return null;
+ }
+ }
+
+ /**
* Attribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send.
When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
* Setter for requestDelay
17 years, 1 month
JBoss Rich Faces SVN: r11299 - 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-21 14:55:04 -0500 (Fri, 21 Nov 2008)
New Revision: 11299
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:
https://jira.jboss.org/jira/browse/RF-4825
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-21 18:33:23 UTC (rev 11298)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-21 19:55:04 UTC (rev 11299)
@@ -193,23 +193,51 @@
this.toggleOnClick = toggleOnClick;
}
+ private boolean ajaxSubmitSelection = false;
+
+ /**
+ * Gets value of ajaxSubmitSelection field.
+ * @return value of ajaxSubmitSelection field
+ */
+ public boolean isAjaxSubmitSelection() {
+ return ajaxSubmitSelection;
+ }
+
+ /**
+ * Set a new value for ajaxSubmitSelection field.
+ * @param ajaxSubmitSelection a new value for ajaxSubmitSelection field
+ */
+ public void setAjaxSubmitSelection(boolean ajaxSubmitSelection) {
+ this.ajaxSubmitSelection = ajaxSubmitSelection;
+ }
+
public void initToggleOnClickTestServerMode() {
setToggleOnClick(true);
setSwitchType("server");
+ setAjaxSubmitSelection(false);
}
public void initToggleOnClickTestAjaxMode() {
setToggleOnClick(true);
setSwitchType("ajax");
+ setAjaxSubmitSelection(false);
}
public void initToggleOnClickTestClientMode() {
setToggleOnClick(true);
setSwitchType("client");
+ setAjaxSubmitSelection(false);
}
public void initAjaxCoreTest() {
setSwitchType("ajax");
setToggleOnClick(false);
+ setAjaxSubmitSelection(false);
}
+
+ public void initAjaxSubmitSelectionTest() {
+ setSwitchType("client");
+ setAjaxSubmitSelection(true);
+ setToggleOnClick(false);
+ }
}
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-21 18:33:23 UTC (rev 11298)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-21 19:55:04 UTC (rev 11299)
@@ -17,6 +17,7 @@
private final static String INIT_TOGGLE_ON_CLICK_AJAX_MODE = "#{treeBean.initToggleOnClickTestAjaxMode}";
private final static String INIT_TOGGLE_ON_CLICK_CLIENT_MODE = "#{treeBean.initToggleOnClickTestClientMode}";
private final static String INIT_AJAX_CORE_TEST = "#{treeBean.initAjaxCoreTest}";
+ private final static String INIT_AJAX_SUBMIT_SELECTION = "#{treeBean.initAjaxSubmitSelectionTest}";
static {
params.put("parameter1", "value1");
@@ -196,6 +197,36 @@
tester.checkUpdateModel(false);
}
+ //@Test
+ public void testAjaxSubmitSelection(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, INIT_AJAX_SUBMIT_SELECTION);
+ tester.reset();
+ tester.clickLoad();
+ writeStatus("test ajaxSubmitSelection attribute");
+ tester.startTracing();
+ writeStatus("the form has to be submitted and proper listeners are invoked at every node click");
+ String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td[3]");
+ tester.checkUpdateModel(true);
+ tester.startTracing();
+ selenium.click("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
+ clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
+ tester.checkUpdateModel(true);
+ tester.checkNodeExpandedListener(true);
+ tester.startTracing();
+ selenium.click("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
+ clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/div/table[1]/tbody/tr/td[3]");
+ tester.checkUpdateModel(true);
+ tester.checkNodeExpandedListener(true);
+ tester.startTracing();
+ writeStatus("Set external validation to fail and click on node. No listeners must be invoked");
+ tester.setExtrenalValidationFailed();
+ clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/div/table[2]/tbody/tr/td[3]");
+ tester.checkUpdateModel(false);
+ tester.checkNodeExpandedListener(false);
+ }
+
@Override
public void sendAjax() {
AutoTester tester = getAutoTester(this);
17 years, 1 month
JBoss Rich Faces SVN: r11298 - in trunk/ui/core/src: main/java/org/ajax4jsf/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-21 13:33:23 -0500 (Fri, 21 Nov 2008)
New Revision: 11298
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml
Modified:
trunk/ui/core/src/main/config/component/queue.xml
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml
trunk/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js
Log:
https://jira.jboss.org/jira/browse/RF-4972
Modified: trunk/ui/core/src/main/config/component/queue.xml
===================================================================
--- trunk/ui/core/src/main/config/component/queue.xml 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/main/config/component/queue.xml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -24,10 +24,6 @@
<classname>org.ajax4jsf.taglib.html.facelets.QueueHandler</classname>
</taghandler>
-->
- <property>
- <name>enabled</name>
- <classname>java.lang.Boolean</classname>
- </property>
<property>
<name>size</name>
<classname>java.lang.Integer</classname>
@@ -38,10 +34,6 @@
<defaultvalue>""</defaultvalue>
</property>
- <property>
- <name>limitToList</name>
- <classname>java.lang.Boolean</classname>
- </property>
<property >
<name>requestDelay</name>
<classname>java.lang.Integer</classname>
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -34,6 +34,7 @@
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.html.scripts.QueueScript;
import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.util.MessageUtil;
/**
* @author Nick Belaevski
@@ -41,6 +42,10 @@
*/
public class QueueRenderer extends HeaderResourcesRendererBase {
+ private static final String SIZE_EXCEEDED_BEHAVIOR = "sizeExceededBehavior";
+
+ private static final String SIZE = "size";
+
private static final String QUEUE_ONSUBMIT_ATTRIBUTE = "queueonsubmit";
private static final String QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE = "queueonbeforedomupdate";
@@ -49,11 +54,14 @@
private static final String QUEUE_ONERROR_ATTRIBUTE = "queueonerror";
- private static final String[] QUEUE_ATTRIBUTES = new String[] {
- "size",
- "sizeExceededBehavior"
- };
+ public static final String BEHAVIOR_DROP_NEXT = "dropNext";
+
+ public static final String BEHAVIOR_DROP_NEW = "dropNew";
+ public static final String BEHAVIOR_FIRE_NEXT = "fireNext";
+
+ public static final String BEHAVIOR_FIRE_NEW = "fireNew";
+
private static final String[] REQUEST_ATTRIBUTES = new String[] {
"requestDelay",
"timeout",
@@ -99,18 +107,32 @@
return true;
}
+ private boolean isValidBehaviorValue(String value) {
+ return BEHAVIOR_DROP_NEW.equals(value) || BEHAVIOR_DROP_NEXT.equals(value) ||
+ BEHAVIOR_FIRE_NEW.equals(value) || BEHAVIOR_FIRE_NEXT.equals(value);
+ }
+
private QueueRendererData createRendererData(FacesContext context, UIQueue queue) {
Map<String, Object> attributes = queue.getAttributes();
QueueRendererData data = new QueueRendererData();
- for (String attributeName : QUEUE_ATTRIBUTES) {
- Object value = attributes.get(attributeName);
- if (isNotEmpty(value)) {
- data.addQueueAttribute(attributeName, value);
+ Integer size = (Integer) attributes.get(SIZE);
+ if (size != null) {
+ data.addQueueAttribute(SIZE, size);
+ }
+
+ String sizeExceededBehavior = (String) attributes.get(SIZE_EXCEEDED_BEHAVIOR);
+ if (isNotEmpty(sizeExceededBehavior)) {
+ if (!isValidBehaviorValue(sizeExceededBehavior)) {
+ throw new IllegalArgumentException(sizeExceededBehavior + " value of " +
+ SIZE_EXCEEDED_BEHAVIOR + " attribute is not a legal one for component: " +
+ MessageUtil.getLabel(context, queue));
}
+
+ data.addQueueAttribute(SIZE_EXCEEDED_BEHAVIOR, sizeExceededBehavior);
}
-
+
for (String attributeName : REQUEST_ATTRIBUTES) {
Object value = attributes.get(attributeName);
if (isNotEmpty(value)) {
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -42,9 +42,7 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.javascript.JSLiteral;
import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.UserResourceRenderer2;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
@@ -105,7 +103,8 @@
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component);
options.put("requestDelay", new JSReference("options.requestDelay"));
- options.put("requestId", new JSReference("options.requestId || '" + component.getClientId(facesContext) + "'"));
+ options.put("similarityGroupingId", new JSReference("options.similarityGroupingId || '" +
+ component.getClientId(facesContext) + "'"));
options.put("data", new JSReference("data"));
options.put("requestTime", new JSReference("options.requestTime"));
options.put("timeout", new JSReference("options.timeout"));
@@ -177,8 +176,8 @@
public ParametersBuilder requestDelay(double value) {
return new ParametersBuilder(this.parameters).put("requestDelay", value);
}
- public ParametersBuilder requestId(Object id) {
- return new ParametersBuilder(this.parameters).put("requestId", id);
+ public ParametersBuilder similarityGroupingId(Object id) {
+ return new ParametersBuilder(this.parameters).put("similarityGroupingId", id);
}
public ParametersBuilder requestTime(double value) {
return new ParametersBuilder(this.parameters).put("requestTime", value);
@@ -319,6 +318,17 @@
page.executeJavaScript(function.toScript());
}
+ private String buildClickExpression(String id) {
+ return "document.getElementById('" + id + "').click()";
+ }
+
+ protected void clickOnTime(int time, String id) {
+ JSFunction function = new JSFunction("simulationContext.executeOnTime",
+ time, new JSFunctionDefinition().addToBody(buildClickExpression(id)));
+
+ page.executeJavaScript(function.toScript());
+ }
+
protected String getRootContextPath() {
return this.getClass().getPackage().getName().replace('.', '/');
}
@@ -415,6 +425,10 @@
return this.page;
}
+ protected void click(String id) {
+ executeJavaScript(buildClickExpression(id));
+ }
+
protected Object executeJavaScript(String expression) {
return page.executeJavaScript(expression).getJavaScriptResult();
}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -40,7 +40,7 @@
protected void checkForm(String formName) throws Exception {
renderView("/queue-ajax-form.xhtml");
- executeJavaScript("$('" + formName + ":link').click()");
+ click(formName + ":link");
executeTimer();
Object resultObject = executeJavaScript("window.testResults." + formName);
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -63,9 +63,9 @@
public void testLegacyQueuesRequestDelay() throws Exception {
renderView("/queue-legacy.xhtml");
- executeOnTime(0, "$('form:buttonDelayed').click()");
- executeOnTime(500, "$('form:buttonDelayed').click()");
- executeOnTime(750, "$('form:buttonDelayed').click()");
+ clickOnTime(0, "form:buttonDelayed");
+ clickOnTime(500, "form:buttonDelayed");
+ clickOnTime(750, "form:buttonDelayed");
TestsResult result = getTestsResult();
List<RequestData> dataList = result.getDataList();
@@ -73,7 +73,7 @@
//request time set to 5000 in .xhtml file
RequestData data = dataList.get(0);
- checkRequestData(data, null, 1750, 6750, false);
+ checkRequestData(data, "form:buttonDelayed", 1750, 6750, false);
assertEquals(6750d, result.getCurrentTime());
}
@@ -81,9 +81,9 @@
public void testLegacyQueuesIgnoreDupResponces() throws Exception {
renderView("/queue-legacy.xhtml");
- executeOnTime(0, "$('form:buttonIgnoreDupResponces').click()");
- executeOnTime(500, "$('form:buttonIgnoreDupResponces').click()");
- executeOnTime(750, "$('form:buttonIgnoreDupResponces').click()");
+ clickOnTime(0, "form:buttonIgnoreDupResponces");
+ clickOnTime(500, "form:buttonIgnoreDupResponces");
+ clickOnTime(750, "form:buttonIgnoreDupResponces");
executeTimer();
TestsResult result = getTestsResult();
@@ -91,9 +91,9 @@
assertEquals(3, dataList.size());
//request time set to 5000 in .xhtml file
- checkRequestData(dataList.get(0), null, 0, 5000, false);
- checkRequestData(dataList.get(1), null, 500, 5500, false);
- checkRequestData(dataList.get(2), null, 750, 5750, false);
+ checkRequestData(dataList.get(0), "form:buttonIgnoreDupResponces", 0, 5000, false);
+ checkRequestData(dataList.get(1), "form:buttonIgnoreDupResponces", 500, 5500, false);
+ checkRequestData(dataList.get(2), "form:buttonIgnoreDupResponces", 750, 5750, false);
assertEquals(5750d, result.getCurrentTime());
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -26,7 +26,6 @@
import org.mozilla.javascript.NativeArray;
-import com.gargoylesoftware.htmlunit.ScriptResult;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -47,18 +46,14 @@
protected void assertListsEqual(List<String> list1, List<String> list2)
throws Exception {
- System.out.println(list1);
- System.out.println(list2);
- System.out.println("xxx");
- assertEquals(list1, list2);
+ assertEquals(list1 + ":" + list2, list1, list2);
}
protected List<String> getResults(HtmlPage page) {
List<String> result = new ArrayList<String>();
- page.executeJavaScript("Timer.execute()");
- ScriptResult scriptResult = page.executeJavaScript("window.testResult");
- NativeArray array = (NativeArray) scriptResult.getJavaScriptResult();
+ executeJavaScript("Timer.execute()");
+ NativeArray array = (NativeArray) executeJavaScript("window.testResult");
for (int i = 0; i < array.getLength(); i++) {
result.add((String) array.get(i, array));
}
@@ -73,24 +68,24 @@
assertListsEqual(list, getResults(page));
list.add("button");
- page.executeJavaScript("$('form:button').click()");
+ click("form:button");
assertListsEqual(list, getResults(page));
list.add("implicitQueue");
- page.executeJavaScript("$('form:implicitQueue').click()");
+ click("form:implicitQueue");
assertListsEqual(list, getResults(page));
list.add("alternativeQueueButton");
list.add("alt:alternativeQueueButton");
- page.executeJavaScript("$('form:alternativeQueueButton').click()");
+ click("form:alternativeQueueButton");
assertListsEqual(list, getResults(page));
list.add("function");
- page.executeJavaScript("ajaxFunction()");
+ executeJavaScript("ajaxFunction()");
assertListsEqual(list, getResults(page));
list.add("implicitDelayedQueue");
- page.executeJavaScript("$('form2:implicitDelayedQueue').click()");
+ click("form2:implicitDelayedQueue");
assertListsEqual(list, getResults(page));
}
@@ -102,36 +97,36 @@
list.add("alternativeQueueButton");
list.add("alt:alternativeQueueButton");
- page.executeJavaScript("$('form2:alternativeQueueButton').click()");
+ click("form2:alternativeQueueButton");
assertListsEqual(list, getResults(page));
list.add("alternativeQueueButton");
- page.executeJavaScript("$('form:alternativeQueueButton').click()");
+ click("form:alternativeQueueButton");
assertListsEqual(list, getResults(page));
list.add("buttonFormQueue");
- page.executeJavaScript("$('form:button').click()");
+ click("form:button");
assertListsEqual(list, getResults(page));
list.add("implicitQueue");
- page.executeJavaScript("$('form:implicitQueue').click()");
+ click("form:implicitQueue");
assertListsEqual(list, getResults(page));
list.add("alternativeQueue1Button");
list.add("alt1:alternativeQueue1Button");
- page.executeJavaScript("$('form:alternativeQueue1Button').click()");
+ click("form:alternativeQueue1Button");
assertListsEqual(list, getResults(page));
list.add("buttonForm2Queue");
- page.executeJavaScript("$('form2:button').click()");
+ click("form2:button");
assertListsEqual(list, getResults(page));
list.add("implicitDelayedQueue");
- page.executeJavaScript("$('form2:implicitDelayedQueue').click()");
+ click("form2:implicitDelayedQueue");
assertListsEqual(list, getResults(page));
list.add("ajaxFunction");
- page.executeJavaScript("ajaxFunction()");
+ executeJavaScript("ajaxFunction()");
assertListsEqual(list, getResults(page));
}
@@ -142,35 +137,35 @@
assertListsEqual(list, getResults(page));
list.add("buttonFormQueue");
- page.executeJavaScript("$('form:button').click()");
+ click("form:button");
assertListsEqual(list, getResults(page));
list.add("implicitDelayedQueue");
- page.executeJavaScript("$('form:implicitDelayedQueue').click()");
+ click("form:implicitDelayedQueue");
assertListsEqual(list, getResults(page));
list.add("implicitQueue");
- page.executeJavaScript("$('form2:implicitQueue').click()");
+ click("form2:implicitQueue");
assertListsEqual(list, getResults(page));
list.add("viewQueue:viewQueueButton");
- page.executeJavaScript("$('form:viewQueueButton').click()");
+ click("form:viewQueueButton");
assertListsEqual(list, getResults(page));
list.add("form2Button");
- page.executeJavaScript("$('form2:button').click()");
+ click("form2:button");
assertListsEqual(list, getResults(page));
list.add("anotherImplicitQueue");
- page.executeJavaScript("$('form3:anotherImplicitQueue').click()");
+ click("form3:anotherImplicitQueue");
assertListsEqual(list, getResults(page));
list.add("form3Button");
- page.executeJavaScript("$('form3:button').click()");
+ click("form3:button");
assertListsEqual(list, getResults(page));
list.add("functionFormQueue");
- page.executeJavaScript("ajaxFunction()");
+ executeJavaScript("ajaxFunction()");
assertListsEqual(list, getResults(page));
}
@@ -181,34 +176,34 @@
assertListsEqual(list, getResults(page));
list.add("button");
- page.executeJavaScript("$('form:button').click()");
+ click("form:button");
assertListsEqual(list, getResults(page));
list.add("formQueueButton");
- page.executeJavaScript("$('form:formQueueButton').click()");
+ click("form:formQueueButton");
assertListsEqual(list, getResults(page));
list.add("button2");
list.add("form2-global:button2");
- page.executeJavaScript("$('form2:button2').click()");
+ click("form2:button2");
assertListsEqual(list, getResults(page));
list.add("formQueueButton2");
list.add("form2-queue:formQueueButton2");
- page.executeJavaScript("$('form2:formQueueButton2').click()");
+ click("form2:formQueueButton2");
assertListsEqual(list, getResults(page));
list.add("global");
- page.executeJavaScript("$('form3:global').click()");
+ click("form3:global");
assertListsEqual(list, getResults(page));
list.add("globalNamed");
- page.executeJavaScript("$('form3:globalNamed').click()");
+ click("form3:globalNamed");
assertListsEqual(list, getResults(page));
list.add("globalNamedX");
list.add("viewNamedX:globalNamedX");
- page.executeJavaScript("$('form3:globalNamedX').click()");
+ click("form3:globalNamedX");
assertListsEqual(list, getResults(page));
}
Added: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -0,0 +1,47 @@
+/**
+ * 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.component;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueParallelTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueueParallelTest(String name) {
+ super(name);
+ }
+
+ public void testParallel() throws Exception {
+ renderView("/queue-parallel.xhtml");
+
+ clickOnTime(0, "form:asyncButton");
+ clickOnTime(0, "form:asyncButton1");
+ clickOnTime(0, "form:asyncButton2");
+
+
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -87,8 +87,8 @@
eventsQueue("queueTimeout").requestDelay(0);
ajax(0, "a", parametersBuilder.requestTime(4999));
- ajax(10000, "b", parametersBuilder.requestTime(5001).requestId("b"));
- ajax(10000, "c", parametersBuilder.requestTime(100).requestId("c"));
+ ajax(10000, "b", parametersBuilder.requestTime(5001).similarityGroupingId("b"));
+ ajax(10000, "c", parametersBuilder.requestTime(100).similarityGroupingId("c"));
ajax(20000, "d", parametersBuilder.requestTime(10000).timeout(10000));
ajax(40000, "e", parametersBuilder.requestTime(10001).timeout(10000));
@@ -111,10 +111,10 @@
ParametersBuilder parametersBuilder = createAjaxParameters().
eventsQueue("queueIgnoreDupResponses").requestDelay(0).requestTime(1000);
- ajax(0, "a", parametersBuilder.requestId("a"));
- ajax(500, "b", parametersBuilder.requestId("a"));
- ajax(2000, "c", parametersBuilder.requestId("a"));
- ajax(2500, "d", parametersBuilder.requestId("a").ignoreDupResponses(false));
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(500, "b", parametersBuilder.similarityGroupingId("a"));
+ ajax(2000, "c", parametersBuilder.similarityGroupingId("a"));
+ ajax(2500, "d", parametersBuilder.similarityGroupingId("a").ignoreDupResponses(false));
TestsResult result = getTestsResult();
List<RequestData> dataList = result.getDataList();
@@ -175,8 +175,8 @@
renderView(VIEW_NAME);
ParametersBuilder queueParameters = createAjaxParameters().requestTime(500).eventsQueue(QUEUE_NAME);
- ajax(50, "a", queueParameters.requestId(0));
- ajax(250, "b", queueParameters.requestId(1));
+ ajax(50, "a", queueParameters.similarityGroupingId(0));
+ ajax(250, "b", queueParameters.similarityGroupingId(1));
TestsResult result = getTestsResult();
List<RequestData> dataList = result.getDataList();
Added: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -0,0 +1,161 @@
+/**
+ * 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.component;
+
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueSimilarityTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueueSimilarityTest(String name) {
+ super(name);
+ }
+
+ private static final String VIEW_NAME = "/queue-similarity.xhtml";
+
+ public void testDefaultBehavior() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "form:button3");
+ clickOnTime(100, "form:button3");
+ clickOnTime(200, "form:button4");
+ clickOnTime(400, "form:button3");
+
+ clickOnTime(4000, "form:button3");
+ clickOnTime(4300, "form:button3");
+ clickOnTime(4500, "form:button3");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "form:button3", 200, 1200, false);
+ checkRequestData(dataList.get(1), "form:button4", 1200, 2200, false);
+ checkRequestData(dataList.get(2), "form:button3", 2200, 3200, false);
+ checkRequestData(dataList.get(3), "form:button3", 5000, 6000, false);
+ }
+
+ public void testGrouping() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "form:button1");
+ clickOnTime(100, "form:button1");
+ clickOnTime(200, "form:button2");
+ clickOnTime(300, "form:button1");
+
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(1, dataList.size());
+
+ checkRequestData(dataList.get(0), "form:button1", 700, 1700, false);
+ }
+
+ public void testSizeExceededGroupingDropNext() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "dropNext:button1");
+ clickOnTime(100, "dropNext:button2");
+ clickOnTime(200, "dropNext:button1");
+ clickOnTime(300, "dropNext:button2");
+ clickOnTime(2000, "dropNext:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "dropNext:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "dropNext:button1", 1100, 2100, false);
+ checkRequestData(dataList.get(2), "dropNext:button2", 2100, 3100, false);
+ checkRequestData(dataList.get(3), "dropNext:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingDropNew() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "dropNew:button1");
+ clickOnTime(100, "dropNew:button2");
+ clickOnTime(200, "dropNew:button1");
+ clickOnTime(300, "dropNew:button2");
+ clickOnTime(2000, "dropNew:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+ checkRequestData(dataList.get(0), "dropNew:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "dropNew:button2", 1100, 2100, false);
+ checkRequestData(dataList.get(2), "dropNew:button1", 2100, 3100, false);
+ checkRequestData(dataList.get(3), "dropNew:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingFireNext() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "fireNext:button1");
+ clickOnTime(100, "fireNext:button2");
+ clickOnTime(200, "fireNext:button1");
+ clickOnTime(300, "fireNext:button2");
+ clickOnTime(2000, "fireNext:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(5, dataList.size());
+ checkRequestData(dataList.get(0), "fireNext:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "fireNext:button2", 300, 1300, false);
+ checkRequestData(dataList.get(2), "fireNext:button1", 1100, 2100, false);
+ checkRequestData(dataList.get(3), "fireNext:button2", 2100, 3100, false);
+ checkRequestData(dataList.get(4), "fireNext:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingFireNew() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "fireNew:button1");
+ clickOnTime(100, "fireNew:button2");
+ clickOnTime(200, "fireNew:button1");
+ clickOnTime(300, "fireNew:button2");
+ clickOnTime(2000, "fireNew:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(5, dataList.size());
+ checkRequestData(dataList.get(0), "fireNew:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "fireNew:button2", 300, 1300, false);
+
+ checkRequestData(dataList.get(2), "fireNew:button2", 1100, 2100, false);
+ checkRequestData(dataList.get(3), "fireNew:button1", 2100, 3100, false);
+ checkRequestData(dataList.get(4), "fireNew:button1", 3100, 4100, false);
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java 2008-11-21 18:33:23 UTC (rev 11298)
@@ -69,7 +69,7 @@
int requestTime = processTimeGenerator.next();
time += userDelay;
- ajax(time, numberFormat.format(i), parametersBuilder.requestId(requestIdGenerator.next()).
+ ajax(time, numberFormat.format(i), parametersBuilder.similarityGroupingId(requestIdGenerator.next()).
requestTime(requestTime));
}
@@ -195,12 +195,12 @@
ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue(queueName).
requestDelay(300).requestTime(300);
- ajax(0, "a", parametersBuilder.requestId("a"));
- ajax(100, "b", parametersBuilder.requestId("b"));
- ajax(200, "c", parametersBuilder.requestId("c"));
- ajax(300, "d", parametersBuilder.requestId("d"));
- ajax(500, "e", parametersBuilder.requestId("e"));
- ajax(600, "f", parametersBuilder.requestId("f"));
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(100, "b", parametersBuilder.similarityGroupingId("b"));
+ ajax(200, "c", parametersBuilder.similarityGroupingId("c"));
+ ajax(300, "d", parametersBuilder.similarityGroupingId("d"));
+ ajax(500, "e", parametersBuilder.similarityGroupingId("e"));
+ ajax(600, "f", parametersBuilder.similarityGroupingId("f"));
TestsResult result = getTestsResult();
return result;
@@ -212,11 +212,11 @@
ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue(queueName).
requestTime(300).requestDelay(200);
- ajax(0, "a", parametersBuilder.requestId("a"));
- ajax(100, "b", parametersBuilder.requestId("b"));
- ajax(400, "c", parametersBuilder.requestId("c"));
- ajax(500, "d", parametersBuilder.requestId("d"));
- ajax(700, "e", parametersBuilder.requestId("e"));
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(100, "b", parametersBuilder.similarityGroupingId("b"));
+ ajax(400, "c", parametersBuilder.similarityGroupingId("c"));
+ ajax(500, "d", parametersBuilder.similarityGroupingId("d"));
+ ajax(700, "e", parametersBuilder.similarityGroupingId("e"));
TestsResult result = getTestsResult();
return result;
@@ -364,7 +364,7 @@
renderView("/queue-size.xhtml");
for (int i = 0; i <= 3; i++) {
- executeOnTime(i, "document.getElementById('form:button" + i + "').click()");
+ clickOnTime(i, "form:button" + i);
}
TestsResult result = getTestsResult();
@@ -373,8 +373,8 @@
assertEquals(2, dataList.size());
//dropNext is default
- checkRequestData(dataList.get(0), null, 0, DEFAULT_REQUEST_TIME, false);
- checkRequestData(dataList.get(1), null, DEFAULT_REQUEST_TIME, DEFAULT_REQUEST_TIME * 2, false);
+ checkRequestData(dataList.get(0), "form:button0", 0, DEFAULT_REQUEST_TIME, false);
+ checkRequestData(dataList.get(1), "form:button3", DEFAULT_REQUEST_TIME, DEFAULT_REQUEST_TIME * 2, false);
NativeArray handlersData = (NativeArray) executeJavaScript("defaultExceededQueueResults");
assertEquals(2, handlersData.getLength());
Modified: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -9,10 +9,6 @@
<body>
<f:view>
<script type="text/javascript">
- function $(name) {
- return document.getElementById(name);
- }
-
window.testResults = {};
</script>
Modified: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -4,10 +4,6 @@
xmlns:a4j="http://richfaces.org/a4j">
<script type="text/javascript">
- function $(id) {
- return document.getElementById(id);
- }
-
window.testResult = new Array();
function addResult(value) {
Modified: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -8,10 +8,6 @@
<script type="text/javascript">
XMLHttpRequest.defaultRequestTime = 5000;
- function $(id) {
- return document.getElementById(id);
- }
-
var counter = 0;
var time = 0;
</script>
Added: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml (rev 0)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -0,0 +1,24 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
+
+ <h:form id="form">
+ <a4j:queue name="queue" />
+
+ <a4j:commandButton id="asyncButton" />
+
+ <a4j:commandButton id="syncButton1" eventsQueue="queue" />
+ <a4j:commandButton id="syncButton2" eventsQueue="queue" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml (rev 0)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml 2008-11-21 18:33:23 UTC (rev 11298)
@@ -0,0 +1,50 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <body>
+ <f:view>
+ <h:form id="form">
+ <a4j:queue name="queue" />
+
+ <a4j:commandButton requestDelay="400" value="Button 1" id="button1" eventsQueue="queue"
+ similarityGroupingId="buttons" />
+
+ <a4j:commandButton requestDelay="400" value="Button 2" id="button2" eventsQueue="queue"
+ similarityGroupingId="buttons" />
+
+ <a4j:commandButton value="Button 3" requestDelay="500" id="button3" eventsQueue="queue" />
+ <a4j:commandButton value="Button 4" requestDelay="500" id="button4" eventsQueue="queue" />
+
+ </h:form>
+
+ <h:form id="dropNext">
+ <a4j:queue name="dropNextQueue" size="3" sizeExceededBehavior="dropNext" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="dropNextQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="dropNextQueue" />
+ </h:form>
+ <h:form id="dropNew">
+ <a4j:queue name="dropNewQueue" size="3" sizeExceededBehavior="dropNew" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="dropNewQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="dropNewQueue" />
+ </h:form>
+ <h:form id="fireNext">
+ <a4j:queue name="fireNextQueue" size="3" sizeExceededBehavior="fireNext" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="fireNextQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="fireNextQueue" />
+ </h:form>
+ <h:form id="fireNew">
+ <a4j:queue name="fireNewQueue" size="3" sizeExceededBehavior="fireNew" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="fireNewQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="fireNewQueue" />
+ </h:form>
+
+ </f:view>
+ </body>
+</html>
Modified: trunk/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js 2008-11-21 18:32:34 UTC (rev 11297)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js 2008-11-21 18:33:23 UTC (rev 11298)
@@ -197,7 +197,7 @@
A4J.AJAX.SubmitQuery = function(query, options) {
XMLHttpRequest.requestTime = options.requestTime || XMLHttpRequest.defaultRequestTime || DEFAULT_REQUEST_TIME;
- XMLHttpRequest.data = options.data;
+ XMLHttpRequest.data = options.data || (query._event && query._event.srcElement.id);
try {
var req = oldSubmitQuery.apply(this, arguments);
17 years, 1 month
JBoss Rich Faces SVN: r11297 - in trunk/framework/impl/src/main: javascript/ajaxjsf and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-21 13:32:34 -0500 (Fri, 21 Nov 2008)
New Revision: 11297
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
Log:
https://jira.jboss.org/jira/browse/RF-4960
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-11-21 17:59:48 UTC (rev 11296)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-11-21 18:32:34 UTC (rev 11297)
@@ -118,6 +118,8 @@
public static final String AJAX_ABORT_ATTR = "ignoreDupResponses";
public static final String AJAX_SINGLE_PARAMETER_NAME = "ajaxSingle";
+
+ public static final String SIMILARITY_GROUPING_ID_ATTR = "similarityGroupingId";
/**
* Static class - protect constructor TODO - make as subclass of chameleon
@@ -341,7 +343,11 @@
options.put("namespace", namespace);
}
- options.put("requestId", clientId);
+ String similarityGroupingId = (String) componentAttributes.get(SIMILARITY_GROUPING_ID_ATTR);
+ if (similarityGroupingId == null || similarityGroupingId.length() == 0) {
+ similarityGroupingId = clientId;
+ }
+ options.put(SIMILARITY_GROUPING_ID_ATTR, similarityGroupingId);
// request timeout.
Integer timeout = (Integer) componentAttributes.get("timeout");
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-21 17:59:48 UTC (rev 11296)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/queue.js 2008-11-21 18:32:34 UTC (rev 11297)
@@ -28,13 +28,13 @@
createRequest: function(data) {
this.request = data.submit();
- this.requestId = data.getRequestId();
+ this.similarityGroupingId = data.getSimilarityGroupingId();
this.request.shouldNotifyQueue = true;
},
clearRequest: function() {
this.request = undefined;
- this.requestId = undefined;
+ this.similarityGroupingId = undefined;
},
getSize: function() {
@@ -104,7 +104,7 @@
},
abortDupResponses: function(data) {
- if (!this.hasNext() && data.getRequestId() == this.requestId) {
+ if (!this.hasNext() && data.getSimilarityGroupingId() == this.similarityGroupingId) {
this.abortCurrentRequest();
}
}
@@ -169,7 +169,7 @@
this.data = undefined;
this.eventsCounter = 0;
- this.requestId = undefined;
+ this.similarityGroupingId = undefined;
this.delayPassed = false;
return data;
@@ -186,9 +186,9 @@
this.pipeline.abortDupResponses(data);
}
- var requestId = data.getRequestId();
+ var similarityGroupingId = data.getSimilarityGroupingId();
- if (this.requestId == requestId) {
+ if (this.similarityGroupingId == similarityGroupingId) {
this.data = data;
data.setEventsCounter(++this.eventsCounter);
@@ -236,7 +236,7 @@
if (!newDataHandled) {
this.data = data;
- this.requestId = requestId;
+ this.similarityGroupingId = similarityGroupingId;
this.startRequestDelay();
}
}
@@ -447,8 +447,8 @@
return request;
},
- getRequestId: function() {
- return this.options.requestId;
+ getSimilarityGroupingId: function() {
+ return this.options.similarityGroupingId;
},
getRequestDelay: function() {
@@ -482,7 +482,7 @@
// LOG.debug("Delay for request not passed yet, have to wait");
// LOG.debug("Queue '" + this.name + "' is empty, nothing to submit");
// LOG.debug("Request in queue '" + this.name + "' is active now, wait until its completion");
-// LOG.debug("New event added to queue '" + this.name + "'. Queue requestId changed to " + requestId);
+// LOG.debug("New event added to queue '" + this.name + "'. Queue similarityGroupingId changed to " + similarityGroupingId);
var extendOptions = function(options) {
var opts = {};
17 years, 1 month
JBoss Rich Faces SVN: r11296 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-21 12:59:48 -0500 (Fri, 21 Nov 2008)
New Revision: 11296
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/orderingList/orderingListTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
Log:
RF-4944
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/orderingList/orderingListTest.xhtml
===================================================================
(Binary files differ)
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-21 17:29:09 UTC (rev 11295)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-21 17:59:48 UTC (rev 11296)
@@ -38,6 +38,8 @@
private String inputTextId;
+ private String requiredInputId;
+
private String orderingListId;
private String orderingListTableId;
@@ -128,6 +130,28 @@
}
/**
+ * value updated, listener fire using multiple selection with external validation failure after form submission
+ */
+ @Test
+ public void testValidationFailure(Template template) {
+ renderPage(template, initMethod);
+ initFields();
+ Assert.assertEquals(selenium.getText(valueChangedId), Boolean.FALSE.toString());
+ _checkOrdering(tableId, new String[]{"0", "1", "2", "3"});
+ Assert.assertTrue(selenium.getText(selectionText).length() == 0);
+ _selectItem(orderingListId + ":0", false, false);
+ selenium.click(downButton);
+ _selectItem(orderingListId + ":1", false, false);
+ _selectItem(orderingListId + ":2", false, true);
+ _selectItem(orderingListId + ":0", true, false);
+ selenium.type(requiredInputId, "");
+ clickAjaxCommandAndWait(submitId);
+ Assert.assertEquals(selenium.getText(valueChangedId), Boolean.FALSE.toString());
+ _checkOrdering(tableId, new String[]{"0", "1", "2", "3"});
+ Assert.assertTrue(selenium.getText(selectionText).length() == 0);
+ }
+
+ /**
* value updated, listener fire using multiple selection
*/
@Test
@@ -136,6 +160,7 @@
initFields();
Assert.assertEquals(selenium.getText(valueChangedId), Boolean.FALSE.toString());
_checkOrdering(tableId, new String[]{"0", "1", "2", "3"});
+ Assert.assertTrue(selenium.getText(selectionText).length() == 0);
_selectItem(orderingListId + ":0", false, false);
selenium.click(downButton);
_selectItem(orderingListId + ":1", false, false);
@@ -516,6 +541,7 @@
String formId = getParentId() + "_form:";
String attrFormId = getParentId() + "attrFormId";
inputTextId = getParentId() + "testRequiredAndImmediate:inputTextId";
+ requiredInputId = formId + "requiredInputId";
orderingListId = formId + "orderingList";
orderingListTableId = orderingListId + "internal_tab";
valueChangedId = formId + "valueChangedId";
17 years, 1 month
JBoss Rich Faces SVN: r11295 - in trunk/sandbox/ui/editor/src/main/java/org/richfaces: convert/seamtext and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-11-21 12:29:09 -0500 (Fri, 21 Nov 2008)
New Revision: 11295
Added:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java
Log:
add marker interface for the seam text converter impl, add default seam text converter
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-21 16:46:20 UTC (rev 11294)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-21 17:29:09 UTC (rev 11295)
@@ -30,7 +30,9 @@
import javax.faces.component.UIInput;
import javax.faces.convert.Converter;
+import org.richfaces.convert.seamtext.DefaultSeamTextConverter;
import org.richfaces.convert.seamtext.SeamTextConverter;
+import org.richfaces.convert.seamtext.SeamTextConverterFactory;
/**
* JSF component class
@@ -48,7 +50,7 @@
/** Id suffix of textarea which used as target element for tinyMCE scripts*/
public static final String EDITOR_TEXT_AREA_ID_SUFFIX = "TextArea";
- private SeamTextConverter defaultSeamTextConverter = new SeamTextConverter();
+ private SeamTextConverterFactory converterFactory = new SeamTextConverterFactory();
public abstract void setType(String type);
@@ -140,7 +142,7 @@
public Converter getConverter() {
Converter converter = super.getConverter();
if(isUseSeamText() && converter == null) {
- converter = defaultSeamTextConverter;
+ return converterFactory.getConverter();
}
return converter;
}
Added: trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java (rev 0)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2008-11-21 17:29:09 UTC (rev 11295)
@@ -0,0 +1,99 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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
+ */
+
+/*
+ * SeamTextConverter.java Date created: 26.09.2008
+ * Last modified by: $Author: alevkovsky $
+ * $Revision: 11244 $ $Date: 2008-11-19 18:45:36 +0200 (Wed, 19 Nov 2008) $
+ */
+
+package org.richfaces.convert.seamtext;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.text.SeamTextLexer;
+import org.jboss.seam.text.SeamTextParser;
+import org.richfaces.antlr.HtmlSeamTextLexer;
+import org.richfaces.antlr.HtmlSeamTextParser;
+
+/**
+ * Seam Text Converter class. Provides converting html to seam text and vice versa.
+ *
+ * @author Alexandr Levkovsky
+ *
+ */
+public final class DefaultSeamTextConverter implements SeamTextConverter {
+
+ /** The converter id for this converter. */
+ public static final String CONVERTER_ID = DefaultSeamTextConverter.class.getName();
+
+
+ private DefaultSeamTextConverter() {
+ }
+
+ private static class DefaultConverterHolder {
+ private static final SeamTextConverter INSTANCE = new DefaultSeamTextConverter();
+ }
+
+ public static SeamTextConverter getInstance() {
+ return DefaultConverterHolder.INSTANCE;
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ try {
+
+ Reader r = new StringReader(value);
+ HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
+ HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
+ parser.startRule();
+ return parser.toString();
+
+ } catch (Exception e) {
+ FacesMessage message = new FacesMessage("An error occurred during conversion html to seam text",e.getMessage());
+ throw new ConverterException(message,e);
+ }
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ if (value == null) {
+ return "";
+ }
+ try {
+ Reader r = new StringReader(value.toString());
+ SeamTextLexer lexer = new SeamTextLexer(r);
+ SeamTextParser parser = new SeamTextParser(lexer);
+ parser.startRule();
+ return parser.toString();
+
+ } catch (Exception e) {
+ FacesMessage message = new FacesMessage("An error occurred during conversion seam text to html",e.getMessage());
+ throw new ConverterException(message,e);
+ }
+ }
+}
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java 2008-11-21 16:46:20 UTC (rev 11294)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java 2008-11-21 17:29:09 UTC (rev 11295)
@@ -19,105 +19,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- * SeamTextConverter.java Date created: 26.09.2008
- * Last modified by: $Author: alevkovsky $
- * $Revision: 11244 $ $Date: 2008-11-19 18:45:36 +0200 (Wed, 19 Nov 2008) $
- */
-
package org.richfaces.convert.seamtext;
-import java.io.Reader;
-import java.io.StringReader;
-import java.lang.reflect.Constructor;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.seam.text.SeamTextLexer;
-import org.jboss.seam.text.SeamTextParser;
-import org.richfaces.antlr.HtmlSeamTextLexer;
-import org.richfaces.antlr.HtmlSeamTextParser;
-
-import antlr.ANTLRException;
-import antlr.RecognitionException;
-import antlr.TokenStream;
-
/**
- * Seam Text Converter class. Provides converting html to seam text and vice versa.
- *
- * @author Alexandr Levkovsky
- *
+ * @author Anton Belevich
+ * Marker interface for the Seam Text Converter
+ *
*/
-public class SeamTextConverter implements Converter {
-
- /** log4j instance for converter class */
- private static final Log _log = LogFactory.getLog(SeamTextConverter.class);
-
- /** The converter id for this converter. */
- public static final String CONVERTER_ID = SeamTextConverter.class.getName();
-
- /* (non-Javadoc)
- * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
- */
- @SuppressWarnings("unchecked")
- public Object getAsObject(FacesContext context, UIComponent component,
- String value) {
- try {
- Reader r = new StringReader(value);
- HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
- HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
- parser.startRule();
- return parser.toString();
- } catch (RecognitionException rex) {
- // Log a nice message for any lexer/parser errors, users can disable
- // this if they want to
- _log.warn("Seam Text parse error: " + rex.getMessage());
- } catch (ANTLRException ex) {
- // All other errors are fatal;
- throw new RuntimeException(ex);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
- */
- @SuppressWarnings("unchecked")
- public String getAsString(FacesContext context, UIComponent component,
- Object value) {
- if (value == null) {
- return "";
- }
-
- SeamTextParser parser = null;
-
- try {
-
- Reader r = new StringReader(value.toString());
- Class seamTextLexerClass = Class.forName("org.jboss.seam.text.SeamTextLexer");
- Class seamTextParserClass = Class.forName("org.jboss.seam.text.SeamTextParser");
- Constructor seamTextLexerConstructor = seamTextLexerClass.getConstructor(Reader.class);
- SeamTextLexer lexer = (SeamTextLexer) seamTextLexerConstructor.newInstance(new Object[] { r });
- Constructor seamTextParserConstructor = seamTextParserClass.getConstructor(TokenStream.class);
- parser = (SeamTextParser) seamTextParserConstructor.newInstance(new Object[] { lexer });
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- try {
- parser.startRule();
- } catch (RecognitionException rex) {
- // Log a nice message for any lexer/parser errors, users can disable
- // this if they want to
- _log.warn("Seam Text parse error: " + rex.getMessage());
- } catch (ANTLRException ex) {
- // All other errors are fatal;
- throw new RuntimeException(ex);
- }
- return parser.toString();
- }
-
+public interface SeamTextConverter extends Converter {
}
Added: trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java (rev 0)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java 2008-11-21 17:29:09 UTC (rev 11295)
@@ -0,0 +1,56 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.convert.seamtext;
+
+import java.lang.reflect.Method;
+
+import javax.faces.FacesException;
+
+/**
+ * Default seam text converter implementation factory
+ * @author Anton Belevich
+ *
+ */
+public class SeamTextConverterFactory {
+
+ private SeamTextConverter converter;
+
+
+ public SeamTextConverter getConverter() {
+ if(converter == null) {
+ converter = createSeamTextConverter();
+ }
+ return converter;
+ }
+
+ public SeamTextConverter createSeamTextConverter() {
+ try {
+
+ Class clazz = Class.forName("org.richfaces.convert.seamtext.DefaultSeamTextConverter");
+ Method method = clazz.getMethod("getInstance");
+ return (SeamTextConverter) method.invoke(clazz);
+
+ } catch(Exception e) {
+ throw new FacesException(e);
+ }
+ }
+}
17 years, 1 month
JBoss Rich Faces SVN: r11294 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-11-21 11:46:20 -0500 (Fri, 21 Nov 2008)
New Revision: 11294
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java
Log:
RF-5001
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-21 16:20:47 UTC (rev 11293)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/OrderingListTest.java 2008-11-21 16:46:20 UTC (rev 11294)
@@ -128,7 +128,7 @@
}
/**
- * value updated, listener fire
+ * value updated, listener fire using multiple selection
*/
@Test
public void testValuesAndListener(Template template) {
@@ -138,9 +138,13 @@
_checkOrdering(tableId, new String[]{"0", "1", "2", "3"});
_selectItem(orderingListId + ":0", false, false);
selenium.click(downButton);
+ _selectItem(orderingListId + ":1", false, false);
+ _selectItem(orderingListId + ":2", false, true);
+ _selectItem(orderingListId + ":0", true, false);
clickAjaxCommandAndWait(submitId);
Assert.assertEquals(selenium.getText(valueChangedId), Boolean.TRUE.toString());
_checkOrdering(tableId, new String[]{"1", "0", "2", "3"});
+ Assert.assertTrue(selenium.getText(selectionText).split(",").length == 2);
}
/**
@@ -277,18 +281,25 @@
renderPage(template, initMethod);
initFields();
selenium.runScript("var listShuttle = ($('" + orderingListId + "')).component;");
+ checkJSError();
Assert.assertTrue("4".equals(selenium.getEval("window.listShuttle.getItems().length")));
+ checkJSError();
Assert.assertTrue("0".equals(selenium.getEval("window.listShuttle.getSelection().length")));
+ checkJSError();
_checkOrdering(orderingListTableId, new String[]{"0", "1", "2", "3"});
selenium.click(firstRow);
Assert.assertTrue("1".equals(selenium.getEval("window.listShuttle.getSelection().length")));
selenium.runScript("listShuttle.down()");
+ checkJSError();
_checkOrdering(orderingListTableId, new String[]{"1", "0", "2", "3"});
selenium.runScript("listShuttle.bottom()");
+ checkJSError();
_checkOrdering(orderingListTableId, new String[]{"1", "2", "3", "0"});
selenium.runScript("listShuttle.up()");
+ checkJSError();
_checkOrdering(orderingListTableId, new String[]{"1", "2", "0", "3"});
selenium.runScript("listShuttle.top()");
+ checkJSError();
_checkOrdering(orderingListTableId, new String[]{"0", "1", "2", "3"});
17 years, 1 month
JBoss Rich Faces SVN: r11293 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-21 11:20:47 -0500 (Fri, 21 Nov 2008)
New Revision: 11293
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
Log:
Panel Test
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-21 16:02:54 UTC (rev 11292)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-21 16:20:47 UTC (rev 11293)
@@ -101,6 +101,7 @@
list.add(new ComponentItem("<rich:dropSupport>", "dnd/dndTest.xhtml"));
list.add(new ComponentItem("<rich:effect>", "effect/effectTest.xhtml"));
list.add(new ComponentItem("<rich:graphValidator>", "graphValidator/graphValidatorTest.xhtml"));
+ list.add(new ComponentItem("<rich:panel>", "panel/panelTest.xhtml"));
sortList();
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelAutoTest.xhtml 2008-11-21 16:20:47 UTC (rev 11293)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:panel id="componentId"
+ rendered="#{autoTestBean.rendered}"
+ >
+ </rich:panel>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panel/panelTest.xhtml 2008-11-21 16:20:47 UTC (rev 11293)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="_controls">
+ </h:form>
+
+
+ <h:form id="_form">
+ <rich:panel id="panel" style="color: green; font-weight: bold" styleClass="myClass"
+ bodyClass="bodyClass"
+ headerClass="headerClass"
+ >
+ <f:facet name="header">
+ <h:outputText id="header" value="Header"></h:outputText>
+ </f:facet>
+ <h:outputText id="content" value="Panel Content"></h:outputText>
+ </rich:panel>
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java 2008-11-21 16:20:47 UTC (rev 11293)
@@ -0,0 +1,105 @@
+/**
+ *
+ */
+package org.richfaces.testng;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class PanelTest extends SeleniumTestBase {
+
+ String panelId;
+
+ String panelBodyId;
+
+ String panelHeaderId;
+
+ static final String FORM_ID = "_form:";
+ static final String PANEL_ID = "panel";
+
+
+ static final String [] panelClasses = new String [] {
+ "dr-pnl",
+ "rich-panel",
+ "myClass"
+ };
+
+ static final Map<String, String> styles = new HashMap<String, String>();
+ static {
+ styles.put("color", "green");
+ styles.put("font-weight", "bold");
+ }
+
+ private void initIds(String parentId) {
+ panelId = parentId + FORM_ID + PANEL_ID;
+ panelBodyId = panelId + "_body";
+ panelHeaderId = panelId + "_header";
+ }
+
+ @Test
+ public void testOutputToClient(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ AssertPresent(panelId, "Panel was not output to client");
+ AssertPresent(panelBodyId, "Panel was not output to client");
+ }
+
+ @Test
+ public void testHTMLAndStyles(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ assertClassNames(panelId, panelClasses, "Panel CSS classes was not rendered to client", true);
+ assertStyleAttributes(panelId, styles);
+
+ assertClassNames(panelBodyId, new String [] {"bodyClass"}, "Body panel css classes was not rendered to client", true);
+
+ }
+
+ @Test
+ public void testContentAndFacets(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ AssertPresent(panelBodyId);
+ AssertPresent(panelHeaderId);
+
+ AssertTextEquals(panelHeaderId, "Header", "Header facet was not rendered to client");
+ AssertTextEquals(panelBodyId, "Panel Content", "Panel does not render children components");
+
+ }
+
+ @Test
+ public void testRendered(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+
+ tester.testRendered();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/panel/panelTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/panel/panelAutoTest.xhtml";
+ }
+
+}
17 years, 1 month
JBoss Rich Faces SVN: r11292 - trunk/ui/extendedDataTable/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2008-11-21 11:02:54 -0500 (Fri, 21 Nov 2008)
New Revision: 11292
Modified:
trunk/ui/extendedDataTable/src/main/java/org/richfaces/component/ExtendedDataTableState.java
Log:
catch exception on init state
Modified: trunk/ui/extendedDataTable/src/main/java/org/richfaces/component/ExtendedDataTableState.java
===================================================================
--- trunk/ui/extendedDataTable/src/main/java/org/richfaces/component/ExtendedDataTableState.java 2008-11-21 15:02:15 UTC (rev 11291)
+++ trunk/ui/extendedDataTable/src/main/java/org/richfaces/component/ExtendedDataTableState.java 2008-11-21 16:02:54 UTC (rev 11292)
@@ -63,13 +63,33 @@
}
}
//initialize columns order part
- columnsOrder = ColumnsOrder.getColumnsOrder(extendedDataTable, (stateMap == null ? null : (JSONCollection)stateMap.get("columnsOrder")));
+ try{
+ columnsOrder = ColumnsOrder.getColumnsOrder(extendedDataTable, (stateMap == null ? null : (JSONCollection)stateMap.get("columnsOrder")));
+ }
+ catch(Exception e){
+ columnsOrder = ColumnsOrder.getColumnsOrder(extendedDataTable, (JSONCollection)null);
+ }
//initialize columns visibility part
- columnsVisibility = ColumnsVisibility.getColumnsVisibility(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnsVisibility")));
+ try{
+ columnsVisibility = ColumnsVisibility.getColumnsVisibility(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnsVisibility")));
+ }
+ catch(Exception e){
+ columnsVisibility = ColumnsVisibility.getColumnsVisibility(extendedDataTable, (JSONMap)null);
+ }
//initialize columns size part
- columnsSizeState = ColumnsSizeState.getColumnsSize(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnsSizeState")));
+ try{
+ columnsSizeState = ColumnsSizeState.getColumnsSize(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnsSizeState")));
+ }
+ catch(Exception e){
+ columnsSizeState = ColumnsSizeState.getColumnsSize(extendedDataTable, (JSONMap)null);
+ }
//initialize column grouping part
- columnGroupingState = ColumnGroupingState.getColumnGropingState(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnGroupingState")));
+ try{
+ columnGroupingState = ColumnGroupingState.getColumnGropingState(extendedDataTable, (stateMap == null ? null : (JSONMap)stateMap.get("columnGroupingState")));
+ }
+ catch(Exception e){
+ columnGroupingState = ColumnGroupingState.getColumnGropingState(extendedDataTable, (JSONMap)null);
+ }
}//init
/**
17 years, 1 month
JBoss Rich Faces SVN: r11291 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-11-21 10:02:15 -0500 (Fri, 21 Nov 2008)
New Revision: 11291
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testImmediateAttribute.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testRequiredAttributes.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java
Log:
tests for inplaceinput
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testImmediateAttribute.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testImmediateAttribute.xhtml 2008-11-21 15:01:40 UTC (rev 11290)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testImmediateAttribute.xhtml 2008-11-21 15:02:15 UTC (rev 11291)
@@ -20,7 +20,7 @@
</rich:inplaceSelect>
<a4j:commandButton id="bn_tia" reRender="group_tia" value="Submit"/>
</td>
- <td><span id="text_tia">#{inplaceSelectBean.isValue}<h:messages /></span></td>
+ <td><span id="text_tia"><h:messages /></span></td>
</tr>
</table>
</h:form>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testRequiredAttributes.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testRequiredAttributes.xhtml 2008-11-21 15:01:40 UTC (rev 11290)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceSelect/testRequiredAttributes.xhtml 2008-11-21 15:02:15 UTC (rev 11291)
@@ -13,7 +13,7 @@
<ui:param name="required" value="true"/>
<ui:param name="value" value="#{inplaceSelectBean.tree}"/>
<ui:param name="requiredMessage" value="requiredMsg" />
- <ui:param name="editEvent" value="" />
+ <ui:param name="editEvent" value="onclick" />
</ui:include>
</ui:define>
</ui:composition>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java 2008-11-21 15:01:40 UTC (rev 11290)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplacesTest.java 2008-11-21 15:02:15 UTC (rev 11291)
@@ -4,9 +4,7 @@
package org.richfaces.testng;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.ajax4jsf.bean.InplaceInputTestBean;
import org.ajax4jsf.template.Template;
@@ -267,7 +265,7 @@
String iid = inplaceId + IMMEDIATE_ATTRIBUTE_ID_PREFIX;
- setValueById(iid + inplaceValuePrefix, "test1");
+ setValueById(iid + inplaceValuePrefix, "Aspen");
clickById(buttonId + IMMEDIATE_ATTRIBUTE_ID_PREFIX);
waitForAjaxCompletion();
check("Value isn't correct!".equals(getTextById(messageId + IMMEDIATE_ATTRIBUTE_ID_PREFIX)),
17 years, 1 month