db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (JDO-390) JPOX fails new test: change to projected Date field is reflected in the database
Date Sat, 31 Mar 2007 19:03:25 GMT

     [ https://issues.apache.org/jira/browse/JDO-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Craig Russell reassigned JDO-390:
---------------------------------

    Assignee: Michelle Caisse  (was: Andy Jefferson)

Andy is right. The test doesn't actually test what it's supposed to. Instead of 
        comp.setFounded(testDate);
it should be something like
        testDate.setTime(123789L); 

And then the tests should make sure that the company instance in memory is not dirty (test
is ok here) and that the instance in the database still has the same Date as it did earlier,
using an equals test.

There is a pretty good summary of the issue at http://mail-archives.apache.org/mod_mbox/db-jdo-dev/200606.mbox/%3cB60FB51F-43A4-43AD-A647-75283D6A969E@SUN.com%3e

The consensus is that if you project a Date from a query, the Date you get is not an owned
SCO. It can be an SCO if your implementation chooses (the only requirement is that it is assignable
to Date) but it cannot be owned.

The test method projects a Date, modifies it, and then verifies both that the instance in
memory whence the projected Date was obtained is not modified, and that the instance in the
database is not modified.


> JPOX fails new test: change to projected Date field is reflected in the database
> --------------------------------------------------------------------------------
>
>                 Key: JDO-390
>                 URL: https://issues.apache.org/jira/browse/JDO-390
>             Project: JDO
>          Issue Type: Bug
>          Components: tck2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Michelle Caisse
>         Assigned To: Michelle Caisse
>             Fix For: JDO 2 maintenance release 1
>
>
> Changes to a projected SCO should not be persisted to the data store. JPOX persists changes
to a projected Date field in the new query.result.ProjectedSCODoesNotTrackChanges test.
>    
>  [java] 1) testDateField(org.apache.jdo.tck.query.result.ProjectedSCODoesNotTrackChanges)junit.framework.AssertionFailedError:
>     [java] Expected Company instance not to be dirty; actual state is {persistent, transactional,
dirty}
>     [java] Expected projected field value is Fri Jun 23 21:53:29 PDT 2006; actual value
is Wed Dec 31 16:02:03 PST 1969
>     [java]
>     [java]      at org.apache.jdo.tck.JDO_Test.failOnError(JDO_Test.java:1052)
>     [java]      at org.apache.jdo.tck.query.result.ProjectedSCODoesNotTrackChanges.testDateField(ProjectedSCODoesNotTrackChanges.java:150)
>     [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [java]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     [java]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
> hodAccessorImpl.java:25)
>     [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:237)
>     [java]      at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:107)
>     [java]      at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:147)
>     [java]      at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:122)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message