Hi Lewis,

I think you might just be overlooking that the newly created one gets their
values added in the for-loop

https://github.com/apache/gora/blob/master/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java#L273-L276

The values it gets are from the object that was persisted, and the object
"after" is the one actually retrieved from the dataStore.


Renato M.

2015-10-03 6:23 GMT+02:00 Lewis John Mcgibbney <[email protected]>:

> A follow up here
>
> once we've retrieved the 'after' Employee object it looks like this
>
> {"name": "Random Joe", "dateOfBirth": 813125426537, "ssn": "101010101010",
> "salary": 100000, "boss": {"name": "Random boss", "dateOfBirth":
> 750053426555, "ssn": "202020202020", "salary": 1000000, "boss": null,
> "webpage": null}, "webpage": {"url": "url..", "content": {"bytes": "test
> content"}, "parsedContent": [], "outlinks": {}, "headers": null,
> "metadata": {"version": 0, "data": {}}}}
>
> whereas the newly created 'expected' Employee object looks as follows
>
> {"name": null, "dateOfBirth": 0, "ssn": "", "salary": 0, "boss": null,
> "webpage": {"url": "url..", "content": {"bytes": "test content"},
> "parsedContent": [], "outlinks": {}, "headers": null, "metadata":
> {"version": 0, "data": {}}}}
>
> If we've populated an object with data and persisted it into a DataStore
> how can we expect it to be a default object?
>
>
> On Fri, Oct 2, 2015 at 9:21 PM, Lewis John Mcgibbney <
> [email protected]> wrote:
>
> > Hi Folks,
> > I am working on GORA-240 [0] and want to reach out as I am puzzled.
> >
> > Essentially DataStoretestUtil#testGetEmployeeWithFields populates one
> > Employee object (after) with data, persists it to the DataStore and then
> > compares it to another newly created Employee object (expected) with
> > default values.
> >
> > Why does the test compare a populated object to a newly created one with
> > no dirty and or persistent data?
> >
> > If someone can explain this it would be appreciated. If not then I am
> > going to assume this test is not correct and the logic needs to be
> changed.
> >
> > Thanks
> > lewis
> >
> > [0] https://issues.apache.org/jira/browse/GORA-240
> > [1]
> >
> https://github.com/apache/gora/blob/master/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java#L256-L280
> > --
> > *Lewis*
> >
>
>
>
> --
> *Lewis*
>

Reply via email to