cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [8/9] cayenne git commit: defaultPackage value from maven plugin should override that value in DataMap
Date Thu, 11 Dec 2014 10:49:53 GMT
defaultPackage value from maven plugin should override that value in DataMap


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

Branch: refs/heads/master
Commit: 4ad9e8c26c5d20d938fa12135e997d6afd80d519
Parents: 233918a
Author: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Authored: Wed Dec 10 21:11:49 2014 +0300
Committer: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Committed: Wed Dec 10 21:11:49 2014 +0300

----------------------------------------------------------------------
 .../java/org/apache/cayenne/tools/dbimport/DbImportAction.java | 5 +++++
 .../cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml    | 1 +
 .../cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml    | 1 +
 .../tools/dbimport/testUnFlattensManyToMany.map.xml-result     | 6 ++++++
 .../apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql | 6 ++++++
 5 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/4ad9e8c2/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
index e3c54d5..60194f3 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
@@ -53,6 +53,8 @@ import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
+import static org.apache.commons.lang.StringUtils.isBlank;
+
 /**
  * A thin wrapper around {@link DbLoader} that encapsulates DB import logic for
  * the benefit of Ant and Maven db importers.
@@ -112,6 +114,9 @@ public class DbImportAction {
                 return;
             }
 
+            if (!isBlank(config.getDefaultPackage())) {
+                existing.setDefaultPackage(config.getDefaultPackage());
+            }
             saveLoaded(execute(config.createMergeDelegate(), existing, log(reverse(mergerFactory,
mergeTokens))));
         }
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4ad9e8c2/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
index c62b2b3..ebc2647 100644
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
@@ -31,6 +31,7 @@
 					<map>target/test-classes/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml</map>
                     <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
                     <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    <defaultPackage>org.not.my.home</defaultPackage>
 				</configuration>
 			</plugin>
 		</plugins>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4ad9e8c2/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
index 3aaa235..a18b3f3 100644
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
@@ -21,6 +21,7 @@
 	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	 xsi:schemaLocation="http://cayenne.apache.org/schema/7/modelMap http://cayenne.apache.org/schema/7/modelMap.xsd"
 	 project-version="7">
+    <property name="defaultPackage" value="com.my.home"/>
     <db-entity name="A" schema="APP">
         <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
     </db-entity>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4ad9e8c2/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
index 5b85aa0..f39e30f 100644
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
@@ -21,6 +21,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://cayenne.apache.org/schema/7/modelMap http://cayenne.apache.org/schema/7/modelMap.xsd"
           project-version="7">
+    <property name="defaultPackage" value="org.not.my.home"/>
     <db-entity name="A" schema="APP">
         <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
     </db-entity>
@@ -31,12 +32,17 @@
     <db-entity name="B" schema="APP">
         <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
     </db-entity>
+    <db-entity name="C" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+    </db-entity>
     <obj-entity name="A" className="A" dbEntityName="A">
     </obj-entity>
     <obj-entity name="AB" className="AB" dbEntityName="A_B">
     </obj-entity>
     <obj-entity name="B" className="B" dbEntityName="B">
     </obj-entity>
+    <obj-entity name="C" className="org.not.my.home.C" dbEntityName="C">
+    </obj-entity>
     <db-relationship name="aBArray" source="A" target="A_B" toMany="true">
         <db-attribute-pair source="ID" target="A_ID"/>
     </db-relationship>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4ad9e8c2/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
index 0241d1d..57dae83 100644
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
@@ -33,4 +33,10 @@ CREATE TABLE APP.A_B (
 
   CONSTRAINT A_B_A FOREIGN KEY (A_ID) REFERENCES APP.A (ID),
   CONSTRAINT A_B_B FOREIGN KEY (B_ID) REFERENCES APP.B (ID)
+);
+
+CREATE TABLE APP.C (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
 );
\ No newline at end of file


Mime
View raw message