geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r439767 - in /geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console: SimpleLogin2Test.java SimpleLoginTest.java StartSeleniumDecorator.java
Date Sun, 03 Sep 2006 12:12:00 GMT
Author: jdillon
Date: Sun Sep  3 05:11:59 2006
New Revision: 439767

URL: http://svn.apache.org/viewvc?rev=439767&view=rev
Log:
(GERONIMO-2374) Applied path from Bill Dudney; to basic-junit module + getName() fix for the
decorator and a new test to see how multi-class setup works

Added:
    geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
  (with props)
    geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
  (with props)
Modified:
    geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLoginTest.java

Added: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java?rev=439767&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
(added)
+++ geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
Sun Sep  3 05:11:59 2006
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.testsuite.console;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * ???
+ * 
+ * @version $Rev$ $Date$
+ */
+public class SimpleLogin2Test extends TestCase {
+    private static StartSeleniumDecorator decorator;
+
+    public static Test suite() {
+        Test test = new TestSuite(SimpleLogin2Test.class);
+        decorator = new StartSeleniumDecorator(test);
+        return decorator;
+    }
+
+    public void testLogin() throws Exception {
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+    }
+
+    public void testLoginAndLogout() throws Exception {
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+        decorator.getSelenium().open("/console");
+        assertEquals("Geronimo Console Login", decorator.getSelenium().getTitle());
+        decorator.getSelenium().close();
+    }
+
+    public void testClickSomeLinks() throws Exception {
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=Information");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=JVM");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=DB Info");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+    }
+
+    public void testDeployDataSource() throws Exception {
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=Database Pools");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        decorator.getSelenium().click("link=Using the Geronimo database pool wizard");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        decorator.getSelenium().type("name", "DefaultDS");
+        decorator.getSelenium().select("dbtype", "Derby embedded");
+        decorator.getSelenium().click("xpath=//input[@value='Next']");
+        // invalid XHTML prevents this from working;
+        // <select multiple name="jars" size="10"> is the value that its trying to
parse
+        //decorator.getSelenium().addSelection("xpath=//select[@name='jars']", "org.apache.derby/derby/10.1.1.0/jar");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+    }
+}
+

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLogin2Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLoginTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLoginTest.java?rev=439767&r1=439766&r2=439767&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLoginTest.java
(original)
+++ geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/SimpleLoginTest.java
Sun Sep  3 05:11:59 2006
@@ -19,101 +19,69 @@
 
 package org.apache.geronimo.testsuite.console;
 
+import junit.framework.Test;
 import junit.framework.TestCase;
-
-import com.thoughtworks.selenium.Selenium;
-import com.thoughtworks.selenium.DefaultSelenium;
-
-import org.openqa.selenium.server.SeleniumServer;
+import junit.framework.TestSuite;
 
 /**
  * ???
- *
+ * 
  * @version $Rev$ $Date$
  */
-public class SimpleLoginTest
-    extends TestCase
-{
-    private Selenium selenium;
-    
-    protected void setUp(String url) throws Exception {
-        super.setUp();
-        if (url == null) {
-            url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
-        }
-        selenium = new DefaultSelenium("localhost", SeleniumServer.DEFAULT_PORT, "*firefox",
url);
-        selenium.start();
-    }
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        
-        this.setUp("http://localhost:8080/");
-    }
-    
-    protected void tearDown() throws Exception {
-        selenium.stop();
+public class SimpleLoginTest extends TestCase {
+    private static StartSeleniumDecorator decorator;
+
+    public static Test suite() {
+        Test test = new TestSuite(SimpleLoginTest.class);
+        decorator = new StartSeleniumDecorator(test);
+        return decorator;
     }
-    
+
     public void testLogin() throws Exception {
-        selenium.open("/");
-        assertEquals("Apache Geronimo", selenium.getTitle());
-        
-        selenium.click("link=Console");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console Login", selenium.getTitle());
-        
-        selenium.type("j_username", "system");
-        selenium.type("j_password", "manager");
-        selenium.click("submit");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
-	}
-    
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+    }
+
     public void testLoginAndLogout() throws Exception {
-        selenium.open("/");
-        assertEquals("Apache Geronimo", selenium.getTitle());
-        
-        selenium.click("link=Console");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console Login", selenium.getTitle());
-        
-        selenium.type("j_username", "system");
-        selenium.type("j_password", "manager");
-        selenium.click("submit");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
-        
-        selenium.click("//a[contains(@href, '/console/logout.jsp')]");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console Login", selenium.getTitle());
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+        decorator.getSelenium().open("/console");
+        assertEquals("Geronimo Console Login", decorator.getSelenium().getTitle());
+        decorator.getSelenium().close();
     }
-    
+
     public void testClickSomeLinks() throws Exception {
-        selenium.open("/");
-        assertEquals("Apache Geronimo", selenium.getTitle());
-        
-        selenium.click("link=Console");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console Login", selenium.getTitle());
-        
-        selenium.type("j_username", "system");
-        selenium.type("j_password", "manager");
-        selenium.click("submit");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
-        
-        selenium.click("link=Information");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
-        
-        selenium.click("link=JVM");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
-        
-        selenium.click("link=DB Info");
-        selenium.waitForPageToLoad("30000");
-        assertEquals("Geronimo Console", selenium.getTitle());
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=Information");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=JVM");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=DB Info");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
+    }
+
+    public void testDeployDataSource() throws Exception {
+        decorator.login();
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.getSelenium().click("link=Database Pools");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        decorator.getSelenium().click("link=Using the Geronimo database pool wizard");
+        decorator.getSelenium().waitForPageToLoad("30000");
+        decorator.getSelenium().type("name", "DefaultDS");
+        decorator.getSelenium().select("dbtype", "Derby embedded");
+        decorator.getSelenium().click("xpath=//input[@value='Next']");
+        // invalid XHTML prevents this from working;
+        // <select multiple name="jars" size="10"> is the value that its trying to
parse
+        //decorator.getSelenium().addSelection("xpath=//select[@name='jars']", "org.apache.derby/derby/10.1.1.0/jar");
+        assertEquals("Geronimo Console", decorator.getSelenium().getTitle());
+        decorator.logout();
     }
 }
 

Added: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java?rev=439767&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
(added)
+++ geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
Sun Sep  3 05:11:59 2006
@@ -0,0 +1,72 @@
+package org.apache.geronimo.testsuite.console;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.openqa.selenium.server.SeleniumServer;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+public class StartSeleniumDecorator extends TestSetup {
+    private Selenium selenium;
+
+    public StartSeleniumDecorator(Test decorated) {
+        super(decorated);
+    }
+    
+    public String getName() {
+        return getClass().getName();
+    }
+    
+    protected void setUp(String url) throws Exception {
+        if (url == null) {
+            url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
+        }
+        selenium = new DefaultSelenium("localhost",
+                SeleniumServer.DEFAULT_PORT, "*firefox", url);
+        selenium.start();
+    }
+    
+    /**
+     * open '/' and login to the console, leaving the browser open
+     * @throws Exception
+     */
+    void login() throws Exception {
+        // after start login, then close the window
+        selenium.open("/");
+        assertEquals("Apache Geronimo", selenium.getTitle());
+        selenium.click("link=Console");
+        selenium.waitForPageToLoad("30000");
+        assertEquals("Geronimo Console Login", selenium.getTitle());
+        selenium.type("j_username", "system");
+        selenium.type("j_password", "manager");
+        selenium.click("submit");
+        selenium.waitForPageToLoad("30000");
+    }
+
+    /**
+     * assume the browser is open, click on logout then close the browser
+     * @throws Exception
+     */
+    void logout() throws Exception {
+        // after start login, then close the window
+        assertEquals("Geronimo Console", selenium.getTitle());
+        selenium.click("//a[contains(@href, '/console/logout.jsp')]");
+        selenium.waitForPageToLoad("30000");
+        assertEquals("Geronimo Console Login", selenium.getTitle());
+        selenium.close();
+    }
+
+    protected void setUp() throws Exception {
+        this.setUp("http://localhost:8080/");
+    }
+
+    protected void tearDown() throws Exception {
+        selenium.stop();
+    }
+
+    public Selenium getSelenium() {
+        return selenium;
+    }
+}

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/testsuite/console-testsuite/basic-junit/src/test/java/org/apache/geronimo/testsuite/console/StartSeleniumDecorator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message