Revision: 459
Author: henryju
Date: 2006-05-22 05:58:33 -0700 (Mon, 22 May 2006)
ViewCVS: http://svn.sourceforge.net/jwebunit/?rev=459&view=rev
Log Message:
-----------
TestingEngineRegistry now detect which plugins are in the classpath. I you
don't specify a testing engine, use the first found in the classpath, instead
of HttpUnit by default.
Modified Paths:
--------------
trunk/TODO
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/WebCookieTest.java
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/util/JettySetup.java
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/TestingEngineRegistry.java
trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/JWebUnitTest.java
trunk/jwebunit-httpunit-plugin/src/test/java/net/sourceforge/jwebunit/httpunit/JWebUnitTest.java
trunk/jwebunit-jacobie-plugin/src/test/java/net/sourceforge/jwebunit/jacobie/JWebUnitTest.java
trunk/jwebunit-selenium-plugin/src/test/java/net/sourceforge/jwebunit/selenium/JWebUnitTest.java
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2006-05-22 09:39:12 UTC (rev 458)
+++ trunk/TODO 2006-05-22 12:58:33 UTC (rev 459)
@@ -1,7 +1,6 @@
** Global **
- Add log4j support and log each function
- Find a way for each dialog to report its presence to the Dialog Registry
- - Use only available dialog if present (currently, HttpUnit is used by
default, even if not present)
** HtmlUnitDialog **
- Add **ForLabel functions (I don't know how to do this)
@@ -12,5 +11,8 @@
- Implement all auto-generated classes
- Find an easy way to cope with jacob.dll
+** SeelniumDialog **
+ - Find a way to automatically launch Selenium Server (conflit with Jetty
version)
+
** Website **
- Add documentation
\ No newline at end of file
Modified:
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/WebCookieTest.java
===================================================================
---
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/WebCookieTest.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/WebCookieTest.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -25,6 +25,6 @@
}
public void testAssertCookieDump() throws Throwable {
- dumpCookies();
+ //dumpCookies();
}
}
\ No newline at end of file
Modified:
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/util/JettySetup.java
===================================================================
---
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/util/JettySetup.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/util/JettySetup.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -31,27 +31,13 @@
*/
private Server jettyServer = null;
- private String key;
-
/**
* Constructor.
*
* @param test
- * @param key The name of the dialog that will be used
*/
- public JettySetup(Test test, String key) {
- super(test);
- this.key=key;
- }
-
- /**
- * Constructor.
- *
- * @param test
- */
public JettySetup(Test test) {
super(test);
- this.key=TestingEngineRegistry.TESTING_ENGINE_HTTPUNIT;
}
/**
@@ -77,7 +63,6 @@
e.printStackTrace();
fail("Could not start the Jetty server: " + e);
}
- JWebUnitAPITestCase.setDialogKey(key);
}
/**
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/TestingEngineRegistry.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/TestingEngineRegistry.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/TestingEngineRegistry.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -1,7 +1,7 @@
/********************************************************************************
* Copyright (c) 2001, ThoughtWorks, Inc.
* Distributed open-source, see full license under
licenses/jwebunit_license.txt
-**********************************/
+ **********************************/
package net.sourceforge.jwebunit;
import java.util.Hashtable;
@@ -9,52 +9,84 @@
import net.sourceforge.jwebunit.exception.TestingEngineRegistryException;
/**
- * This will maintain a registry of known testing engines to be used by
jWebUnit.
+ * This will maintain a registry of known testing engines to be used by
+ * jWebUnit.
+ *
* @author Nicholas Neuberger
* @author Julien Henry
*/
public class TestingEngineRegistry {
-
- //TODO Move this to a JDK1.5 typesafe enum
- public final static String TESTING_ENGINE_HTTPUNIT =
"TestingEngineHttpUnit";
- public final static String TESTING_ENGINE_HTMLUNIT =
"TestingEngineHtmlUnit";
- public final static String TESTING_ENGINE_JACOBIE =
"TestingEngineJacobie";
- public final static String TESTING_ENGINE_SELENIUM =
"TestingEngineSelenium";
- private static Hashtable testingEngineMap = null;
-
- public TestingEngineRegistry() {
- }
+ // TODO Move this to a JDK1.5 typesafe enum
+ public final static String TESTING_ENGINE_HTTPUNIT =
"TestingEngineHttpUnit";
- /**
- * Gets the map of testing engines defined within jwebunit.
- * @return
- */
- public Hashtable getTestingEngineMap() {
- if (testingEngineMap == null) {
- testingEngineMap = new Hashtable();
+ public final static String TESTING_ENGINE_HTMLUNIT =
"TestingEngineHtmlUnit";
- testingEngineMap.put(TESTING_ENGINE_HTTPUNIT,
"net.sourceforge.jwebunit.httpunit.HttpUnitDialog");
- testingEngineMap.put(TESTING_ENGINE_HTMLUNIT,
"net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog");
- testingEngineMap.put(TESTING_ENGINE_JACOBIE,
"net.sourceforge.jwebunit.jacobie.JacobieDialog");
- testingEngineMap.put(TESTING_ENGINE_SELENIUM,
"net.sourceforge.jwebunit.selenium.SeleniumDialog");
- }
- return testingEngineMap;
- }
+ public final static String TESTING_ENGINE_JACOBIE = "TestingEngineJacobie";
- /**
- * Gets the class based on the key of the class.
- * @param aKey
- * @return
- */
- public Class getTestingEngineClass(String aKey) throws
ClassNotFoundException {
- Class theClass = Class.forName((String)
getTestingEngineMap().get(aKey));
- if (theClass == null) {
- throw new TestingEngineRegistryException("Testing
Engine with Key: [" + aKey + "] not defined for jWebUnit.");
- }
- return theClass;
- }
-
-
-
+ public final static String TESTING_ENGINE_SELENIUM =
"TestingEngineSelenium";
+
+ private static Hashtable testingEngineMap = null;
+
+ public TestingEngineRegistry() {
+ }
+
+ /**
+ * Gets the map of testing engines defined within jwebunit.
+ *
+ * @return
+ */
+ public static Hashtable getTestingEngineMap() {
+ if (testingEngineMap == null) {
+ testingEngineMap = new Hashtable();
+ try {
+ String cp = "net.sourceforge.jwebunit.httpunit.HttpUnitDialog";
+ Class.forName(cp);
+ testingEngineMap.put(TESTING_ENGINE_HTTPUNIT, cp);
+ } catch (ClassNotFoundException e) {
+ //Nothing to do
+ }
+ try {
+ String cp = "net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog";
+ Class.forName(cp);
+ testingEngineMap.put(TESTING_ENGINE_HTMLUNIT, cp);
+ } catch (ClassNotFoundException e) {
+ //Nothing to do
+ }
+ try {
+ String cp = "net.sourceforge.jwebunit.jacobie.JacobieDialog";
+ Class.forName(cp);
+ testingEngineMap.put(TESTING_ENGINE_JACOBIE, cp);
+ } catch (ClassNotFoundException e) {
+ //Nothing to do
+ }
+ try {
+ String cp = "net.sourceforge.jwebunit.selenium.SeleniumDialog";
+ Class.forName(cp);
+ testingEngineMap.put(TESTING_ENGINE_SELENIUM, cp);
+ } catch (ClassNotFoundException e) {
+ //Nothing to do
+ }
+ }
+ return testingEngineMap;
+ }
+
+ /**
+ * Gets the class based on the key of the class.
+ *
+ * @param aKey
+ * @return
+ */
+ public static Class getTestingEngineClass(String aKey)
+ throws ClassNotFoundException {
+ Class theClass = Class
+ .forName((String) getTestingEngineMap().get(aKey));
+ if (theClass == null) {
+ throw new TestingEngineRegistryException(
+ "Testing Engine with Key: [" + aKey
+ + "] not defined for jWebUnit.");
+ }
+ return theClass;
+ }
+
}
Modified:
trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/JWebUnitTest.java
===================================================================
---
trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/JWebUnitTest.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-htmlunit-plugin/src/test/java/net/sourceforge/jwebunit/htmlunit/JWebUnitTest.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -43,7 +43,7 @@
suite.addTestSuite(FormAssertionsTest.class);
suite.addTestSuite(NavigationTest.class);
//$JUnit-END$
- return new JettySetup(suite,
TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT);
+ return new JettySetup(suite);
}
}
\ No newline at end of file
Modified:
trunk/jwebunit-httpunit-plugin/src/test/java/net/sourceforge/jwebunit/httpunit/JWebUnitTest.java
===================================================================
---
trunk/jwebunit-httpunit-plugin/src/test/java/net/sourceforge/jwebunit/httpunit/JWebUnitTest.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-httpunit-plugin/src/test/java/net/sourceforge/jwebunit/httpunit/JWebUnitTest.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -43,7 +43,7 @@
suite.addTestSuite(FormAssertionsTest.class);
suite.addTestSuite(NavigationTest.class);
//$JUnit-END$
- return new JettySetup(suite,
TestingEngineRegistry.TESTING_ENGINE_HTTPUNIT);
+ return new JettySetup(suite);
}
}
\ No newline at end of file
Modified:
trunk/jwebunit-jacobie-plugin/src/test/java/net/sourceforge/jwebunit/jacobie/JWebUnitTest.java
===================================================================
---
trunk/jwebunit-jacobie-plugin/src/test/java/net/sourceforge/jwebunit/jacobie/JWebUnitTest.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-jacobie-plugin/src/test/java/net/sourceforge/jwebunit/jacobie/JWebUnitTest.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -43,7 +43,7 @@
suite.addTestSuite(FormAssertionsTest.class);
suite.addTestSuite(NavigationTest.class);
//$JUnit-END$
- return new JettySetup(suite,
TestingEngineRegistry.TESTING_ENGINE_JACOBIE);
+ return new JettySetup(suite);
}
}
\ No newline at end of file
Modified:
trunk/jwebunit-selenium-plugin/src/test/java/net/sourceforge/jwebunit/selenium/JWebUnitTest.java
===================================================================
---
trunk/jwebunit-selenium-plugin/src/test/java/net/sourceforge/jwebunit/selenium/JWebUnitTest.java
2006-05-22 09:39:12 UTC (rev 458)
+++
trunk/jwebunit-selenium-plugin/src/test/java/net/sourceforge/jwebunit/selenium/JWebUnitTest.java
2006-05-22 12:58:33 UTC (rev 459)
@@ -43,6 +43,6 @@
suite.addTestSuite(FormAssertionsTest.class);
suite.addTestSuite(NavigationTest.class);
//$JUnit-END$
- return new JettySetup(suite,
TestingEngineRegistry.TESTING_ENGINE_SELENIUM);
+ return new JettySetup(suite);
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development