Re: How to compare the tables when two column relation is many to many

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: How to compare the tables when two column relation is many to many

Feng Xuemin

Hello everybody,

Do you have any idea about this, I blocked by this issue. Thanks.

 

Best Regards,

Xuemin

 


From: Feng Xuemin
Sent: Friday, November 13, 2009 16:13
To: '[hidden email]'
Subject: How to handle the data when relation is many to many

 

I met one issue when compare tables, here is the case.

I defined the xls format dataset below and insert db successfully, then I check if the insert result is correct. Very simple case, but compare failed.

I think it is because the relation between these two columns is many to many, so when compare the result, the data order was broken.

So for this case, how I can handle it correctly, thanks for your helpJ

Here is the run result: junit.framework.ComparisonFailure: value (table=SDMC_DEVICE_TYPE_SEGMENT, row=1, col=SEGMENT_ID) expected:<[2]> but was:<[1]>

       at org.dbunit.assertion.JUnitFailureFactory.createFailure(JUnitFailureFactory.java:39)

       at org.dbunit.assertion.DefaultFailureHandler.createFailure(DefaultFailureHandler.java:105)

       at org.dbunit.assertion.DefaultFailureHandler.handle(DefaultFailureHandler.java:208)

       at org.dbunit.assertion.DbUnitAssert.compareData(DbUnitAssert.java:514)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:400)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:312)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:274)

       at org.dbunit.Assertion.assertEquals(Assertion.java:122)

 

xls file data:

SEGMENT_ID

DEVICE_TYPE_ID

1

2

2

3

3

4

1

3

1

4

db data:

 

Best Regards,

Xuemin

 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: How to compare the tables when two column relation is many to many

Feng Xuemin

I use the following code to sort this table, it does not work.:(

String[] column_name={"SEGMENT_ID"};

ITable actualTable=new SortedTable(jndiConnection.createDataSet ().getTable ("SDMC_DEVICE_TYPE_SEGMENT"),column_name);


From: Feng Xuemin
Sent: Saturday, November 14, 2009 16:00
To: '[hidden email]'
Subject: RE: How to compare the tables when two column relation is many to many

 

Hello everybody,

Do you have any idea about this, I blocked by this issue. Thanks.

 

Best Regards,

Xuemin

 


From: Feng Xuemin
Sent: Friday, November 13, 2009 16:13
To: '[hidden email]'
Subject: How to handle the data when relation is many to many

 

I met one issue when compare tables, here is the case.

I defined the xls format dataset below and insert db successfully, then I check if the insert result is correct. Very simple case, but compare failed.

I think it is because the relation between these two columns is many to many, so when compare the result, the data order was broken.

So for this case, how I can handle it correctly, thanks for your helpJ

Here is the run result: junit.framework.ComparisonFailure: value (table=SDMC_DEVICE_TYPE_SEGMENT, row=1, col=SEGMENT_ID) expected:<[2]> but was:<[1]>

       at org.dbunit.assertion.JUnitFailureFactory.createFailure(JUnitFailureFactory.java:39)

       at org.dbunit.assertion.DefaultFailureHandler.createFailure(DefaultFailureHandler.java:105)

       at org.dbunit.assertion.DefaultFailureHandler.handle(DefaultFailureHandler.java:208)

       at org.dbunit.assertion.DbUnitAssert.compareData(DbUnitAssert.java:514)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:400)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:312)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:274)

       at org.dbunit.Assertion.assertEquals(Assertion.java:122)

 

xls file data:

SEGMENT_ID

DEVICE_TYPE_ID

1

2

2

3

3

4

1

3

1

4

db data:

 

Best Regards,

Xuemin

 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: How to compare the tables when two column relation is many to many

Feng Xuemin

Hello,

 I solve this issue when I use SortedTable API for expected and actual table, Thanks everybody.

 


From: Feng Xuemin [mailto:[hidden email]]
Sent: Saturday, November 14, 2009 16:39
To: [hidden email]
Subject: Re: [dbunit-user] How to compare the tables when two column relation is many to many

 

I use the following code to sort this table, it does not work.:(

String[] column_name={"SEGMENT_ID"};

ITable actualTable=new SortedTable(jndiConnection.createDataSet ().getTable ("SDMC_DEVICE_TYPE_SEGMENT"),column_name);


From: Feng Xuemin
Sent: Saturday, November 14, 2009 16:00
To: '[hidden email]'
Subject: RE: How to compare the tables when two column relation is many to many

 

Hello everybody,

Do you have any idea about this, I blocked by this issue. Thanks.

 

Best Regards,

Xuemin

 


From: Feng Xuemin
Sent: Friday, November 13, 2009 16:13
To: '[hidden email]'
Subject: How to handle the data when relation is many to many

 

I met one issue when compare tables, here is the case.

I defined the xls format dataset below and insert db successfully, then I check if the insert result is correct. Very simple case, but compare failed.

I think it is because the relation between these two columns is many to many, so when compare the result, the data order was broken.

So for this case, how I can handle it correctly, thanks for your helpJ

Here is the run result: junit.framework.ComparisonFailure: value (table=SDMC_DEVICE_TYPE_SEGMENT, row=1, col=SEGMENT_ID) expected:<[2]> but was:<[1]>

       at org.dbunit.assertion.JUnitFailureFactory.createFailure(JUnitFailureFactory.java:39)

       at org.dbunit.assertion.DefaultFailureHandler.createFailure(DefaultFailureHandler.java:105)

       at org.dbunit.assertion.DefaultFailureHandler.handle(DefaultFailureHandler.java:208)

       at org.dbunit.assertion.DbUnitAssert.compareData(DbUnitAssert.java:514)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:400)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:312)

       at org.dbunit.assertion.DbUnitAssert.assertEquals(DbUnitAssert.java:274)

       at org.dbunit.Assertion.assertEquals(Assertion.java:122)

 

xls file data:

SEGMENT_ID

DEVICE_TYPE_ID

1

2

2

3

3

4

1

3

1

4

db data:

 

Best Regards,

Xuemin

 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user