You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2018/10/19 12:42:05 UTC
cayenne git commit: CAY-2478 cgen: Generate properties for PK fix test
Repository: cayenne
Updated Branches:
refs/heads/master da720a59c -> b1e92e596
CAY-2478 cgen: Generate properties for PK
fix test
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/b1e92e59
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/b1e92e59
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/b1e92e59
Branch: refs/heads/master
Commit: b1e92e5969ca08ff2abf90da4dea83703c241142
Parents: da720a5
Author: Nikita Timofeev <st...@gmail.com>
Authored: Fri Oct 19 15:41:53 2018 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Fri Oct 19 15:41:53 2018 +0300
----------------------------------------------------------------------
.../org/apache/cayenne/gen/EntityUtilsTest.java | 21 ++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/b1e92e59/cayenne-cgen/src/test/java/org/apache/cayenne/gen/EntityUtilsTest.java
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/EntityUtilsTest.java b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/EntityUtilsTest.java
index 6bb87dd..f34deb4 100644
--- a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/EntityUtilsTest.java
+++ b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/EntityUtilsTest.java
@@ -21,6 +21,8 @@ package org.apache.cayenne.gen;
import org.apache.cayenne.map.CallbackDescriptor;
import org.apache.cayenne.map.DataMap;
+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.junit.After;
@@ -78,17 +80,24 @@ public class EntityUtilsTest {
@Test
public void testDeclaresDbAttribute() throws Exception {
- String existKey = "testKey";
- String notExistKey = "testKey1";
+ DbEntity dbEntity = new DbEntity("test");
+ DbAttribute exists = new DbAttribute("testKey");
+ DbAttribute notExists = new DbAttribute("testKey1");
+ dbEntity.addAttribute(exists);
- ObjAttribute attribute = new ObjAttribute(existKey);
- attribute.setDbAttributePath(existKey);
+ ObjAttribute attribute = new ObjAttribute("exists");
+ attribute.setDbAttributePath("testKey");
objEntity.addAttribute(attribute);
+ objEntity.setName("test");
+ objEntity.setDbEntity(dbEntity);
+ dataMap.addDbEntity(dbEntity);
+ dataMap.addObjEntity(objEntity);
+
entityUtils = new EntityUtils(dataMap, objEntity, "TestBaseClass", "TestSuperClass", "TestSubClass");
- assertTrue(entityUtils.declaresDbAttribute(existKey));
- assertFalse(entityUtils.declaresDbAttribute(notExistKey));
+ assertTrue(entityUtils.declaresDbAttribute(exists));
+ assertFalse(entityUtils.declaresDbAttribute(notExists));
}
}