| org.sakaiproject.test.SakaiTestBase
All known Subclasses: org.sakaiproject.coursemanagement.impl.CmIntegrationTest, org.sakaiproject.component.test.privacy.PrivacyTest, org.sakaiproject.test.section.SectionAwarenessImplTest, org.sakaiproject.authz.impl.AuthzIntegrationTest, org.sakaiproject.test.section.CourseManagementIntegrationTest, org.sakaiproject.test.section.SectionIntegrationTestSuite,
SakaiTestBase | abstract public class SakaiTestBase extends TestCase (Code) | | An extension of JUnit's TestCase that launches the Sakai component manager.
Extend this class to run tests in a simulated Sakai environment.
NOTE:
Starting the component manager is an expensive operation, since it loads all
of the service implementations in the system, including database connection
pools, hibernate mappings, etc. To run a test suite, please collect all tests
into a single class rather than running a variety of individual test cases.
See
org.sakaiproject.test.SakaiIntegrationTest for an example.
author: Josh Holtzman |
Method Summary | |
protected String | generateSiteId() Convenience method to create a somewhat unique site id for testing. | final protected static Object | getService(String beanId) Convenience method to get a service bean from the Sakai component manager. | final public static Object | getServiceProxy(Class clazz, InvocationHandler handler) Returns a dynamic proxy for a service interface. | protected static void | oneTimeSetup() Initialize the component manager once for all tests, and log in as admin. | public static void | oneTimeTearDown() Close the component manager when the tests finish. |
generateSiteId | protected String generateSiteId()(Code) | | Convenience method to create a somewhat unique site id for testing. Useful
in tests that need to create a site to run tests upon.
A string suitable for using as a site id. |
getService | final protected static Object getService(String beanId)(Code) | | Convenience method to get a service bean from the Sakai component manager.
Parameters: beanId - The id of the service The service, or null if the ID is not registered |
getServiceProxy | final public static Object getServiceProxy(Class clazz, InvocationHandler handler)(Code) | | Returns a dynamic proxy for a service interface. Useful for testing with
customized service implementations without needing to write custom stubs.
Parameters: clazz - The service interface class Parameters: handler - The invocation handler that defines how the dynamic proxy should behave The dynamic proxy to use as a collaborator |
oneTimeSetup | protected static void oneTimeSetup() throws Exception(Code) | | Initialize the component manager once for all tests, and log in as admin.
|
oneTimeTearDown | public static void oneTimeTearDown()(Code) | | Close the component manager when the tests finish.
|
|
|