cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [1/7] cayenne git commit: CAY-2114 cdbimport: object layer settings are not respected
Date Tue, 04 Oct 2016 12:45:29 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master cd411abc8 -> 1455622fa


CAY-2114 cdbimport: object layer settings are not respected

* tests


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

Branch: refs/heads/master
Commit: 6a1eb0fff4bc1e5ce233e985df06c7a0c8a80a7e
Parents: cd411ab
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Tue Oct 4 13:33:45 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Tue Oct 4 13:33:45 2016 +0300

----------------------------------------------------------------------
 .../cayenne/tools/DbImporterMojoTest.java       |  8 ++++
 .../testCustomObjectLayerSettings-pom.xml       | 48 ++++++++++++++++++++
 .../testCustomObjectLayerSettings.map.xml       | 30 ++++++++++++
 ...testCustomObjectLayerSettings.map.xml-result | 40 ++++++++++++++++
 .../dbimport/testCustomObjectLayerSettings.sql  | 31 +++++++++++++
 5 files changed, 157 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/6a1eb0ff/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
index a736faf..3b040f1 100644
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
+++ b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
@@ -190,6 +190,14 @@ public class DbImporterMojoTest extends AbstractMojoTestCase {
         test("testUnFlattensManyToMany");
     }
 
+	/**
+	 * Make sure any merges preserve custom object layer settings, like "usePrimitives", PK
mapping as attribute, etc.
+	 */
+	@Test
+	public void testCustomObjectLayerSettings() throws Exception {
+		test("testCustomObjectLayerSettings");
+	}
+
     /**
      * CREATE TABLE APP.A (
      * id INTEGER NOT NULL,

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6a1eb0ff/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
new file mode 100644
index 0000000..b57d42e
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~    or more contributor license agreements.  See the NOTICE file
+  ~    distributed with this work for additional information
+  ~    regarding copyright ownership.  The ASF licenses this file
+  ~    to you under the Apache License, Version 2.0 (the
+  ~    "License"); you may not use this file except in compliance
+  ~    with the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~    Unless required by applicable law or agreed to in writing,
+  ~    software distributed under the License is distributed on an
+  ~    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~    KIND, either express or implied.  See the License for the
+  ~    specific language governing permissions and limitations
+  ~    under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+	http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <name>DbImporterMojo Test1</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    <map>target/test-classes/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
+                    </map>
+                    <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                    <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    <meaningfulPkTables>^*$</meaningfulPkTables>
+                    <usePrimitives>true</usePrimitives>
+
+                    <reverseEngineering>
+                        <schema>
+                            <name>SCHEMA_01</name>
+                        </schema>
+                    </reverseEngineering>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6a1eb0ff/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
new file mode 100644
index 0000000..84ecf2f
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements.  See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership.  The ASF licenses this file
+	to you under the Apache License, Version 2.0 (the
+	"License"); you may not use this file except in compliance
+	with the License.  You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing,
+	software distributed under the License is distributed on an
+	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	KIND, either express or implied.  See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<data-map xmlns="http://cayenne.apache.org/schema/8/modelMap"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://cayenne.apache.org/schema/8/modelMap http://cayenne.apache.org/schema/8/modelMap.xsd"
+          project-version="8">
+    <property name="defaultSchema" value="SCHEMA_01"/>
+    <db-entity name="EXISTING_TABLE" schema="SCHEMA_01">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+    </db-entity>
+    <obj-entity name="ExistingTable" className="ExistingTable" dbEntityName="EXISTING_TABLE">
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6a1eb0ff/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
new file mode 100644
index 0000000..a433b46
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements.  See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership.  The ASF licenses this file
+	to you under the Apache License, Version 2.0 (the
+	"License"); you may not use this file except in compliance
+	with the License.  You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing,
+	software distributed under the License is distributed on an
+	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	KIND, either express or implied.  See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<data-map xmlns="http://cayenne.apache.org/schema/8/modelMap"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://cayenne.apache.org/schema/8/modelMap http://cayenne.apache.org/schema/8/modelMap.xsd"
+          project-version="8">
+    <property name="defaultSchema" value="SCHEMA_01"/>
+    <db-entity name="EXISTING_TABLE" schema="SCHEMA_01">
+    	<db-attribute name="COL2" type="INTEGER" length="10"/>
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+    </db-entity>
+    <db-entity name="NEW_TABLE" schema="SCHEMA_01">
+    	<db-attribute name="COL2" type="INTEGER" length="10"/>
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+    </db-entity>
+    <obj-entity name="ExistingTable" className="ExistingTable" dbEntityName="EXISTING_TABLE">
+    	 <obj-attribute name="col2" type="int" db-attribute-path="COL2"/>
+    </obj-entity>
+    <obj-entity name="NewTable" className="NewTable" dbEntityName="NEW_TABLE">
+    	 <obj-attribute name="col2" type="int" db-attribute-path="COL2"/>
+    	 <obj-attribute name="id" type="int" db-attribute-path="ID"/>
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/6a1eb0ff/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
new file mode 100644
index 0000000..f8f4192
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
@@ -0,0 +1,31 @@
+--  Licensed to the Apache Software Foundation (ASF) under one
+--  or more contributor license agreements.  See the NOTICE file
+--  distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+--  to you under the Apache License, Version 2.0 (the
+--  "License"); you may not use this file except in compliance
+--  with the License.  You may obtain a copy of the License at
+--
+--    http://www.apache.org/licenses/LICENSE-2.0
+--
+--  Unless required by applicable law or agreed to in writing,
+--  software distributed under the License is distributed on an
+--  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+--  KIND, either express or implied.  See the License for the
+--  specific language governing permissions and limitations
+--  under the License.
+
+CREATE SCHEMA schema_01;
+SET SCHEMA schema_01;
+
+CREATE TABLE schema_01.new_table (
+  id INTEGER NOT NULL,
+  COL2 INTEGER,
+  PRIMARY KEY (id)
+ );
+
+CREATE TABLE schema_01.existing_table (
+  id INTEGER NOT NULL,
+  COL2 INTEGER,
+  PRIMARY KEY (id)
+ );
\ No newline at end of file


Mime
View raw message