christiannelson / c5-test-support Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/c5-test-support
Automatically exported from code.google.com/p/c5-test-support
Module: test-support
Version: 0.9.2-m2
Right now the DataSetTestExecutionListener only supports one DataSource in the
entire application context. There are cases where more than one DataSources are
defined in the context.
For instance I am working on a DataArchiving application and in the unit tests
I have to define two datasources (the data is archived/moved from one
datasource to another).
I have attached a simple patch that allows the said funtionality. If more than
one datasource bean is found in the application context the code prefers the
datasource names as "DataSource". Otherwise the first datasource found is used
for populating the dataset.
Original issue reported on code.google.com by [email protected]
on 21 Jul 2010 at 2:07
Attachments:
Usage of @DataSet with InsertIdentityOperation (dedicated to MSSQL), e.g.
@DataSet(setupOperation = "InsertIdentityOperation.CLEAN_INSERT"), doesn't
seem to be supported.
(org.springframework.core.ConstantException: Field
'INSERTIDENTITYOPERATION.CLEAN_INSERT' not found in class
[org.dbunit.operation.DatabaseOperation])
I wouldn't mind adding the support for these specific operation myself if
you care.
cf. http://dbunit.sourceforge.net/components.html#cleanInsert
-nodje
Original issue reported on code.google.com by [email protected]
on 24 Apr 2009 at 7:37
Perhaps I'm not understanding how to use this correctly, but I expect the
test class included below to pass. I am seeing expected rollback behavior
when not using the @DataSet insert data (testDaoRollback()). When using it
(testDaoAndDataSetRollback()), only the DAO insert is rolled back. It
seems they are on separate transactions?
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/spring-config-domain-test.xml"})
@TransactionConfiguration(transactionManager = "transactionManager",
defaultRollback = true)
@Transactional
public class ObjectActionRuleDaoTest extends
AbstractTransactionalDataSetTestCase {
@Autowired
private iObjectActionRuleDao objectActionRuleDao;
@Test
public void testDaoRollback() {
assertEquals(0, objectActionRuleDao.findAll().size());
ObjectActionRule oar = new ObjectActionRule();
oar.setId(1L);
objectActionRuleDao.merge(oar);
assertEquals(1, objectActionRuleDao.findAll().size());
}
@Test
@DataSet("classpath:/ObjectActionRule.db.xml")
public void testDaoAndDataSetRollback() {
assertEquals(1, objectActionRuleDao.findAll().size());
ObjectActionRule oar = new ObjectActionRule();
oar.setId(2L);
objectActionRuleDao.merge(oar);
assertEquals(2, objectActionRuleDao.findAll().size());
}
@AfterTransaction
public void checkEmpty() {
assertEquals(0, objectActionRuleDao.findAll().size());
}
}
I would've asked on a mailing list, but didn't see one...
Original issue reported on code.google.com by [email protected]
on 7 Jan 2010 at 4:37
What steps will reproduce the problem?
1. x
2. x
3. x
What is the expected output? What do you see instead?
x
What version of the product are you using? On what operating system?
0.9.1-SNAPSHOT
Please provide any additional information below.
We'd like to make use of multiple datasets.
@DataSet("dataset1.xml,dataset2.xml, dataset3.xml")
the attached file would support it (sorry, no specific tests implemented yet)
Original issue reported on code.google.com by [email protected]
on 27 Jan 2009 at 12:19
Attachments:
An example is worth an explanation I believe:
Here's my persistence level test super class:
@TransactionConfiguration(defaultRollback = true)
@TestExecutionListeners({ DataSetTestExecutionListener.class })
@ContextConfiguration(locations =
{"file:src/main/webapp/WEB-INF/hibernateContext.xml",
"file:src/main/webapp/WEB-INF/daoContext.xml"})
public class BaseDaoHibernateTest extends
AbstractTransactionalTestNGSpringContextTests {
/**
* Empty method that is called before the group of test
* it triggers the insertion of the DBUnit base data script
*/
@DataSet(value = "classpath:basedata.xml")
@BeforeClass(groups = "dao")
public void setData() {
logger.warn("Base data are being injected by DBUnit");
}
}
If I run a test extending this base class, the DBunit data injection won't
be triggered.
public final class CommonDaoHibernateTest extends BaseDaoHibernateTest {
@Autowired
private CommonDAOHibernate commonDAOHibernate;
/**
* check if the most basic query works out. Verify the Hibernate setup
*/
@Test(groups = "common")
public void queryTest() {
String queryStr = "id = 'admin'";
List result = commonDAOHibernate.findObject(User.class, queryStr);
assertNotNull(result);
}
If I add the @DataSet annotation to the test method, then it works.
My idea is to get a basic set of table populated for the whole suite, then
inject specific Spring Bean based data for each test.
Am I missing something? Or is it because the setData() method in
BaseDaohibernateTest is not a proper test itself?
Original issue reported on code.google.com by [email protected]
on 23 Apr 2009 at 8:51
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.