Opened 12 years ago

Closed 12 years ago

#4676 closed enhancement (fixed)

Key-Value pair data provider

Reported by: guest Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.1
Component: Data Version: 0.9
Keywords: Sourcecode source upload submission code Cc:
Blocked By: Blocking:

Description

Wraps data of the form {key1: "val1", key2: "val2, ... } with a data provider. Implements the Read and Identity data APIs

CLA sent by e-mail (no confirmation of receipt received)

Russell Jones

Attachments (4)

KeyValPairReadStore.js (15.7 KB) - added by guest 12 years ago.
KeyValueStore.patch (50.2 KB) - added by guest 12 years ago.
Patch file containing KeyValueStore?.js and UT test cases.
KeyValueStoreDoc.html (8.1 KB) - added by guest 12 years ago.
Doc page mimicing format/layout of the CsvStore? page from the Dojo Book
dojox.data_KeyValueStore_20071218.patch (50.8 KB) - added by Jared Jurkiewicz 12 years ago.
Updated patch with better root, plus a couple style fixes.

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by guest

Attachment: KeyValPairReadStore.js added

comment:1 Changed 12 years ago by Jared Jurkiewicz

Concerns with the provided file:

One: dojo.provide("oucas.data.KeyValPairReadStore?");

It isn't namespaced to dojo.

Two: No unit tests.

Cannot commit contribution without both problems resolved.

comment:2 Changed 12 years ago by Jared Jurkiewicz

Milestone: 1.01.1

No contact information for contributor, nor verification of CLA. Cannot commit. Patch is not complete. Needs UT, docs, etc.

comment:3 Changed 12 years ago by guest

I put my name in the bug, thinking that would be sufficient. What else do you need? Obviously, I'm reluctant to put my email address here because a passing spider would wrap it up in its nasty little regexp and cart it off to the spam pits of Mordor.

Of course oucas should be changed to dojo.data or dojox.data, sorry to have missed that.

UT = Unit test? I guess I'd have to look at the ItemFileReadStore.js tests. I'm afraid I don't understand the testing framework. I've sketched out some tests for the functions, but I couldn't work out how to get them into the testing framework (it seems very different from, e.g. JUnit) or if they would be considered sufficient. Would it be useful to attach these sketches here?

Docs? Where are the docs for ItemFileReadStore.js? What needs to be said beyond the comments at the start of the file?

comment:4 Changed 12 years ago by guest

You can find my name on http://dojo.jot.com/WikiHome/ContributorListing I provided my CLA to Carrie Sackett

comment:5 Changed 12 years ago by Jared Jurkiewicz

The ItemFileReadStore? has docs in the dojo book like: http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/available-stores/dojo-data-item

Basically, docs that show simple general usage of the store is very helpful to dojo users.

As for UT, yes, Unit Tests. To commit anything into dojo or dojox, I prefer that there are basic unit tests that exercise each of the core functions that the store implements to ensure it conforms to the dojo.data API. It also helps with preventing bugs and adding a regression point for any bugs found later; unit tests are added for them to make sure it doesn't return. They're very helpful for sanity checks.

I would advise to look at something like the CsvStore? tests over the ItemFileReadStore? tests. ItemFileReadStore? tests are using templates so we can share the tests with ItemFileWriteStore?, which makes them much more complicated to understand. The CsvStore? tests are much simpler. You can see them at: dojox/data/tests/stores/CsvStore.js They're loaded by the dojox/data/tests/module.js file

comment:6 Changed 12 years ago by Jared Jurkiewicz

I've got a co-worker here who's willing to help write some UT for this, so I'm referring him to this tracker. If all goes well, it should go in pretty quickly...

comment:7 in reply to:  6 Changed 12 years ago by guest

I actually ended up changing the format of the expected file and re-writing this store. The expected format I used was:

[
    {"key1": "value1"},
    {"key2": "value2"}
]

"Items" from the store are now these individual objects, with three available attributes: "key", "value", and the actual value of the key (for example, "key1" in the first object above).

I've attached a .patch file that contains the KeyValueStore? and the test cases. I've also attached a .html file that could be dumped directly into a new Book page on the dojotoolkit.org website (I copied the CsvStore? page to keep the correct formatting and classes).

-Ben Schell

Changed 12 years ago by guest

Attachment: KeyValueStore.patch added

Patch file containing KeyValueStore?.js and UT test cases.

Changed 12 years ago by guest

Attachment: KeyValueStoreDoc.html added

Doc page mimicing format/layout of the CsvStore? page from the Dojo Book

Changed 12 years ago by Jared Jurkiewicz

Updated patch with better root, plus a couple style fixes.

comment:8 Changed 12 years ago by Jared Jurkiewicz

Tested on:

FireFox? 2.0.0.12 IE 6 IE 7 SeaMonkey? 1.1.2 Opera 9.2 Safari B3

comment:9 Changed 12 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [11862]) Applying in a key/value store. fixes #4676

Note: See TracTickets for help on using tickets.