tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r915053 - in /tuscany/sca-java-2.x/trunk: itest/distribution/webapp-helloworld-bpel/ itest/distribution/webapp-helloworld-js-client/ itest/distribution/webapp-helloworld-jsf/ itest/distribution/webapp-helloworld-jsp/ itest/distribution/weba...
Date Mon, 22 Feb 2010 20:44:25 GMT
Author: lresende
Date: Mon Feb 22 20:44:24 2010
New Revision: 915053

URL: http://svn.apache.org/viewvc?rev=915053&view=rev
Log:
Moving to most recent release of HtmlUnit (2.6) and adjusting tests based on api changes

Modified:
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-bpel/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-js-client/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsf/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/src/test/java/itest/HelloworldTestCase.java
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/pom.xml
    tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java
    tuscany/sca-java-2.x/trunk/samples/store/pom.xml
    tuscany/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-bpel/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-bpel/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-bpel/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-bpel/pom.xml Mon Feb 22
20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-js-client/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-js-client/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-js-client/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-js-client/pom.xml Mon
Feb 22 20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsf/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsf/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsf/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsf/pom.xml Mon Feb 22
20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/pom.xml Mon Feb 22
20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java
Mon Feb 22 20:44:24 2010
@@ -29,6 +29,7 @@
 
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
 
@@ -39,12 +40,14 @@
     @Test
     public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException
{
         HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-jsp");
-        Iterator<?> ss = page.getAllHtmlChildElements();
-        ss.next();
-        ss.next();
-        ss.next();
-        HtmlParagraph p = (HtmlParagraph)ss.next();
-        assertEquals("Hello world", p.asText());
+        Iterator<?> ss = page.getAllHtmlChildElements().iterator();
+        while(ss.hasNext()) {
+            HtmlElement htmlElement = (HtmlElement) ss.next();
+            if( htmlElement instanceof HtmlParagraph) {
+                assertEquals("Hello world", htmlElement.asText());
+                break;
+            }
+        }
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/pom.xml Mon Feb
22 20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/src/test/java/itest/HelloworldTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/src/test/java/itest/HelloworldTestCase.java?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/src/test/java/itest/HelloworldTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-servlet/src/test/java/itest/HelloworldTestCase.java
Mon Feb 22 20:44:24 2010
@@ -26,7 +26,6 @@
 import org.junit.Test;
 
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
-import com.gargoylesoftware.htmlunit.UnexpectedPage;
 import com.gargoylesoftware.htmlunit.WebClient;
 import com.gargoylesoftware.htmlunit.html.HtmlButton;
 import com.gargoylesoftware.htmlunit.html.HtmlForm;
@@ -48,13 +47,9 @@
 
         HtmlButton button = (HtmlButton) form.getButtonsByName("submit").get(0);
 
-        Object foo = button.click();
+        HtmlPage pageResponse = (HtmlPage) button.click();
         
-        // TODO: something up with getting the response but this works:
-        UnexpectedPage p = (UnexpectedPage) foo;
-        String s = new String(p.getWebResponse().getResponseBody());
-
-        assertTrue(s.endsWith("</strong>Hello petra</body></html>"));
+        assertTrue(pageResponse.getWebResponse().getContentAsString().endsWith("</strong>Hello
petra</body></html>"));
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/pom.xml Mon Feb
22 20:44:24 2010
@@ -59,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>htmlunit</groupId>
+            <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>1.9</version>
+            <version>2.6</version>
             <scope>test</scope>
         </dependency>
 

Modified: tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java
Mon Feb 22 20:44:24 2010
@@ -29,6 +29,7 @@
 
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
 import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
 
@@ -39,15 +40,14 @@
     @Test
     public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException
{
         HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-stripes");
-        Iterator<?> ss = page.getAllHtmlChildElements();
-        Object o1= ss.next();
-        Object o2= ss.next();
-        Object o3= ss.next();
-        Object o4= ss.next();
-        Object o5= ss.next();
-        Object o6= ss.next();
-        HtmlParagraph p = (HtmlParagraph)ss.next();
-        assertEquals("sayHello returns: Hello world", p.asText());
+        Iterator<?> ss = page.getAllHtmlChildElements().iterator();
+        while(ss.hasNext()) {
+            HtmlElement htmlElement = (HtmlElement) ss.next();
+            if( htmlElement instanceof HtmlParagraph) {
+                assertEquals("sayHello returns: Hello world", htmlElement.asText());
+                break;
+            }
+        }
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/samples/store/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/store/pom.xml?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/store/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/samples/store/pom.xml Mon Feb 22 20:44:24 2010
@@ -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>

Modified: tuscany/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java?rev=915053&r1=915052&r2=915053&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/samples/store/src/test/java/store/StoreTestCase.java Mon Feb
22 20:44:24 2010
@@ -37,6 +37,7 @@
 
 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 @@
     @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();
     }
 
 }



Mime
View raw message