| Author |
Message |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 23/09/2009 04:41:57
|
seasonedcoder
Joined: 15/09/2009 00:43:17
Messages: 7
Offline
|
Imagine that I have implemented a fixture class to execute sql queries. Now I have a problem.
I want to compare the returned recordset against a table of expected values by applying the 'list of' interpreter. The problem is that I don't know beforehand the names of the columns (because authors of the tests will define them), thus I cannot implement a statically compiled class instances of which will be passed on the interpreter. Some gut feeling tells me that I need some kind of dynamism, in other words, for each resultset I have to define a class dynamically along with necessary properties that reflect the columns.
May be this is just a matter of misunderstanding on my side and things are much simpler, but I don't really know the mechanism that GP employs to refer to properties in the 'list of' interpreter. I guess it is reflection, but what kind of reflection ? How exactly the properties are fetched for comparison and is there any way to override this default behavior ?
Have you ever faced this challenge ?
|
|
|
 |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 23/09/2009 10:43:05
|
fdenommee
Joined: 25/01/2008 10:23:16
Messages: 587
Offline
|
Hi,
We did face this challenge on a client (in .Net C#). We wrote a new interpreter that handle a DataTable (kind of ResultSet in Java) without have an Object representing columns.
The specifications look like :
Code:
|| DataTable Of || Specification Table ||
|| id|| version || uuid || name || repository_id || anullstring |
| 1 | 6 | 97ec009b-eb82-4ab9-aaa1-0268316bb365 | Cell Decoration | 1 | nil |
| 2 | 8 | 55024a44-be17-41be-bf78-88e99cc11a6a | Calculator | 1 | nothing |
| 3 | 3 | f7353021-4885-4bd0-afbe-012ec272fdd5 | Fine Rate | 1 | null |
| 4 | 1 | c69697a6-ddad-4b4d-9ca2-e29af3e0ccbd | GP-2 | 2 | empty |
So here, the specification knows the column names but the code does not... Sound interesting ? I can send you code snippet in .Net C#..
Just for information, the creator of dbFit is porting it to GreenPepper (the team here call it dbGreenPepper!)... it is not actually released (in development) but we can help you if you want to use it... This will allow you to test more stuff from the database (maybe not all you want but...)
Cheers,
Francois D.
|
|
|
 |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 28/09/2009 06:46:01
|
seasonedcoder
Joined: 15/09/2009 00:43:17
Messages: 7
Offline
|
Bonjour, François,
sorry for a late reply - a bit busy these days.
Yes, I'm really interested in this code, since I'm blocked.
Could you please send it to pavel at octopusnetwork dot org ?
Thanks in advance.
|
|
|
 |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 28/09/2009 10:15:29
|
fdenommee
Joined: 25/01/2008 10:23:16
Messages: 587
Offline
|
Hi,
I attach the code to this post (to allow others to play with it!)...
This is the latest version i have given to my client - do not know if they improve it... Feel free to send me your improvement... i will put this code in our SubVersion repository in the next days...
Cheers,
Francois D.
| Filename |
GreenPepper-DataTable.zip |
Download
|
| Description |
DataTable Interpreter |
| Filesize |
4 Kbytes
|
| Downloaded: |
163 time(s) |
|
|
|
 |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 08/10/2009 04:54:57
|
nicolas
Joined: 06/01/2009 08:00:25
Messages: 53
Offline
|
Hi,
Is there any documentationabout how to write interpreter ?
Best regards,
Nicolas
|
|
|
 |
![[Post New]](/site/templates/default/images/icon_minipost_new.gif) 08/10/2009 06:45:25
|
fdenommee
Joined: 25/01/2008 10:23:16
Messages: 587
Offline
|
Hi,
There is no such documentation to help writer interpreter. The best way is to see the actual code of the interpreters found in the core : http://www.greenpeppersoftware.com/svn/trunk/java/core/src/main/java/com/greenpepper/interpreter/
If you want to write one, i can assist you if you need to...
Cheers,
Francois D.
|
|
|
 |
|
|