cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject [1/2] cayenne git commit: CAY-1993 | Reverse Engineering does not work with PostgreSQL database
Date Thu, 26 Mar 2015 13:39:20 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 469ad0e41 -> f19da189c


CAY-1993 | Reverse Engineering does not work with PostgreSQL database


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

Branch: refs/heads/master
Commit: 9c7f93140a79c9098acc6822908f50c652c638d0
Parents: 469ad0e
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Thu Mar 26 16:32:03 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Thu Mar 26 16:32:03 2015 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/dba/AutoAdapter.java     | 13 ++++--
 .../java/org/apache/cayenne/dba/DbAdapter.java  | 18 +++++---
 .../org/apache/cayenne/dba/JdbcAdapter.java     | 28 ++++++++----
 .../cayenne/dba/postgres/PostgresAdapter.java   | 24 ++++++----
 .../apache/cayenne/tools/DbImporterTask.java    | 32 +++++++++++++-
 .../modeler/dialog/db/DbLoaderHelper.java       |  8 +++-
 .../apache/cayenne/tools/DbImporterMojo.java    | 32 +++++++++++++-
 .../cayenne/tools/DbImporterMojoTest.java       | 46 ++++++++++++++------
 ...SupportsCatalogsOnReverseEngineering-pom.xml | 41 +++++++++++++++++
 ...SupportsCatalogsOnReverseEngineering.map.xml | 25 +++++++++++
 10 files changed, 220 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/cayenne-server/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/AutoAdapter.java b/cayenne-server/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
index 012a3f0..4e16194 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/AutoAdapter.java
@@ -19,10 +19,6 @@
 
 package org.apache.cayenne.dba;
 
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.Collection;
-
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.translator.ejbql.EJBQLTranslatorFactory;
@@ -38,6 +34,10 @@ import org.apache.cayenne.merge.MergerFactory;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.query.SQLAction;
 
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Collection;
+
 /**
  * A DbAdapter that automatically detects the kind of database it is running on and
  * instantiates an appropriate DB-specific adapter, delegating all subsequent method calls
@@ -115,6 +115,11 @@ public class AutoAdapter implements DbAdapter {
     }
 
     @Override
+    public boolean supportsCatalogsOnReverseEngineering() {
+        return getAdapter().supportsCatalogsOnReverseEngineering();
+    }
+
+    @Override
     public boolean supportsGeneratedKeys() {
         return getAdapter().supportsGeneratedKeys();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/cayenne-server/src/main/java/org/apache/cayenne/dba/DbAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/DbAdapter.java b/cayenne-server/src/main/java/org/apache/cayenne/dba/DbAdapter.java
index 9914974..5d6c4d9 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/DbAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/DbAdapter.java
@@ -18,11 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.dba;
 
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Collection;
-
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.translator.ejbql.EJBQLTranslatorFactory;
 import org.apache.cayenne.access.translator.select.QualifierTranslator;
@@ -35,6 +30,10 @@ import org.apache.cayenne.merge.MergerFactory;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.query.SQLAction;
 
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Collection;
+
 /**
  * A Cayenne extension point that abstracts the differences between specifics of
  * JDBC interfaces to various databases. Cayenne already ships with a number of
@@ -63,12 +62,19 @@ public interface DbAdapter {
 
     /**
      * Returns true if a target database supports UNIQUE constraints.
-     * 
+     *
      * @since 1.1
      */
     boolean supportsUniqueConstraints();
 
     /**
+     * Returns true if a target database supports catalogs on reverse engineering.
+     *
+     * @since 4.0
+     */
+    boolean supportsCatalogsOnReverseEngineering();
+
+    /**
      * Returns true if a target database supports key autogeneration. This
      * feature also requires JDBC3-compliant driver.
      * 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/cayenne-server/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java b/cayenne-server/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
index 552aeae..c79ff42 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/JdbcAdapter.java
@@ -19,15 +19,6 @@
 
 package org.apache.cayenne.dba;
 
-import java.net.URL;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.translator.batch.BatchTranslatorFactory;
@@ -53,6 +44,15 @@ import org.apache.cayenne.resource.Resource;
 import org.apache.cayenne.resource.ResourceLocator;
 import org.apache.cayenne.util.Util;
 
+import java.net.URL;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * A generic DbAdapter implementation. Can be used as a default adapter or as a
  * superclass of a concrete adapter implementation.
@@ -234,6 +234,16 @@ public class JdbcAdapter implements DbAdapter {
     }
 
     /**
+     * Returns true.
+     *
+     * @since 4.0
+     */
+    @Override
+    public boolean supportsCatalogsOnReverseEngineering() {
+        return true;
+    }
+
+    /**
      * @since 1.1
      */
     public void setSupportsUniqueConstraints(boolean flag) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
index 36ecba2..05904d8 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
@@ -19,14 +19,6 @@
 
 package org.apache.cayenne.dba.postgres;
 
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.translator.select.QualifierTranslator;
@@ -37,9 +29,9 @@ import org.apache.cayenne.access.types.ExtendedTypeFactory;
 import org.apache.cayenne.access.types.ExtendedTypeMap;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.RuntimeProperties;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
+import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
@@ -49,6 +41,14 @@ import org.apache.cayenne.query.Query;
 import org.apache.cayenne.query.SQLAction;
 import org.apache.cayenne.resource.ResourceLocator;
 
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * DbAdapter implementation for <a href="http://www.postgresql.org">PostgreSQL
  * RDBMS </a>. Sample connection settings to use with PostgreSQL are shown
@@ -253,4 +253,10 @@ public class PostgresAdapter extends JdbcAdapter {
     public MergerFactory mergerFactory() {
         return new PostgresMergerFactory();
     }
+
+    @Override
+    public boolean supportsCatalogsOnReverseEngineering() {
+        return false;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/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 5c1585d..de60b65 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
@@ -18,11 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.tools;
 
-import java.io.File;
-
 import org.apache.cayenne.access.loader.filters.EntityFilters;
 import org.apache.cayenne.access.loader.filters.FilterFactory;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
+import org.apache.cayenne.configuration.server.DataSourceFactory;
+import org.apache.cayenne.configuration.server.DbAdapterFactory;
 import org.apache.cayenne.conn.DataSourceInfo;
+import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.map.naming.DefaultNameGenerator;
@@ -46,6 +48,9 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 
+import javax.sql.DataSource;
+import java.io.File;
+
 public class DbImporterTask extends Task {
 
     private final DbImportConfiguration config;
@@ -78,6 +83,8 @@ public class DbImporterTask extends Task {
 
         Injector injector = DIBootstrap.createInjector(new ToolsModule(logger), new DbImportModule());
 
+        validateDbImportConfiguration(config, injector);
+
         try {
             injector.getInstance(DbImportAction.class).execute(config);
         } catch (Exception ex) {
@@ -97,6 +104,27 @@ public class DbImporterTask extends Task {
         }
     }
 
+    private void validateDbImportConfiguration(DbImportConfiguration config, Injector injector)
throws BuildException {
+        DataNodeDescriptor dataNodeDescriptor = config.createDataNodeDescriptor();
+        DataSource dataSource = null;
+        DbAdapter adapter = null;
+
+        try {
+            dataSource = injector.getInstance(DataSourceFactory.class).getDataSource(dataNodeDescriptor);
+            adapter = injector.getInstance(DbAdapterFactory.class).createAdapter(dataNodeDescriptor,
dataSource);
+
+            if (!adapter.supportsCatalogsOnReverseEngineering() &&
+                    reverseEngineering.getCatalogs() != null && !reverseEngineering.getCatalogs().isEmpty())
{
+                String message = "Your database does not support catalogs on reverse engineering.
" +
+                        "It allows to connect to only one at the moment. Please don't note
catalogs as param.";
+                throw new BuildException(message);
+            }
+        } catch (Exception e) {
+            throw new BuildException("Error creating DataSource ("
+                    + dataSource + ") or DbAdapter (" + adapter + ") for DataNodeDescriptor
(" + dataNodeDescriptor + ")", e);
+        }
+    }
+
     /**
      * Validates attributes that are not related to internal
      * DefaultClassGenerator. Throws BuildException if attributes are invalid.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
index 0a878e8..15b49cc 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
@@ -85,6 +85,7 @@ public class DbLoaderHelper {
     protected boolean meaningfulPk;
     protected List<String> schemas;
     protected List<String> catalogs;
+    protected DbAdapter adapter;
 
     private final EntityFilters.Builder filterBuilder = new EntityFilters.Builder();
 
@@ -103,6 +104,7 @@ public class DbLoaderHelper {
         } catch (SQLException e) {
             logObj.warn("Error getting catalog.", e);
         }
+        this.adapter = adapter;
         this.loader = new DbLoader(connection, adapter, new LoaderDelegate());
     }
 
@@ -123,8 +125,10 @@ public class DbLoaderHelper {
         stoppingReverseEngineering = false;
 
         // load catalogs...
-        LongRunningTask loadCatalogsTask = new LoadCatalogsTask(Application.getFrame(), "Loading
Catalogs");
-        loadCatalogsTask.startAndWait();
+        if (adapter.supportsCatalogsOnReverseEngineering()) {
+            LongRunningTask loadCatalogsTask = new LoadCatalogsTask(Application.getFrame(),
"Loading Catalogs");
+            loadCatalogsTask.startAndWait();
+        }
 
         if (stoppingReverseEngineering) {
             return;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/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 dacb398..0073268 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
@@ -18,10 +18,12 @@
  ****************************************************************/
 package org.apache.cayenne.tools;
 
-import java.io.File;
-
 import org.apache.cayenne.access.loader.filters.EntityFilters;
 import org.apache.cayenne.access.loader.filters.FilterFactory;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
+import org.apache.cayenne.configuration.server.DataSourceFactory;
+import org.apache.cayenne.configuration.server.DbAdapterFactory;
+import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.tools.configuration.ToolsModule;
@@ -38,6 +40,9 @@ import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 
+import javax.sql.DataSource;
+import java.io.File;
+
 /**
  * Maven mojo to reverse engineer datamap from DB.
  * 
@@ -245,6 +250,8 @@ public class DbImporterMojo extends AbstractMojo {
         config.setLogger(logger);
         Injector injector = DIBootstrap.createInjector(new ToolsModule(logger), new DbImportModule());
 
+        validateDbImportConfiguration(config, injector);
+
         try {
             injector.getInstance(DbImportAction.class).execute(config);
         } catch (Exception ex) {
@@ -261,6 +268,27 @@ public class DbImporterMojo extends AbstractMojo {
         }
     }
 
+    private void validateDbImportConfiguration(DbImportConfiguration config, Injector injector)
throws MojoExecutionException {
+        DataNodeDescriptor dataNodeDescriptor = config.createDataNodeDescriptor();
+        DataSource dataSource = null;
+        DbAdapter adapter = null;
+
+        try {
+            dataSource = injector.getInstance(DataSourceFactory.class).getDataSource(dataNodeDescriptor);
+            adapter = injector.getInstance(DbAdapterFactory.class).createAdapter(dataNodeDescriptor,
dataSource);
+
+            if (!adapter.supportsCatalogsOnReverseEngineering() &&
+                    reverseEngineering.getCatalogs() != null && !reverseEngineering.getCatalogs().isEmpty())
{
+                String message = "Your database does not support catalogs on reverse engineering.
" +
+                        "It allows to connect to only one at the moment. Please don't note
catalogs as param.";
+                throw new MojoExecutionException(message);
+            }
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error creating DataSource ("
+                    + dataSource + ") or DbAdapter (" + adapter + ") for DataNodeDescriptor
(" + dataNodeDescriptor + ")", e);
+        }
+    }
+
     DbImportConfiguration toParameters() {
         DbImportConfiguration config = new DbImportConfiguration();
         config.setAdapter(adapter);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/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 e7fc592..2fa903f 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
@@ -18,25 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.tools;
 
-import static org.apache.commons.lang.StringUtils.isBlank;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Iterator;
-
 import org.apache.cayenne.test.jdbc.SQLReader;
 import org.apache.cayenne.test.resource.ResourceUtil;
 import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
 import org.apache.cayenne.tools.dbimport.config.Catalog;
 import org.apache.cayenne.tools.dbimport.config.IncludeTable;
 import org.apache.cayenne.tools.dbimport.config.Schema;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.custommonkey.xmlunit.DetailedDiff;
@@ -48,6 +36,19 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Iterator;
+
+import static org.apache.commons.lang.StringUtils.isBlank;
+
 
 public class DbImporterMojoTest extends AbstractMojoTestCase {
 
@@ -233,6 +234,25 @@ public class DbImporterMojoTest extends AbstractMojoTestCase {
         assertEquals("excludeColumn-03", catalog.getExcludeColumns().iterator().next().getPattern());
     }
 
+    @Test
+    public void testSupportsCatalogsOnReverseEngineering() throws Exception {
+        DbImporterMojo cdbImport = getCdbImport("dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml");
+        cdbImport.getReverseEngineering().addCatalog(new Catalog("DbImporterMojoTest2"));
+
+        Exception exceptedException = null;
+        String exceptedMessage = "Your database does not support catalogs on reverse engineering.
" +
+                "It allows to connect to only one at the moment. Please don't note catalogs
as param.";
+
+        try {
+            cdbImport.execute();
+        } catch (MojoExecutionException ex) {
+            exceptedException = ex;
+        }
+
+        assertNotNull(exceptedException);
+        assertEquals(exceptedException.getCause().getMessage(), exceptedMessage);
+    }
+
     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/9c7f9314/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml
new file mode 100644
index 0000000..94e2965
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.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">
+
+    <name>DbImporterMojo Test1</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    <map>target/test-classes/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml</map>
+                    <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                    <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    <adapter>org.apache.cayenne.dba.postgres.PostgresAdapter</adapter>
+                    <catalog>DbImporterMojoTest1</catalog>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9c7f9314/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
new file mode 100644
index 0000000..4e28e1c
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
@@ -0,0 +1,25 @@
+<?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">
+    <property name="defaultPackage" value="com.my.home"/>
+</data-map>
\ No newline at end of file


Mime
View raw message