Created
October 24, 2010 17:46
-
-
Save thesurlydev/643712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** package and imports omitted for brevity *** | |
@ContextConfiguration(locations = { | |
"file:src/main/webapp/WEB-INF/appContext.xml", | |
"classpath:appTestContext.xml" | |
}) | |
public abstract class AppTransactionalStrutsTestCase extends StrutsSpringTransactionalTests { | |
@Before | |
public void onSetUp() throws Exception { | |
super.setUp(); | |
setupAction(); | |
} | |
protected abstract void setupAction() throws DataAccessException; | |
@Override | |
protected void setupBeforeInitDispatcher() throws Exception { | |
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); | |
} | |
protected ActionProxy initActionProxy(String uri) { | |
ActionProxy proxy = getActionProxy(uri); | |
ActionContext actionContext = proxy.getInvocation().getInvocationContext(); | |
actionContext.setSession(new HashMap<String, Object>()); | |
return proxy; | |
} | |
@Autowired | |
public void setDataSource(@Qualifier(value = "appDataSource") DataSource appDataSource) { | |
this.dataSource = appDataSource; | |
this.simpleJdbcTemplate = new SimpleJdbcTemplate(appDataSource); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment