[cvs] expresso commit by rimovm: Updated against latest Cactus.
JCorporate Ltd
jcorp at jcorporate.com
Sun Mar 13 06:52:33 UTC 2005
Log Message:
-----------
Updated against latest Cactus. ServerSide test suite works using expresso-war
Modified Files:
--------------
expresso/expresso-web/WEB-INF/src:
cactus.properties
log_client.properties
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel:
ConsoleInstallLog.java
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test:
ActionTestServlet.java
ControllerTestCase.java
expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core:
ServerSideTestSuite.java
expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests:
DBMaintTests.java
DBSecurityMatrixTests.java
LoginControllerTest.java
RegistrationControllerTests.java
Revision Data
-------------
Index: cactus.properties
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/cactus.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/src/cactus.properties -Lexpresso-web/WEB-INF/src/cactus.properties -u -r1.3 -r1.4
--- expresso-web/WEB-INF/src/cactus.properties
+++ expresso-web/WEB-INF/src/cactus.properties
@@ -9,9 +9,7 @@
# that you use for your application. In the example below, the context is
# "test".
-#cactus.servletRedirectorURL = http://localhost:8080/servlet/ServletRedirector
-#cactus.jspRedirectorURL = http://localhost:8080/expresso/jsp/JspRedirector
-cactus.contextURL = http://localhost:8080/
+cactus.contextURL = http://localhost:8080/expresso
cactus.servletRedirectorName = ServletRedirector
cactus.jspRedirectorName = JspRedirector
Index: log_client.properties
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/log_client.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lexpresso-web/WEB-INF/src/log_client.properties -Lexpresso-web/WEB-INF/src/log_client.properties -u -r1.1 -r1.2
--- expresso-web/WEB-INF/src/log_client.properties
+++ expresso-web/WEB-INF/src/log_client.properties
@@ -1,7 +1,8 @@
# Properties for configuring Log4j
# This is the configuring for logging on the JUnit side (i.e. the client side)
-log4j.appender.cactus = org.apache.log4j.varia.NullAppender
+#log4j.appender.cactus = org.apache.log4j.varia.NullAppender
+log4j.appender.cactus = org.apache.log4j.ConsoleAppender
log4j.appender.cactus.File = cactus_client.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
@@ -13,7 +14,7 @@
# By default we don't log at the DEBUG level for Cactus log, in order not to generate too
# many logs. However, should a problem arise and logs need to be sent to the Cactus dev team,
# then we will ask you to change this to DEBUG.
-log4j.category.org.apache.cactus = WARN, cactus
+log4j.category.org.apache.cactus = DEBUG, cactus
log4j.additivity.org.apache.cactus=false
Index: ActionTestServlet.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ActionTestServlet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ActionTestServlet.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ActionTestServlet.java -u -r1.11 -r1.12
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ActionTestServlet.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ActionTestServlet.java
@@ -134,4 +134,5 @@
// request, response);
return null;
}
+
}
Index: ControllerTestCase.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ControllerTestCase.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ControllerTestCase.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ControllerTestCase.java -u -r1.19 -r1.20
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ControllerTestCase.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test/ControllerTestCase.java
@@ -64,15 +64,24 @@
package com.jcorporate.expresso.services.test;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
import com.jcorporate.expresso.core.ExpressoConstants;
import com.jcorporate.expresso.core.controller.Controller;
import com.jcorporate.expresso.core.controller.ControllerException;
import com.jcorporate.expresso.core.controller.ControllerResponse;
import com.jcorporate.expresso.core.db.DBConnectionPool;
+import com.jcorporate.expresso.core.dbobj.Schema;
+import com.jcorporate.expresso.core.dbobj.SchemaFactory;
import com.jcorporate.expresso.core.misc.ConfigManager;
import com.jcorporate.expresso.core.misc.CookieUtil;
import com.jcorporate.expresso.core.misc.StringDOMParser;
-import org.apache.cactus.ServletTestCase;
+import com.jcorporate.expresso.core.controller.ExpressoActionServlet;
+import com.jcorporate.expresso.kernel.ConsoleInstallLog;
import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;
import org.apache.log4j.Logger;
@@ -85,25 +94,43 @@
import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.net.HttpURLConnection;
+import org.apache.cactus.ServletTestCase;
/**
* Base class for testing controllers. Provides an integration with Expresso,
* JUnit and Cactus
- *
- * @author Michael Rimov
*/
-public class ControllerTestCase
- extends ServletTestCase {
- private String theClass = null;
+public class ControllerTestCase extends ServletTestCase {
+
+ /**
+ * The controller class we're testing.
+ */
+ private String theControllerClass = null;
+
+ /**
+ * The log4j logger.
+ */
private Logger log = Logger.getLogger(ControllerTestCase.class);
+
+ /**
+ * The state we're excuting with this test case
+ */
private String theState = null;
- boolean isInitialized = false;
+
+ /**
+ * Flag because to cut down on 'ensureSchemaExists' calls, we
+ * attempt to only invoke once per 'test class'. At least it cuts
+ * the execution time by 1/2 to 1/5.
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * A list of required schemas for this ControllerTest case.
+ */
+ private List schemasRequired = new ArrayList();
+
+
/**
@@ -114,11 +141,11 @@
* @throws Exception if something happens in the system initialization or potentially
* if the controller name passed doesn't map to a real class
*/
- public ControllerTestCase(String testName, String controllerName)
+ public ControllerTestCase(final String testName, final String controllerName)
throws Exception {
super(testName);
TestSystemInitializer.setUp();
- theClass = controllerName;
+ theControllerClass = controllerName;
//Check to make sure that the controllername is correct. Will initialize
//later, but this way the test case doesn't get off to even a start without
@@ -127,16 +154,30 @@
}
/**
+ * Adds a required schema to the test suite. Call this in the custructor
+ * of your <tt>ControllerTestCase</tt> derived object to ensure that required
+ * schemas are created before invocation of the test.
+ * @param schemaClass Class the Schema class that is required
+ */
+ protected void addRequiredSchema(final Class schemaClass) {
+ schemasRequired.add(schemaClass);
+ }
+
+
+
+ /**
* Instantiates a Controller Test Case
*
* @param testName the name of the test. Usually handed down by the framework
* @param controllerClass The class of the controller to test
+ * @throws java.lang.Exception if there is an error setting up the configuration
+ * system.
*/
- public ControllerTestCase(String testName, Class controllerClass)
+ public ControllerTestCase(final String testName, final Class controllerClass)
throws Exception {
super(testName);
TestSystemInitializer.setUp();
- theClass = controllerClass.getName();
+ theControllerClass = controllerClass.getName();
}
/**
@@ -153,8 +194,10 @@
* Uses the default setup that a blank database has the security of
* Admin User = Admin
* Admin Password = Blank
+ * @param theRequest The WebRequest we're adding the parameters to.
+ * @throws java.lang.Exception if there is an error encoding the cookies.
*/
- public void logIn(WebRequest theRequest)
+ public void logIn(final WebRequest theRequest)
throws Exception {
this.logIn(theRequest, "Admin", "");
}
@@ -162,8 +205,13 @@
/**
* Allows special capabilities of logging in using a specially defined username
* and password.
+ * @param theRequest The <tt>WebRequest</tt> object given to the
+ * beginXXXX methods to populate with parameters/cookies
+ * @param userName the user name to log in as.
+ * @param password the password to log in as.
+ * @throws java.lang.Exception if there is an error populating/encrypting the cookie data.
*/
- public void logIn(WebRequest theRequest, String userName, String password)
+ public void logIn(final WebRequest theRequest, final String userName, final String password)
throws Exception {
String encryptedPassword;
@@ -180,86 +228,20 @@
}
/**
- * Called to set the appropriate states for the controller Also makes sure
+ * Called to set the appropriate states for the controller. Also makes sure
* that parameters are set up so that the controller responds in unprocessed
- * XML, and not standard HTML
+ * XML, and not standard HTML. Call from the Cactus beginXXXX methods.
+ * @param state The state we're invoking.
+ * @param request the <tt>WebRequest</tt> operation we're populating parameters.
*/
- public void setupParameters(String state, WebRequest request) {
+ public void setupParameters(final String state, final WebRequest request) {
theState = state;
request.addParameter("style", "xml");
request.addParameter("xsl", "none");
request.addParameter(Controller.STATE_PARAM_KEY, state);
}
- /**
- * parses the xml into an appropriate DOM document
- *
- * @deprecated
- */
- public Document parseResponse(WebResponse response)
- throws Exception {
- try {
- int responseCode = response.getConnection().getResponseCode();
-
- if (responseCode != HttpURLConnection.HTTP_OK) {
- fail("Failed to get OK Response code. Got " +
- Integer.toString(response.getConnection().getResponseCode()) +
- " instead");
- }
-
- String s = response.getText();
- assertTrue("Some Real Content Returned",
- response.getConnection().getContentLength() > 4);
-
- StringDOMParser sdom = new StringDOMParser();
- Document d = sdom.parseString(s);
- assertTrue("Reponse Returned Valid XML Document", d != null);
-
- return d;
- } catch (java.io.IOException ioe) {
- log.error("IOException parsing response", ioe);
- fail("IOException Parsing Reponse");
-
- return null;
- }
- }
-
- /**
- * Build a ControllerResponse given an XML DOM document
- *
- * @param d The DOM document to parse. Root node must be controller-response
- * @deprecated
- */
- public ControllerResponse buildControllerResponse(Document d) {
- ControllerResponse cr = null;
-
- try {
- cr = ControllerResponse.fromXML(d);
- } catch (ControllerException ce) {
- log.error("ControllerException parsing response", ce);
- }
-
- assertTrue("Built a valid controller response object", cr != null);
-
- return cr;
- }
-
- /**
- * Takes the connection handed out by the framework in the endXXXX() methods
- * and builds a full Controller Response document out of it.
- *
- * @deprecated
- */
- public ControllerResponse buildControllerResponse(WebResponse theConnection)
- throws Exception {
- Document d = parseResponse(theConnection);
- assertTrue("XML Document Returned", d != null);
-
- NodeList nl = getNodes(d, "controller-response");
- assertTrue("controller-response node exists", nl.getLength() > 0);
- return buildControllerResponse(d);
- }
/**
* Run the target controller. Requires querying the struts framework to find
@@ -267,15 +249,21 @@
* to the XML servlet for formatting.
*
* @since Expresso 3.1
+ * @throws ServletException if there is an error manipulating the ActionServlet
+ * instance.
+ * @throws IOException if the client cuts out before data is read.
+ * @throws java.lang.Exception for Controller/Database related errors.
+ * @return ControllerResponse -- the result of the invocation of the
+ * Controller state.
*/
public ControllerResponse controllerProcess()
throws ServletException, IOException,
Exception {
try {
- ActionServlet servlet = new ActionServlet();
+ ActionServlet servlet = new ExpressoActionServlet();
servlet.init(config);
- ActionConfig actionConfig = ConfigManager.getActionConfig(theClass, theState);
+ ActionConfig actionConfig = ConfigManager.getActionConfig(theControllerClass, theState);
ActionForm form = RequestUtils.createActionForm(request, (ActionMapping) actionConfig,
actionConfig.getModuleConfig(), servlet);
if (form != null) {
@@ -290,9 +278,9 @@
Controller controller = null;
try {
- controller = ConfigManager.getControllerFactory().getController(theClass);
+ controller = ConfigManager.getControllerFactory().getController(theControllerClass);
} catch (ControllerException ce) {
- log.error("ControllerException " + theClass, ce);
+ log.error("ControllerException " + theControllerClass, ce);
throw new ServletException(ce);
}
try {
@@ -339,21 +327,28 @@
}
/**
- * Returns a DOM NodeList given the xpath expression and the document given.
- * Simply wrapper
+ * Sets up the fixture, for example, open a network connection. This
+ * method is run on the server side and we therefore make sure
+ * the database is initialized at this point.
+ * <p><em>Please make sure you call <strong>super.setup()</strong> if you override
+ * setUp() in derived classes</em></p>
*
- * @deprecated
+ * @throws Exception
*/
- public NodeList getNodes(Document d, String xpath) {
- NodeList nl = null;
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ if (!isInitialized) {
+ for (int i = 0; i < schemasRequired.size(); i++) {
+ Class oneClass = (Class)schemasRequired.get(i);
+ Schema oneSchema = SchemaFactory.getInstance().getSchema(oneClass.getName());
+ SchemaCreator.ensureSchemaExists(oneSchema, new ConsoleInstallLog());
+ }
- try {
- nl = XPathAPI.selectNodeList(d, xpath);
- } catch (javax.xml.transform.TransformerException trex) {
- log.error("Error performing transformation", trex);
+ isInitialized = true;
}
-
- return nl;
}
}
Index: ServerSideTestSuite.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ServerSideTestSuite.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ServerSideTestSuite.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ServerSideTestSuite.java -u -r1.2 -r1.3
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ServerSideTestSuite.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ServerSideTestSuite.java
@@ -64,10 +64,10 @@
package com.jcorporate.expresso.core;
-import com.jcorporate.expresso.services.test.DBTestSuite;
import com.jcorporate.expresso.services.test.TestSystemInitializer;
-
-import java.util.Vector;
+import junit.framework.TestSuite;
+import com.jcorporate.expresso.core.security.SuperUser;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
/**
* Test suite that utilizes Apache Cactus for running on the server side.
@@ -78,7 +78,7 @@
* @version $Revision$ on $Date$
*/
-public class ServerSideTestSuite extends DBTestSuite {
+public class ServerSideTestSuite extends TestSuite {
public ServerSideTestSuite() {
}
@@ -93,6 +93,8 @@
public static junit.framework.Test suite()
throws Exception {
TestSystemInitializer.setUp();
+ new MutableRequestRegistry(TestSystemInitializer.getTestContext(),
+ SuperUser.SUPER_USER);
ServerSideTestSuite ts = new ServerSideTestSuite();
//Server Side Testing Classes
@@ -103,19 +105,4 @@
return ts;
}
-
- /**
- * Allows the test schema to be automatically be created and cleaned up as
- * well
- *
- * @param schemas a vector of schemas to be automatically created and destroyed
- * at the end of the test
- * @throws Exception upon error
- */
- protected void addSchema(Vector schemas)
- throws Exception {
- TestSystemInitializer.setUp();
- schemas.add(com.jcorporate.expresso.core.dbobj.tests.TestSchema.class.newInstance());
- super.addSchema(schemas);
- }
-}
\ No newline at end of file
+}
Index: ConsoleInstallLog.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/ConsoleInstallLog.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/ConsoleInstallLog.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/ConsoleInstallLog.java -u -r1.3 -r1.4
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/ConsoleInstallLog.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/ConsoleInstallLog.java
@@ -76,6 +76,7 @@
public ConsoleInstallLog() {
}
+
/**
* Logs debug messages
*
@@ -139,4 +140,4 @@
public void error(String message) {
System.out.println("[ERROR] Install Log: " + message);
}
-}
\ No newline at end of file
+}
Index: RegistrationControllerTests.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/RegistrationControllerTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/RegistrationControllerTests.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/RegistrationControllerTests.java -u -r1.2 -r1.3
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/RegistrationControllerTests.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/RegistrationControllerTests.java
@@ -64,11 +64,10 @@
package com.jcorporate.expresso.services.controller.tests;
+import com.jcorporate.expresso.core.ExpressoSchema;
import com.jcorporate.expresso.core.controller.ControllerResponse;
import com.jcorporate.expresso.services.test.ControllerTestCase;
-import com.jcorporate.expresso.services.test.ControllerTestSuite;
import com.jcorporate.expresso.services.test.TestSystemInitializer;
-import junit.framework.TestSuite;
import org.apache.cactus.WebRequest;
@@ -89,35 +88,7 @@
*/
public RegistrationControllerTests(String testName) throws Exception {
super(testName, com.jcorporate.expresso.services.controller.SimpleRegistration.class);
- }
-
-
- /**
- * Convenience method so we can test just this class.
- *
- * @param args the command line arguments
- * @throws Exception upon error
- */
- public static void main(String[] args) throws Exception {
- junit.textui.TestRunner.run(suite());
- }
-
-
- /**
- * Determines what tests are run in the test suite. We also tell ControllerTestSuite
- * that we need ExpressoSchema to exist for our tests. We also tell it that
- * we aren't modifying the underlying database for our own tests so the schema
- * doesn't necessarily have to be deleted when we're done with it.
- *
- * @return an instantiated testsuite
- * @throws Exception upon error
- */
- public static TestSuite suite() throws Exception {
- ControllerTestSuite cts = new ControllerTestSuite();
- cts.addReadOnlySchemaDependency(com.jcorporate.expresso.core.ExpressoSchema.class);
- cts.addTestSuite(RegistrationControllerTests.class);
-
- return cts;
+ this.addRequiredSchema(ExpressoSchema.class);
}
@@ -191,4 +162,4 @@
}
-}
\ No newline at end of file
+}
Index: LoginControllerTest.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/LoginControllerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/LoginControllerTest.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/LoginControllerTest.java -u -r1.2 -r1.3
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/LoginControllerTest.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/LoginControllerTest.java
@@ -64,12 +64,11 @@
package com.jcorporate.expresso.services.controller.tests;
+import com.jcorporate.expresso.core.ExpressoSchema;
import com.jcorporate.expresso.core.controller.ControllerResponse;
import com.jcorporate.expresso.core.controller.Input;
import com.jcorporate.expresso.core.controller.Transition;
import com.jcorporate.expresso.services.test.ControllerTestCase;
-import com.jcorporate.expresso.services.test.ControllerTestSuite;
-import junit.framework.TestSuite;
import org.apache.cactus.WebRequest;
@@ -92,35 +91,7 @@
*/
public LoginControllerTest(String testName) throws Exception {
super(testName, com.jcorporate.expresso.services.controller.SimpleLoginController.class);
- }
-
-
- /**
- * Convenience method so we can test just this class.
- *
- * @param args the command line arguments
- * @throws Exception upon error
- */
- public static void main(String[] args) throws Exception {
- junit.textui.TestRunner.run(suite());
- }
-
-
- /**
- * Determines what tests are run in the test suite. We also tell ControllerTestSuite
- * that we need ExpressoSchema to exist for our tests. We also tell it that
- * we aren't modifying the underlying database for our own tests so the schema
- * doesn't necessarily have to be deleted when we're done with it.
- *
- * @return an instantiated testsuite
- * @throws Exception upon error
- */
- public static TestSuite suite() throws Exception {
- ControllerTestSuite cts = new ControllerTestSuite();
- cts.addReadOnlySchemaDependency(com.jcorporate.expresso.core.ExpressoSchema.class);
- cts.addTestSuite(LoginControllerTest.class);
-
- return cts;
+ this.addRequiredSchema(ExpressoSchema.class);
}
@@ -269,4 +240,4 @@
assertTrue("Process Change Password Transition must exist", t != null);
}
-}
\ No newline at end of file
+}
Index: DBMaintTests.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBMaintTests.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBMaintTests.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBMaintTests.java -u -r1.3 -r1.4
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBMaintTests.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBMaintTests.java
@@ -75,6 +75,7 @@
import com.jcorporate.expresso.services.test.ControllerTestSuite;
import junit.framework.TestSuite;
import org.apache.cactus.WebRequest;
+import com.jcorporate.expresso.core.ExpressoSchema;
/**
* Unit tests some of the states for the DBMaint Controller.
@@ -95,36 +96,9 @@
public DBMaintTests(String testName)
throws Exception {
super(testName, DBMaint.class);
+ this.addRequiredSchema(ExpressoSchema.class);
}
- /**
- * Convenience method so we can test just this class.
- *
- * @param args the command line arguments (unused)
- * @throws Exception upon error
- */
- public static void main(String[] args)
- throws Exception {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- * Determines what tests are run in the test suite. We also tell ControllerTestSuite
- * that we need ExpressoSchema to exist for our tests. We also tell it that
- * we aren't modifying the underlying database for our own tests so the schema
- * doesn't necessarily have to be deleted when we're done with it.
- *
- * @return instantiated TestSuite object
- * @throws Exception upon error
- */
- public static TestSuite suite()
- throws Exception {
- ControllerTestSuite cts = new ControllerTestSuite();
- cts.addReadOnlySchemaDependency(com.jcorporate.expresso.core.ExpressoSchema.class);
- cts.addTestSuite(DBMaintTests.class);
-
- return cts;
- }
/**
@@ -325,4 +299,4 @@
}
-}
\ No newline at end of file
+}
Index: DBSecurityMatrixTests.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBSecurityMatrixTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBSecurityMatrixTests.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBSecurityMatrixTests.java -u -r1.2 -r1.3
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBSecurityMatrixTests.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests/DBSecurityMatrixTests.java
@@ -64,6 +64,8 @@
package com.jcorporate.expresso.services.controller.tests;
+import java.util.Enumeration;
+import com.jcorporate.expresso.core.ExpressoSchema;
import com.jcorporate.expresso.core.controller.Block;
import com.jcorporate.expresso.core.controller.ControllerElement;
import com.jcorporate.expresso.core.controller.ControllerResponse;
@@ -71,18 +73,12 @@
import com.jcorporate.expresso.core.controller.Output;
import com.jcorporate.expresso.core.controller.Transition;
import com.jcorporate.expresso.services.test.ControllerTestCase;
-import com.jcorporate.expresso.services.test.ControllerTestSuite;
-import junit.framework.TestSuite;
import org.apache.cactus.WebRequest;
-import java.util.Enumeration;
-
/**
* Unit tests some of the states for the DBSecurityMatrix Controller.
- *
* @author Michael Rimov
- * @version $Revision$ $Date$
* @todo Implement 'update state' unit tests
*/
public class DBSecurityMatrixTests
@@ -96,37 +92,8 @@
*/
public DBSecurityMatrixTests(String testName)
throws Exception {
- super(testName,
- com.jcorporate.expresso.services.controller.DBSecurityMatrix.class);
- }
-
- /**
- * Convenience method so we can test just this class.
- *
- * @param args the Command line arguments
- * @throws Exception upon error
- */
- public static void main(String[] args)
- throws Exception {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- * Determines what tests are run in the test suite. We also tell ControllerTestSuite
- * that we need ExpressoSchema to exist for our tests. We also tell it that
- * we aren't modifying the underlying database for our own tests so the schema
- * doesn't necessarily have to be deleted when we're done with it.
- *
- * @return Instantiated TestSuite
- * @throws Exception upon error
- */
- public static TestSuite suite()
- throws Exception {
- ControllerTestSuite cts = new ControllerTestSuite();
- cts.addReadOnlySchemaDependency(com.jcorporate.expresso.core.ExpressoSchema.class);
- cts.addTestSuite(DBSecurityMatrixTests.class);
-
- return cts;
+ super(testName, com.jcorporate.expresso.services.controller.DBSecurityMatrix.class);
+ this.addRequiredSchema(ExpressoSchema.class);
}
/**
@@ -253,4 +220,4 @@
}
}
}
-}
\ No newline at end of file
+}
More information about the cvs
mailing list