JBoss Rich Faces SVN: r19175 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-09-13 13:37:03 -0400 (Mon, 13 Sep 2010)
New Revision: 19175
Added:
branches/RF-8742/
Log:
create working branch for client side validation
Copied: branches/RF-8742 (from rev 19174, trunk)
14 years, 3 months
JBoss Rich Faces SVN: r19173 - branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-13 12:53:22 -0400 (Mon, 13 Sep 2010)
New Revision: 19173
Modified:
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
Log:
remove duplicate initialization from the constructor
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-13 16:49:49 UTC (rev 19172)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-13 16:53:22 UTC (rev 19173)
@@ -5,12 +5,6 @@
rf.ui.InplaceSelect = function(id, options) {
$super.constructor.call(this, id, options)
this.select = new rf.ui.Select(options.listCord, this, options);
- this.input = $(document.getElementById(options.input));
- this.label = $(document.getElementById(options.label));
-
- var label = this.label.text();
- var inputLabel = this.input.val();
- this.initialValue = (label == inputLabel) ? label : "";
}
rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
@@ -55,9 +49,8 @@
__blurHandler: function(e) {
return false;
- },
+ }
-
}
})());
14 years, 3 months
JBoss Rich Faces SVN: r19172 - in branches/RF-8992/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-13 12:49:49 -0400 (Mon, 13 Sep 2010)
New Revision: 19172
Modified:
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
select component js base class, apply markup changes, use inplaceInput as a base for the inpalceSelect
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-13 16:49:49 UTC (rev 19172)
@@ -34,6 +34,7 @@
@ResourceDependency(name = "richfaces-selection.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceBase.js"),
@ResourceDependency(library = "org.richfaces", name = "select.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceSelect.js"),
@ResourceDependency(library = "org.richfaces", name = "inplaceSelect.ecss") })
public class InplaceSelectBaseRenderer extends InplaceInputBaseRenderer {
@@ -115,8 +116,6 @@
writer.write("\u00a0");
}
writer.endElement(HTML.SPAN_ELEM);
- writer.startElement("br", inplaceSelect);
- writer.endElement("br");
}
}
}
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-09-13 16:49:49 UTC (rev 19172)
@@ -26,7 +26,8 @@
rf.ui.InplaceBase = function(id, options) {
$super.constructor.call(this, id);
this.attachToDom(id);
-
+ this.namespace = this.getNamespace() || "." + rf.Event.createNamespace(this.getName(), this.id);
+
this.editEvent = options.editEvent;
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
@@ -49,11 +50,16 @@
var $super = rf.ui.InplaceBase.$super;
$.extend(rf.ui.InplaceBase.prototype, ( function () {
- var saved = false;
+ var isSaved = false;
var useDefaultLabel = false;
return {
+ getName: function() {
+ },
+ getNamespace: function() {
+ },
+
getValue: function() {
},
@@ -83,13 +89,14 @@
this.setLabel(this.defaultLabel);
useDefaultLabel = true;
}
-
- if(this.isValueChanged()) {
+
+ isSaved = true;
+
+ if(this.isValueChanged()) {
this.element.addClass(this.changedCss);
} else {
this.element.removeClass(this.changedCss);
}
- isSaved = true;
this.__hide();
},
@@ -100,7 +107,7 @@
}
this.setValue(text);
isSaved = true;
- this.onhide();
+ this.__hide();
},
isValueSaved: function() {
@@ -117,6 +124,7 @@
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
this.scrollElements = null;
}
+ this.onhide();
this.editContainer.addClass(this.noneCss);
},
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-13 16:49:49 UTC (rev 19172)
@@ -205,7 +205,6 @@
rf.ui.InplaceInput = function(id, options) {
$super.constructor.call(this, id, options);
- this.namespace = this.namespace || "." + rf.Event.createNamespace(this.name, this.id);
this.input = $(document.getElementById(options.input));
this.label = $(document.getElementById(options.label));
@@ -231,6 +230,10 @@
name : "inplaceInput",
+ geName: function() {
+ return this.name;
+ },
+
geNamespace: function() {
return this.namespace;
},
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-13 16:49:49 UTC (rev 19172)
@@ -12,7 +12,7 @@
}
.rf-is-none {
- display: none;
+ display: none !important;
}
.insel_font {
@@ -29,18 +29,20 @@
padding-left : 3px;
padding-right : 3px;
}
-
+
.insel_changed_state {
+ display : inline-block;
background-image : "url(#{resource['org.richfaces:mark_changed.gif']})";
background-position : top left;
background-repeat : no-repeat;
}
-.insel_edit_state {
+.insel_edit_state{
position : absolute;
top : 0px;
left : 0px;
width : 100px;
+ background-color : '#{richSkin.editBackgroundColor}';
}
.insel_field {
@@ -62,7 +64,7 @@
border-width : 1px;
border-style : outset;
border-color : '#{richSkin.panelBorderColor}';
- padding : 0px;
+ padding : 3px;
margin : 0px;
}
@@ -74,7 +76,7 @@
border-width : 1px;
border-style : inset;
border-color : '#{richSkin.panelBorderColor}';
- padding : 0px;
+ padding : 3px;
margin : 0px;
}
@@ -85,71 +87,66 @@
white-space : nowrap;
}
-.insel_list_cord {
- position : absolute;
+.insel_list_cord {
+ display : block;
+ /*font-size : 0px;*/
+ position : relative;
font-family:inherit;
font-size : inherit;
}
-.insel_list_position {
+.insel_list_position {
+ display : block;
position : absolute;
top: 0px;
left: -1px;
}
.insel_list_decoration {
+ display : block;
border-width : 1px;
border-style : solid;
border-color : '#{richSkin.panelBorderColor}';
padding : 0px;
- display: inline-block;
- width: 100%;
+ /*width: 100%;*/
background-color : '#{richSkin.editBackgroundColor}';
}
-.insel_list_scroll {
+.insel_list_scroll {
+ display : block;
overflow : auto;
overflow-x : hidden;
- display: inline-block;
- width: 100%;
+ /*height : 100px;*/
}
-.insel_option {
+.insel_option {
+ display : block;
padding : 2px;
white-space : nowrap;
background-color : '#{richSkin.editBackgroundColor}';
cursor : default;
- display : inline-block;
- width : 100%;
}
-.insel_select {
+.insel_select {
+ display : block;
padding : 1px;
- width : 100%;
background-color: #DFE8F6; /*get from skin???*/
border-width : 1px;
border-style : dotted;
border-color : '#{richSkin.generalTextColor}';
}
-.insel_select {
- padding : 1px;
- width : 100%;
- background-color: #DFE8F6;
- border-width : 1px;
- border-style : dotted;
- border-color : '#{richSkin.generalTextColor}';
-}
-
-.insel_btn_preposition {
+.insel_btn_preposition {
+ display : block;
position : absolute;
- top : 0px;
+ top : -4px;
right : 0px;
wigth : 1px;
height : 1px;
}
.insel_btn_position {
+ display : block;
position : absolute;
top : 0px;
left : 0px;
@@ -157,6 +154,7 @@
}
.insel_btn_shadow {
+ display : block;
position: relative;
padding : 6px 6px 6px 6px;
top : -6px;
@@ -164,14 +162,15 @@
}
.insel_shadow {
- display: inline-block;
- width: 100%;
+ display : block;
position: relative;
padding : 6px 6px 6px 6px;
- top : -6px; left : -6px;
+ top : -6px;
+ left : -6px;
}
.insel_shadow_t {
+ display : block;
background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : top left;
position: absolute;
@@ -180,7 +179,9 @@
bottom: 6px;
left : 0px
}
+
.insel_shadow_l {
+ display : block;
background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : bottom left;
position : absolute;
@@ -189,7 +190,9 @@
left : 0px;
right : 6px;
}
+
.insel_shadow_r {
+ display : block;
background : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : bottom right;
position : absolute;
@@ -200,6 +203,7 @@
}
.insel_shadow_b {
+ display : block;
background : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : right top;
position: absolute;
@@ -207,4 +211,4 @@
top: 0px;
left : 6px;
right : 0px;
-}
\ No newline at end of file
+}
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-13 16:49:49 UTC (rev 19172)
@@ -4,12 +4,19 @@
rf.ui.InplaceSelect = function(id, options) {
$super.constructor.call(this, id, options)
- this.select = new rf.ui.Select(options.listCord, options);
+ this.select = new rf.ui.Select(options.listCord, this, options);
+ this.input = $(document.getElementById(options.input));
+ this.label = $(document.getElementById(options.label));
+
+ var label = this.label.text();
+ var inputLabel = this.input.val();
+ this.initialValue = (label == inputLabel) ? label : "";
}
- rf.ui.InplaceBase.extend(rf.ui.InplaceSelect);
+ rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
+ $.extend(rf.ui.InplaceSelect, rf.ui.SelectListener);
+
var $super = rf.ui.InplaceSelect.$super;
-
$.extend(rf.ui.InplaceSelect.prototype, ( function () {
var openPopup = false;
@@ -17,6 +24,14 @@
return{
name : "inplaceSelect",
+ geName: function() {
+ return this.name;
+ },
+
+ geNamespace: function() {
+ return this.namespace;
+ },
+
onshow: function() {
if(openPopup) {
this.select.show();
@@ -30,7 +45,19 @@
onhide: function() {
this.select.hide();
openPopup = false;
- }
+ },
+
+ processItem: function(event, element) {
+ var key = element.text();
+ this.setValue(key);
+ this.save();
+ },
+
+ __blurHandler: function(e) {
+ return false;
+ },
+
+
}
})());
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-09-13 16:49:49 UTC (rev 19172)
@@ -1,14 +1,22 @@
(function ($, rf) {
rf.ui = rf.ui || {};
-
- rf.ui.Select = function(id, options) {
+
+ var INTERFACE = {
+ SelectListener : {
+ processItem: function(event, element){}
+ }
+ };
+
+ rf.ui.Select = function(id, listener, options) {
this.select = $(document.getElementById(id));
this.itemsCord = $(document.getElementById(options.itemsCord));
this.selectItemCss = options.selectItemCss;
this.itemCss = options.itemCss;
this.noneCss = options.noneCss;
-
+ this.selectListener = listener;
+
+ this.select.bind("blur", $.proxy(this.__blurHandler, this));
this.itemsCord.bind("mouseover", $.proxy(this.__mouseHandler, this));
this.itemsCord.bind("click", $.proxy(this.__mouseHandler, this));
};
@@ -20,6 +28,15 @@
var processed = null;
+ var isSelectListener = function(obj) {
+ for (var method in INTERFACE.SelectListener) {
+ if ( (typeof obj[method] != typeof INTERFACE.SelectListener[method]) ) {
+ return false;
+ }
+ }
+ return true;
+ };
+
return{
name : "select",
@@ -28,14 +45,25 @@
},
hide: function() {
- this.select.addClass(this.noneCss);
+ this.select.addClass(this.noneCss);
},
processItem: function(event, element) {
-
+ if(isSelectListener(this.selectListener)) {
+ this.selectListener.processItem(event, element);
+ }
},
+
+ __getCurrentElement: function() {
+ return processed;
+ },
+
+ __blurHandler: function(e) {
+ processItem(e, processed);
+ return false;
+ },
- __mouseHandler: function(event) {
+ __mouseHandler: function(event) {
var element = $(event.target).closest("."+this.itemCss, event.currentTarget);
if (event&& element) {
if(event.type == 'mouseover') {
@@ -47,10 +75,11 @@
}
if(event.type == 'click') {
- //TODO: process click here
+ this.processItem(event, element);
}
- }
- }
+ }
+ return false;
+ },
}
})());
Modified: branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-13 13:21:57 UTC (rev 19171)
+++ branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-13 16:49:49 UTC (rev 19172)
@@ -77,8 +77,7 @@
</span>
</span>
</c:if>
- <br/>
- <span id="#{clientId}List" class="insel_list_cord rf-is-none">
+ <span id="#{clientId}List" class="rf-is-none insel_list_cord">
<span class="insel_list_position" style="width: #{component.attributes['listWidth']}">
<span class="insel_shadow">
<span class="insel_shadow_t"></span>
14 years, 3 months
JBoss Rich Faces SVN: r19171 - modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-13 09:21:57 -0400 (Mon, 13 Sep 2010)
New Revision: 19171
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/simple.xhtml
Log:
* fixed attribute render
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/simple.xhtml 2010-09-13 12:19:55 UTC (rev 19170)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/simple.xhtml 2010-09-13 13:21:57 UTC (rev 19171)
@@ -81,7 +81,7 @@
</h:inputText>
<h:inputText id="input2" value="#{a4jAttachQueueBean.text2}" onkeyup="addEvent();">
- <a4j:ajax event="keyup" render="output1" execute="@form" onbegin="addRequest();"
+ <a4j:ajax event="keyup" render="output2" execute="@form" onbegin="addRequest();"
oncomplete="printCounts()" onbeforedomupdate="addUpdate()">
<a4j:attachQueue id="a4jAttachQueue2"
ignoreDupResponses="#{a4jAttachQueueBean.attributes2['ignoreDupResponses'].value}"
14 years, 3 months
JBoss Rich Faces SVN: r19170 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-13 08:19:55 -0400 (Mon, 13 Sep 2010)
New Revision: 19170
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
Log:
added JavaDoc to a4j:queue tests (RFPL-733)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java 2010-09-13 12:11:08 UTC (rev 19169)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java 2010-09-13 12:19:55 UTC (rev 19170)
@@ -63,6 +63,19 @@
return buildUrl(contextPath, "faces/components/a4jQueue/formQueue.xhtml");
}
+ /**
+ * <p>
+ * Tests request delays for one form queue.
+ * </p>
+ *
+ * <p>
+ * Uses one form queue, which controls events from two distinct event sources.
+ * </p>
+ * <p>
+ * When one source waits for delay and another source produces event, events from first source should be immediately
+ * processed.
+ * </p>
+ */
@Test
public void testTimingOneQueueTwoEvents() {
formQueueA.attributes.setRequestDelay(DELAY_A);
@@ -83,6 +96,19 @@
checkTimes(formQueueA, Event.SECOND, DELAY_A);
}
+ /**
+ * <p>
+ * Tests the event handlers producing count of events (count of events, requests and updates).
+ *
+ * <p>
+ * Uses one form queue, which controls events from two distinct event sources.
+ * </p>
+ *
+ * <p>
+ * When one source waits for delay and another source produces event, events from first source should be immediately
+ * processed.
+ * </p>
+ */
@Test
public void testCountsOneQueueTwoEvents() {
formQueueA.attributes.setRequestDelay(DELAY_A);
@@ -107,6 +133,20 @@
checkCounts(formQueueA, 2, 3, 2, 2);
}
+ /**
+ * <p>
+ * Tests request delays for two form queues.
+ * </p>
+ *
+ * <p>
+ * Uses two form queues, controlling events from four distinct event sources (two for each queue).
+ * </p>
+ *
+ * <p>
+ * When one source waits for delay and another source produces event, events from first source should be immediately
+ * processed.
+ * </p>
+ */
@Test
public void testTimingTwoQueuesFourEvents() {
formQueueA.attributes.setRequestDelay(DELAY_A);
@@ -139,6 +179,19 @@
assertTrue(formQueueB.retrieveBeginTime.retrieve() - formQueueB.retrieveEvent1Time.retrieve() > 3000);
}
+ /**
+ * <p>
+ * Tests the event handlers producing count of events (count of events, requests and updates).
+ *
+ * <p>
+ * Uses two form queues, controlling events from four distinct event sources (two for each queue).
+ * </p>
+ *
+ * <p>
+ * When one source waits for delay and another source produces event, events from first source should be immediately
+ * processed.
+ * </p>
+ */
@Test
public void testCountsTwoQueuesThreeEvents() {
formQueueA.attributes.setRequestDelay(DELAY_A);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java 2010-09-13 12:11:08 UTC (rev 19169)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java 2010-09-13 12:19:55 UTC (rev 19170)
@@ -59,6 +59,9 @@
return buildUrl(contextPath, "faces/components/a4jQueue/globalQueue.xhtml");
}
+ /**
+ * Tests delay between time last event occurs and time when event triggers request (begin).
+ */
@Test
@Use(field = "requestDelay", ints = { 0, 500, 1500, 5000 })
public void testRequestDelay() {
@@ -72,6 +75,9 @@
checkAvgDeviation();
}
+ /**
+ * Events from one source should be stacked as occurs, while last event isn't delayed by configured requestDelay.
+ */
@Test
public void testMultipleRequestsWithDelay() {
attributes.setRequestDelay(3000);
@@ -97,6 +103,15 @@
XHRHalter.disable();
}
+ /**
+ * <p>
+ * When no requestDelay (0) is set, events should fire request immediately.
+ * </p>
+ *
+ * <p>
+ * However, when one event is waiting in queue for processing of previous request, events should be stacked.
+ * </p>
+ */
@Test
public void testMultipleRequestsWithNoDelay() {
attributes.setRequestDelay(0);
14 years, 3 months
JBoss Rich Faces SVN: r19169 - modules/tests/metamer/trunk/application/src/main/resources.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-13 08:11:08 -0400 (Mon, 13 Sep 2010)
New Revision: 19169
Modified:
modules/tests/metamer/trunk/application/src/main/resources/log4j.properties
Log:
* reverting logging level back to info
Modified: modules/tests/metamer/trunk/application/src/main/resources/log4j.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/log4j.properties 2010-09-13 12:10:27 UTC (rev 19168)
+++ modules/tests/metamer/trunk/application/src/main/resources/log4j.properties 2010-09-13 12:11:08 UTC (rev 19169)
@@ -1,5 +1,5 @@
#### Use two appenders, one to log to console, another to log to a file
-log4j.rootCategory=debug, stdout
+log4j.rootCategory=info, stdout
#### First appender writes to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
14 years, 3 months
JBoss Rich Faces SVN: r19168 - in modules/tests/metamer/trunk/application/src/main: resources and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-09-13 08:10:27 -0400 (Mon, 13 Sep 2010)
New Revision: 19168
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java
modules/tests/metamer/trunk/application/src/main/resources/log4j.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml
Log:
https://jira.jboss.org/browse/RFPL-729
* page for rich:column fixed, bean refactored and cleaned up
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java 2010-09-13 11:58:36 UTC (rev 19167)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnBean.java 2010-09-13 12:10:27 UTC (rev 19168)
@@ -35,7 +35,7 @@
/**
* Managed bean for rich:column
*
- * @author <a href="mailto:pjha@redhat.com">Prabhat Jha</a>
+ * @author <a href="mailto:pjha@redhat.com">Prabhat Jha</a>, <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@ManagedBean(name = "richColumnBean")
@@ -56,16 +56,8 @@
attributes = Attributes.getUIComponentAttributes(UIColumn.class, getClass());
attributes.setAttribute("rendered", true);
- attributes.setAttribute("columnSpan", 1);
+ attributes.setAttribute("colspan", 1);
- /*breakRowBefore=""
- colspan=""
- comparator=""
- filter=""
- filterValue=""
- rendered=""
- rowspan=""
- sortOrder=""*/
}
public Attributes getAttributes() {
Modified: modules/tests/metamer/trunk/application/src/main/resources/log4j.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/log4j.properties 2010-09-13 11:58:36 UTC (rev 19167)
+++ modules/tests/metamer/trunk/application/src/main/resources/log4j.properties 2010-09-13 12:10:27 UTC (rev 19168)
@@ -1,5 +1,5 @@
#### Use two appenders, one to log to console, another to log to a file
-log4j.rootCategory=info, stdout
+log4j.rootCategory=debug, stdout
#### First appender writes to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumn/simple.xhtml 2010-09-13 12:10:27 UTC (rev 19168)
@@ -36,37 +36,53 @@
</ui:define>
<ui:define name="outOfTemplateBefore">
-
+
</ui:define>
<ui:define name="component">
-
- <rich:dataTable id="richDataTable"
- rendered="true"
- value="#{model.capitals}"
- rows="5"
- var="record"
- >
+
+ <rich:dataTable id="richDataTable"
+ rendered="true"
+ value="#{model.capitals}"
+ rows="5"
+ var="record">
+
<rich:column id="columnState"
- rendered="#{richColumnBean.attributes['rendered'].value}"
- colspan="#{richColumnBean.attributes['colspan'].value}"
- sortOrder="#{richColumnBean.attributes['sortOrder'].value}"
- >
+ breakRowBefore="#{richColumnBean.attributes['breakRowBefore'].value}"
+ colspan="#{richColumnBean.attributes['colspan'].value}"
+ columnSpan="#{richColumnBean.attributes['columnSpan'].value}"
+ comparator="#{richColumnBean.attributes['comparator'].value}"
+ filter="#{richColumnBean.attributes['filter'].value}"
+ filterField="#{richColumnBean.attributes['filterField'].value}"
+ filterValue="#{richColumnBean.attributes['filterValue'].value}"
+ footer="#{richColumnBean.attributes['footer'].value}"
+ header="#{richColumnBean.attributes['header'].value}"
+ rendered="#{richColumnBean.attributes['rendered'].value}"
+ rowspan="#{richColumnBean.attributes['rowspan'].value}"
+ sortField="#{richColumnBean.attributes['sortField'].value}"
+ sortOrder="#{richColumnBean.attributes['sortOrder'].value}"
+ >
<f:facet name="header">
<h:outputText id="columnHeaderState" value="State" />
</f:facet>
- <h:outputText value="#{record.state}" />
+
+ <h:outputText id="state" value="#{record.state}" />
+
<f:facet name="footer">
<h:outputText id="columnFooterState" value="State" />
</f:facet>
</rich:column>
- <rich:column id="columnCapital"
- filter="#{richColumnBean.attributes['filter'].value}"
- >
+
+ <rich:column id="columnCapital">
<f:facet name="header">
- <h:outputText id="columnCapitalState" value="Capital" />
+ <h:outputText id="columnHeaderCapital" value="Capital" />
</f:facet>
- <h:outputText value="#{record.name}" />
+
+ <h:outputText id="capital" value="#{record.name}" />
+
+ <f:facet name="footer">
+ <h:outputText id="columnFooterCapital" value="Capital" />
+ </f:facet>
</rich:column>
</rich:dataTable>
</ui:define>
14 years, 3 months
JBoss Rich Faces SVN: r19167 - in modules/tests/metamer/trunk: application/src/main/webapp/components/a4jQueue and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-13 07:58:36 -0400 (Mon, 13 Sep 2010)
New Revision: 19167
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/formQueue.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/globalQueue.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueLocators.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
Removed:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JQueueBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml
Log:
a4j:queue - modified global queue test; added form queues interleaving test (RFPL-733)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JQueueBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JQueueBean.java 2010-09-13 11:54:19 UTC (rev 19166)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JQueueBean.java 2010-09-13 11:58:36 UTC (rev 19167)
@@ -34,7 +34,7 @@
/**
* Managed bean for a4j:queue.
- *
+ *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@@ -47,6 +47,10 @@
private Attributes attributes;
private String text;
+ private A4JQueueBean globalQueue;
+ private A4JQueueBean formQueue1;
+ private A4JQueueBean formQueue2;
+
/**
* Initializes the managed bean.
*/
@@ -58,8 +62,13 @@
// initialize attributes
attributes = Attributes.getUIComponentAttributes(UIQueue.class, getClass());
attributes.setAttribute("rendered", true);
- attributes.setAttribute("requestDelay", 1500);
+ // hidden attributes
+ attributes.remove("status");
+
+ // TODO attributes not implemented yet
+ attributes.remove("timeout");
+ attributes.remove("ignoreDupResponses");
}
public Attributes getAttributes() {
@@ -70,6 +79,37 @@
this.attributes = attributes;
}
+ public A4JQueueBean getGlobalQueue() {
+ if (globalQueue == null) {
+ globalQueue = new A4JQueueBean();
+ globalQueue.init();
+ globalQueue.attributes.setAttribute("requestDelay", 10000);
+ }
+ return globalQueue;
+ }
+
+ public A4JQueueBean getFormQueue1() {
+ if (formQueue1 == null) {
+ formQueue1 = new A4JQueueBean();
+ formQueue1.init();
+ formQueue1.attributes.setAttribute("requestDelay", 500);
+ }
+ return formQueue1;
+ }
+
+ public A4JQueueBean getFormQueue2() {
+ if (formQueue2 == null) {
+ formQueue2 = new A4JQueueBean();
+ formQueue2.init();
+ formQueue2.attributes.setAttribute("requestDelay", 2000);
+ }
+ return formQueue2;
+ }
+
+ public A4JQueueBean[] getFormQueues() {
+ return new A4JQueueBean[]{getFormQueue1(), getFormQueue2()};
+ }
+
public String getText() {
return text;
}
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/formQueue.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/formQueue.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/formQueue.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,138 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<!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: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:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ <c:set var="dontRenderForm" value="#{true}" />
+ </f:metadata>
+ <h:outputStylesheet library="css" name="a4jQueue.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <a4j:queue id="globalQueue" ignoreDupResponses="#{a4jQueueBean.globalQueue.attributes['ignoreDupResponses'].value}"
+ name="#{a4jQueueBean.globalQueue.attributes['name'].value}"
+ onbeforedomupdate="#{a4jQueueBean.globalQueue.attributes['onbeforedomupdate'].value}"
+ oncomplete="#{a4jQueueBean.globalQueue.attributes['oncomplete'].value}"
+ onerror="#{a4jQueueBean.globalQueue.attributes['onerror'].value}" onevent="#{a4jQueueBean.globalQueue.attributes['event'].value}"
+ onrequestdequeue="#{a4jQueueBean.globalQueue.attributes['onrequestdequeue'].value}"
+ onrequestqueue="#{a4jQueueBean.globalQueue.attributes['onrequestqueue'].value}"
+ onsubmit="#{a4jQueueBean.globalQueue.attributes['onsubmit'].value}"
+ rendered="#{a4jQueueBean.globalQueue.attributes['rendered'].value}"
+ requestDelay="#{a4jQueueBean.globalQueue.attributes['requestDelay'].value}"
+ timeout="#{a4jQueueBean.globalQueue.attributes['timeout'].value}" />
+
+ <c:forEach var="i" begin="1" end="2" step="1">
+ <rich:panel id="formQueue${i}Panel" header="Form Based Queue ${i}">
+ <h:form id="formQueue${i}Form">
+
+ <a4j:queue id="queue"
+ ignoreDupResponses="#{a4jQueueBean.formQueues[i-1].attributes['ignoreDupResponses'].value}"
+ name="#{a4jQueueBean.formQueues[i-1].attributes['name'].value}"
+ onbeforedomupdate="#{a4jQueueBean.formQueues[i-1].attributes['onbeforedomupdate'].value}"
+ oncomplete="#{a4jQueueBean.formQueues[i-1].attributes['oncomplete'].value}"
+ onerror="#{a4jQueueBean.formQueues[i-1].attributes['onerror'].value}"
+ onevent="#{a4jQueueBean.formQueues[i-1].attributes['event'].value}"
+ onrequestdequeue="#{a4jQueueBean.formQueues[i-1].attributes['onrequestdequeue'].value}"
+ onrequestqueue="#{a4jQueueBean.formQueues[i-1].attributes['onrequestqueue'].value}"
+ onsubmit="#{a4jQueueBean.formQueues[i-1].attributes['onsubmit'].value}"
+ rendered="#{a4jQueueBean.formQueues[i-1].attributes['rendered'].value}"
+ requestDelay="#{a4jQueueBean.formQueues[i-1].attributes['requestDelay'].value}"
+ timeout="#{a4jQueueBean.formQueues[i-1].attributes['timeout'].value}" />
+
+ <script type="text/javascript">
+ function add(element) {
+ element.innerHTML = 1 + parseInt(element.innerHTML);
+ }
+ </script>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Event 1:" />
+ <h:inputText id="input1" value="#{a4jQueueBean.text}" onkeypress="add(#{rich:element('events1')}); refresh(#{rich:element('eventTime1:outputTime')}); "
+ disabled="#{not (facesContext.maximumSeverity==null)}">
+ <a4j:ajax event="keypress" onbegin="add(#{rich:element('requests')}); refresh(#{rich:element('beginTime:outputTime')}); " render="outtext"
+ oncomplete="refresh(#{rich:element('completeTime:outputTime')});" onbeforedomupdate="add(#{rich:element('updates')}); " />
+ </h:inputText>
+ <h:outputText value="Event 2:" />
+ <h:inputText id="input2" value="#{a4jQueueBean.text}" onkeypress="add(#{rich:element('events2')}); refresh(#{rich:element('eventTime2:outputTime')}); "
+ disabled="#{not (facesContext.maximumSeverity==null)}">
+ <a4j:ajax event="keypress" onbegin="add(#{rich:element('requests')}); refresh(#{rich:element('beginTime:outputTime')}); " render="outtext"
+ oncomplete="refresh(#{rich:element('completeTime:outputTime')});" onbeforedomupdate="add(#{rich:element('updates')}); " />
+ </h:inputText>
+
+
+ <h:outputText value="Repeated text:" />
+ <h:outputText value="#{a4jQueueBean.text}" id="outtext" style="font-weight:bold;" />
+ <h:outputText value="Event 1 count:" />
+ <h:outputText value="0" id="events1" />
+ <h:outputText value="Event 2 count:" />
+ <h:outputText value="0" id="events2" />
+ <h:outputText value="Requests count:" />
+ <h:outputText value="0" id="requests" />
+ <h:outputText value="DOM updates count:" />
+ <h:outputText value="0" id="updates" />
+
+ </h:panelGrid>
+
+ <h:panelGrid columns="1">
+ <metamer:clientTime id="eventTime1" label="Event 1 Time:" />
+ <metamer:clientTime id="eventTime2" label="Event 2 Time:" />
+ <metamer:clientTime id="beginTime" label="Begin Time:" />
+ <metamer:clientTime id="completeTime" label="Complete Time:" />
+ </h:panelGrid>
+ </h:form>
+ </rich:panel>
+
+ </c:forEach>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <h:form id="attributeForm">
+ <rich:panel id="formQueue1AttributesPanel" header="Form Queue 1 Attributes">
+ <metamer:attributes value="#{a4jQueueBean.formQueue1.attributes}" id="formQueue1Attributes" />
+ </rich:panel>
+ <rich:panel id="formQueue2AttributesPanel" header="Form Queue 2 Attributes">
+ <metamer:attributes value="#{a4jQueueBean.formQueue2.attributes}" id="formQueue2Attributes" />
+ </rich:panel>
+ <rich:panel id="globalQueueAttributesPanel" header="Global Queue Attributes">
+ <metamer:attributes value="#{a4jQueueBean.globalQueue.attributes}" id="globalQueueAttributes" />
+ </rich:panel>
+ </h:form>
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Copied: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/globalQueue.xhtml (from rev 19087, modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/simple.xhtml)
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/globalQueue.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/globalQueue.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,101 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<!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: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:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ <c:set var="dontRenderForm" value="#{true}" />
+ </f:metadata>
+ <h:outputStylesheet library="css" name="a4jQueue.css" />
+ <script type="text/javascript">
+ function add(element) {
+ element.innerHTML = 1 + parseInt(element.innerHTML);
+ }
+ </script>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+
+ <a4j:queue id="a4jQueue" ignoreDupResponses="#{a4jQueueBean.attributes['ignoreDupResponses'].value}"
+ name="#{a4jQueueBean.attributes['name'].value}"
+ onbeforedomupdate="#{a4jQueueBean.attributes['onbeforedomupdate'].value}"
+ oncomplete="#{a4jQueueBean.attributes['oncomplete'].value}"
+ onerror="#{a4jQueueBean.attributes['onerror'].value}" onevent="#{a4jQueueBean.attributes['event'].value}"
+ onrequestdequeue="#{a4jQueueBean.attributes['onrequestdequeue'].value}"
+ onrequestqueue="#{a4jQueueBean.attributes['onrequestqueue'].value}"
+ onsubmit="#{a4jQueueBean.attributes['onsubmit'].value}"
+ rendered="#{a4jQueueBean.attributes['rendered'].value}"
+ requestDelay="#{a4jQueueBean.attributes['requestDelay'].value}" status="status1"
+ timeout="#{a4jQueueBean.attributes['timeout'].value}" />
+
+ <h:form name="queueTestForm">
+ <h:panelGrid columns="2">
+ <h:outputText value="Type here:" />
+ <h:inputText id="input1" value="#{a4jQueueBean.text}" onkeypress="add(#{rich:element('events1')}); refresh(#{rich:element('eventTime1:outputTime')}); "
+ disabled="#{not (facesContext.maximumSeverity==null)}">
+ <a4j:ajax event="keypress" onbegin="add(#{rich:element('requests')}); refresh(#{rich:element('beginTime:outputTime')}); " render="outtext" oncomplete="refresh(#{rich:element('completeTime:outputTime')}); "
+ onbeforedomupdate="add(#{rich:element('updates')});"/>
+ </h:inputText>
+
+ <h:outputText value="Repeated text:" />
+ <h:outputText value="#{a4jQueueBean.text}" id="outtext" style="font-weight:bold;" />
+ <h:outputText value="Events count:" />
+ <h:outputText value="0" id="events1" />
+ <h:outputText value="Requests count:" />
+ <h:outputText value="0" id="requests" />
+ <h:outputText value="DOM updates count:" />
+ <h:outputText value="0" id="updates" />
+
+ </h:panelGrid>
+
+ <h:panelGrid columns="1">
+ <metamer:clientTime id="eventTime1" label="Event Time:" />
+ <metamer:clientTime id="beginTime" label="Begin Time:" />
+ <metamer:clientTime id="completeTime" label="Complete Time:" />
+ </h:panelGrid>
+
+ </h:form>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <h:form id="attributeForm">
+ <metamer:attributes value="#{a4jQueueBean.attributes}" id="attributes" />
+ </h:form>
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/list.xhtml 2010-09-13 11:54:19 UTC (rev 19166)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/list.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
@@ -30,9 +30,15 @@
<ui:define name="links">
- <metamer:testPageLink id="simple" outcome="simple" value="Simple">
- Simple page that contains <b>a4j:queue</b> and input boxes for all its attributes.
+ <metamer:testPageLink id="globalQueue" outcome="globalQueue" value="Global Queue">
+ Simple page that contains <b>a4j:queue</b> outside of any form (<b>global queue</b>) and input boxes for all its attributes.
</metamer:testPageLink>
+
+ <metamer:testPageLink id="formQueue" outcome="formQueue" value="Form Queue">
+ <div>There are three <b>a4j:queue</b>s defined: two inside forms (<b>form based queues</b>) and also <b>global queue</b>.</div>
+ <div>The <b>form based queues</b> should not inherit any attributes from <b>global queue</b>.</div>
+
+ </metamer:testPageLink>
</ui:define>
Deleted: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/simple.xhtml 2010-09-13 11:54:19 UTC (rev 19166)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jQueue/simple.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
@@ -1,104 +0,0 @@
-<!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-This software 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 software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-
-<!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: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:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich">
-
- <ui:composition template="/templates/template.xhtml">
-
- <ui:define name="head">
- <f:metadata>
- <f:viewParam name="templates" value="#{templateBean.templates}">
- <f:converter converterId="templatesListConverter" />
- </f:viewParam>
- </f:metadata>
- <h:outputStylesheet library="css" name="a4jQueue.css" />
- <script type="text/javascript">
- var events = 0;
- var updates = 0;
- var requests = 0;
-
- function addEvent() {
- events++;
- }
- function addUpdate() {
- updates++;
- }
- function addRequest() {
- requests++;
- }
-
- function printCounts() {
- #{rich:element('events')}.innerHTML=events;
- #{rich:element('updates')}.innerHTML=updates;
- #{rich:element('requests')}.innerHTML=requests;
- }
- </script>
- </ui:define>
-
- <ui:define name="outOfTemplateBefore">
- </ui:define>
-
- <ui:define name="component">
-
- <a4j:queue id="a4jQueue"
- ignoreDupResponses="#{a4jQueueBean.attributes['ignoreDupResponses'].value}"
- name="#{a4jQueueBean.attributes['name'].value}"
- onbeforedomupdate="#{a4jQueueBean.attributes['onbeforedomupdate'].value}"
- oncomplete="#{a4jQueueBean.attributes['oncomplete'].value}"
- onerror="#{a4jQueueBean.attributes['onerror'].value}"
- onevent="#{a4jQueueBean.attributes['event'].value}"
- onrequestdequeue="#{a4jQueueBean.attributes['onrequestdequeue'].value}"
- onrequestqueue="#{a4jQueueBean.attributes['onrequestqueue'].value}"
- onsubmit="#{a4jQueueBean.attributes['onsubmit'].value}"
- rendered="#{a4jQueueBean.attributes['rendered'].value}"
- requestDelay="#{a4jQueueBean.attributes['requestDelay'].value}"
- status="#{a4jQueueBean.attributes['status'].value}"
- timeout="#{a4jQueueBean.attributes['timeout'].value}"/>
-
- <h:panelGrid columns="2">
- <h:outputText value="Type here:" />
- <h:inputText id="input" value="#{a4jQueueBean.text}" onkeyup="addEvent();" disabled="#{not (facesContext.maximumSeverity==null)}">
- <a4j:ajax onbegin="addRequest();" event="keyup" render="outtext" oncomplete="printCounts()" onbeforedomupdate="addUpdate()" />
- </h:inputText>
-
- <h:outputText value="Repeated text:" />
- <h:outputText value="#{a4jQueueBean.text}" id="outtext"
- style="font-weight:bold;" />
- <h:outputText value="Events count:" />
- <h:outputText value="0" id="events" />
- <h:outputText value="Requests count:" />
- <h:outputText value="0" id="requests" />
- <h:outputText value="DOM updates count:" />
- <h:outputText value="0" id="updates" />
- </h:panelGrid>
-
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- <metamer:attributes value="#{a4jQueueBean.attributes}" id="attributes" />
- </ui:define>
-
- </ui:composition>
-</html>
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml 2010-09-13 11:54:19 UTC (rev 19166)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/clientTime.xhtml 2010-09-13 11:58:36 UTC (rev 19167)
@@ -1,26 +1,26 @@
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:a4j="http://richfaces.org/a4j">
+ xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
<h:body>
<composite:interface>
+ <composite:attribute name="id" type="java.lang.String" required="true" />
<composite:attribute name="label" type="java.lang.String" required="true" />
- <composite:attribute name="name" type="java.lang.String" default="metamerOutputTime" />
</composite:interface>
<composite:implementation>
- <h:outputLabel value="#{cc.attrs.label}" for="#{cc.attrs.name}" />
- <h:outputText styleClass="metamerOutputTime" id="#{cc.attrs.name}" value="" title="" />
+ <h:outputLabel value="#{cc.attrs.label}" />
+ <h:outputText id="outputTime" value="" title="" />
<h:outputScript library="script" name="date-format.js" />
<script type="text/javascript">
//<![CDATA[
- function #{cc.attrs.name}Refresh() {
+ function refresh(element) {
var now = new Date();
- jQuery("span.metamerOutputTime[id$=#{cc.attrs.name}]")
+ jQuery(element)
.text(now.format("dd.mm.yyyy HH:MM:ss.l", false))
.attr("title", now.getTime());
}
- #{cc.attrs.name}Refresh();
+ refresh(#{rich:element('outputTime')});
//]]>
</script>
</composite:implementation>
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jQueue;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class QueueAttributes extends AbstractComponentAttributes {
+
+ public QueueAttributes() {
+ }
+
+ public QueueAttributes(ExtendedLocator<JQueryLocator> root) {
+ super(root);
+ }
+
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ setProperty("ignoreDupResponses", ignoreDupResponses);
+ }
+
+ public void setName(String name) {
+ setProperty("name", name);
+ }
+
+ public void setOnBeforeDomUpdate(JavaScript onBeforeDomUpdate) {
+ setProperty("onbeforedomupdate", onBeforeDomUpdate);
+ }
+
+ public void setOnComplete(JavaScript onComplete) {
+ setProperty("oncomplete", onComplete);
+ }
+
+ public void setOnEvent(JavaScript onEvent) {
+ setProperty("onevent", onEvent);
+ }
+
+ public void setOnError(JavaScript onError) {
+ setProperty("onerror", onError);
+ }
+
+ public void setOnRequestDequeue(JavaScript onRequestDequeue) {
+ setProperty("onrequestdequeue", onRequestDequeue);
+ }
+
+ public void setOnRequestQueue(JavaScript onRequestQueue) {
+ setProperty("onrequestqueue", onRequestQueue);
+ }
+
+ public void setOnSubmit(JavaScript onSubmit) {
+ setProperty("onsubmit", onSubmit);
+ }
+
+ public void setRendered(boolean rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setRequestDelay(long requestDelay) {
+ setProperty("requestDelay", requestDelay);
+ }
+
+ public void setTimeout(long timeout) {
+ setProperty("timeout", timeout);
+ }
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueLocators.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueLocators.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueLocators.java 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,93 @@
+package org.richfaces.tests.metamer.ftest.a4jQueue;
+
+import static org.jboss.cheiron.retriever.RetrieverAdapter.integerAdapter;
+import static org.jboss.cheiron.retriever.RetrieverAdapter.longAdapter;
+import static org.jboss.test.selenium.locator.Attribute.TITLE;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+import static org.jboss.test.selenium.waiting.retrievers.RetrieverFactory.RETRIEVE_ATTRIBUTE;
+import static org.jboss.test.selenium.waiting.retrievers.RetrieverFactory.RETRIEVE_TEXT;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.LocatorReference;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.jboss.test.selenium.waiting.retrievers.Retriever;
+
+public class QueueLocators {
+
+ LocatorReference<JQueryLocator> form = new LocatorReference<JQueryLocator>(null);
+ LocatorReference<JQueryLocator> attributesPanel = new LocatorReference<JQueryLocator>(null);
+
+ ReferencedLocator<JQueryLocator> input1 = ref(form, "input:text[id$=input1]");
+ ReferencedLocator<JQueryLocator> input2 = ref(form, "input:text[id$=input2]");
+ ReferencedLocator<JQueryLocator> attributesTable = ref(attributesPanel, "table.attributes");
+
+ QueueAttributes attributes = new QueueAttributes(attributesTable);
+
+ ElementLocator<?> events1 = ref(form, "span[id$=events1]");
+ ElementLocator<?> events2 = ref(form, "span[id$=events2]");
+ ElementLocator<?> requests = ref(form, "span[id$=requests]");
+ ElementLocator<?> updates = ref(form, "span[id$=updates]");
+
+ AttributeLocator<?> event1Time = ref(form, "span[id$=eventTime1\\:outputTime]").getAttribute(TITLE);
+ AttributeLocator<?> event2Time = ref(form, "span[id$=eventTime2\\:outputTime]").getAttribute(TITLE);
+ AttributeLocator<?> beginTime = ref(form, "span[id$=beginTime\\:outputTime]").getAttribute(TITLE);
+ AttributeLocator<?> completeTime = ref(form, "span[id$=completeTime\\:outputTime]").getAttribute(TITLE);
+
+ Retriever<Integer> retrieveEvent1Count = integerAdapter(RETRIEVE_TEXT.locator(events1));
+ Retriever<Integer> retrieveEvent2Count = integerAdapter(RETRIEVE_TEXT.locator(events2));
+ Retriever<Integer> retrieveRequestCount = integerAdapter(RETRIEVE_TEXT.locator(requests));
+ Retriever<Integer> retrieveDOMUpdateCount = integerAdapter(RETRIEVE_TEXT.locator(updates));
+
+ Retriever<Long> retrieveEvent1Time = longAdapter(RETRIEVE_ATTRIBUTE.attributeLocator(event1Time));
+ Retriever<Long> retrieveEvent2Time = longAdapter(RETRIEVE_ATTRIBUTE.attributeLocator(event2Time));
+ Retriever<Long> retrieveBeginTime = longAdapter(RETRIEVE_ATTRIBUTE.attributeLocator(beginTime));
+ Retriever<Long> retrieveCompleteTime = longAdapter(RETRIEVE_ATTRIBUTE.attributeLocator(completeTime));
+
+ private String identifier;
+
+ public QueueLocators(String identifier, JQueryLocator queueRoot, JQueryLocator queueAttributesPanel) {
+ this.identifier = identifier;
+
+ form.setLocator(queueRoot);
+ attributesPanel.setLocator(queueAttributesPanel);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ QueueLocators other = (QueueLocators) obj;
+ if (identifier == null) {
+ if (other.identifier != null) {
+ return false;
+ }
+ } else if (!identifier.equals(other.identifier)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "FormQueueLocators [identifier=" + identifier + "]";
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jQueue;
+
+import static org.jboss.test.selenium.dom.Event.KEYPRESS;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.cheiron.halt.XHRHalter;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.waiting.retrievers.Retriever;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestFormQueue extends AbstractMetamerTest {
+
+ static final Long GLOBAL_DELAY = 10000L;
+ static final Long DELAY_A = 3000L;
+ static final Long DELAY_B = 5000L;
+
+ int deviationTotal;
+ int deviationCount;
+
+ QueueLocators formQueueA = prepareLocators("formQueue1");
+ QueueLocators formQueueB = prepareLocators("formQueue2");
+ QueueLocators globalQueue = prepareLocators("globalQueue");
+
+ private static QueueLocators prepareLocators(String identifier) {
+ return new QueueLocators(identifier, pjq("div.rf-p[id$={0}Panel]").format(identifier), pjq(
+ "div.rf-p[id$={0}AttributesPanel]").format(identifier));
+ }
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jQueue/formQueue.xhtml");
+ }
+
+ @Test
+ public void testTimingOneQueueTwoEvents() {
+ formQueueA.attributes.setRequestDelay(DELAY_A);
+ globalQueue.attributes.setRequestDelay(GLOBAL_DELAY);
+
+ initializeTimes(formQueueA);
+
+ XHRHalter.enable();
+
+ fireEvent(formQueueA, Event.FIRST, 2);
+ fireEvent(formQueueA, Event.SECOND, 3);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ halter.complete();
+ halter.waitForOpen();
+ halter.complete();
+
+ checkTimes(formQueueA, Event.SECOND, DELAY_A);
+ }
+
+ @Test
+ public void testCountsOneQueueTwoEvents() {
+ formQueueA.attributes.setRequestDelay(DELAY_A);
+ globalQueue.attributes.setRequestDelay(GLOBAL_DELAY);
+
+ initializeCounts(formQueueA);
+
+ XHRHalter.enable();
+
+ fireEvent(formQueueA, Event.FIRST, 2);
+ checkCounts(formQueueA, 2, 0, 0, 0);
+ fireEvent(formQueueA, Event.SECOND, 3);
+ checkCounts(formQueueA, 2, 3, 1, 0);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ checkCounts(formQueueA, 2, 3, 1, 0);
+ halter.complete();
+ checkCounts(formQueueA, 2, 3, 2, 1);
+ halter.waitForOpen();
+ checkCounts(formQueueA, 2, 3, 2, 1);
+ halter.complete();
+ checkCounts(formQueueA, 2, 3, 2, 2);
+ }
+
+ @Test
+ public void testTimingTwoQueuesFourEvents() {
+ formQueueA.attributes.setRequestDelay(DELAY_A);
+ formQueueB.attributes.setRequestDelay(DELAY_B);
+ globalQueue.attributes.setRequestDelay(GLOBAL_DELAY);
+
+ initializeTimes(formQueueA);
+ initializeTimes(formQueueB);
+
+ XHRHalter.enable();
+
+ fireEvent(formQueueA, Event.FIRST, 1);
+ fireEvent(formQueueA, Event.SECOND, 1);
+ fireEvent(formQueueB, Event.FIRST, 1);
+ fireEvent(formQueueB, Event.SECOND, 1);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ halter.complete();
+ halter.waitForOpen();
+ halter.complete();
+ halter.waitForOpen();
+ halter.complete();
+ halter.waitForOpen();
+ halter.complete();
+
+ checkTimes(formQueueB, Event.SECOND, DELAY_B);
+
+ assertTrue(formQueueA.retrieveBeginTime.retrieve() - formQueueA.retrieveEvent1Time.retrieve() < 1000);
+ assertTrue(formQueueA.retrieveBeginTime.retrieve() - formQueueA.retrieveEvent2Time.retrieve() < 1000);
+ assertTrue(formQueueB.retrieveBeginTime.retrieve() - formQueueB.retrieveEvent1Time.retrieve() > 3000);
+ }
+
+ @Test
+ public void testCountsTwoQueuesThreeEvents() {
+ formQueueA.attributes.setRequestDelay(DELAY_A);
+ formQueueB.attributes.setRequestDelay(DELAY_B);
+ globalQueue.attributes.setRequestDelay(GLOBAL_DELAY);
+
+ initializeCounts(formQueueA);
+ initializeCounts(formQueueB);
+
+ XHRHalter.enable();
+
+ fireEvent(formQueueA, Event.FIRST, 1);
+ checkCounts(formQueueA, 1, 0, 0, 0);
+ fireEvent(formQueueA, Event.SECOND, 1);
+ checkCounts(formQueueA, 1, 1, 1, 0);
+ fireEvent(formQueueB, Event.FIRST, 1);
+ checkCounts(formQueueB, 1, 0, 0, 0);
+ fireEvent(formQueueB, Event.SECOND, 1);
+
+ checkCounts(formQueueA, 1, 1, 1, 0);
+ checkCounts(formQueueB, 1, 1, 0, 0);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ halter.complete();
+ checkCounts(formQueueA, 1, 1, 2, 1);
+ halter.waitForOpen();
+ halter.complete();
+ checkCounts(formQueueA, 1, 1, 2, 2);
+ checkCounts(formQueueB, 1, 1, 1, 0);
+ halter.waitForOpen();
+ halter.complete();
+ halter.waitForOpen();
+ checkCounts(formQueueB, 1, 1, 2, 1);
+ halter.complete();
+
+ checkCounts(formQueueA, 1, 1, 2, 2);
+ checkCounts(formQueueB, 1, 1, 2, 2);
+ }
+
+ private void initializeTimes(QueueLocators formQueueLocators) {
+ deviationTotal = 0;
+ deviationCount = 0;
+ formQueueLocators.retrieveEvent1Time.initializeValue();
+ formQueueLocators.retrieveEvent2Time.initializeValue();
+ formQueueLocators.retrieveBeginTime.initializeValue();
+ formQueueLocators.retrieveCompleteTime.initializeValue();
+ }
+
+ private void fireEvent(QueueLocators formQueueLocators, Event event, int countOfEvents) {
+ ElementLocator<?> input = (event == Event.FIRST) ? formQueueLocators.input1 : formQueueLocators.input2;
+ for (int i = 0; i < countOfEvents; i++) {
+ selenium.fireEvent(input, KEYPRESS);
+ }
+ }
+
+ private void initializeCounts(QueueLocators formQueueLocators) {
+ formQueueLocators.retrieveEvent1Count.initializeValue();
+ formQueueLocators.retrieveEvent2Count.initializeValue();
+ formQueueLocators.retrieveRequestCount.initializeValue();
+ formQueueLocators.retrieveDOMUpdateCount.initializeValue();
+ }
+
+ private void checkCounts(QueueLocators formQueueLocators, int events1, int events2, int requests, int domUpdates) {
+ assertChangeIfNotEqualToOldValue(formQueueLocators.retrieveEvent1Count, events1, "event1Count");
+ assertChangeIfNotEqualToOldValue(formQueueLocators.retrieveEvent2Count, events2, "event2Count");
+ assertChangeIfNotEqualToOldValue(formQueueLocators.retrieveRequestCount, requests, "requestCount");
+ assertChangeIfNotEqualToOldValue(formQueueLocators.retrieveDOMUpdateCount, domUpdates, "domUpdates");
+ }
+
+ private void assertChangeIfNotEqualToOldValue(Retriever<Integer> retrieveCount, Integer eventCount, String eventType) {
+ if (!eventCount.equals(retrieveCount.getValue())) {
+ assertEquals(waitAjax.failWith(eventType).waitForChangeAndReturn(retrieveCount), eventCount);
+ } else {
+ assertEquals(retrieveCount.retrieve(), eventCount);
+ }
+ }
+
+ private void checkTimes(QueueLocators formQueueLocators, Event event, long requestDelay) {
+ Retriever<Long> retrieveEventTime = (event == Event.FIRST) ? formQueueLocators.retrieveEvent1Time
+ : formQueueLocators.retrieveEvent2Time;
+ long eventTime = waitAjax.waitForChangeAndReturn(retrieveEventTime);
+ long beginTime = waitAjax.waitForChangeAndReturn(formQueueLocators.retrieveBeginTime);
+ long actualDelay = beginTime - eventTime;
+ long deviation = Math.abs(actualDelay - requestDelay);
+ long maxDeviation = Math.max(100, requestDelay);
+
+ if (seleniumDebug) {
+ System.out.println(format("deviation for requestDelay {0}: {1}", requestDelay, deviation));
+ }
+
+ assertTrue(
+ deviation <= maxDeviation,
+ format("Deviation ({0}) is greater than maxDeviation ({1}) for requestDelay {2}", deviation, maxDeviation,
+ requestDelay));
+
+ deviationTotal += deviation;
+ deviationCount += 1;
+ }
+
+ private enum Event {
+ FIRST, SECOND;
+ }
+}
\ No newline at end of file
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java 2010-09-13 11:58:36 UTC (rev 19167)
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jQueue;
+
+import static org.jboss.test.selenium.dom.Event.KEYPRESS;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.cheiron.halt.XHRHalter;
+import org.jboss.cheiron.halt.XHRState;
+import org.jboss.test.selenium.waiting.retrievers.Retriever;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestGlobalQueue extends AbstractMetamerTest {
+
+ QueueLocators queue = new QueueLocators("globalQueue", pjq(""), pjq("#attributeForm"));
+
+ QueueAttributes attributes = new QueueAttributes();
+
+ @Inject
+ @Use(empty = false)
+ Integer requestDelay;
+
+ int deviationTotal;
+ int deviationCount;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jQueue/globalQueue.xhtml");
+ }
+
+ @Test
+ @Use(field = "requestDelay", ints = { 0, 500, 1500, 5000 })
+ public void testRequestDelay() {
+ attributes.setRequestDelay(requestDelay);
+
+ initializeTimes();
+ for (int i = 0; i < 5; i++) {
+ fireEvents(1);
+ checkTimes();
+ }
+ checkAvgDeviation();
+ }
+
+ @Test
+ public void testMultipleRequestsWithDelay() {
+ attributes.setRequestDelay(3000);
+
+ initializeCounts();
+
+ XHRHalter.enable();
+
+ fireEvents(4);
+ XHRHalter handle = XHRHalter.getHandleBlocking();
+ handle.send();
+ handle.complete();
+
+ checkCounts(4, 1, 1);
+
+ fireEvents(3);
+ handle.waitForOpen();
+ handle.send();
+ handle.complete();
+
+ checkCounts(7, 2, 2);
+
+ XHRHalter.disable();
+ }
+
+ @Test
+ public void testMultipleRequestsWithNoDelay() {
+ attributes.setRequestDelay(0);
+
+ initializeCounts();
+
+ XHRHalter.enable();
+
+ fireEvents(1);
+ checkCounts(1, 1, 0);
+
+ XHRHalter handle = XHRHalter.getHandleBlocking();
+ handle.send();
+
+ fireEvents(1);
+ checkCounts(2, 1, 0);
+
+ handle.complete();
+ checkCounts(2, 2, 1);
+
+ handle.waitForOpen();
+ handle.send();
+ fireEvents(4);
+ checkCounts(6, 2, 1);
+
+ handle.complete();
+ checkCounts(6, 3, 2);
+
+ handle.waitForOpen();
+ handle.send();
+ fireEvents(1);
+ checkCounts(7, 3, 2);
+
+ handle.complete();
+ checkCounts(7, 4, 3);
+
+ handle.waitForOpen();
+ handle.send();
+ checkCounts(7, 4, 3);
+
+ handle.complete();
+ checkCounts(7, 4, 4);
+
+ XHRHalter.disable();
+ }
+
+ // TODO not implemented yet
+ public void testTimeout() {
+ attributes.setRequestDelay(0);
+ attributes.setTimeout(1000);
+
+ XHRHalter.enable();
+
+ fireEvents(1);
+ XHRHalter handle = XHRHalter.getHandleBlocking();
+ handle.continueBefore(XHRState.COMPLETE);
+ fireEvents(10);
+
+ XHRHalter.disable();
+
+ // fireEvents(1);
+ // fireEvents(1);
+ }
+
+ // TODO not implemented yet
+ public void testIgnoreDuplicatedResponses() {
+ attributes.setIgnoreDupResponses(true);
+
+ XHRHalter.enable();
+ fireEvents(1);
+ XHRHalter handle = XHRHalter.getHandleBlocking();
+ handle.send();
+ fireEvents(1);
+ handle.complete();
+ handle.waitForOpen();
+ }
+
+ private void initializeTimes() {
+ deviationTotal = 0;
+ deviationCount = 0;
+ queue.retrieveEvent1Time.initializeValue();
+ queue.retrieveBeginTime.initializeValue();
+ queue.retrieveCompleteTime.initializeValue();
+ }
+
+ private void fireEvents(int countOfEvents) {
+ for (int i = 0; i < countOfEvents; i++) {
+ selenium.fireEvent(queue.input1, KEYPRESS);
+ }
+ }
+
+ private void initializeCounts() {
+ queue.retrieveEvent1Count.initializeValue();
+ queue.retrieveRequestCount.initializeValue();
+ queue.retrieveDOMUpdateCount.initializeValue();
+ }
+
+ private void checkCounts(int events, int requests, int domUpdates) {
+ assertChangeIfNotEqualToOldValue(queue.retrieveEvent1Count, events, "eventCount");
+ assertChangeIfNotEqualToOldValue(queue.retrieveRequestCount, requests, "requestCount");
+ assertChangeIfNotEqualToOldValue(queue.retrieveDOMUpdateCount, domUpdates, "domUpdates");
+ }
+
+ private void assertChangeIfNotEqualToOldValue(Retriever<Integer> retrieveCount, Integer eventCount, String eventType) {
+ if (!eventCount.equals(retrieveCount.getValue())) {
+ assertEquals(waitAjax.failWith(eventType).waitForChangeAndReturn(retrieveCount), eventCount);
+ } else {
+ assertEquals(retrieveCount.retrieve(), eventCount);
+ }
+ }
+
+ private void checkTimes() {
+ long eventTime = waitAjax.waitForChangeAndReturn(queue.retrieveEvent1Time);
+ long beginTime = waitAjax.waitForChangeAndReturn(queue.retrieveBeginTime);
+ long actualDelay = beginTime - eventTime;
+ long deviation = Math.abs(actualDelay - requestDelay);
+ long maxDeviation = Math.max(50, requestDelay);
+
+ if (seleniumDebug) {
+ System.out.println(format("deviation for requestDelay {0}: {1}", requestDelay, deviation));
+ }
+
+ assertTrue(
+ deviation <= maxDeviation,
+ format("Deviation ({0}) is greater than maxDeviation ({1}) for requestDelay {2}", deviation, maxDeviation,
+ requestDelay));
+
+ deviationTotal += deviation;
+ deviationCount += 1;
+ }
+
+ private void checkAvgDeviation() {
+ long maximumAvgDeviation = Math.max(25, Math.min(50, requestDelay / 4));
+ long averageDeviation = deviationTotal / deviationCount;
+ if (seleniumDebug) {
+ System.out.println("averageDeviation: " + averageDeviation);
+ }
+ assertTrue(
+ averageDeviation <= maximumAvgDeviation,
+ format(
+ "Average deviation for all tests of requestDelay ({0}) should not be greater than defined maximum {1}",
+ averageDeviation, maximumAvgDeviation));
+ }
+}
\ No newline at end of file
14 years, 3 months
JBoss Rich Faces SVN: r19166 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron: retriever and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-13 07:54:19 -0400 (Mon, 13 Sep 2010)
New Revision: 19166
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/retriever/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/retriever/RetrieverAdapter.java
Log:
introduced retrieverAdapter principle (can converty any Retriever<String> to Retriever<Integer> or any other retriever of primite types)
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/retriever/RetrieverAdapter.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/retriever/RetrieverAdapter.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/retriever/RetrieverAdapter.java 2010-09-13 11:54:19 UTC (rev 19166)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.jboss.cheiron.retriever;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.waiting.conversion.Convertor;
+import org.jboss.test.selenium.waiting.retrievers.Retriever;
+
+/**
+ * Adapts the value for final representation using predefined set of converters.
+ *
+ *
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ *
+ * @param <T>
+ * the type of retrieved value
+ * @param <C>
+ * the type of value converted from retriever value
+ */
+public class RetrieverAdapter<T, C> implements Retriever<C> {
+
+ private Retriever<T> retriever;
+ private Class<C> conversionType;
+
+ public static <A> RetrieverAdapter<A, String> stringAdapter(Retriever<A> retriever) {
+ RetrieverAdapter<A, String> adapter = new RetrieverAdapter<A, String>();
+ adapter.retriever = retriever;
+ adapter.conversionType = String.class;
+ return adapter;
+ }
+
+ public static <A> RetrieverAdapter<A, Integer> integerAdapter(Retriever<A> retriever) {
+ RetrieverAdapter<A, Integer> adapter = new RetrieverAdapter<A, Integer>();
+ adapter.retriever = retriever;
+ adapter.conversionType = Integer.class;
+ return adapter;
+ }
+
+ public static <A> RetrieverAdapter<A, Long> longAdapter(Retriever<A> retriever) {
+ RetrieverAdapter<A, Long> adapter = new RetrieverAdapter<A, Long>();
+ adapter.retriever = retriever;
+ adapter.conversionType = Long.class;
+ return adapter;
+ }
+
+ public Convertor<C, T> convertor() {
+ return new Convertor<C, T>() {
+ public C backwardConversion(T object) {
+ String converted = retriever.getConvertor().forwardConversion(object);
+ if (conversionType == String.class) {
+ return (C) converted;
+ } else if (conversionType == Integer.class) {
+ return (C) Integer.valueOf(converted);
+ } else if (conversionType == Long.class) {
+ return (C) Long.valueOf(converted);
+ }
+ throw new UnsupportedOperationException();
+ };
+
+ public T forwardConversion(C object) {
+ String converted;
+ if (conversionType == String.class) {
+ converted = (String) object;
+ } else if (conversionType == Integer.class) {
+ converted = Integer.toString((Integer) object);
+ } else if (conversionType == Long.class) {
+ converted = Long.toString((Long) object);
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ return retriever.getConvertor().backwardConversion(converted);
+ };
+ };
+ }
+
+ public C getValue() {
+ return convertor().backwardConversion(retriever.getValue());
+ }
+
+ public void setValue(C oldValue) {
+ retriever.setValue(convertor().forwardConversion(oldValue));
+ }
+
+ public void initializeValue() {
+ retriever.initializeValue();
+ }
+
+ public C retrieve() {
+ return convertor().backwardConversion(retriever.retrieve());
+ }
+
+ public JavaScript getJavaScriptRetrieve() {
+ return retriever.getJavaScriptRetrieve();
+ }
+
+ public Convertor<C, String> getConvertor() {
+ return new Convertor<C, String>() {
+ public C backwardConversion(String object) {
+ return convertor().backwardConversion(retriever.getConvertor().backwardConversion(object));
+ }
+
+ public String forwardConversion(C object) {
+ return retriever.getConvertor().forwardConversion(convertor().forwardConversion(object));
+ };
+ };
+ }
+
+}
14 years, 3 months