|
From: Roy B. <roy...@do...> - 2013-03-14 13:07:30
|
Thanks for the heads up!
Re interpretation of the "columns"-value: The current idea is that a
sequence defines column ordering and, optionally, default values, whereas a
mapping defines default values only. Maybe they should use different keys,
to avoid confusion. A column name order would be valid until a new sequence
replaces it. I think that named values ought to be allowed in the rows as
well. So. there is no declaration of columns as such; the set of column
names in a table's metadata is the union of all column names occurring in
the dataset for that table.
An example using a named value inside a row:
- mytable:
columns: [ id, name, version:0, created_by:1 ]
rows: [ 1, "A name" ]
- mytable
columns: [ id, version, name, created_by: 1 ]
rows: [ 2, 1, "Another", description: "Description of a name" ]
Admittedly, putting a value that's inherently unordered into a sequence
smells a little. Defining a row as a mapping with two different tags for
ordered (positional) and unordered (named) values would be more precise,
but more also more verbose, and perhaps less readable, even.
Example translated to FlatXml:
<mytable id="1" name="A name" version="0" created_by="1"
description="[null]"/>
<mytable id="2" name="Another" version="1" created_by="1"
description="Description of a name"/>
Re tabluar representation: I like your example as well - I just think the
choice of dataset language should depend mostly on the kind/nature of the
data.
Regards,
2013/3/14 John Hurst <joh...@gm...>
> Hello,
>
> I am very interested in alternative formats for DbUnit and would consider
> putting this implementation into the core.
>
> The second entry provides new default values for some columns. Does that
> mean that the full list of columns from the first entry is retained? What
> if the second entry mentions new columns? What happens to the ordering?
>
> I think the idea of default values is a very interesting one for DbUnit
> and probably should be supported somehow as a specific concept separate
> from specific dataset formats.
>
> Personally I think that YAML suffers from the same basic problem as XML --
> it is essentially hierarchical, not tabular.
>
> In my work lately we have been using the Creativyst Tabular Exchange
> format (http://www.creativyst.com/Doc/Std/ctx/ctx.htm). I have written
> simple DbUnit support for it and it is working pretty well.
>
> If I interpret your example correctly, it would look like this in CTX:
>
> \T mytable
> \L id | name | description | version | created_by |
> last_modified_by
> 1 | Just | The first row | 0 | 1 |
> 1
> 2 | another | The second row | 0 | 1 |
> 1
> 3 | example | (NULL) | 0 | 1 |
> 1
> 4 | created by | (NULL) | 0 | 4 |
> 2
> 5 | another user | (NULL) | 0 | 4 |
> 2
>
> (Meant to be read monospaced.)
>
> We've found this makes for nice clean inline datasets. (We tend to embed
> test data in test code.)
>
> I need to get this into DbUnit core at some point too. (The current impl
> is in Groovy, I need to rewrite it in Java.)
>
> More later. (Train reaching station.)
>
> Regards
>
> John Hurst
>
>
>
> On Thu, Mar 14, 2013 at 4:31 AM, Roy Brokvam <roy...@do...>wrote:
>
>> (Sorry about sending that previous incomplete snippet!)
>>
>> I know Arquillian Persistence Extension supports YAML datasets, but that
>> one has two major shortcomings:
>> * It's part of a bigger testing framework that not all DbUnit users use
>> * It doesn't exploit YAML's structured model - it's basically just
>> another simple dataset
>>
>> At my work, I have started specifying a YAML dataset format that uses
>> positional values (less need to name each value for every row) and default
>> values (less need to mention each column in each row). I'm pretty sure that
>> others have the same problem that we're trying to solve: Unnecessary long
>> FlatXml datasets that are really hard to read.
>>
>> An illustrative example along the lines I'm thinking:
>>
>> - mytable:
>> columns: [ id, name, description, version: 0, created_by: 1,
>> last_modified_by: 1 ] # defines order and default values
>> rows:
>> - [ 1, "Just", "The first row" ]
>> - [ 2, "another", "The second row" ]
>> - [ 3, "example" ] # No comment here, default is null
>>
>> - mytable:
>> columns: { created_by : 2, last_modified_by : 2 } # new default
>> values
>> rows:
>> - [ 4, "created by" ]
>> - [ 5, "another user" ]
>>
>> I am also thinking of including some sequence generating mechanism, as
>> well as supporting YAML anchors and aliases.
>>
>> I am encouraged by my employer to provide the specification and an
>> implementation of it to the open source community, and DbUnit would of
>> course be a natural home for it. The question is - is there any chance that
>> such an extension would be included, or should I just create a separate
>> open source project for it?
>>
>> Regards,
>> RoyB
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_mar
>> _______________________________________________
>> dbunit-developer mailing list
>> dbu...@li...
>> https://lists.sourceforge.net/lists/listinfo/dbunit-developer
>>
>>
>
>
> --
> Life is interfering with my game
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> dbunit-developer mailing list
> dbu...@li...
> https://lists.sourceforge.net/lists/listinfo/dbunit-developer
>
>
|