Author: lfryc(a)redhat.com
Date: 2010-09-03 09:10:20 -0400 (Fri, 03 Sep 2010)
New Revision: 19111
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
Log:
refactored a4j:status tests to expose SendHalt interface (will be used in queue tests)
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/AbstractPageExtensions.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -0,0 +1,105 @@
+/*
+ * 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.halt;
+
+import java.util.List;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.waiting.Wait;
+
+import static org.jboss.test.selenium.encapsulated.JavaScript.*;
+
+/**
+ * Defines methods for installing JavaScript page extension to the target page.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPageExtensions {
+
+ /** The JavaScript for extending of the page. */
+ JavaScript pageExtensions;
+
+ /** Evaluates if the body is loaded */
+ final JavaScript isBodyLoaded = js("(selenium.browserbot.getCurrentWindow() !=
null) "
+ + " && (selenium.browserbot.getCurrentWindow().document != null)
"
+ + " && (selenium.browserbot.getCurrentWindow().document.body !=
null)");
+
+ /** The associated selenium object. */
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ public abstract JavaScript isExtensionInstalledScript();
+
+ /**
+ * Install.
+ */
+ public void install() {
+ if (!isInstalled()) {
+ waitForBodyLoaded();
+ installPageExtension();
+ }
+ }
+
+ /**
+ * Checks if RichFacesSelenium is already installed
+ *
+ * @return true, if is installed
+ */
+ public boolean isInstalled() {
+ return Boolean.valueOf(selenium.getEval(isExtensionInstalledScript()));
+ }
+
+ /**
+ * Install the page extensions
+ */
+ void installPageExtension() {
+ selenium.runScript(pageExtensions);
+ }
+
+ /**
+ * Wait for body to be loaded.
+ */
+ void waitForBodyLoaded() {
+ selenium.waitForCondition(isBodyLoaded, Wait.DEFAULT_TIMEOUT);
+ }
+
+ public void loadFromResource(String resourceName) {
+ this.pageExtensions = fromResource(resourceName);
+ }
+
+ /**
+ * Loads the page JS extensions from resources defined by list of resource names.
+ *
+ * @param resourceNames
+ * the list of full paths to resources
+ */
+ public void loadFromResources(List<String> resourceNames) {
+ JavaScript extensions = null;
+ for (String resourceName : resourceNames) {
+ JavaScript partial = fromResource(resourceName);
+ extensions = (extensions == null) ? partial : extensions.join(partial);
+ }
+ this.pageExtensions = extensions;
+ }
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/cheiron/halt/SendHalt.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.halt;
+
+import static org.jboss.test.selenium.encapsulated.JavaScript.js;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class SendHalt {
+
+ private static JavaScript isHaltAvailable =
js("selenium.browserbot.getCurrentWindow().SendHalt.isHaltAvailable()");
+ private static JavaScript getHalt =
js("selenium.browserbot.getCurrentWindow().SendHalt.getHalt()");
+ private static JavaScript unhalt =
js("selenium.browserbot.getCurrentWindow().SendHalt.unhalt({0})");
+ private static JavaScript setEnabled =
js("selenium.browserbot.getCurrentWindow().SendHalt.setEnabled({0})");
+
+ private static final AbstractPageExtensions sendHaltExtensions = new
AbstractPageExtensions() {
+ {
+ loadFromResource("javascript/cheiron/SendHalt.js");
+ }
+
+ public JavaScript isExtensionInstalledScript() {
+ return js("selenium.browserbot.getCurrentWindow().SendHalt !=
undefined");
+ }
+ };
+
+ int handle;
+
+ private SendHalt(int handle) {
+ this.handle = handle;
+ }
+
+ static AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ public static void enable() {
+ selenium.getPageExtensions().install();
+ sendHaltExtensions.install();
+ selenium.getEval(setEnabled.parametrize(true));
+ }
+
+ public static void disable() {
+ selenium.getEval(setEnabled.parametrize(false));
+ }
+
+ public static SendHalt getHalt() {
+ selenium.waitForCondition(isHaltAvailable);
+ return new SendHalt(Integer.valueOf(selenium.getEval(getHalt)));
+ }
+
+ public void unhalt() {
+ selenium.getEval(unhalt.parametrize(handle));
+ }
+
+}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -21,10 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jStatus;
-import static org.jboss.test.selenium.encapsulated.JavaScript.js;
import static org.testng.Assert.assertEquals;
-import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
@@ -44,38 +43,14 @@
TextRetriever retrieveStatus = retrieveText.locator(status);
- JavaScript extension =
JavaScript.fromResource(getClass().getPackage().getName().replaceAll("\\.",
"/")
- + "/status-halt.js");
-
- void installStatusExtensions() {
- selenium.getPageExtensions().install();
- selenium.runScript(extension);
- }
-
void testRequestButton(ElementLocator<?> button, String startStatusText, String
stopStatusText) {
- enableHalt();
+ SendHalt.enable();
selenium.click(button);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus.retrieve(), startStatusText);
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange(startStatusText, retrieveStatus);
assertEquals(retrieveStatus.retrieve(), stopStatusText);
- disableHalt();
+ SendHalt.disable();
}
-
- void waitForHalt() {
-
selenium.waitForCondition(js("selenium.browserbot.getCurrentWindow().Metamer.waitForHalt()"));
- }
-
- void unhalt() {
-
selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.unhalt()"));
- }
-
- void enableHalt() {
-
selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.haltEnabled =
true"));
- }
-
- void disableHalt() {
-
selenium.getEval(js("selenium.browserbot.getCurrentWindow().Metamer.haltEnabled =
false"));
- }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -26,7 +26,6 @@
import java.net.URL;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -41,11 +40,6 @@
return buildUrl(contextPath,
"faces/components/a4jStatus/simple.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testInterleavedChangingOfFacets() {
for (int i = 0; i < 13; i++) {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -28,10 +28,10 @@
import java.net.URL;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -54,23 +54,17 @@
return buildUrl(contextPath,
"faces/components/a4jStatus/instantAttributes.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testOnStart() {
for (int i = 0; i < 2; i++) {
attributes.setOnStart(alert.parametrize("start" + 1));
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.waitForCondition(js("selenium.isAlertPresent()"));
assertEquals(selenium.getAlert(), "start" + 1);
- waitForHalt();
- unhalt();
- disableHalt();
+ SendHalt.getHalt().unhalt();
+ SendHalt.disable();
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestReferencedUsage.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -26,9 +26,9 @@
import java.net.URL;
+import org.jboss.cheiron.halt.SendHalt;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -48,90 +48,84 @@
return buildUrl(contextPath,
"faces/components/a4jStatus/referencedUsage.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testClickBothButtonsInSequence() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
selenium.click(button2);
- waitForHalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "START");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus2);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
@Test
public void testClickBothButtonsImmediately() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.click(button2);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
- waitForHalt();
+ halt.unhalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "START");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus2);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
/**
- * @Test
- * TODO: selenium is causing 3 requests, but manually we triggers 2 requests (use
Firebug to reproduce)
+ * @Test TODO: selenium is causing 3 requests, but manually we triggers 2 requests
(use Firebug to reproduce)
*/
public void testClickFirstButtonThenSecondButtonThenAgainFirstButtonImmediately() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
selenium.click(button2);
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
- waitForHalt();
+ halt.unhalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
@Test
public void testDoubleClick() {
- enableHalt();
+ SendHalt.enable();
selenium.click(button1);
- waitForHalt();
+ SendHalt halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
selenium.click(button1);
- waitForHalt();
+ halt = SendHalt.getHalt();
assertEquals(retrieveStatus1.retrieve(), "START");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- unhalt();
+ halt.unhalt();
waitAjax.waitForChange("START", retrieveStatus1);
assertEquals(retrieveStatus1.retrieve(), "STOP");
assertEquals(retrieveStatus2.retrieve(), "STOP");
- disableHalt();
+ SendHalt.disable();
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2010-09-03
13:10:20 UTC (rev 19111)
@@ -25,7 +25,6 @@
import java.net.URL;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -38,11 +37,6 @@
return buildUrl(contextPath,
"faces/components/a4jStatus/simple.xhtml");
}
- @BeforeMethod
- public void installStatusExtensions() {
- super.installStatusExtensions();
- }
-
@Test
public void testRequestButton1() {
testRequestButton(button1, "START", "STOP");
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js
(from rev 19087,
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/resources/javascript/cheiron/SendHalt.js 2010-09-03
13:10:20 UTC (rev 19111)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+var SendHalt = function(xhr, content, callback) {
+ SendHalt._instances.push(this);
+ this.halt = true;
+ this.xhr = xhr;
+ this.content = content;
+ this.callback = callback;
+ this.id = SendHalt._instances.length - 1;
+}
+
+SendHalt._instances = new Array();
+SendHalt._haltCounter = 0;
+SendHalt._enabled = false;
+
+SendHalt.setEnabled = function(enabled) {
+ SendHalt._enabled = enabled;
+}
+
+SendHalt.isEnabled = function(enabled) {
+ return SendHalt._enabled;
+}
+
+SendHalt.getLastId = function() {
+ return SendHalt._instances.length - 1;
+}
+
+SendHalt.getHalt = function() {
+ if (SendHalt.isHaltAvailable()) {
+ SendHalt._haltCounter += 1;
+ return SendHalt.getLastId();
+ }
+ return -1;
+}
+
+SendHalt.XHRWrapperInjection = {
+ send : RichFacesSelenium.XHRWrapper.prototype.send
+}
+
+SendHalt._repeatWait = function(id) {
+ var halt = SendHalt._instances[id];
+ if (halt.halt) {
+ setTimeout("SendHalt._repeatWait(" + id + ")", 100);
+ } else {
+ halt.callback(halt.xhr, halt.content);
+ }
+}
+
+SendHalt.prototype.wait = function() {
+ SendHalt._repeatWait(this.id);
+}
+
+SendHalt.unhalt = function(id) {
+ var halt = SendHalt._instances[id];
+ halt.halt = false;
+}
+
+SendHalt.isHaltAvailable = function() {
+ return SendHalt.getLastId() == SendHalt._haltCounter;
+}
+
+RichFacesSelenium.XHRWrapper.prototype.send = function(content) {
+ if (SendHalt.isEnabled()) {
+ var metamerHalt = new SendHalt(this, content, function(xhr, content1) {
+ SendHalt.XHRWrapperInjection.send.call(xhr, content1);
+ });
+ metamerHalt.wait();
+ } else {
+ SendHalt.XHRWrapperInjection.send.call(this, content);
+ }
+};
\ No newline at end of file
Deleted:
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js 2010-09-03
12:51:59 UTC (rev 19110)
+++
modules/tests/metamer/trunk/ftest-source/src/main/resources/org/richfaces/tests/metamer/ftest/a4jStatus/status-halt.js 2010-09-03
13:10:20 UTC (rev 19111)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.
- */
-var Metamer = {
- halts : new Array(),
- sequenceId : 0,
- haltIterator : 0,
- haltEnabled : false,
- passes : 0,
- wait : function(metamerHalt) {
- Metamer.halts.push(metamerHalt);
- Metamer._wait(metamerHalt.id);
- },
- _wait : function(id) {
- var metamerHalt = Metamer.halts[id];
- if (metamerHalt.halt) {
- setTimeout("Metamer._wait(" + id + ")", 100);
- } else {
- metamerHalt.callback(metamerHalt.xhr, metamerHalt.content);
- }
- },
- unhalt : function() {
- var metamerHalt = Metamer.halts[Metamer.haltIterator];
- Metamer.haltIterator += 1;
- metamerHalt.halt = false;
- },
- isHalted : function() {
- return Metamer.sequenceId > Metamer.haltIterator;
- },
- waitForHalt : function() {
- return Metamer.sequenceId == 1 + Metamer.haltIterator;
- }
-};
-
-var MetamerHalt = function(xhr, content, callback) {
- this.halt = true;
- this.xhr = xhr;
- this.content = content;
- this.callback = callback;
- this.id = Metamer.sequenceId++;
-}
-
-Metamer.XHRWrapperInjection = {
- send : RichFacesSelenium.XHRWrapper.prototype.send
-};
-
-RichFacesSelenium.XHRWrapper.prototype.send = function(content) {
- if (Metamer.haltEnabled) {
- var metamerHalt = new MetamerHalt(this, content, function(xhr, content1) {
- Metamer.XHRWrapperInjection.send.call(xhr, content1);
- });
- Metamer.wait(metamerHalt);
- } else {
- Metamer.XHRWrapperInjection.send.call(this, content);
- }
-};
\ No newline at end of file