summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/store
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-02-22 20:44:24 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-02-22 20:44:24 +0000
commit0f560ae9c35c5a9f3b65cd95130b316d40c687c8 (patch)
tree532fc7435d29f23f65feb53218a463a1be54d255 /sca-java-2.x/trunk/samples/store
parent97a82f0659ad3a6f4e51d5c6fb2b675e036e360a (diff)
Moving to most recent release of HtmlUnit (2.6) and adjusting tests based on api changes
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@915053 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/samples/store/pom.xml35
-rw-r--r--sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java24
2 files changed, 25 insertions, 34 deletions
diff --git a/sca-java-2.x/trunk/samples/store/pom.xml b/sca-java-2.x/trunk/samples/store/pom.xml
index d4b09c3ffb..a6d85eba2b 100644
--- a/sca-java-2.x/trunk/samples/store/pom.xml
+++ b/sca-java-2.x/trunk/samples/store/pom.xml
@@ -104,27 +104,20 @@
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>htmlunit</groupId>
- <artifactId>htmlunit</artifactId>
- <version>1.14</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<build>
<finalName>${artifactId}</finalName>
diff --git a/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java b/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java
index 8c66e28427..900bc3f582 100644
--- a/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java
+++ b/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java
@@ -37,6 +37,7 @@ import client.Shopper;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
@@ -90,27 +91,24 @@ public class StoreTestCase {
@Test
@Ignore
public void testStoreWidget() throws FailingHttpStatusCodeException, MalformedURLException, IOException {
- WebClient browser = new WebClient(BrowserVersion.FIREFOX_2);
- browser.setRedirectEnabled(true);
- browser.setThrowExceptionOnScriptError(false);
+ WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);
+ webClient.setRedirectEnabled(true);
+ webClient.setThrowExceptionOnScriptError(false);
+ webClient.waitForBackgroundJavaScript(50000);
+ webClient.waitForBackgroundJavaScriptStartingBefore(50000);
+ webClient.setAjaxController(new NicelyResynchronizingAjaxController());
- HtmlPage page = (HtmlPage) browser.getPage("http://localhost:8080/store/store.html");
-
- //delay to allow all javascript to be retrieved and loaded
- try {
- Thread.sleep(8000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ HtmlPage page = (HtmlPage) webClient.getPage("http://localhost:8080/store/store.html");
HtmlForm form = (HtmlForm) page.getFormByName("catalogForm");
HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items");
- System.out.println(">>>" + catalogItems.getAttributeValue("value"));
- Assert.assertEquals("Apple - $2.99", catalogItems.getAttributeValue("value"));
+ System.out.println(">>>" + catalogItems.getAttribute("value"));
+ Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value"));
+ webClient.closeAllWindows();
}
}