cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r583266 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit: MultiNodeCase.java SimpleAccessStack.java
Date Tue, 09 Oct 2007 19:28:32 GMT
Author: aadamchik
Date: Tue Oct  9 12:28:31 2007
New Revision: 583266

URL: http://svn.apache.org/viewvc?rev=583266&view=rev
Log:
smarter DataSource assignment during unit tests that prevents creation of unneeded DataSources

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/MultiNodeCase.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/SimpleAccessStack.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/MultiNodeCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/MultiNodeCase.java?rev=583266&r1=583265&r2=583266&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/MultiNodeCase.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/MultiNodeCase.java
Tue Oct  9 12:28:31 2007
@@ -30,6 +30,9 @@
  */
 public class MultiNodeCase extends CayenneCase {
 
+    static final String NODE1 = "map-db1";
+    static final String NODE2 = "map-db2";
+
     public static final String MULTINODE_ACCESS_STACK = "MultiNodeStack";
 
     protected AccessStack buildAccessStack() {
@@ -49,10 +52,10 @@
     }
 
     public DataNode getNode1() {
-        return accessStack.getDataDomain().getNode("map-db1");
+        return accessStack.getDataDomain().getNode(NODE1);
     }
 
     public DataNode getNode2() {
-        return accessStack.getDataDomain().getNode("map-db2");
+        return accessStack.getDataDomain().getNode(NODE2);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/SimpleAccessStack.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/SimpleAccessStack.java?rev=583266&r1=583265&r2=583266&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/SimpleAccessStack.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/SimpleAccessStack.java
Tue Oct  9 12:28:31 2007
@@ -40,8 +40,8 @@
     protected UnitTestDomain domain;
     protected DataSetFactory dataSetFactory;
 
-    public SimpleAccessStack(CayenneResources resources,
-            DataSetFactory dataSetFactory, DataMap[] maps) throws Exception {
+    public SimpleAccessStack(CayenneResources resources, DataSetFactory dataSetFactory,
+            DataMap[] maps) throws Exception {
 
         this.dataSetFactory = dataSetFactory;
         this.resources = resources;
@@ -68,9 +68,14 @@
 
         node.addDataMap(map);
 
-        // avoid using shared DataSource if there is more than one node
-        if (!domain.getDataNodes().isEmpty()) {
+        // use shared data source in all cases but the multi-node...
+
+        if (MultiNodeCase.NODE1.equals(node.getName())
+                || MultiNodeCase.NODE2.equals(node.getName())) {
             node.setDataSource(resources.createDataSource());
+        }
+        else {
+            node.setDataSource(resources.getDataSource());
         }
 
         domain.addNode(node);



Mime
View raw message