cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1104196 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne: merge/ util/
Date Tue, 17 May 2011 12:32:32 GMT
Author: aadamchik
Date: Tue May 17 12:32:31 2011
New Revision: 1104196

URL: http://svn.apache.org/viewvc?rev=1104196&view=rev
Log:
CAY-1564 CayenneCase unit tests conversion(4)

related patches by Dzmitry Kazimirchyk :

MergeCase + subclasses
I refactored MergerCase to avoid cloning of DataMap, as with DI scoping we are allowed
to modify the main DataMap which is reset on every test

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/AddColumnToModelTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropColumnToModelTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropRelationshipToModelTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropTableToModelTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergeCase.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergerFactoryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetAllowNullToDbTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetNotNullToDbTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetPrimaryKeyToDbTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/ValueForNullTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/EntityMergeSupportTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/AddColumnToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/AddColumnToModelTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/AddColumnToModelTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/AddColumnToModelTest.java
Tue May 17 12:32:31 2011
@@ -21,13 +21,14 @@ package org.apache.cayenne.merge;
 import java.sql.Types;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class AddColumnToModelTest extends MergeCase {
 
     public void testAddColumn() throws Exception {
@@ -59,7 +60,6 @@ public class AddColumnToModelTest extend
         objEntity.addAttribute(oatr1);
         map.addObjEntity(objEntity);
 
-        
         // remove name column
         objEntity.removeAttribute(oatr1.getName());
         dbEntity.removeAttribute(column2.getName());
@@ -76,14 +76,16 @@ public class AddColumnToModelTest extend
         assertTrue(token instanceof AddColumnToModel);
         execute(token);
         assertEquals(1, objEntity.getAttributes().size());
-        assertEquals("java.lang.String", objEntity.getAttributes().iterator().next().getType());
-
-        DataContext ctxt = createDataContext();
+        assertEquals("java.lang.String", objEntity
+                .getAttributes()
+                .iterator()
+                .next()
+                .getType());
 
         // clear up
         map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
Tue May 17 12:32:31 2011
@@ -19,14 +19,15 @@
 package org.apache.cayenne.merge;
 
 import java.sql.Types;
-import java.util.Collections;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class CreateTableToModelTest extends MergeCase {
 
     public void testAddTable() throws Exception {
@@ -55,7 +56,7 @@ public class CreateTableToModelTest exte
             token = token.createReverse(mergerFactory());
         }
         assertTrue(token.getClass().getName(), token instanceof CreateTableToModel);
-        logTokens(Collections.singletonList(token));
+
         execute(token);
 
         ObjEntity objEntity = null;
@@ -69,12 +70,16 @@ public class CreateTableToModelTest exte
             }
         }
         assertNotNull(objEntity);
-        
-        assertEquals(objEntity.getClassName(), map.getDefaultPackage() + "." + objEntity.getName());
+
+        assertEquals(objEntity.getClassName(), map.getDefaultPackage()
+                + "."
+                + objEntity.getName());
         assertEquals(objEntity.getSuperClassName(), map.getDefaultSuperclass());
-        assertEquals(objEntity.getClientClassName(), 
-                map.getDefaultClientPackage() + "." + objEntity.getName());
-        assertEquals(objEntity.getClientSuperClassName(), map.getDefaultClientSuperclass());
+        assertEquals(objEntity.getClientClassName(), map.getDefaultClientPackage()
+                + "."
+                + objEntity.getName());
+        assertEquals(objEntity.getClientSuperClassName(), map
+                .getDefaultClientSuperclass());
 
         assertEquals(1, objEntity.getAttributes().size());
         assertEquals("java.lang.String", objEntity
@@ -83,14 +88,12 @@ public class CreateTableToModelTest exte
                 .next()
                 .getType());
 
-        DataContext ctxt = createDataContext();
-
         // clear up
         // fix psql case issue
         map.removeDbEntity(objEntity.getDbEntity().getName(), true);
         map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropColumnToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropColumnToModelTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropColumnToModelTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropColumnToModelTest.java
Tue May 17 12:32:31 2011
@@ -21,7 +21,6 @@ package org.apache.cayenne.merge;
 import java.sql.Types;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
@@ -29,7 +28,10 @@ import org.apache.cayenne.map.DbRelation
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class DropColumnToModelTest extends MergeCase {
 
     public void testSimpleColumn() throws Exception {
@@ -58,7 +60,7 @@ public class DropColumnToModelTest exten
         objEntity.setDbEntity(dbEntity);
         ObjAttribute oatr1 = new ObjAttribute("name");
         oatr1.setDbAttributePath(column2.getName());
-        oatr1.setType("java.lang.String");        
+        oatr1.setType("java.lang.String");
         objEntity.addAttribute(oatr1);
         map.addObjEntity(objEntity);
 
@@ -77,12 +79,10 @@ public class DropColumnToModelTest exten
         assertNull(dbEntity.getAttribute(column2.getName()));
         assertNull(objEntity.getAttribute(oatr1.getName()));
 
-        DataContext ctxt = createDataContext();
-
         // clear up
         map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));
@@ -126,7 +126,7 @@ public class DropColumnToModelTest exten
 
         assertTokensAndExecute(node, map, 2, 0);
         assertTokensAndExecute(node, map, 0, 0);
-        
+
         // force drop fk column in db
         execute(mergerFactory().createDropColumnToDb(dbEntity2, e2col2));
 
@@ -161,7 +161,7 @@ public class DropColumnToModelTest exten
         o2a1.setType("java.lang.String");
         objEntity2.addAttribute(o2a1);
         map.addObjEntity(objEntity2);
-        
+
         // create ObjRelationships
         assertEquals(0, objEntity1.getRelationships().size());
         assertEquals(0, objEntity2.getRelationships().size());
@@ -188,9 +188,9 @@ public class DropColumnToModelTest exten
         MergerToken token1 = tokens.get(1).createReverse(mergerFactory());
         assertTrue(token0.getClass().getName(), token0 instanceof DropColumnToModel);
         assertTrue(token1.getClass().getName(), token1 instanceof DropRelationshipToModel);
-        // do not execute DropRelationshipToModel, only DropColumnToModel. 
+        // do not execute DropRelationshipToModel, only DropColumnToModel.
         execute(token0);
-        
+
         // check after merging
         assertNull(dbEntity2.getAttribute(e2col2.getName()));
         assertEquals(0, dbEntity1.getRelationships().size());
@@ -199,14 +199,14 @@ public class DropColumnToModelTest exten
         assertEquals(0, objEntity2.getRelationships().size());
 
         // clear up
-        DataContext ctxt = createDataContext();
+
         dbEntity1.removeRelationship(rel1To2.getName());
         dbEntity2.removeRelationship(rel2To1.getName());
         map.removeObjEntity(objEntity1.getName(), true);
         map.removeDbEntity(dbEntity1.getName(), true);
         map.removeObjEntity(objEntity2.getName(), true);
         map.removeDbEntity(dbEntity2.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity1.getName()));
         assertNull(map.getDbEntity(dbEntity1.getName()));
         assertNull(map.getObjEntity(objEntity2.getName()));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropRelationshipToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropRelationshipToModelTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropRelationshipToModelTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropRelationshipToModelTest.java
Tue May 17 12:32:31 2011
@@ -21,7 +21,6 @@ package org.apache.cayenne.merge;
 import java.sql.Types;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
@@ -29,8 +28,10 @@ import org.apache.cayenne.map.DbRelation
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class DropRelationshipToModelTest extends MergeCase {
 
     public void testForreignKey() throws Exception {
@@ -100,7 +101,7 @@ public class DropRelationshipToModelTest
         o2a1.setType("java.lang.String");
         objEntity2.addAttribute(o2a1);
         map.addObjEntity(objEntity2);
-        
+
         // create ObjRelationships
         assertEquals(0, objEntity1.getRelationships().size());
         assertEquals(0, objEntity2.getRelationships().size());
@@ -134,7 +135,7 @@ public class DropRelationshipToModelTest
         dbEntity2.addRelationship(rel2To1);
         dbEntity1.addRelationship(rel1To2);
         dbEntity2.addAttribute(e2col2);
-        
+
         // try do use the merger to remove the relationship in the model
         tokens = createMergeTokens();
         assertTokens(tokens, 2, 0);
@@ -145,7 +146,7 @@ public class DropRelationshipToModelTest
         assertTrue(token1 instanceof DropRelationshipToModel);
         execute(token1);
         execute(token0);
-        
+
         // check after merging
         assertNull(dbEntity2.getAttribute(e2col2.getName()));
         assertEquals(0, dbEntity1.getRelationships().size());
@@ -154,14 +155,13 @@ public class DropRelationshipToModelTest
         assertEquals(0, objEntity2.getRelationships().size());
 
         // clear up
-        DataContext ctxt = createDataContext();
         dbEntity1.removeRelationship(rel1To2.getName());
         dbEntity2.removeRelationship(rel2To1.getName());
         map.removeObjEntity(objEntity1.getName(), true);
         map.removeDbEntity(dbEntity1.getName(), true);
         map.removeObjEntity(objEntity2.getName(), true);
         map.removeDbEntity(dbEntity2.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity1.getName()));
         assertNull(map.getDbEntity(dbEntity1.getName()));
         assertNull(map.getObjEntity(objEntity2.getName()));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropTableToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropTableToModelTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropTableToModelTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/DropTableToModelTest.java
Tue May 17 12:32:31 2011
@@ -21,12 +21,14 @@ package org.apache.cayenne.merge;
 import java.sql.Types;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class DropTableToModelTest extends MergeCase {
 
     public void testDropTable() throws Exception {
@@ -73,12 +75,10 @@ public class DropTableToModelTest extend
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertNull(map.getObjEntity(objEntity.getName()));
 
-        DataContext ctxt = createDataContext();
-
         // clear up
         map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergeCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergeCase.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergeCase.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergeCase.java
Tue May 17 12:32:31 2011
@@ -18,53 +18,72 @@
  ****************************************************************/
 package org.apache.cayenne.merge;
 
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
 import java.sql.Connection;
-import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.cayenne.access.DataContext;
-import org.apache.cayenne.access.DataDomain;
+import javax.sql.DataSource;
+
 import org.apache.cayenne.access.DataNode;
-import org.apache.cayenne.access.QueryLogger;
-import org.apache.cayenne.ashwood.AshwoodEntitySorter;
+import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.map.MapLoader;
-import org.apache.cayenne.unit.CayenneCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.xml.sax.InputSource;
+import org.apache.cayenne.unit.AccessStackAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+
+public abstract class MergeCase extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private AccessStackAdapter accessStackAdapter;
 
-public class MergeCase extends CayenneCase {
+    @Inject
+    private DataSource dataSource;
 
-    protected DataDomain domain;
+    @Inject
+    protected EntityResolver resolver;
+
+    @Inject
     protected DataNode node;
-    protected DataMap map;
 
-    private final Log logObj = LogFactory.getLog(getClass());
+    protected DataMap map;
 
-    private static List<String> tableNames = Arrays.asList(
+    private static List<String> TABLE_NAMES = Arrays.asList(
             "ARTIST",
             "PAINTING",
             "NEW_TABLE",
             "NEW_TABLE2");
 
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+
+        // this map can't be safely modified in this test, as it is reset by DI container
+        // on every test
+        map = runtime.getDataDomain().getDataMap("testmap");
+
+        filterDataMap();
+
+        List<MergerToken> tokens = createMergeTokens();
+        execute(tokens);
+
+        assertTokensAndExecute(0, 0);
+    }
+
     protected DbMerger createMerger() {
         return new DbMerger() {
 
             @Override
             public boolean includeTableName(String tableName) {
-                return tableNames.contains(tableName.toUpperCase());
+                return TABLE_NAMES.contains(tableName.toUpperCase());
             }
         };
     }
@@ -73,80 +92,38 @@ public class MergeCase extends CayenneCa
         return createMerger().createMergeTokens(node, map);
     }
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        deleteTestData();
-        createTestData("testArtists");
-        DataNode orgNode = getDomain().getDataNodes().iterator().next();
-        
-        
-        // clone DataMap by saving and loading from XML as to avoid modifying shared test
-        // DataMap
-        DataMap originalMap = getDomain().getDataMap("testmap");
-        StringWriter out = new StringWriter();
-        PrintWriter outWriter = new PrintWriter(out);
-        originalMap.encodeAsXML(outWriter);
-        outWriter.flush();
-        StringReader in = new StringReader(out.toString());
-        map = new MapLoader().loadDataMap(new InputSource(in));
-        
-        // map must operate in an EntityResolve namespace...
-        EntityResolver testResolver = new EntityResolver();
-        testResolver.addDataMap(map);
-
-        node = new DataNode("mergenode");
-        node.setAdapter(orgNode.getAdapter());
-        node.setDataSource(orgNode.getDataSource());
-        node.addDataMap(map);
-        
-        domain = new DataDomain("mergetestdomain");
-        domain.setEntitySorter(new AshwoodEntitySorter());
-        domain.addNode(node);
-
-        filterDataMap(node, map);
-
-        List<MergerToken> tokens = createMergeTokens();
-        execute(tokens);
-
-        assertTokensAndExecute(0, 0);
-    }
-
     /**
      * Remote binary pk {@link DbEntity} for {@link DbAdapter} not supporting that and so
      * on.
      */
-    private void filterDataMap(DataNode node, DataMap map) {
+    private void filterDataMap() {
         // copied from AbstractAccessStack.dbEntitiesInInsertOrder
-        boolean excludeBinPK = getAccessStackAdapter().supportsBinaryPK();
+        boolean excludeBinPK = accessStackAdapter.supportsBinaryPK();
 
-        if (!excludeBinPK) { 
+        if (!excludeBinPK) {
             return;
         }
 
         List<DbEntity> entitiesToRemove = new ArrayList<DbEntity>();
 
         for (DbEntity ent : map.getDbEntities()) {
-                for (DbAttribute attr : ent.getAttributes()) {
-                    // check for BIN PK or FK to BIN Pk
-                    if (attr.getType() == Types.BINARY
-                            || attr.getType() == Types.VARBINARY
-                            || attr.getType() == Types.LONGVARBINARY) {
-
-                        if (attr.isPrimaryKey() || attr.isForeignKey()) {
-                            entitiesToRemove.add(ent);
-                            break;
-                        }
+            for (DbAttribute attr : ent.getAttributes()) {
+                // check for BIN PK or FK to BIN Pk
+                if (attr.getType() == Types.BINARY
+                        || attr.getType() == Types.VARBINARY
+                        || attr.getType() == Types.LONGVARBINARY) {
+
+                    if (attr.isPrimaryKey() || attr.isForeignKey()) {
+                        entitiesToRemove.add(ent);
+                        break;
                     }
+                }
             }
         }
 
         for (DbEntity e : entitiesToRemove) {
-            logObj.info("filter away " + e.getName());
             map.removeDbEntity(e.getName(), true);
         }
-
     }
 
     protected void execute(List<MergerToken> tokens) throws Exception {
@@ -161,27 +138,23 @@ public class MergeCase extends CayenneCa
         token.execute(mergerContext);
     }
 
-    protected void executeSql(String sql) throws Exception {
-        Connection conn = null;
-        Statement st = null;
+    private void executeSql(String sql) throws Exception {
+        Connection conn = dataSource.getConnection();
+
         try {
-            QueryLogger.log(sql);
-            conn = getConnection();
-            st = conn.createStatement();
-            st.execute(sql);
-        }
-        catch (SQLException e) {
-            QueryLogger.logQueryError(e);
-            throw e;
-        }
-        finally {
-            if (st != null) {
-                st.close();
+            Statement st = conn.createStatement();
+
+            try {
+                st.execute(sql);
             }
-            if (conn != null) {
-                conn.close();
+            finally {
+                st.close();
             }
         }
+
+        finally {
+            conn.close();
+        }
     }
 
     protected void assertTokens(
@@ -198,7 +171,7 @@ public class MergeCase extends CayenneCa
                 actualToModel++;
             }
         }
-        logTokens(tokens);
+
         assertEquals("tokens to db", expectedToDb, actualToDb);
         assertEquals("tokens to model", expectedToModel, actualToModel);
     }
@@ -235,12 +208,6 @@ public class MergeCase extends CayenneCa
         }
     }
 
-    protected void logTokens(List<MergerToken> tokens) {
-        for (MergerToken token : tokens) {
-            logObj.info("token: " + token.toString());
-        }
-    }
-
     protected MergerFactory mergerFactory() {
         return node.getAdapter().mergerFactory();
     }
@@ -257,16 +224,4 @@ public class MergeCase extends CayenneCa
         catch (Exception e) {
         }
     }
-    
-    @Override
-    protected DataContext createDataContext() {
-        return domain.createDataContext();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        deleteTestData();
-    }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergerFactoryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergerFactoryTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergerFactoryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/MergerFactoryTest.java
Tue May 17 12:32:31 2011
@@ -22,16 +22,22 @@ import java.sql.Types;
 
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.access.DataContext;
-import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class MergerFactoryTest extends MergeCase {
 
+    @Inject
+    private DataContext context;
+
     public void testAddAndDropColumnToDb() throws Exception {
         DbEntity dbEntity = map.getDbEntity("PAINTING");
         assertNotNull(dbEntity);
@@ -148,30 +154,17 @@ public class MergerFactoryTest extends M
         objEntity.addAttribute(oatr1);
         map.addObjEntity(objEntity);
 
-        // try to insert some rows to check that pk stuff is working
-        DataContext ctxt = createDataContext();
-        DataMap sourceMap = map;//ctxt.getEntityResolver().getDataMap("testmap");
-
-        try {
-            sourceMap.addDbEntity(dbEntity);
-            sourceMap.addObjEntity(objEntity);
-
-            for (int i = 0; i < 5; i++) {
-                CayenneDataObject dao = (CayenneDataObject) ctxt.newObject(objEntity
-                        .getName());
-                dao.writeProperty(oatr1.getName(), "test " + i);
-            }
-            ctxt.commitChanges();
-        }
-        finally {
-            sourceMap.removeObjEntity(objEntity.getName(), true);
-            sourceMap.removeDbEntity(dbEntity.getName(), true);
+        for (int i = 0; i < 5; i++) {
+            CayenneDataObject dao = (CayenneDataObject) context.newObject(objEntity
+                    .getName());
+            dao.writeProperty(oatr1.getName(), "test " + i);
         }
+        context.commitChanges();
 
         // clear up
         map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));
@@ -225,19 +218,17 @@ public class MergerFactoryTest extends M
         assertTokensAndExecute(node, map, 2, 0);
         assertTokensAndExecute(node, map, 0, 0);
 
-        DataContext ctxt = createDataContext();
-
         // remove relationships
         dbEntity.removeRelationship(r1.getName());
         artistDbEntity.removeRelationship(r2.getName());
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertTokensAndExecute(node, map, 1, 1);
         assertTokensAndExecute(node, map, 0, 0);
 
         // clear up
         // map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         // assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));
@@ -294,19 +285,17 @@ public class MergerFactoryTest extends M
         assertTokensAndExecute(node, map, 1, 0);
         assertTokensAndExecute(node, map, 0, 0);
 
-        DataContext ctxt = createDataContext();
-
         // remove relationships
         dbEntity.removeRelationship(r1.getName());
         artistDbEntity.removeRelationship(r2.getName());
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         assertTokensAndExecute(node, map, 1, 1);
         assertTokensAndExecute(node, map, 0, 0);
 
         // clear up
         // map.removeObjEntity(objEntity.getName(), true);
         map.removeDbEntity(dbEntity.getName(), true);
-        ctxt.getEntityResolver().clearCache();
+        resolver.clearCache();
         // assertNull(map.getObjEntity(objEntity.getName()));
         assertNull(map.getDbEntity(dbEntity.getName()));
         assertFalse(map.getDbEntities().contains(dbEntity));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetAllowNullToDbTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetAllowNullToDbTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetAllowNullToDbTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetAllowNullToDbTest.java
Tue May 17 12:32:31 2011
@@ -22,7 +22,10 @@ import java.sql.Types;
 
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class SetAllowNullToDbTest extends MergeCase {
 
     public void test() throws Exception {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetNotNullToDbTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetNotNullToDbTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetNotNullToDbTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetNotNullToDbTest.java
Tue May 17 12:32:31 2011
@@ -20,11 +20,29 @@ package org.apache.cayenne.merge;
 
 import java.sql.Types;
 
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class SetNotNullToDbTest extends MergeCase {
 
+    @Inject
+    private DBHelper dbHelper;
+
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        super.setUpAfterInjection();
+
+        // must cleanup the tables as changing NULL column to NOT NULL may require that no
+        // nullable data is stored in the column
+        dbHelper.deleteAll("PAINTING_INFO");
+        dbHelper.deleteAll("PAINTING");
+    }
+
     public void test() throws Exception {
         DbEntity dbEntity = map.getDbEntity("PAINTING");
         assertNotNull(dbEntity);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetPrimaryKeyToDbTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetPrimaryKeyToDbTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetPrimaryKeyToDbTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/SetPrimaryKeyToDbTest.java
Tue May 17 12:32:31 2011
@@ -22,8 +22,10 @@ import java.sql.Types;
 
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class SetPrimaryKeyToDbTest extends MergeCase {
 
     public void test() throws Exception {
@@ -40,17 +42,17 @@ public class SetPrimaryKeyToDbTest exten
 
         assertTokensAndExecute(node, map, 1, 0);
         assertTokensAndExecute(node, map, 0, 0);
-        
+
         DbAttribute e1col2 = new DbAttribute("ID2", Types.INTEGER, dbEntity1);
         e1col2.setMandatory(true);
         dbEntity1.addAttribute(e1col2);
-        
+
         assertTokensAndExecute(node, map, 2, 0);
         assertTokensAndExecute(node, map, 0, 0);
 
         e1col1.setPrimaryKey(false);
         e1col2.setPrimaryKey(true);
-        
+
         assertTokensAndExecute(node, map, 1, 0);
         assertTokensAndExecute(node, map, 0, 0);
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/ValueForNullTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/ValueForNullTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/ValueForNullTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/ValueForNullTest.java
Tue May 17 12:32:31 2011
@@ -27,6 +27,7 @@ import org.apache.cayenne.DataObject;
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.access.jdbc.ParameterBinding;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.ExpressionFactory;
 import org.apache.cayenne.map.DbAttribute;
@@ -34,26 +35,30 @@ import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class ValueForNullTest extends MergeCase {
 
     private static final String DEFAULT_VALUE_STRING = "DEFSTRING";
 
+    @Inject
+    private DataContext context;
+
     public void test() throws Exception {
         DbEntity dbEntity = map.getDbEntity("PAINTING");
         assertNotNull(dbEntity);
         ObjEntity objEntity = map.getObjEntity("Painting");
         assertNotNull(objEntity);
 
-        DataContext ctxt = createDataContext();
-
         // insert some rows before adding "not null" column
         final int nrows = 10;
         for (int i = 0; i < nrows; i++) {
-            DataObject o = (DataObject) ctxt.newObject("Painting");
+            DataObject o = (DataObject) context.newObject("Painting");
             o.writeProperty("paintingTitle", "ptitle" + i);
         }
-        ctxt.commitChanges();
+        context.commitChanges();
 
         // create and add new column to model and db
         DbAttribute column = new DbAttribute("NEWCOL2", Types.VARCHAR, dbEntity);
@@ -87,7 +92,7 @@ public class ValueForNullTest extends Me
                 objAttr.getName(),
                 DEFAULT_VALUE_STRING);
         SelectQuery query = new SelectQuery("Painting", qual);
-        List<Persistent> rows = ctxt.performQuery(query);
+        List<Persistent> rows = context.performQuery(query);
         assertEquals(nrows, rows.size());
 
         // clean up

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/EntityMergeSupportTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/EntityMergeSupportTest.java?rev=1104196&r1=1104195&r2=1104196&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/EntityMergeSupportTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/EntityMergeSupportTest.java
Tue May 17 12:32:31 2011
@@ -29,71 +29,76 @@ import org.apache.cayenne.map.DeleteRule
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.merge.MergeCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class EntityMergeSupportTest extends MergeCase {
-     public void testMerging() {
-         DbEntity dbEntity1 = new DbEntity("NEW_TABLE");
 
-         DbAttribute e1col1 = new DbAttribute("ID", Types.INTEGER, dbEntity1);
-         e1col1.setMandatory(true);
-         e1col1.setPrimaryKey(true);
-         dbEntity1.addAttribute(e1col1);
-
-         DbAttribute e1col2 = new DbAttribute("NAME", Types.VARCHAR, dbEntity1);
-         e1col2.setMaxLength(10);
-         e1col2.setMandatory(false);
-         dbEntity1.addAttribute(e1col2);
-
-         map.addDbEntity(dbEntity1);
-
-         DbEntity dbEntity2 = new DbEntity("NEW_TABLE2");
-         DbAttribute e2col1 = new DbAttribute("ID", Types.INTEGER, dbEntity2);
-         e2col1.setMandatory(true);
-         e2col1.setPrimaryKey(true);
-         dbEntity2.addAttribute(e2col1);
-         DbAttribute e2col2 = new DbAttribute("FK", Types.INTEGER, dbEntity2);
-         dbEntity2.addAttribute(e2col2);
-
-         map.addDbEntity(dbEntity2);
-
-         // create db relationships
-         DbRelationship rel1To2 = new DbRelationship("rel1To2");
-         rel1To2.setSourceEntity(dbEntity1);
-         rel1To2.setTargetEntity(dbEntity2);
-         rel1To2.setToMany(true);
-         rel1To2.addJoin(new DbJoin(rel1To2, e1col1.getName(), e2col2.getName()));
-         dbEntity1.addRelationship(rel1To2);
-         DbRelationship rel2To1 = new DbRelationship("rel2To1");
-         rel2To1.setSourceEntity(dbEntity2);
-         rel2To1.setTargetEntity(dbEntity1);
-         rel2To1.setToMany(false);
-         rel2To1.addJoin(new DbJoin(rel2To1, e2col2.getName(), e1col1.getName()));
-         dbEntity2.addRelationship(rel2To1);
-         assertSame(rel1To2, rel2To1.getReverseRelationship());
-         assertSame(rel2To1, rel1To2.getReverseRelationship());
-         
-         ObjEntity objEntity1 = new ObjEntity("NewTable");
-         objEntity1.setDbEntity(dbEntity1);
-         map.addObjEntity(objEntity1);
-         
-         ObjEntity objEntity2 = new ObjEntity("NewTable2");
-         objEntity2.setDbEntity(dbEntity2);
-         map.addObjEntity(objEntity2);
-         
-         assertTrue(new EntityMergeSupport(map).synchronizeWithDbEntities(
-                 Arrays.asList(objEntity1, objEntity2)));
-         assertNotNull(objEntity1.getAttribute("name"));
-         assertNotNull(objEntity1.getRelationship("rel1To2"));
-         assertNotNull(objEntity2.getRelationship("rel2To1"));
-         
-         assertEquals(((ObjRelationship) objEntity1.getRelationship("rel1To2")).getDeleteRule(),
-                 DeleteRule.DEFAULT_DELETE_RULE_TO_MANY);
-         assertEquals(((ObjRelationship) objEntity2.getRelationship("rel2To1")).getDeleteRule(),
-                 DeleteRule.DEFAULT_DELETE_RULE_TO_ONE);
-         
-         map.removeObjEntity(objEntity2.getName());
-         map.removeObjEntity(objEntity1.getName());
-         map.removeDbEntity(dbEntity2.getName());
-         map.removeDbEntity(dbEntity1.getName());
-     }
+    public void testMerging() {
+        DbEntity dbEntity1 = new DbEntity("NEW_TABLE");
+
+        DbAttribute e1col1 = new DbAttribute("ID", Types.INTEGER, dbEntity1);
+        e1col1.setMandatory(true);
+        e1col1.setPrimaryKey(true);
+        dbEntity1.addAttribute(e1col1);
+
+        DbAttribute e1col2 = new DbAttribute("NAME", Types.VARCHAR, dbEntity1);
+        e1col2.setMaxLength(10);
+        e1col2.setMandatory(false);
+        dbEntity1.addAttribute(e1col2);
+
+        map.addDbEntity(dbEntity1);
+
+        DbEntity dbEntity2 = new DbEntity("NEW_TABLE2");
+        DbAttribute e2col1 = new DbAttribute("ID", Types.INTEGER, dbEntity2);
+        e2col1.setMandatory(true);
+        e2col1.setPrimaryKey(true);
+        dbEntity2.addAttribute(e2col1);
+        DbAttribute e2col2 = new DbAttribute("FK", Types.INTEGER, dbEntity2);
+        dbEntity2.addAttribute(e2col2);
+
+        map.addDbEntity(dbEntity2);
+
+        // create db relationships
+        DbRelationship rel1To2 = new DbRelationship("rel1To2");
+        rel1To2.setSourceEntity(dbEntity1);
+        rel1To2.setTargetEntity(dbEntity2);
+        rel1To2.setToMany(true);
+        rel1To2.addJoin(new DbJoin(rel1To2, e1col1.getName(), e2col2.getName()));
+        dbEntity1.addRelationship(rel1To2);
+        DbRelationship rel2To1 = new DbRelationship("rel2To1");
+        rel2To1.setSourceEntity(dbEntity2);
+        rel2To1.setTargetEntity(dbEntity1);
+        rel2To1.setToMany(false);
+        rel2To1.addJoin(new DbJoin(rel2To1, e2col2.getName(), e1col1.getName()));
+        dbEntity2.addRelationship(rel2To1);
+        assertSame(rel1To2, rel2To1.getReverseRelationship());
+        assertSame(rel2To1, rel1To2.getReverseRelationship());
+
+        ObjEntity objEntity1 = new ObjEntity("NewTable");
+        objEntity1.setDbEntity(dbEntity1);
+        map.addObjEntity(objEntity1);
+
+        ObjEntity objEntity2 = new ObjEntity("NewTable2");
+        objEntity2.setDbEntity(dbEntity2);
+        map.addObjEntity(objEntity2);
+
+        assertTrue(new EntityMergeSupport(map).synchronizeWithDbEntities(Arrays.asList(
+                objEntity1,
+                objEntity2)));
+        assertNotNull(objEntity1.getAttribute("name"));
+        assertNotNull(objEntity1.getRelationship("rel1To2"));
+        assertNotNull(objEntity2.getRelationship("rel2To1"));
+
+        assertEquals(((ObjRelationship) objEntity1.getRelationship("rel1To2"))
+                .getDeleteRule(), DeleteRule.DEFAULT_DELETE_RULE_TO_MANY);
+        assertEquals(((ObjRelationship) objEntity2.getRelationship("rel2To1"))
+                .getDeleteRule(), DeleteRule.DEFAULT_DELETE_RULE_TO_ONE);
+
+        map.removeObjEntity(objEntity2.getName());
+        map.removeObjEntity(objEntity1.getName());
+        map.removeDbEntity(dbEntity2.getName());
+        map.removeDbEntity(dbEntity1.getName());
+    }
 }



Mime
View raw message