cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [4/9] cayenne git commit: add skipRelationshipLoading option
Date Thu, 11 Dec 2014 10:49:49 GMT
add skipRelationshipLoading option


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

Branch: refs/heads/master
Commit: 3037c5e56becf6ea3e2ea825d04192b58fcce6c4
Parents: e2734bf
Author: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Authored: Tue Dec 9 18:42:10 2014 +0300
Committer: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Committed: Tue Dec 9 18:42:10 2014 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/access/DbLoader.java     |  4 +-
 .../access/loader/DbLoaderConfiguration.java    | 21 +++++++++-
 .../java/org/apache/cayenne/merge/DbMerger.java |  1 -
 .../apache/cayenne/tools/DbImporterTask.java    |  4 ++
 .../tools/dbimport/DbImportConfiguration.java   |  4 ++
 .../config/DefaultReverseEngineeringLoader.java |  5 +++
 .../dbimport/config/ReverseEngineering.java     | 10 +++++
 .../cayenne/tools/DbImporterTaskTest.java       | 10 +++--
 .../DefaultReverseEngineeringLoaderTest.java    | 13 ++++++
 .../tools/build-skip-relationships-loading.xml  | 37 +++++++++++++++++
 ...erseEngineering-skipRelationshipsLoading.xml | 23 +++++++++++
 .../apache/cayenne/tools/DbImporterMojo.java    |  1 +
 .../tools/DbImporterMojoConfigurationTest.java  |  9 ++--
 .../cayenne/tools/DbImporterMojoTest.java       |  4 ++
 .../cayenne/tools/config/pom-schema-2.xml       | 41 +++++++++++++++++++
 .../config/pom-skip-relationships-loading.xml   | 39 ++++++++++++++++++
 .../testSkipRelationshipsLoading-pom.xml        | 43 ++++++++++++++++++++
 .../testSkipRelationshipsLoading.map.xml-result | 36 ++++++++++++++++
 .../dbimport/testSkipRelationshipsLoading.sql   | 30 ++++++++++++++
 19 files changed, 324 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
index fc8eb2d..4fc17c3 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
@@ -744,7 +744,9 @@ public class DbLoader {
         List<DbEntity> entities = loadDbEntities(dataMap, config, tables);
 
         if (entities != null) {
-            loadDbRelationships(config, tables);
+            if (!config.isSkipRelationshipsLoading()) {
+                loadDbRelationships(config, tables);
+            }
 
             loadObjEntities(dataMap, config, entities);
             flattenManyToManyRelationships(dataMap);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-server/src/main/java/org/apache/cayenne/access/loader/DbLoaderConfiguration.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/DbLoaderConfiguration.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/DbLoaderConfiguration.java
index 6c6a628..290da78 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/DbLoaderConfiguration.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/DbLoaderConfiguration.java
@@ -68,6 +68,8 @@ public class DbLoaderConfiguration {
      */
     private String namingStrategy;
 
+    private Boolean skipRelationshipsLoading;
+
     private String[] tableTypes;
 
     private FiltersConfig filtersConfig;
@@ -108,8 +110,25 @@ public class DbLoaderConfiguration {
         this.filtersConfig = filtersConfig;
     }
 
+    public Boolean isSkipRelationshipsLoading() {
+        return skipRelationshipsLoading != null && skipRelationshipsLoading;
+    }
+
+    public Boolean getSkipRelationshipsLoading() {
+        return skipRelationshipsLoading;
+    }
+
+    public void setSkipRelationshipsLoading(Boolean skipRelationshipsLoading) {
+        this.skipRelationshipsLoading = skipRelationshipsLoading;
+    }
+
     @Override
     public String toString() {
-        return "EntitiesFilters: " + getFiltersConfig();
+        String res = "EntitiesFilters: " + getFiltersConfig();
+        if (skipRelationshipsLoading != null && skipRelationshipsLoading) {
+            res += "\n Skip Loading Relationships! \n";
+        }
+
+        return res;
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java b/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
index ef93589..2c17361 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
@@ -136,7 +136,6 @@ public class DbMerger {
         try {
             conn = dataSource.getConnection();
 
-            // TODO pass naming strategy
             DbLoader dbLoader = new DbLoader(conn, adapter, new DefaultDbLoaderDelegate());
             return loadDataMapFromDb(dbLoader, config);
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
index 9cac30b..43df27b 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
@@ -225,6 +225,10 @@ public class DbImporterTask extends Task {
         config.setUsePrimitives(usePrimitives);
     }
 
+    public void setSkipRelationshipsLoading(Boolean skipRelationshipsLoading) {
+        reverseEngineering.setSkipRelationshipsLoading(skipRelationshipsLoading);
+    }
+
     public void addConfiguredIncludeColumn(IncludeColumn includeColumn) {
         reverseEngineering.addIncludeColumn(includeColumn);
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportConfiguration.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportConfiguration.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportConfiguration.java
index dff86ae..a116801 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportConfiguration.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportConfiguration.java
@@ -321,4 +321,8 @@ public class DbImportConfiguration {
     public DataSourceInfo getDataSourceInfo() {
         return dataSourceInfo;
     }
+
+    public void setSkipRelationshipsLoading(Boolean skipRelationshipsLoading) {
+        this.dbLoaderConfiguration.setSkipRelationshipsLoading(skipRelationshipsLoading);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
index 35bd09d..216e218 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
@@ -57,6 +57,7 @@ public class DefaultReverseEngineeringLoader implements ReverseEngineeringLoader
             ReverseEngineering engineering = new ReverseEngineering();
 
             Element root = doc.getDocumentElement();
+            engineering.setSkipRelationshipsLoading(loadBoolean(root, "skipRelationshipsLoading"));
             engineering.setCatalogs(loadCatalogs(root));
             engineering.setSchemas(loadSchemas(root));
             engineering.setIncludeTables(loadIncludeTables(root));
@@ -79,6 +80,10 @@ public class DefaultReverseEngineeringLoader implements ReverseEngineeringLoader
         return null;
     }
 
+    private Boolean loadBoolean(Element root, String name) {
+        return Boolean.valueOf(loadByName(root, name));
+    }
+
     private Collection<ExcludeProcedure> loadExcludeProcedures(Node parent) {
         return loadPatternParams(ExcludeProcedure.class, getElementsByTagName(parent, "excludeProcedure"));
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
index 0502986..377e8ac 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
@@ -27,12 +27,22 @@ import java.util.LinkedList;
  */
 public class ReverseEngineering extends FilterContainer {
 
+    private Boolean skipRelationshipsLoading;
+
     private Collection<Catalog> catalogs = new LinkedList<Catalog>();
     private Collection<Schema> schemas = new LinkedList<Schema>();
 
     public ReverseEngineering() {
     }
 
+    public Boolean getSkipRelationshipsLoading() {
+        return skipRelationshipsLoading;
+    }
+
+    public void setSkipRelationshipsLoading(Boolean skipRelationshipsLoading) {
+        this.skipRelationshipsLoading = skipRelationshipsLoading;
+    }
+
     public Collection<Catalog> getCatalogs() {
         return catalogs;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
b/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
index 1fdde49..9121132 100644
--- a/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
+++ b/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
@@ -18,10 +18,7 @@
  ****************************************************************/
 package org.apache.cayenne.tools;
 
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertCatalog;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertCatalogAndSchema;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertFlat;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertSchema;
+import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.*;
 import static org.apache.commons.lang.StringUtils.isBlank;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -80,6 +77,11 @@ public class DbImporterTaskTest {
 	}
 
 	@Test
+	public void testSkipRelationshipsLoading() throws Exception {
+		assertSkipRelationshipsLoading(getCdbImport("build-skip-relationships-loading.xml").getReverseEngineering());
+	}
+
+	@Test
 	public void testIncludeTable() throws Exception {
 		test("build-include-table.xml");
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoaderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoaderTest.java
b/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoaderTest.java
index 9597af5..ff3e04d 100644
--- a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoaderTest.java
+++ b/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoaderTest.java
@@ -28,6 +28,7 @@ import java.net.MalformedURLException;
 import java.util.Iterator;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 public class DefaultReverseEngineeringLoaderTest {
 
@@ -197,6 +198,18 @@ public class DefaultReverseEngineeringLoaderTest {
         assertEquals("includeProcedure-03", includeProcedures.next().getPattern());
     }
 
+    @Test
+    public void testSkipRelationships() throws Exception {
+        ReverseEngineering engineering = new DefaultReverseEngineeringLoader()
+                .load(getResource("reverseEngineering-skipRelationshipsLoading.xml"));
+
+        assertSkipRelationshipsLoading(engineering);
+    }
+
+    public static void assertSkipRelationshipsLoading(ReverseEngineering engineering) {
+        assertTrue(engineering.getSkipRelationshipsLoading());
+    }
+
     protected URLResource getResource(String file) throws MalformedURLException {
 		return new URLResource(getClass().getResource(file));
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/test/resources/org/apache/cayenne/tools/build-skip-relationships-loading.xml
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/resources/org/apache/cayenne/tools/build-skip-relationships-loading.xml
b/cayenne-tools/src/test/resources/org/apache/cayenne/tools/build-skip-relationships-loading.xml
new file mode 100644
index 0000000..1eb40a8
--- /dev/null
+++ b/cayenne-tools/src/test/resources/org/apache/cayenne/tools/build-skip-relationships-loading.xml
@@ -0,0 +1,37 @@
+<!--
+  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 name="MyProject" default="dist" basedir=".">
+
+    <taskdef name="cdbimport" classname="org.apache.cayenne.tools.DbImporterTask" taskname="cdbimport"
+             classpath="${basedir}"  />
+
+    <target name="dist">
+        <cdbimport map="${context.dir}/WEB-INF/DefaultMap.map.xml"
+                   adapter="org.apache.cayenne.dba.hsqldb.HSQLDBAdapter"
+                   driver="org.hsqldb.jdbcDriver"
+                   url="jdbc:hsqldb:hsql://localhost/bookmarker"
+                   username="sa"
+                   skipRelationshipsLoading="true">
+
+        </cdbimport>
+    </target>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/cayenne-tools/src/test/resources/org/apache/cayenne/tools/dbimport/config/reverseEngineering-skipRelationshipsLoading.xml
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/resources/org/apache/cayenne/tools/dbimport/config/reverseEngineering-skipRelationshipsLoading.xml
b/cayenne-tools/src/test/resources/org/apache/cayenne/tools/dbimport/config/reverseEngineering-skipRelationshipsLoading.xml
new file mode 100644
index 0000000..9eac789
--- /dev/null
+++ b/cayenne-tools/src/test/resources/org/apache/cayenne/tools/dbimport/config/reverseEngineering-skipRelationshipsLoading.xml
@@ -0,0 +1,23 @@
+<?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.
+  -->
+
+<reverseEngineering>
+    <skipRelationshipsLoading>true</skipRelationshipsLoading>
+</reverseEngineering>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
b/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
index cf5b59d..93ce3c8 100644
--- a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
+++ b/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
@@ -276,6 +276,7 @@ public class DbImporterMojo extends AbstractMojo {
         config.setUsePrimitives(usePrimitives);
         config.setFiltersConfig(new FiltersConfigBuilder(reverseEngineering)
                 .add(filterBuilder.build()).filtersConfig());
+        config.setSkipRelationshipsLoading(reverseEngineering.getSkipRelationshipsLoading());
         return config;
     }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
index 922c6b7..97736a7 100644
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
+++ b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
@@ -20,10 +20,7 @@ package org.apache.cayenne.tools;
 
 import static org.apache.cayenne.access.loader.filters.FilterFactory.NULL;
 import static org.apache.cayenne.access.loader.filters.FilterFactory.exclude;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertCatalog;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertCatalogAndSchema;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertFlat;
-import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.assertSchemaContent;
+import static org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.*;
 
 import org.apache.cayenne.access.loader.filters.DbPath;
 import org.apache.cayenne.access.loader.filters.EntityFilters;
@@ -76,7 +73,11 @@ public class DbImporterMojoConfigurationTest extends AbstractMojoTestCase
{
     @Test
     public void testLoadFlat() throws Exception {
         assertFlat(getCdbImport("pom-flat.xml").getReverseEngineering());
+    }
 
+    @Test
+    public void testSkipRelationshipsLoading() throws Exception {
+        assertSkipRelationshipsLoading(getCdbImport("pom-skip-relationships-loading.xml").getReverseEngineering());
     }
 
     private DbImporterMojo getCdbImport(String pomFileName) throws Exception {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/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 3b7e7e2..9066150 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
@@ -112,6 +112,10 @@ public class DbImporterMojoTest extends AbstractMojoTestCase {
 		test("testDefaultPackage");
 	}
 
+	public void testSkipRelationshipsLoading() throws Exception {
+		test("testSkipRelationshipsLoading");
+	}
+
 	private void test(String name) throws Exception {
 		DbImporterMojo cdbImport = getCdbImport("dbimport/" + name + "-pom.xml");
 		File mapFile = cdbImport.getMap();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
new file mode 100644
index 0000000..02f05c6
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
@@ -0,0 +1,41 @@
+<?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">
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    <reverseEngineering>
+                        <schema>
+                            <name>NHL_STATS</name>
+                            <excludeTable>^ETL_.*</excludeTable>
+                            <excludeColumn>^ETL_.*</excludeColumn>
+                        </schema>
+                    </reverseEngineering>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
new file mode 100644
index 0000000..892752c
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
@@ -0,0 +1,39 @@
+<?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">
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <reverseEngineering>
+                        <skipRelationshipsLoading>true</skipRelationshipsLoading>
+                    </reverseEngineering>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
new file mode 100644
index 0000000..45a76e2
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
@@ -0,0 +1,43 @@
+<?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/testSkipRelationshipsLoading.map.xml</map>
+                    <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                    <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+
+                    <reverseEngineering>
+                        <skipRelationshipsLoading>true</skipRelationshipsLoading>
+                    </reverseEngineering>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
new file mode 100644
index 0000000..af9ea36
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
@@ -0,0 +1,36 @@
+<?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/7/modelMap"
+          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">
+    <db-entity name="CHILD" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+        <db-attribute name="PARENT_ID" type="INTEGER" length="10"/>
+    </db-entity>
+    <db-entity name="PARENT" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"
length="10"/>
+    </db-entity>
+    <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+        <obj-attribute name="parentId" type="java.lang.Integer" db-attribute-path="PARENT_ID"/>
+    </obj-entity>
+    <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3037c5e5/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
new file mode 100644
index 0000000..2955a3a
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
@@ -0,0 +1,30 @@
+--  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 TABLE APP.Parent (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.Child (
+  id INTEGER NOT NULL,
+  Parent_id INTEGER,
+
+  PRIMARY KEY (id),
+  CONSTRAINT PARENT_CHILD FOREIGN KEY (Parent_id) REFERENCES APP.Parent (id)
+);
\ No newline at end of file


Mime
View raw message