cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: CAY-1988 ServerRuntimeBuilder: synthetic DataNode does not have domain's DataMaps linked
Date Sun, 22 Feb 2015 12:36:29 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master fb4123a51 -> 6fa5de23b


CAY-1988 ServerRuntimeBuilder: synthetic DataNode does not have domain's DataMaps linked


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/6fa5de23
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/6fa5de23
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/6fa5de23

Branch: refs/heads/master
Commit: 6fa5de23b8ecdabf2a981beaa05abe85473e8cdb
Parents: fb4123a
Author: aadamchik <aadamchik@apache.org>
Authored: Sun Feb 22 15:23:34 2015 +0300
Committer: aadamchik <aadamchik@apache.org>
Committed: Sun Feb 22 15:36:08 2015 +0300

----------------------------------------------------------------------
 .../server/SyntheticNodeDataDomainProvider.java |  6 ++++
 .../server/ServerRuntimeBuilderIT.java          | 38 ++++++++++++++++++++
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |  4 +++
 3 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/6fa5de23/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/SyntheticNodeDataDomainProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/SyntheticNodeDataDomainProvider.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/SyntheticNodeDataDomainProvider.java
index dbd0ec2..ba6c9dc 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/SyntheticNodeDataDomainProvider.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/SyntheticNodeDataDomainProvider.java
@@ -22,6 +22,7 @@ import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
+import org.apache.cayenne.map.DataMap;
 
 /**
  * @since 4.0
@@ -39,6 +40,11 @@ class SyntheticNodeDataDomainProvider extends DataDomainProvider {
 			DataChannelDescriptor channelDescriptor = new DataChannelDescriptor();
 
 			DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor(ServerRuntimeBuilder.DEFAULT_NAME);
+
+			for (DataMap map : dataDomain.getDataMaps()) {
+				nodeDescriptor.getDataMapNames().add(map.getName());
+			}
+
 			nodeDescriptor.setDataChannelDescriptor(channelDescriptor);
 
 			DataNode node = addDataNode(dataDomain, nodeDescriptor);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6fa5de23/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderIT.java
index 1ad342d..36c8734 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderIT.java
@@ -19,8 +19,10 @@
 package org.apache.cayenne.configuration.server;
 
 import org.apache.cayenne.DataRow;
+import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.query.SQLSelect;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
@@ -32,9 +34,12 @@ import org.junit.Before;
 import org.junit.Test;
 
 import javax.sql.DataSource;
+
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 
 @UseServerRuntime(CayenneProjects.TESTMAP_PROJECT)
 public class ServerRuntimeBuilderIT extends ServerCase {
@@ -92,6 +97,39 @@ public class ServerRuntimeBuilderIT extends ServerCase {
 	}
 
 	@Test
+	public void testNoNodeConfig_WithDataSource() {
+
+		localRuntime = new ServerRuntimeBuilder().addConfig(CayenneProjects.TESTMAP_PROJECT).dataSource(dataSource)
+				.build();
+
+		DataMap map = localRuntime.getDataDomain().getDataMap("testmap");
+		assertNotNull(map);
+
+		DataNode node = localRuntime.getDataDomain().getDefaultNode();
+		assertNotNull(node);
+		assertEquals(1, node.getDataMaps().size());
+
+		assertSame(map, node.getDataMap("testmap"));
+	}
+
+	@Test
+	public void testNoNodeConfig_WithDBParams() {
+
+		localRuntime = new ServerRuntimeBuilder().addConfig(CayenneProjects.TESTMAP_PROJECT)
+				.jdbcDriver(dsi.getJdbcDriver()).url(dsi.getDataSourceUrl()).password(dsi.getPassword())
+				.user(dsi.getUserName()).minConnections(1).maxConnections(2).build();
+
+		DataMap map = localRuntime.getDataDomain().getDataMap("testmap");
+		assertNotNull(map);
+
+		DataNode node = localRuntime.getDataDomain().getDefaultNode();
+		assertNotNull(node);
+		assertEquals(1, node.getDataMaps().size());
+
+		assertSame(map, node.getDataMap("testmap"));
+	}
+
+	@Test
 	public void test_UnnamedDomain_MultiLocation() {
 		localRuntime = new ServerRuntimeBuilder().addConfigs(CayenneProjects.TESTMAP_PROJECT,
 				CayenneProjects.EMBEDDABLE_PROJECT).build();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6fa5de23/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index edbcec9..105df98 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -16,6 +16,10 @@ Changes/New Features:
 
 CAY-1267 Some changes to LogDialog
 
+Bug Fixes:
+
+CAy-1988 ServerRuntimeBuilder: synthetic DataNode does not have domain's DataMaps linked
+
 Changes/New Features:
 ----------------------------------
 Release: 4.0.M2


Mime
View raw message