You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/05/09 08:12:09 UTC

svn commit: r654689 - in /geronimo/server/trunk: ./ testsupport/testsupport-common/ testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/ testsupport/testsupport-selenium/ testsupport/testsupport-selenium/src/main/java/org/apach...

Author: jdillon
Date: Thu May  8 23:12:09 2008
New Revision: 654689

URL: http://svn.apache.org/viewvc?rev=654689&view=rev
Log:
Move some dep versions to dm
Add some sanity checks to selenium client muck

Modified:
    geronimo/server/trunk/pom.xml
    geronimo/server/trunk/testsupport/testsupport-common/pom.xml
    geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/DOMUtils.java
    geronimo/server/trunk/testsupport/testsupport-selenium/pom.xml
    geronimo/server/trunk/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=654689&r1=654688&r2=654689&view=diff
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Thu May  8 23:12:09 2008
@@ -662,7 +662,26 @@
                 <artifactId>junit</artifactId>
                 <version>3.8.2</version>
             </dependency>
-
+            
+            <dependency>
+                <groupId>org.testng</groupId>
+                <artifactId>testng</artifactId>
+                <version>5.8</version>
+                <classifier>jdk15</classifier>
+            </dependency>
+            
+            <dependency>
+                <groupId>org.openqa.selenium.client-drivers</groupId>
+                <artifactId>selenium-java-client-driver</artifactId>
+                <version>1.0-beta-1</version>
+            </dependency>
+            
+            <dependency>
+                <groupId>org.openqa.selenium.server</groupId>
+                <artifactId>selenium-server</artifactId>
+                <version>1.0-beta-1</version>
+            </dependency>
+            
             <dependency>
                 <groupId>org.apache.activemq</groupId>
                 <artifactId>activemq-core</artifactId>

Modified: geronimo/server/trunk/testsupport/testsupport-common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-common/pom.xml?rev=654689&r1=654688&r2=654689&view=diff
==============================================================================
--- geronimo/server/trunk/testsupport/testsupport-common/pom.xml (original)
+++ geronimo/server/trunk/testsupport/testsupport-common/pom.xml Thu May  8 23:12:09 2008
@@ -38,16 +38,10 @@
             <artifactId>slf4j-api</artifactId>
         </dependency>
         
-        <!--
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-        -->
-        
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
+            <scope>compile</scope>
         </dependency>
 
         <dependency>
@@ -55,8 +49,6 @@
             <artifactId>rmock</artifactId>
         </dependency>
 
-        <!-- xmlbeans -->
-        
         <dependency>
             <groupId>org.apache.xmlbeans</groupId>
             <artifactId>xmlbeans</artifactId>

Modified: geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/DOMUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/DOMUtils.java?rev=654689&r1=654688&r2=654689&view=diff
==============================================================================
--- geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/DOMUtils.java (original)
+++ geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/DOMUtils.java Thu May  8 23:12:09 2008
@@ -59,7 +59,7 @@
         if (expected instanceof Document) {
             Document expectedDoc = (Document)expected;
             Document actualDoc = (Document)actual;
-            compareNodes(expectedDoc.getDocumentElement(), actualDoc.getDocumentElement());            
+            compareNodes(expectedDoc.getDocumentElement(), actualDoc.getDocumentElement());
         } else if (expected instanceof Element) {
             Element expectedElement = (Element)expected;
             Element actualElement = (Element)actual;
@@ -71,7 +71,7 @@
             // compare element ns
             String expectedNS = expectedElement.getNamespaceURI();
             String actualNS = actualElement.getNamespaceURI();
-            if ((expectedNS == null && actualNS != null) || (expectedNS != null && !expectedNS.equals(actualNS))) {               
+            if ((expectedNS == null && actualNS != null) || (expectedNS != null && !expectedNS.equals(actualNS))) {
                 throw new Exception("Element namespaces names do not match: " + expectedNS + " " + actualNS);
             }
             
@@ -100,7 +100,7 @@
                 if (!expectedAttr.getValue().equals(actualAttr.getValue())) {
                     throw new Exception(elementName + ": Attribute values do not match: " + expectedAttr.getValue() + " " + actualAttr.getValue());
                 }
-            }            
+            }
             
             // compare children
             NodeList expectedChildren = expectedElement.getChildNodes();

Modified: geronimo/server/trunk/testsupport/testsupport-selenium/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-selenium/pom.xml?rev=654689&r1=654688&r2=654689&view=diff
==============================================================================
--- geronimo/server/trunk/testsupport/testsupport-selenium/pom.xml (original)
+++ geronimo/server/trunk/testsupport/testsupport-selenium/pom.xml Thu May  8 23:12:09 2008
@@ -17,7 +17,9 @@
     specific language governing permissions and limitations
     under the License.
 -->
+
 <!-- $Rev$ $Date$ -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     
@@ -32,34 +34,24 @@
     
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>compile</scope>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.geronimo.testsupport</groupId>
             <artifactId>testsupport-common</artifactId>
             <version>${version}</version>
-            <scope>compile</scope>
         </dependency>
         
         <dependency>
             <groupId>org.openqa.selenium.client-drivers</groupId>
             <artifactId>selenium-java-client-driver</artifactId>
-            <version>1.0-beta-1</version>
         </dependency>
         
         <dependency>
             <groupId>org.openqa.selenium.server</groupId>
             <artifactId>selenium-server</artifactId>
-            <version>1.0-beta-1</version>
         </dependency>
         
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>5.1</version>
             <classifier>jdk15</classifier>
         </dependency>
     </dependencies>

Modified: geronimo/server/trunk/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java?rev=654689&r1=654688&r2=654689&view=diff
==============================================================================
--- geronimo/server/trunk/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java (original)
+++ geronimo/server/trunk/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java Thu May  8 23:12:09 2008
@@ -38,14 +38,14 @@
 {
     protected static ExtendedSelenium selenium;
     
-    protected ExtendedSelenium createSeleniumClient(String url) throws Exception {
+    private ExtendedSelenium createSeleniumClient(String url) throws Exception {
         super.setUp();
         
         if (url == null) {
             url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
         }
         
-        log.info("Creating Selenium client for URL: " + url);
+        log.info("Creating Selenium client for URL: {}", url);
         
         ExtendedSelenium selenium = new ExtendedSelenium(
             "localhost", SeleniumServer.DEFAULT_PORT, "*firefox", url);
@@ -53,8 +53,14 @@
         return selenium;
     }
     
+    protected void ensureSeleniumClientInitialized() {
+        if (selenium == null) {
+            throw new IllegalStateException("Selenium client was not initalized");
+        }
+    }
+    
     @BeforeSuite
-    protected void startSeleniumClient() throws Exception {
+    protected synchronized void startSeleniumClient() throws Exception {
         log.info("Starting Selenium client");
         
         selenium = createSeleniumClient("http://localhost:8080/");
@@ -62,35 +68,18 @@
     }
     
     @AfterSuite
-    protected void stopSeleniumClient() throws Exception {
+    protected synchronized void stopSeleniumClient() throws Exception {
+        ensureSeleniumClientInitialized();
+        
         log.info("Stopping Selenium client");
         
         selenium.stop();
     }
     
     protected void waitForLoad() throws Exception {
-        selenium.waitForPageToLoad("30000");
-    }
-    
-    /**
-     * junit's per class setup.
-     * 
-    protected void setUp() throws Exception {
-        log.info("Starting Selenium client");
+        ensureSeleniumClientInitialized();
         
-        selenium = createSeleniumClient("http://localhost:8080/");
-        selenium.start();
-    }
-     */
-    
-    /**
-     * junit's per class teardown.
-     * 
-    protected void tearDown() throws Exception {
-        log.info("Stopping Selenium client");
-        
-        selenium.stop();
+        selenium.waitForPageToLoad("30000");
     }
-    */
 }