I have been able to prototype an integration of the current JBoss Unit + JBoss MC which makes trivial the parametrization of complex test cases that required services, here is just a simple example:
@Test @Bootstrap("/mytest/jboss-beans.xml"); public class MyTest { private String dataSourceName; private DataSource dataSource; public String getDataSourceName() { return dataSourceName; } @Parameter public void setDataSourceName(String dataSourceName) { this.dataSourceName = dataSourceName; } @Inject(bean="DataSource") public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } @Test public void test() { // use data source here } }
<deployment> <bean name="DataSource" class="javax.sql.DataSource"> <constructor> <factory name="some factory"> <parameter><inject bean="TestCase" property="dataSourceName" state="Instantiated"/></parameter> </factory> </constructor> </bean> </deployment>