|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.ojb.broker.ReferenceTest
Test case for checking the management of references.
| Nested Class Summary | |
static class |
ReferenceTest.Animal
|
static class |
ReferenceTest.Bird
|
static class |
ReferenceTest.Fish
|
static class |
ReferenceTest.Mammal
|
static class |
ReferenceTest.Reference
|
static class |
ReferenceTest.ReferenceA
|
static interface |
ReferenceTest.ReferenceAIF
|
static class |
ReferenceTest.ReferenceB
|
static interface |
ReferenceTest.ReferenceBIF
|
static interface |
ReferenceTest.ReferenceIF
|
static class |
ReferenceTest.Region
|
static class |
ReferenceTest.Repository
|
static class |
ReferenceTest.RepositoryFK
|
static class |
ReferenceTest.Wine
|
| Constructor Summary | |
ReferenceTest()
|
|
| Method Summary | |
static void |
main(java.lang.String[] args)
|
void |
setUp()
|
void |
tearDown()
|
void |
testAbstractReferenceDelete()
this test case use an abstract class as reference |
void |
testAbstractReferenceQuery()
|
void |
testAbstractReferenceStore()
this test case use an abstract class as reference |
void |
testDeleteReferencesMappedToSameTable()
|
void |
testGetReferencesByIdentityMappedToSameTable()
|
void |
testHandlingOfMultiplePKFields()
not really a reference test, here we check handling of objects with multiple PK fields. |
void |
testQueryReferencesMappedToSameTable()
|
void |
testRepositoryFKStore()
This test does the same as the testRepositoryFKStore(),
but the used mapping data differ. |
void |
testStoreReferencesMappedToSameTable()
|
void |
testStoreWithMultiplePK_1()
|
void |
testStoreWithMultiplePK_2()
|
void |
testStoreWithMultiplePK_3()
|
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ReferenceTest()
| Method Detail |
public static void main(java.lang.String[] args)
public void setUp()
throws PBFactoryException
PBFactoryExceptionpublic void tearDown()
public void testHandlingOfMultiplePKFields()
throws java.lang.Exception
java.lang.Exception
public void testStoreWithMultiplePK_1()
throws java.lang.Exception
java.lang.Exception
public void testStoreWithMultiplePK_2()
throws java.lang.Exception
java.lang.Exception
public void testStoreWithMultiplePK_3()
throws java.lang.Exception
java.lang.Exceptionpublic void testStoreReferencesMappedToSameTable()
public void testGetReferencesByIdentityMappedToSameTable()
public void testQueryReferencesMappedToSameTable()
public void testDeleteReferencesMappedToSameTable()
public void testRepositoryFKStore()
testRepositoryFKStore(),
but the used mapping data differ.
ReferenceTest.RepositoryFK defines all the reference fields as
primary key in field-descriptors. Further on the used
database table declares the reference fields as PK too.
Based on a user post:
> The following fails to be stored by PersistenceBroker:
>
> I have a class ACL which has two primary keys: objectId and userFK, and
> userFK is also a foreign key tied to a reference of type User. If I do
this:
>
> persistentBroker.beginTransaction();
> ACL acl = new ACL();
> acl.setObjectId( 100 );
> acl.setUser( currentUser );
> persistentBroker.store(acl);
> persistentBroker.commitTransaction();
>
> Acl will not be saved. The reason seems to be because in the storeToDb()
> method of the PersistentBroker, there first comes an assertion of the
> PrimaryKeys and afterwards comes the assignment of all the foreign keys.
In
> the scenario above the assertion of the primary keys will fail, because
the
> userFK has not been assigned yet, so we have an incomplete set of primary
> keys. This does work with the ODMG layer, probably because of a different
> sequence of events during the storing of the object.
>
> I wonder if there should be a check whether a primary key is shared by the
> foreign key and allow that assignment before the assertion of the primary
> keys is performed. Any ideas?
>
> Cheers,
> --Bill.
public void testAbstractReferenceStore()
throws java.lang.Exception
java.lang.Exception
public void testAbstractReferenceQuery()
throws java.lang.Exception
java.lang.Exception
public void testAbstractReferenceDelete()
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||