* Time: 11:59:49 AM
* To change this template use File | Settings | File Templates.
*/
public class SpringTapestryIntegrationTests extends TestCase {
public void testSpringIntegration() throws Exception {
MockServletContext servletContext = new MockServletContext();
servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:org/springmodules/web/tapestry/applicationContext.xml");
ContextLoader contextLoader = new ContextLoader();
contextLoader.initWebApplicationContext(servletContext);
MockServletConfig servletConfig = new MockServletConfig(servletContext, "servlet");
ApplicationServlet servlet = new ApplicationServlet();
servlet.init(servletConfig);
Registry hiveMindRegistry = (Registry) servletContext.getAttribute("org.apache.tapestry.Registry:servlet");
assertNotNull("HiveMind registry is not available in servlet context", hiveMindRegistry);
BeanFactory beanFactory = (BeanFactory) hiveMindRegistry.getService("hivemind.lib.DefaultSpringBeanFactory", BeanFactory.class);
String name = (String) beanFactory.getBean("name", String.class);
assertNotNull(name);