Git Product home page Git Product logo

c5-test-support's People

Watchers

 avatar

c5-test-support's Issues

Support for more than one datasource in the Application Context.

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:

MSSQL InsertIdentityOperation type of DatabaseOperation not supported

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

@DataSet data persists after rollback.

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

support for multi dataset-locations

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:

@DataSet won't trigger the data injection when set on a test super class

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.