Issue Details (XML | Word | Printable)

Key: JDO-191
Type: Test Test
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig Russell
Reporter: Craig Russell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

Add test for PersistenceManager.getDataStoreConnection()

Created: 19/Oct/05 07:07 AM   Updated: 26/Mar/06 10:34 AM
Return to search
Component/s: tck2
Affects Version/s: JDO 2 beta
Fix Version/s: JDO 2 final

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works DataStoreConnection.java 2006-03-08 03:11 AM Craig Russell 5 kB
Java Source File Licensed for inclusion in ASF works DataStoreConnection.java 2006-03-07 01:30 PM Craig Russell 3 kB
Java Source File Licensed for inclusion in ASF works DataStoreConnectionThrows.java 2006-03-08 03:11 AM Craig Russell 6 kB
Environment: TCK

Resolution Date: 09/Mar/06 07:47 AM


 Description  « Hide
A12.16-1 [JDOConnection getDataStoreConnection(); If this method is called while a datastore transaction is active, the object returned will be enlisted in the current transaction. If called in an optimistic transaction before flush has been called, or outside an active transaction, the object returned will not be enlisted in any transaction.]]

The tests use the jdbc Connection.

The test needs to work with the jdbc library from the standard JDK 1.3 (JDBC 2.0).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig Russell made changes - 04/Feb/06 04:27 AM
Field Original Value New Value
Affects Version/s JDO 2 beta [ 12310683 ]
Fix Version/s JDO 2 rc1 [ 12310771 ]
Craig Russell made changes - 25/Feb/06 07:41 AM
Fix Version/s JDO 2 final [ 12310830 ]
Fix Version/s JDO 2 rc1 [ 12310771 ]
Craig Russell made changes - 07/Mar/06 01:29 PM
Description A12.16-1 [JDOConnection getDataStoreConnection(); If this method is called while a datastore transaction is active, the object returned will be enlisted in the current transaction. If called in an optimistic transaction before flush has been called, or outside an active transaction, the object returned will not be enlisted in any transaction.]]

The tests use the PCPoint class and a jdbc Connection.

The first test verifies that an object inserted into the PCPoint table during a transaction is visible by getObjectById in the same transaction.

The second test verifies that an object inserted into the PCPoint table outside a transaction is visible in the next transaction.

The test needs to work with the jdbc library from the standard JDK 1.3 (JDBC 2.0).
A12.16-1 [JDOConnection getDataStoreConnection(); If this method is called while a datastore transaction is active, the object returned will be enlisted in the current transaction. If called in an optimistic transaction before flush has been called, or outside an active transaction, the object returned will not be enlisted in any transaction.]]

The tests use the jdbc Connection.

The test needs to work with the jdbc library from the standard JDK 1.3 (JDBC 2.0).
Craig Russell added a comment - 07/Mar/06 01:30 PM
Please review this patch.

Craig Russell made changes - 07/Mar/06 01:30 PM
Attachment DataStoreConnection.java [ 12323842 ]
Craig Russell added a comment - 08/Mar/06 03:11 AM
These test programs test the ability to get data from the JDBC Connection for implementations that support the getDataStoreConnection and SQL optional features.

Currently JPOX fails the DataStoreConnectionThrows tests because it passes the Connection object directly to the user instead of wrapping it.

Note that JPOX could add a feature to permit restricted Connection methods to be used by setting a property, e.g. org.jpox.jdoconnection.Unrestricted.

Craig Russell made changes - 08/Mar/06 03:11 AM
Attachment DataStoreConnectionThrows.java [ 12323878 ]
Attachment DataStoreConnection.java [ 12323877 ]
Craig Russell made changes - 08/Mar/06 03:14 AM
Comment [ There is no standard way to access data from the database using this API. The test will be limited to getting a jdbc Connection and making sure that it is operational via a simple API like getAutocommit(). ]
Repository Revision Date User Message
ASF #384378 Wed Mar 08 23:45:25 UTC 2006 clr JDO-191 Added tests for DataStoreConnection
Files Changed
MODIFY /db/jdo/trunk/tck20/src/conf/pm.conf
MODIFY /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/JDO_Test.java
ADD /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
ADD /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnectionThrows.java

Craig Russell added a comment - 09/Mar/06 07:47 AM
svn commit -m "JDO-191 Added tests for DataStoreConnection" \
src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java \
src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnectionThrows.java \
src/conf/pm.conf \
src/java/org/apache/jdo/tck/JDO_Test.java
Sending src/conf/pm.conf
Sending src/java/org/apache/jdo/tck/JDO_Test.java
Adding src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
Adding src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnectionThrows.java
Transmitting file data ....
Committed revision 384378.

Craig Russell made changes - 09/Mar/06 07:47 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Repository Revision Date User Message
ASF #384648 Thu Mar 09 23:50:39 UTC 2006 clr JDO-191 Changed test to run just JDO 1 state transitions; will be fixed later
Files Changed
MODIFY /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/StateTransitions.java

Andy Jefferson added a comment - 12/Mar/06 09:31 AM
You say that JPOX fails DataStoreConnectionThrows because it passes a Connection directly instead of wrapping it. Can you please define what you mean here ? JPOX returns a org.jpox.JDOConnectionImpl from PM.getDataStoreConnection(). JDOConnectionImpl implements java.sql.Connection, and javax.jdo.datastore.JDOConnection. This does indeed wrap a (java.sql.)Connection. The test then proceeds to call commit not on the JDOConnection but on the native connection that it wraps. Are we saying that getNativeConnection() has to return the wrapped connection ? The spec says nothing about the returned object from getNativeConnection() wrapping a connection. Can we have a clarification on what this test is actually checking.

Repository Revision Date User Message
ASF #385352 Sun Mar 12 19:16:32 UTC 2006 clr JDO-191 Fixed Connection to be cast of JDOConnection
Files Changed
MODIFY /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
MODIFY /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnectionThrows.java

Craig Russell made changes - 13/Mar/06 02:40 AM
Assignee Craig Russell [ clr ]
Craig Russell added a comment - 13/Mar/06 03:17 AM
The test now simply casts the JDOConnectin to jdbc Connection.

Michelle Caisse added a comment - 26/Mar/06 10:34 AM
Updated Implemented to yes in spreadsheet.