Package org.sakaiproject.component.cover
Class TestComponentManagerContainer
- java.lang.Object
-
- org.sakaiproject.component.cover.TestComponentManagerContainer
-
public class TestComponentManagerContainer extends Object
A container for a Test Component Manager that can be configured with one of more components.
-
-
Constructor Summary
Constructors Constructor Description TestComponentManagerContainer(String configPaths)TestComponentManagerContainer(String configPaths, Properties props)create a component manager based on a list of component.xml
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgenerateSiteId()Convenience method to create a somewhat unique site id for testing.ComponentManagergetComponentManager()get the current component managerObjectgetService(String beanId)Convenience method to get a service bean from the Sakai component manager.static ObjectgetServiceProxy(Class clazz, InvocationHandler handler)Returns a dynamic proxy for a service interface.voidloadComponent(org.springframework.context.ConfigurableApplicationContext ac, List<org.springframework.core.io.Resource> config, ClassLoader loader)Load the application context using a single classloaderstatic voidsetSakaiHome(String sakaiHome)
-
-
-
Constructor Detail
-
TestComponentManagerContainer
public TestComponentManagerContainer(String configPaths) throws IOException
- Throws:
IOException
-
TestComponentManagerContainer
public TestComponentManagerContainer(String configPaths, Properties props) throws IOException
create a component manager based on a list of component.xml- Parameters:
configPaths- a ';' seperated list of xml bean config files- Throws:
IOException
-
-
Method Detail
-
loadComponent
public void loadComponent(org.springframework.context.ConfigurableApplicationContext ac, List<org.springframework.core.io.Resource> config, ClassLoader loader)Load the application context using a single classloader- Parameters:
ac- The spring application contextconfig- a list of configurations represented as List of resourcesloader- the classloader to use
-
getComponentManager
public ComponentManager getComponentManager()
get the current component manager- Returns:
-
generateSiteId
protected String generateSiteId()
Convenience method to create a somewhat unique site id for testing. Useful in tests that need to create a site to run tests upon.- Returns:
- A string suitable for using as a site id.
-
getServiceProxy
public static final Object getServiceProxy(Class clazz, InvocationHandler handler)
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 classhandler- The invocation handler that defines how the dynamic proxy should behave- Returns:
- The dynamic proxy to use as a collaborator
-
setSakaiHome
public static void setSakaiHome(String sakaiHome)
-
-