dbunit

DBUnit Sybase unable to CLEAN_INSERT

天涯浪子 提交于 2019-12-22 18:45:18
问题 According to the DBUnit docs link it should support using a CLEAN_INSERT when using a DatabaseSequenceFilter. I get the following exception when attempting this com.sybase.jdbc2.jdbc.SybSQLException: Dependent foreign key constraint violation in a referential integrity constraint. dbname = 'my_db', table name = 'tbl_child', constraint name = 'fk_tbl_child_parentid'. My tables look like this: CREATE TABLE dbo.tbl_parent ( parent_id numeric(19,0) IDENTITY, ... ) CREATE TABLE dbo.tbl_child (

Log Output in DBUnit

风流意气都作罢 提交于 2019-12-22 05:47:09
问题 I feel that this is something I could easily figure out but I'm having a hard time finding information on how to change the log level of DBUnit. Can anyone solve this problem for me? 回答1: When using log4j add the following to your log4j.properties : # DbUnit log4j.logger.org.dbunit=ERROR 回答2: After avoiding the problem for a while, I came to a solution. import org.slf4j.Logger import org.slf4j.LoggerFactory import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.core.util

DBunit; confusion over case sensitivity on table/column names

一世执手 提交于 2019-12-19 08:52:39
问题 I'm getting this error when I start up my application Caused by: org.dbunit.dataset.NoSuchColumnException: CLIENT.ID - (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive I'm not too sure why I'm getting this, since my table/column names all all referenced in upper case(even though the message insists this shouldn't be an issue) My table : mysql> describe CLIENT; +------------------+--------------+------+-----+---------+--

POI Appending .0 while reading numeric data from excel

北城以北 提交于 2019-12-19 07:19:08
问题 I am using POI HSSF to read excel data and I am using JUnit to check the data against database proc RefCursor. The Junit test fails as the numeric data from the Refcursor for example 100 are compared against the data in the excel sheet 100 but it fails as the POI reads it as 100.0. InputStream fileInputStream = Testdb.class.getClassLoader().getResourceAsStream(fileName); //retrieve number of columns and rows int numRows=0, numCols=0, i, j, minColIndex=0, maxColIndex=0; POIFSFileSystem

How do I reference a file that is placed in the WEB-INF folder when using Arquillian?

早过忘川 提交于 2019-12-18 12:33:05
问题 I am using maven and the standard directory layout. So I have added a testdata.xml file in the src/test/resources folder, and I also added it as: .addAsWebInfResource("testdata.xml", "testdata.xml") in the deployment method, and I have confirmed that it is there. This will make the file appear in /WEB-INF/testdata.xml . Now I need to have a reference to this file in my code and I tried several different getClass().getResourceAsStream(...) and failing again and again so I need some advise now.

DbUnit and binary data

梦想的初衷 提交于 2019-12-18 11:49:13
问题 I use DbUnit for unit-testing of my DAO objects. It works great so far. I have a problem, I have field ob type byte[] which is stored as BLOB in the database. The column is not-null. How can I specify the value for this column in the XML dataset file, that DbUnit uses? The value can be nothing fancy, 5 bytes will be enough. I would like to avoid necessity to create extra binary files just for this. Any suggestions? 回答1: After all I solved it like that: XML dataset file: <?xml version="1.0"

what does null entities are not supported by org.hibernate.event.def.EventCache mean?

蓝咒 提交于 2019-12-13 14:41:03
问题 I am getting the error at the point I try to save an entity. I only get this error when I have booted up my server, not when I run my unit tests using dbunit. I am trying to save an association. My unit test should be the exact same condition as that which I am encountering when manually testing. I am adding a new entity on one end of the relationship where no relationships existed before. I am using HSQLDB with the unit tests and the web app is using SQL Server. The searches I have performed

database testing in php using phpunit,simpletest on api haveing stored procedure

微笑、不失礼 提交于 2019-12-13 05:24:54
问题 how can i do database testing with phpunit, i have done Google search on this but the problem is, my api is calling an stored procedure to interact with mysql and in phpunit i am unable to fire an stored procedure on the database XML file please check this https://stackoverflow.com/questions/21278242/phpunit-stored-procedure-database-testing https://stackoverflow.com/questions/21230707/testing-stored-procedure-which-is-call-within-an-api-in-php-using-either-phpunit And i have to create an XML

org.dbunit.dataset.NoSuchTableException, but table exists

和自甴很熟 提交于 2019-12-12 16:22:17
问题 H2 1.4.191. DbUnit 2.5.1. How this can be fixed? Code and results for 3 cases: org.dbunit.dataset.NoSuchTableException: category org.dbunit.dataset.NoSuchTableException: Category org.dbunit.dataset.NoSuchTableException: CATEGORY // <dataset> <Category categoryId="9223372036854775806" categoryName="NAME" categoryParentId="9223372036854775805"/> </dataset> // CREATE TABLE Category ( categoryId INT AUTO_INCREMENT, categoryName VARCHAR NOT NULL, categoryParentId INT NOT NULL, PRIMARY KEY

Strange behavior of HSQLDB and group by

萝らか妹 提交于 2019-12-12 13:15:55
问题 I am using HSQLDB for writing junits and my query is like this: String queryStr = "from ManualUrlBatchModel where status IN(:status) group by batchUser order by creationTime"; Query query = getSession(requestType).createQuery(queryStr); query.setParameterList("status", status); I am retrieving one batch per user in the given status (depending on creation time FIFO order). It runs fine for end to end testing but fails while writing junits. Exception says: Caused by: java.sql.SQLException: Not