Fix test case db preparation to allow tests to repeat run without taking various runtime exception.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@702180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Albert Lee 2008-10-06 15:33:57 +00:00
parent 229220b922
commit d31d40f511
3 changed files with 12 additions and 6 deletions

View File

@ -98,7 +98,7 @@ public class TestParentChild extends CombinatorialPersistenceTestCase {
// The last argument tells that this is a runtime option. So the
// values are included to generate combinations but are excluded
// from generating OpenJPA configuration.
getHelper().addOption("persist-order", PersistOrder.values(), true);
getHelper().addOption(Key_PersistOrder, PersistOrder.values(), true);
}
public void setUp() {
@ -109,7 +109,7 @@ public class TestParentChild extends CombinatorialPersistenceTestCase {
getHelper().addOption(Key_SchemaFactory, Option_SchemaFactory);
getHelper().addOption(Key_UpdateManager, Option_UpdateManager);
getHelper().addOption("persist-order", PersistOrder.values(), true);
getHelper().addOption(Key_PersistOrder, PersistOrder.values(), true);
sql.clear();
super.setUp(DROP_TABLES, Parent.class, Child.class);
@ -191,7 +191,8 @@ public class TestParentChild extends CombinatorialPersistenceTestCase {
*/
void assertPostInsertUpdate() {
if (getPersistOrder().equals(PersistOrder.CHILD_THEN_PARENT)
&& getMappingDefaults().contains("restrict")) {
&& getMappingDefaults().contains("restrict")
&& getUpdateManagerDefaults().contains("operation-order")) {
assertSQL("UPDATE .* SET PARENT_ID .* WHERE .*");
}
}
@ -226,6 +227,10 @@ public class TestParentChild extends CombinatorialPersistenceTestCase {
return getHelper().getOptionAsString(Key_MappingDefaults);
}
String getUpdateManagerDefaults() {
return getHelper().getOptionAsString(Key_UpdateManager);
}
String getSchemaFactory() {
return getHelper().getOptionAsString(Key_SchemaFactory);
}

View File

@ -27,7 +27,7 @@ public class TestRecursiveRelationships extends SingleEMFTestCase {
private int _l2Nodes = 3;
public void setUp() {
setUp(Node.class);
setUp(DROP_TABLES, Node.class);
}
public void testRecursiveNodes() {

View File

@ -25,12 +25,13 @@ public class TestLibService extends SingleEMFTestCase
public void setUp() {
// declare the library model classes
super.setUp(Book.class, Borrower.class, Subject.class, Volunteer.class);
super.setUp(DROP_TABLES, Book.class, Borrower.class, Subject.class,
Volunteer.class);
// put golden data in database
LibTestingService libTestingService = new LibTestingService();
libTestingService.setEntityManager(emf.createEntityManager());
libTestingService. repopulateDB();
libTestingService.repopulateDB();
libTestingService.close();
// create the LibService