gdamour 2005/08/19 23:49:06
Modified: modules/itests/src/itest/org/openejb/test/entity/cmp2
Cmp2TestSuite.java
Added: modules/itests/src/itest/org/openejb/test/entity/cmp2
CMRMappingTests.java
Log:
o GERONIMO-675 CMR / CMP Fields should not be read-only
Some additional enhancement to support the scenario where a primary key column
is also a foreign key column.
This basically implements the rules that Jeremy was recommending to apply
in such a case:
when the primary key is set in the ejbCreate<Method> the associated CMR field,
i.e. the CMR mapped to the foreign key column, is marked as under
construction.
From this point, the CMR must be set before the commit of the current
transaction. If not set, then the transaction is marked as rolled back.
Also, if an attempt is made to reset the pk field by relating the entity to
the wrong entity, an IllegalStateException is thrown.
o Also sync the code with the refactoring of the Association and
AssociationEnd
classes: the Association.isOneToOne, isOneToMany, isManyToOne and
isManyToMany methods have been moved to AssociationEnd.
Revision Changes Path
1.6 +3 -2
openejb/modules/itests/src/itest/org/openejb/test/entity/cmp2/Cmp2TestSuite.java
Index: Cmp2TestSuite.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/itests/src/itest/org/openejb/test/entity/cmp2/Cmp2TestSuite.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Cmp2TestSuite.java 29 Jul 2005 22:29:44 -0000 1.5
+++ Cmp2TestSuite.java 20 Aug 2005 03:49:06 -0000 1.6
@@ -71,6 +71,7 @@
this.addTest(new PrefetchTests());
this.addTest(new PetstoreTests());
this.addTest(new StorageTests());
+ this.addTest(new CMRMappingTests());
}
public static junit.framework.Test suite() {
1.1
openejb/modules/itests/src/itest/org/openejb/test/entity/cmp2/CMRMappingTests.java
Index: CMRMappingTests.java
===================================================================
package org.openejb.test.entity.cmp2;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.openejb.test.NamedTestCase;
import org.openejb.test.TestFailureException;
import org.openejb.test.TestManager;
import org.openejb.test.entity.cmp2.cmrmapping.CMRMappingFacadeHome;
import org.openejb.test.entity.cmp2.cmrmapping.CMRMappingFacadeRemote;
/**
* @version $Revision: 1.1 $ $Date: 2005/08/20 03:49:06 $
*/
public class CMRMappingTests extends NamedTestCase {
private InitialContext initialContext;
private CMRMappingFacadeHome ejbHome;
private CMRMappingFacadeRemote facade;
public CMRMappingTests() {
super("CMRMappingTests.");
}
protected void setUp() throws Exception {
Properties properties =
TestManager.getServer().getContextEnvironment();
properties.put(Context.SECURITY_PRINCIPAL, "ENTITY_TEST_CLIENT");
properties.put(Context.SECURITY_CREDENTIALS, "ENTITY_TEST_CLIENT");
initialContext = new InitialContext(properties);
ejbHome = (CMRMappingFacadeHome)
javax.rmi.PortableRemoteObject.narrow(initialContext.lookup("cmp2/CMRMappingFacade"),
CMRMappingFacadeHome.class);
facade = ejbHome.create();
}
public void testOneToManyDoNotSetCMR() throws RemoteException,
TestFailureException {
facade.testOneToManyDoNotSetCMR();
}
public void testOneToManySetCMROnInverseSide() throws RemoteException,
TestFailureException {
facade.testOneToManySetCMROnInverseSide();
}
public void testOneToManySetCMROnInverseSideResetPK() throws
RemoteException, TestFailureException {
facade.testOneToManySetCMROnInverseSideResetPK();
}
public void testOneToManySetCMROnOwningSide() throws RemoteException,
TestFailureException {
facade.testOneToManySetCMROnOwningSide();
}
public void testOneToManySetCMROnOwningSideResetPK() throws
RemoteException, TestFailureException {
facade.testOneToManySetCMROnOwningSideResetPK();
}
public void testOneToOneDoNotSetCMR() throws RemoteException,
TestFailureException {
facade.testOneToOneDoNotSetCMR();
}
public void testOneToOneSetCMROnInverseSide() throws RemoteException,
TestFailureException {
facade.testOneToOneSetCMROnInverseSide();
}
public void testOneToOneSetCMROnInverseSideResetPK() throws
RemoteException, TestFailureException {
facade.testOneToOneSetCMROnInverseSideResetPK();
}
public void testOneToOneSetCMROnOwningSide() throws RemoteException,
TestFailureException {
facade.testOneToOneSetCMROnOwningSide();
}
public void testOneToOneSetCMROnOwningSideResetPK() throws
RemoteException, TestFailureException {
facade.testOneToOneSetCMROnOwningSideResetPK();
}
}