Repository: cayenne
Updated Branches:
  refs/heads/master 32fd73575 -> eb9a25a4a


http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.apache.cayenne.properties
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.apache.cayenne.properties
 
b/cayenne-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.apache.cayenne.properties
new file mode 100644
index 0000000..fc608ad
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.apache.cayenne.properties
@@ -0,0 +1,19 @@
+#####################################################################
+#   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.
+#####################################################################
+implementation-class=org.apache.cayenne.tools.GradlePlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/BaseTaskIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/BaseTaskIT.java 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/BaseTaskIT.java
new file mode 100644
index 0000000..66230d5
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/BaseTaskIT.java
@@ -0,0 +1,71 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.gradle.testkit.runner.GradleRunner;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * @since 4.0
+ */
+public class BaseTaskIT {
+
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
+    protected File projectDir;
+
+    @Before
+    public void createProjectDir() throws IOException {
+        projectDir = tempFolder.newFolder();
+    }
+
+    protected GradleRunner createRunner(String projectName, String... args) 
throws IOException {
+        prepareBuildScript(projectName);
+
+        List<String> gradleArguments = new ArrayList<>();
+        gradleArguments.addAll(Arrays.asList(args));
+        gradleArguments.add("--stacktrace");
+
+        return GradleRunner.create()
+                .withProjectDir(projectDir)
+                .withPluginClasspath()
+                .withArguments(gradleArguments);
+    }
+
+    private void prepareBuildScript(String name) throws IOException {
+        String projectFileSrc = getClass().getResource(name + 
".gradle").getFile();
+        Path src = FileSystems.getDefault().getPath(projectFileSrc);
+        Path dst = 
FileSystems.getDefault().getPath(projectDir.getAbsolutePath(), "build.gradle");
+        Files.copy(src, dst, StandardCopyOption.REPLACE_EXISTING);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
new file mode 100644
index 0000000..8f660ff
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskIT.java
@@ -0,0 +1,89 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.gradle.testkit.runner.BuildResult;
+import org.gradle.testkit.runner.GradleRunner;
+import org.gradle.testkit.runner.TaskOutcome;
+import org.junit.Test;
+
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @since 4.0
+ */
+public class CgenTaskIT extends BaseTaskIT {
+
+    @Test
+    public void classGeneratingWithDefaultConfigSuccess() throws Exception {
+
+        GradleRunner runner = createRunner(
+                "cgen_default_config",
+                "cgen",
+                "-PdataMap=" + 
getClass().getResource("test_datamap.map.xml").getFile()
+        );
+        BuildResult result = runner.build();
+
+        String generatedDirectoryPath = projectDir.getAbsolutePath() + 
"/org/example/cayenne/persistent/";
+
+        String generatedClassPath = generatedDirectoryPath + "City.java";
+        String generatedParentClassPath = generatedDirectoryPath + 
"auto/_City.java";
+        File generatedClass = new File(generatedClassPath);
+        File generatedParentClass = new File(generatedParentClassPath);
+
+        assertTrue(generatedClass.exists());
+        assertTrue(generatedParentClass.exists());
+        assertEquals(TaskOutcome.SUCCESS, result.task(":cgen").getOutcome());
+    }
+
+    @Test
+    public void classGeneratingWithCustomConfigSuccess() throws Exception {
+
+        GradleRunner runner = createRunner(
+                "cgen_custom_config",
+                "cgen",
+                "-PdataMap=" + 
getClass().getResource("test_datamap.map.xml").getFile()
+        );
+        BuildResult result = runner.build();
+
+        String generatedDirectoryPath = projectDir.getAbsolutePath() + 
"/customDirectory/org/example/cayenne/persistent/";
+
+        String generatedClassPath = generatedDirectoryPath + "City.groovy";
+        String excludedClassPath = generatedDirectoryPath + "Artist.groovy";
+        String generatedParentClassPath = generatedDirectoryPath + 
"auto/_City.groovy";
+        String excludedParentClassPath = generatedDirectoryPath + 
"auto/_Artist.groovy";
+
+        File generatedClass = new File(generatedClassPath);
+        File excludedClass = new File(excludedClassPath);
+        File generatedParentClass = new File(generatedParentClassPath);
+        File excludedParentClass = new File(excludedParentClassPath);
+
+        assertTrue(generatedClass.exists());
+        assertTrue(!excludedClass.exists());
+        assertTrue(!excludedParentClass.exists());
+        assertTrue(!generatedParentClass.exists());
+        assertEquals(TaskOutcome.SUCCESS, result.task(":cgen").getOutcome());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
new file mode 100644
index 0000000..8259d21
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/CgenTaskTest.java
@@ -0,0 +1,102 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.apache.cayenne.gen.ClassGenerationAction;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+/**
+ * @since 4.0
+ */
+public class CgenTaskTest {
+
+    @Rule
+    public TemporaryFolder temp = new TemporaryFolder();
+
+    private CgenTask createCgenTaskMock(ClassGenerationAction action) {
+        CgenTask mock = mock(CgenTask.class);
+
+        doCallRealMethod().when(mock).setClient(anyBoolean());
+        doCallRealMethod().when(mock).setAdditionalMaps(any(File.class));
+        doCallRealMethod().when(mock).setCreatePropertyNames(anyBoolean());
+        doCallRealMethod().when(mock).setEmbeddableSuperTemplate(anyString());
+        doCallRealMethod().when(mock).setEmbeddableTemplate(anyString());
+        doCallRealMethod().when(mock).setEncoding(anyString());
+        doCallRealMethod().when(mock).setExcludeEntities(anyString());
+        doCallRealMethod().when(mock).setIncludeEntities(anyString());
+        doCallRealMethod().when(mock).setMakePairs(anyBoolean());
+        doCallRealMethod().when(mock).setMode(anyString());
+        doCallRealMethod().when(mock).setOutputPattern(anyString());
+        doCallRealMethod().when(mock).setSuperPkg(anyString());
+        doCallRealMethod().when(mock).setSuperTemplate(anyString());
+        doCallRealMethod().when(mock).setOverwrite(anyBoolean());
+        doCallRealMethod().when(mock).setUsePkgPath(anyBoolean());
+        doCallRealMethod().when(mock).setTemplate(anyString());
+        when(mock.newGeneratorInstance()).thenReturn(action);
+        when(mock.createGenerator()).thenCallRealMethod();
+
+        return mock;
+    }
+
+    @Test
+    public void testGeneratorCreation() {
+        ClassGenerationAction action = mock(ClassGenerationAction.class);
+        CgenTask task = createCgenTaskMock(action);
+
+        task.setEmbeddableSuperTemplate("superTemplate");
+        task.setEmbeddableTemplate("template");
+        task.setEncoding("UTF-8");
+        task.setExcludeEntities("entity1");
+        task.setIncludeEntities("entity2");
+        task.setMode("entity");
+        task.setOutputPattern("pattern");
+        task.setSuperPkg("org.example.model.auto");
+        task.setSuperTemplate("*.java");
+        task.setTemplate("*.java");
+        task.setMakePairs(true);
+        task.setCreatePropertyNames(true);
+        task.setOverwrite(true);
+        task.setUsePkgPath(true);
+
+        ClassGenerationAction createdAction = task.createGenerator();
+        assertSame(action, createdAction);
+
+        verify(action).setCreatePropertyNames(true);
+        verify(action).setMakePairs(true);
+        verify(action).setOverwrite(true);
+        verify(action).setUsePkgPath(true);
+        verify(action).setArtifactsGenerationMode("entity");
+        verify(action).setEncoding("UTF-8");
+        verify(action).setEmbeddableSuperTemplate("superTemplate");
+        verify(action).setEmbeddableTemplate("template");
+        verify(action).setOutputPattern("pattern");
+        verify(action).setSuperPkg("org.example.model.auto");
+        verify(action).setSuperTemplate("*.java");
+        verify(action).setTemplate("*.java");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbGenerateTaskIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbGenerateTaskIT.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbGenerateTaskIT.java
new file mode 100644
index 0000000..da00470
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbGenerateTaskIT.java
@@ -0,0 +1,99 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import java.io.IOException;
+
+import org.gradle.testkit.runner.BuildResult;
+import org.gradle.testkit.runner.GradleRunner;
+import org.gradle.testkit.runner.TaskOutcome;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @since 4.0
+ */
+public class DbGenerateTaskIT extends BaseTaskIT {
+
+    @Test
+    public void notConfiguredTaskFailure() throws IOException {
+        GradleRunner runner = createRunner("cdbgen_failure", "cdbgen", 
"--info");
+
+        BuildResult result = runner.buildAndFail();
+
+        // NOTE: There will be no result for the task, as build will fail 
earlier because
+        // datamap is required parameter that is validated directly by Gradle 
before task execution.
+        //assertNotNull(result.task(":cdbgen"));
+        //assertEquals(TaskOutcome.FAILED, 
result.task(":cdbgen").getOutcome());
+
+        assertTrue(result.getOutput().contains("No datamap configured in task 
or in cayenne.defaultDataMap"));
+    }
+
+    @Test
+    public void defaultConfigTaskSuccess() throws Exception {
+        String dbUrl = "jdbc:derby:build/testdb";
+
+        GradleRunner runner = createRunner(
+                "cdbgen_simple",
+                "cdbgen",
+                "-PdbUrl=" + dbUrl,
+                "-PdataMap=" + 
getClass().getResource("test_datamap.map.xml").getFile(),
+                "--info"
+        );
+
+        BuildResult result = runner.build();
+
+        assertNotNull(result.task(":cdbgen"));
+        assertEquals(TaskOutcome.SUCCESS, result.task(":cdbgen").getOutcome());
+
+        assertTrue(result.getOutput().contains(
+                "generator options - [dropTables: false, dropPK: false, 
createTables: true, createPK: true, createFK: true]"));
+
+        /* // check that DB is really created
+        try (Connection connection = DriverManager.getConnection(dbUrl)) {
+            try (ResultSet rs = connection.getMetaData()
+                    .getTables(null, null, "artist", new String[]{"TABLE"})) {
+                assertTrue(rs.next());
+            }
+        } */
+    }
+
+    @Test
+    public void customConfigTaskSuccess() throws IOException {
+        GradleRunner runner = createRunner(
+                "cdbgen_custom",
+                "customCdbgen",
+                "-PdataMap=" + 
getClass().getResource("test_datamap.map.xml").getFile(),
+                "--info"
+        );
+
+        BuildResult result = runner.build();
+
+        assertNotNull(result.task(":customCdbgen"));
+        assertEquals(TaskOutcome.SUCCESS, 
result.task(":customCdbgen").getOutcome());
+
+        assertTrue(result.getOutput().contains(
+                "generator options - [dropTables: true, dropPK: true, 
createTables: false, createPK: false, createFK: false]"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
new file mode 100644
index 0000000..69f8813
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportIT.java
@@ -0,0 +1,113 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Objects;
+
+import org.apache.cayenne.test.jdbc.SQLReader;
+import org.apache.cayenne.test.resource.ResourceUtil;
+import org.gradle.testkit.runner.BuildResult;
+import org.gradle.testkit.runner.GradleRunner;
+import org.gradle.testkit.runner.TaskOutcome;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class DbImportIT extends BaseTaskIT {
+
+    @Test
+    public void notConfiguredTaskFailure() throws IOException {
+        GradleRunner runner = createRunner("dbimport_failure", "cdbimport", 
"--info");
+
+        BuildResult result = runner.buildAndFail();
+
+        assertNotNull(result.task(":cdbimport"));
+        assertEquals(TaskOutcome.FAILED, 
result.task(":cdbimport").getOutcome());
+
+        assertTrue(result.getOutput().contains("No datamap configured in task 
or in cayenne.defaultDataMap"));
+    }
+
+    @Test
+    public void emptyDbTaskSuccess() throws IOException {
+        GradleRunner runner = createRunner("dbimport_empty_db", "cdbimport", 
"--info");
+
+        BuildResult result = runner.build();
+
+        assertNotNull(result.task(":cdbimport"));
+        assertEquals(TaskOutcome.SUCCESS, 
result.task(":cdbimport").getOutcome());
+
+        File dataMap = new File(projectDir.getAbsolutePath() + 
"/datamap.map.xml");
+        assertTrue(dataMap.exists());
+        assertTrue(result.getOutput().contains("Detected changes: No changes 
to import."));
+    }
+
+    @Test
+    public void simpleDbTaskSuccess() throws Exception {
+        String dbUrl = prepareDerbyDatabase("test_map_db");
+        GradleRunner runner = createRunner("dbimport_simple_db", "cdbimport", 
"--info", "-PdbUrl=" + dbUrl);
+
+        BuildResult result = runner.build();
+
+        assertNotNull(result.task(":cdbimport"));
+        assertEquals(TaskOutcome.SUCCESS, 
result.task(":cdbimport").getOutcome());
+
+        File dataMap = new File(projectDir.getAbsolutePath() + 
"/datamap.map.xml");
+        assertTrue(dataMap.exists());
+
+        // Check few lines from reverse engineering output
+        assertTrue(result.getOutput().contains("Table: APP.PAINTING"));
+        assertTrue(result.getOutput().contains("Db Relationship : toOne  
(EXHIBIT.GALLERY_ID, GALLERY.GALLERY_ID)"));
+        assertTrue(result.getOutput().contains("Db Relationship : toMany 
(GALLERY.GALLERY_ID, PAINTING.GALLERY_ID)"));
+        assertTrue(result.getOutput().contains("Create Table         ARTIST"));
+        assertFalse(result.getOutput().contains("Create Table         
PAINTING1"));
+        assertTrue(result.getOutput().contains("Skip relation: 
'.APP.ARTIST.ARTIST_ID <- .APP.PAINTING1.ARTIST_ID # 1'"));
+        assertTrue(result.getOutput().contains("Migration Complete 
Successfully."));
+    }
+
+    private String prepareDerbyDatabase(String sqlFile) throws Exception {
+        URL sqlUrl = 
Objects.requireNonNull(ResourceUtil.getResource(getClass(), sqlFile + ".sql"));
+        String dbUrl = "jdbc:derby:" + projectDir.getAbsolutePath() + 
"/build/" + sqlFile;
+        try (Connection connection = DriverManager.getConnection(dbUrl + 
";create=true")) {
+            try (Statement stmt = connection.createStatement()) {
+                for (String sql : SQLReader.statements(sqlUrl, ";")) {
+                    stmt.execute(sql);
+                }
+            }
+        }
+
+        // shutdown Derby DB, so it can be used by test build later
+        try(Connection connection = DriverManager.getConnection(dbUrl + 
";shutdown=true")) {
+        } catch (SQLException ignored) {
+            // should be thrown according to the Derby docs...
+        }
+
+        return dbUrl + ";create=true";
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportTaskTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportTaskTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportTaskTest.java
new file mode 100644
index 0000000..35c36f4
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/DbImportTaskTest.java
@@ -0,0 +1,126 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import groovy.lang.Closure;
+import org.apache.cayenne.dbsync.reverse.dbimport.DbImportConfiguration;
+import org.apache.cayenne.tools.model.DataSourceConfig;
+import org.apache.cayenne.tools.model.DbImportConfig;
+import org.gradle.api.InvalidUserDataException;
+import org.gradle.api.Project;
+import org.gradle.testfixtures.ProjectBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+/**
+ * @since 4.0
+ */
+public class DbImportTaskTest {
+
+    private DbImportTask task;
+
+    @Before
+    public void createTask() {
+        Project project = ProjectBuilder.builder().build();
+
+        Map<String, Object> parameters = new HashMap<>();
+        parameters.put("type", DbImportTask.class);
+        task = (DbImportTask)project.task(parameters, "cdbimportTask");
+    }
+
+    @Test(expected = InvalidUserDataException.class)
+    public void testRunWithNoConfig() {
+        task.runImport();
+    }
+
+    @Test
+    public void testFullConfigCreation() {
+        File mockFile = mock(File.class);
+
+        // configure task
+        task.setMap(mockFile);
+        task.setAdapter("org.apache.cayenne.test.adapter");
+        task.dataSource(new Closure<DataSourceConfig>(task, task) {
+            DataSourceConfig doCall(DataSourceConfig dataSourceConfig) {
+                assertNotNull(dataSourceConfig);
+
+                dataSourceConfig.setUrl("test://url");
+                dataSourceConfig.setDriver("org.apache.cayenne.test.driver");
+                dataSourceConfig.setUsername("username");
+                dataSourceConfig.setPassword("password");
+                return dataSourceConfig;
+            }
+        });
+        task.dbImport(new Closure<DataSourceConfig>(task, task) {
+            DbImportConfig doCall(DbImportConfig config) {
+                assertNotNull(config);
+
+                config.setDefaultPackage("com.example.package");
+                config.setMeaningfulPkTables("pk_tables");
+                config.setNamingStrategy("com.example.naming");
+                config.setSkipPrimaryKeyLoading(true);
+                config.setSkipRelationshipsLoading(true);
+                config.setStripFromTableNames("strip");
+                config.tableTypes("view", "alias");
+
+                config.setForceDataMapCatalog(true);
+                config.setForceDataMapSchema(true);
+                config.setUseJava7Types(true);
+                config.setUsePrimitives(false);
+
+                return config;
+            }
+        });
+
+        // Testing this:
+        DbImportConfiguration dbImportConfiguration = task.createConfig();
+
+        // Check that all values in end configuration is properly set
+        assertEquals("org.apache.cayenne.test.adapter", 
dbImportConfiguration.getAdapter());
+
+        assertEquals("test://url", dbImportConfiguration.getUrl());
+        assertEquals("org.apache.cayenne.test.driver", 
dbImportConfiguration.getDriver());
+        assertEquals("username", dbImportConfiguration.getUsername());
+        assertEquals("password", dbImportConfiguration.getPassword());
+
+        assertEquals("com.example.package", 
dbImportConfiguration.getDefaultPackage());
+        assertEquals("pk_tables", 
dbImportConfiguration.getMeaningfulPkTables());
+        assertEquals("com.example.naming", 
dbImportConfiguration.getNamingStrategy());
+        
assertTrue(dbImportConfiguration.getDbLoaderConfig().isSkipPrimaryKeyLoading());
+        
assertTrue(dbImportConfiguration.getDbLoaderConfig().isSkipRelationshipsLoading());
+        assertEquals("strip", dbImportConfiguration.getStripFromTableNames());
+        assertEquals("password", dbImportConfiguration.getPassword());
+        assertArrayEquals(new String[]{"view", "alias"}, 
dbImportConfiguration.getDbLoaderConfig().getTableTypes());
+
+        assertTrue(dbImportConfiguration.isForceDataMapCatalog());
+        assertTrue(dbImportConfiguration.isForceDataMapSchema());
+        assertTrue(dbImportConfiguration.isUseJava7Types());
+        assertFalse(dbImportConfiguration.isUsePrimitives());
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java
new file mode 100644
index 0000000..25b8284
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java
@@ -0,0 +1,50 @@
+package org.apache.cayenne.tools;
+
+import org.gradle.testkit.runner.GradleRunner;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+public class GradlePluginIT extends BaseTaskIT {
+
+    private void testDbImportWithGradleVersion(String version) throws 
Exception {
+        String dbUrl = "jdbc:derby:" + projectDir.getAbsolutePath() + 
"/build/" + version.replace('.', '_');
+        dbUrl += ";create=true";
+        GradleRunner runner = createRunner("dbimport_simple_db", "cdbimport", 
"--info", "-PdbUrl=" + dbUrl);
+        runner.withGradleVersion(version);
+        runner.build();
+    }
+
+    private void testCgenWithGradleVersion(String version) throws Exception {
+        GradleRunner runner = createRunner(
+                "cgen_default_config",
+                "cgen",
+                "-PdataMap=" + 
getClass().getResource("test_datamap.map.xml").getFile()
+        );
+        runner.withGradleVersion(version);
+        runner.build();
+    }
+
+    @Test
+    public void testGradleVersionsCompatibility() throws Exception {
+        String[] versions = {"3.5", "3.3", "3.0", "2.12", "2.8"};
+        List<String> failedVersions = new ArrayList<>();
+        for(String version : versions) {
+            try {
+                testDbImportWithGradleVersion(version);
+                testCgenWithGradleVersion(version);
+            } catch(Throwable th) {
+                failedVersions.add(version);
+            }
+        }
+
+        StringBuilder versionString = new StringBuilder("Failed versions:");
+        for(String version : failedVersions) {
+            versionString.append(" ").append(version);
+        }
+        assertTrue(versionString.toString(), failedVersions.isEmpty());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginTest.java
new file mode 100644
index 0000000..4de48fa
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginTest.java
@@ -0,0 +1,45 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.gradle.api.Project;
+import org.gradle.testfixtures.ProjectBuilder;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class GradlePluginTest {
+
+    @Test
+    public void apply() throws Exception {
+        Project project = ProjectBuilder.builder().build();
+        project.getPluginManager().apply("org.apache.cayenne");
+
+        assertTrue(project.getTasks().getByName("cgen") instanceof CgenTask);
+        assertTrue(project.getTasks().getByName("cdbimport") instanceof 
DbImportTask);
+        assertTrue(project.getTasks().getByName("cdbgen") instanceof 
DbGenerateTask);
+
+        assertTrue(project.getExtensions().getByName("cayenne") instanceof 
GradleCayenneExtension);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/DbImportConfigTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/DbImportConfigTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/DbImportConfigTest.java
new file mode 100644
index 0000000..696bc0c
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/DbImportConfigTest.java
@@ -0,0 +1,114 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools.model;
+
+import org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class DbImportConfigTest {
+
+    @Test
+    public void toEmptyReverseEngineering() throws Exception {
+        DbImportConfig config = new DbImportConfig();
+        ReverseEngineering rr = config.toReverseEngineering();
+
+        assertNotNull(rr);
+
+        assertEquals(0, rr.getCatalogs().size());
+        assertEquals(0, rr.getSchemas().size());
+        assertEquals(0, rr.getIncludeTables().size());
+        assertEquals(0, rr.getExcludeTables().size());
+        assertEquals(0, rr.getIncludeColumns().size());
+        assertEquals(0, rr.getExcludeColumns().size());
+        assertEquals(0, rr.getIncludeProcedures().size());
+        assertEquals(0, rr.getExcludeProcedures().size());
+
+        assertNull(rr.getDefaultPackage());
+        assertNull(rr.getMeaningfulPkTables());
+        
assertEquals("org.apache.cayenne.dbsync.naming.DefaultObjectNameGenerator", 
rr.getNamingStrategy());
+        assertFalse(rr.getSkipPrimaryKeyLoading());
+        assertFalse(rr.getSkipRelationshipsLoading());
+        assertEquals("", rr.getStripFromTableNames());
+        assertArrayEquals(new String[0], rr.getTableTypes());
+
+        assertFalse(rr.isForceDataMapCatalog());
+        assertFalse(rr.isForceDataMapSchema());
+        assertFalse(rr.isUseJava7Types());
+        assertTrue(rr.isUsePrimitives());
+
+        assertTrue(rr.isEmptyContainer());
+    }
+
+    @Test
+    public void toReverseEngineering() throws Exception {
+        DbImportConfig config = new DbImportConfig();
+
+        config.catalog("catalog1");
+        config.schema("schema1");
+
+        config.setDefaultPackage("com.example.package");
+        config.setMeaningfulPkTables("pk_tables");
+        config.setNamingStrategy("com.example.naming");
+        config.setSkipPrimaryKeyLoading(true);
+        config.setSkipRelationshipsLoading(true);
+        config.setStripFromTableNames("strip");
+        config.tableType("table");
+        config.tableTypes("view", "alias");
+
+        config.setForceDataMapCatalog(true);
+        config.setForceDataMapSchema(true);
+        config.setUseJava7Types(true);
+        config.setUsePrimitives(false);
+
+        ReverseEngineering rr = config.toReverseEngineering();
+
+        assertNotNull(rr);
+
+        assertEquals(1, rr.getCatalogs().size());
+        assertEquals("catalog1", rr.getCatalogs().iterator().next().getName());
+        assertEquals(1, rr.getSchemas().size());
+        assertEquals("schema1", rr.getSchemas().iterator().next().getName());
+        assertEquals(0, rr.getIncludeTables().size());
+        assertEquals(0, rr.getExcludeTables().size());
+        assertEquals(0, rr.getIncludeColumns().size());
+        assertEquals(0, rr.getExcludeColumns().size());
+        assertEquals(0, rr.getIncludeProcedures().size());
+        assertEquals(0, rr.getExcludeProcedures().size());
+
+        assertEquals("com.example.package", rr.getDefaultPackage());
+        assertEquals("pk_tables", rr.getMeaningfulPkTables());
+        assertEquals("com.example.naming", rr.getNamingStrategy());
+        assertTrue(rr.getSkipPrimaryKeyLoading());
+        assertTrue(rr.getSkipRelationshipsLoading());
+        assertEquals("strip", rr.getStripFromTableNames());
+        assertArrayEquals(new String[]{"table", "view", "alias"}, 
rr.getTableTypes());
+
+        assertTrue(rr.isForceDataMapCatalog());
+        assertTrue(rr.isForceDataMapSchema());
+        assertTrue(rr.isUseJava7Types());
+        assertFalse(rr.isUsePrimitives());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/FilterContainerTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/FilterContainerTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/FilterContainerTest.java
new file mode 100644
index 0000000..812fa18
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/FilterContainerTest.java
@@ -0,0 +1,121 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools.model;
+
+import groovy.lang.Closure;
+import org.apache.cayenne.dbsync.reverse.dbimport.Catalog;
+import org.apache.cayenne.dbsync.reverse.dbimport.Schema;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class FilterContainerTest {
+
+    @Test
+    public void includeTableClosure() {
+        FilterContainer container = new FilterContainer();
+
+        container.includeTable(new Closure<IncludeTable>(container, container) 
{
+            public IncludeTable doCall(IncludeTable arg) {
+                assertNotNull(arg);
+                arg.name("table_from_closure");
+                return arg;
+            }
+        });
+
+        Schema schema = new Schema();
+        container.fillContainer(schema);
+        assertEquals(1, schema.getIncludeTables().size());
+        assertEquals("table_from_closure", 
schema.getIncludeTables().iterator().next().getPattern());
+    }
+
+    @Test
+    public void includeTableNameAndClosure() {
+        FilterContainer container = new FilterContainer();
+
+        container.includeTable("start_name", new 
Closure<IncludeTable>(container, container) {
+            public IncludeTable doCall(IncludeTable arg) {
+                assertNotNull(arg);
+                assertEquals("start_name", arg.getPattern());
+                arg.name("table_from_closure");
+                return arg;
+            }
+        });
+
+        Schema schema = new Schema();
+        container.fillContainer(schema);
+        assertEquals(1, schema.getIncludeTables().size());
+        assertEquals("table_from_closure", 
schema.getIncludeTables().iterator().next().getPattern());
+    }
+
+
+    @Test
+    public void fillContainer() throws Exception {
+
+        Catalog catalog = new Catalog();
+
+        FilterContainer container = new FilterContainer();
+        container.setName("name");
+
+        container.includeTable("table1");
+        container.includeTables("table2", "table3");
+
+        container.excludeTable("table4");
+        container.excludeTables("table5", "table6");
+
+        container.includeColumn("column1");
+        container.includeColumns("column2", "column3");
+
+        container.excludeColumn("column4");
+        container.excludeColumns("column5", "collum6");
+
+        container.includeProcedure("proc1");
+        container.includeProcedures("proc2", "proc3");
+
+        container.excludeProcedure("proc4");
+        container.excludeProcedures("proc5", "proc6");
+
+        container.fillContainer(catalog);
+
+        assertEquals("name", catalog.getName());
+        assertEquals(3, catalog.getIncludeTables().size());
+        assertEquals("table1", 
catalog.getIncludeTables().iterator().next().getPattern());
+
+        assertEquals(3, catalog.getExcludeTables().size());
+        assertEquals("table4", 
catalog.getExcludeTables().iterator().next().getPattern());
+
+        assertEquals(3, catalog.getIncludeColumns().size());
+        assertEquals("column1", 
catalog.getIncludeColumns().iterator().next().getPattern());
+
+        assertEquals(3, catalog.getExcludeColumns().size());
+        assertEquals("column4", 
catalog.getExcludeColumns().iterator().next().getPattern());
+
+        assertEquals(3, catalog.getIncludeProcedures().size());
+        assertEquals("proc1", 
catalog.getIncludeProcedures().iterator().next().getPattern());
+
+        assertEquals(3, catalog.getExcludeProcedures().size());
+        assertEquals("proc4", 
catalog.getExcludeProcedures().iterator().next().getPattern());
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/IncludeTableTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/IncludeTableTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/IncludeTableTest.java
new file mode 100644
index 0000000..2d95cf9
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/IncludeTableTest.java
@@ -0,0 +1,95 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools.model;
+
+import java.util.Collection;
+
+import org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn;
+import org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class IncludeTableTest {
+
+    @Test
+    public void includeColumn() throws Exception {
+        IncludeTable table = new IncludeTable("name");
+        table.includeColumn("column1");
+        table.includeColumn("column2");
+        table.includeColumn("column2");
+
+        Collection<IncludeColumn> columns = 
table.toIncludeTable().getIncludeColumns();
+        assertNotNull(columns);
+        assertEquals(3, columns.size());
+        assertEquals("column1", columns.iterator().next().getPattern());
+    }
+
+    @Test
+    public void includeColumns() throws Exception {
+        IncludeTable table = new IncludeTable("name");
+        table.includeColumns("column1", "column2", "column2");
+
+        Collection<IncludeColumn> columns = 
table.toIncludeTable().getIncludeColumns();
+        assertNotNull(columns);
+        assertEquals(3, columns.size());
+        assertEquals("column1", columns.iterator().next().getPattern());
+    }
+
+    @Test
+    public void excludeColumn() throws Exception {
+        IncludeTable table = new IncludeTable("name");
+        table.excludeColumn("column1");
+        table.excludeColumn("column2");
+        table.excludeColumn("column2");
+
+        Collection<ExcludeColumn> columns = 
table.toIncludeTable().getExcludeColumns();
+        assertNotNull(columns);
+        assertEquals(3, columns.size());
+        assertEquals("column1", columns.iterator().next().getPattern());
+    }
+
+    @Test
+    public void excludeColumns() throws Exception {
+        IncludeTable table = new IncludeTable("name");
+        table.excludeColumns("column1", "column2", "column2");
+
+        Collection<ExcludeColumn> columns = 
table.toIncludeTable().getExcludeColumns();
+        assertNotNull(columns);
+        assertEquals(3, columns.size());
+        assertEquals("column1", columns.iterator().next().getPattern());
+    }
+
+    @Test
+    public void toIncludeTable() throws Exception {
+        IncludeTable table = new IncludeTable("name");
+        table.includeColumns("column1", "column2");
+        table.excludeColumns("column3", "column4", "column5");
+
+        org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable rrTable = 
table.toIncludeTable();
+        assertEquals("name", rrTable.getPattern());
+        assertEquals(2, rrTable.getIncludeColumns().size());
+        assertEquals(3, rrTable.getExcludeColumns().size());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/PatternParamTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/PatternParamTest.java
 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/PatternParamTest.java
new file mode 100644
index 0000000..93fa12c
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/model/PatternParamTest.java
@@ -0,0 +1,79 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools.model;
+
+import org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn;
+import org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure;
+import org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable;
+import org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn;
+import org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @since 4.0
+ */
+public class PatternParamTest {
+
+    private PatternParam param;
+
+    @Before
+    public void createNewPatternParam() {
+        param = new PatternParam("test");
+    }
+
+    @Test
+    public void toExcludeTable() throws Exception {
+        ExcludeTable table = param.toExcludeTable();
+        assertNotNull(table);
+        assertEquals("test", table.getPattern());
+    }
+
+    @Test
+    public void toIncludeColumn() throws Exception {
+        IncludeColumn table = param.toIncludeColumn();
+        assertNotNull(table);
+        assertEquals("test", table.getPattern());
+    }
+
+    @Test
+    public void toExcludeColumn() throws Exception {
+        ExcludeColumn table = param.toExcludeColumn();
+        assertNotNull(table);
+        assertEquals("test", table.getPattern());
+    }
+
+    @Test
+    public void toIncludeProcedure() throws Exception {
+        IncludeProcedure table = param.toIncludeProcedure();
+        assertNotNull(table);
+        assertEquals("test", table.getPattern());
+    }
+
+    @Test
+    public void toExcludeProcedure() throws Exception {
+        ExcludeProcedure table = param.toExcludeProcedure();
+        assertNotNull(table);
+        assertEquals("test", table.getPattern());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
new file mode 100644
index 0000000..9cbe90d
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_custom.gradle
@@ -0,0 +1,41 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+task customCdbgen(type: cayenne.cdbgen) {
+    map = dataMap
+
+    adapter = "org.apache.cayenne.dba.derby.DerbyAdapter"
+
+    dataSource {
+        username = 'sa'
+        password = ''
+        url = 'jdbc:derby:build/testdb;create=true'
+        driver = 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+
+    dropTables true
+    dropPK = true
+    createTables false
+    createPK = false
+    createFK false
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_failure.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_failure.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_failure.gradle
new file mode 100644
index 0000000..36efa18
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_failure.gradle
@@ -0,0 +1,22 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_simple.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_simple.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_simple.gradle
new file mode 100644
index 0000000..1e1bc25
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cdbgen_simple.gradle
@@ -0,0 +1,35 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+cdbgen {
+    map dataMap
+
+    adapter "org.apache.cayenne.dba.derby.DerbyAdapter"
+
+    dataSource {
+        username 'sa'
+        password ''
+        url dbUrl + ';create=true'
+        driver 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
new file mode 100644
index 0000000..8cdd8f0
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_custom_config.gradle
@@ -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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+cgen {
+    map = dataMap
+    destDir = './customDirectory'
+    makePairs = false
+    outputPattern = '*.groovy'
+    excludeEntities = 'Artist'
+    overwrite = false
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
new file mode 100644
index 0000000..863e3e7
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/cgen_default_config.gradle
@@ -0,0 +1,27 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+cgen {
+    map = dataMap
+    destDir = './'
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_empty_db.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_empty_db.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_empty_db.gradle
new file mode 100644
index 0000000..b7a75bb
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_empty_db.gradle
@@ -0,0 +1,35 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+cdbimport {
+    map 'datamap.map.xml'
+
+    adapter 'org.apache.cayenne.dba.derby.DerbyAdapter'
+
+    dataSource {
+        username 'sa'
+        password ''
+        url 'jdbc:derby:build/testdb;create=true'
+        driver 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_failure.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_failure.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_failure.gradle
new file mode 100644
index 0000000..36efa18
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_failure.gradle
@@ -0,0 +1,22 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_simple_db.gradle
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_simple_db.gradle
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_simple_db.gradle
new file mode 100644
index 0000000..f42e663
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/dbimport_simple_db.gradle
@@ -0,0 +1,39 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+plugins {
+    id 'org.apache.cayenne'
+}
+
+cdbimport {
+    map 'datamap.map.xml'
+
+    adapter 'org.apache.cayenne.dba.derby.DerbyAdapter'
+
+    dataSource {
+        username 'sa'
+        password ''
+        url dbUrl
+        driver 'org.apache.derby.jdbc.EmbeddedDriver'
+    }
+
+    dbImport {
+        excludeTable 'PAINTING1'
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_datamap.map.xml
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_datamap.map.xml
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_datamap.map.xml
new file mode 100644
index 0000000..507875f
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_datamap.map.xml
@@ -0,0 +1,44 @@
+<?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/9/modelMap";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap 
http://cayenne.apache.org/schema/9/modelMap.xsd";
+          project-version="9">
+
+    <property name="defaultPackage" value="org.example.cayenne.persistent"/>
+    <property name="defaultClientPackage" value="tmp"/>
+    <db-entity name="City">
+        <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+        <db-attribute name="name" type="VARCHAR" length="255"/>
+    </db-entity>
+    <db-entity name="artist">
+        <db-attribute name="birth_date" type="DATE"/>
+        <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+        <db-attribute name="name" type="VARCHAR" length="255"/>
+    </db-entity>
+    <obj-entity name="City" className="org.example.cayenne.persistent.City" 
dbEntityName="City">
+        <obj-attribute name="name" type="java.lang.String" 
db-attribute-path="name"/>
+    </obj-entity>
+    <obj-entity name="Artist" 
className="org.example.cayenne.persistent.Artist" clientClassName="tmp.Artist" 
dbEntityName="artist">
+        <obj-attribute name="birthDate" type="java.util.Date" 
db-attribute-path="birth_date"/>
+        <obj-attribute name="name" type="java.lang.String" 
db-attribute-path="name"/>
+    </obj-entity>
+
+</data-map>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_map_db.sql
----------------------------------------------------------------------
diff --git 
a/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_map_db.sql
 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_map_db.sql
new file mode 100644
index 0000000..82c8d79
--- /dev/null
+++ 
b/cayenne-gradle-plugin/src/test/resources/org/apache/cayenne/tools/test_map_db.sql
@@ -0,0 +1,53 @@
+--  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.
+
+-- Test Schema for dbimport task test
+
+CREATE TABLE ARTIST (ARTIST_ID BIGINT  NOT NULL, ARTIST_NAME CHAR (254) NOT 
NULL, DATE_OF_BIRTH DATE , PRIMARY KEY (ARTIST_ID));
+CREATE TABLE NULL_TEST (ID INTEGER  NOT NULL GENERATED BY DEFAULT AS IDENTITY, 
NAME VARCHAR (100), PRIMARY KEY (ID));
+CREATE TABLE ARTIST_CT (ARTIST_ID INTEGER  NOT NULL, ARTIST_NAME CHAR (254) 
NOT NULL, DATE_OF_BIRTH DATE , PRIMARY KEY (ARTIST_ID));
+CREATE TABLE GENERATED_COLUMN (GENERATED_COLUMN INTEGER  NOT NULL GENERATED BY 
DEFAULT AS IDENTITY, NAME VARCHAR (250), PRIMARY KEY (GENERATED_COLUMN));
+CREATE TABLE GALLERY (GALLERY_ID INTEGER  NOT NULL, GALLERY_NAME VARCHAR (100) 
NOT NULL, PRIMARY KEY (GALLERY_ID));
+CREATE TABLE PAINTING1 (ARTIST_ID BIGINT , ESTIMATED_PRICE DECIMAL (10, 2), 
GALLERY_ID INTEGER , PAINTING_ID INTEGER  NOT NULL, PAINTING_TITLE VARCHAR 
(255) NOT NULL, PRIMARY KEY (PAINTING_ID));
+CREATE TABLE ARTGROUP (GROUP_ID INTEGER  NOT NULL, NAME VARCHAR (100) NOT 
NULL, PARENT_GROUP_ID INTEGER , PRIMARY KEY (GROUP_ID));
+CREATE TABLE EXHIBIT (CLOSING_DATE TIMESTAMP  NOT NULL, EXHIBIT_ID INTEGER  
NOT NULL, GALLERY_ID INTEGER  NOT NULL, OPENING_DATE TIMESTAMP  NOT NULL, 
PRIMARY KEY (EXHIBIT_ID));
+CREATE TABLE ARTIST_GROUP (ARTIST_ID BIGINT  NOT NULL, GROUP_ID INTEGER  NOT 
NULL, PRIMARY KEY (ARTIST_ID, GROUP_ID));
+CREATE TABLE PAINTING (ARTIST_ID BIGINT , ESTIMATED_PRICE DECIMAL (10, 2), 
GALLERY_ID INTEGER , PAINTING_DESCRIPTION VARCHAR (255), PAINTING_ID INTEGER  
NOT NULL, PAINTING_TITLE VARCHAR (255) NOT NULL, PRIMARY KEY (PAINTING_ID));
+CREATE TABLE ARTIST_EXHIBIT (ARTIST_ID BIGINT  NOT NULL, EXHIBIT_ID INTEGER  
NOT NULL, PRIMARY KEY (ARTIST_ID, EXHIBIT_ID));
+CREATE TABLE PAINTING_INFO (IMAGE_BLOB LONG VARCHAR FOR BIT DATA , PAINTING_ID 
INTEGER  NOT NULL, TEXT_REVIEW LONG VARCHAR , PRIMARY KEY (PAINTING_ID));
+
+ALTER TABLE PAINTING1 ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST 
(ARTIST_ID);
+ALTER TABLE ARTGROUP ADD FOREIGN KEY (PARENT_GROUP_ID) REFERENCES ARTGROUP 
(GROUP_ID);
+ALTER TABLE EXHIBIT ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY 
(GALLERY_ID);
+ALTER TABLE ARTIST_GROUP ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST 
(ARTIST_ID);
+ALTER TABLE ARTIST_GROUP ADD FOREIGN KEY (GROUP_ID) REFERENCES ARTGROUP 
(GROUP_ID);
+ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ARTIST_ID);
+ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY 
(GALLERY_ID);
+ALTER TABLE ARTIST_EXHIBIT ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST 
(ARTIST_ID);
+ALTER TABLE ARTIST_EXHIBIT ADD FOREIGN KEY (EXHIBIT_ID) REFERENCES EXHIBIT 
(EXHIBIT_ID);
+ALTER TABLE PAINTING_INFO ADD FOREIGN KEY (PAINTING_ID) REFERENCES PAINTING 
(PAINTING_ID);
+
+CREATE SEQUENCE PK_ARTGROUP AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_ARTIST AS BIGINT START WITH 200 INCREMENT BY 20 NO MAXVALUE 
NO CYCLE;
+CREATE SEQUENCE PK_ARTIST_CT AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_ARTIST_GROUP AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_EXHIBIT AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_GALLERY AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_GENERATED_COLUMN AS BIGINT START WITH 200 INCREMENT BY 20 
NO MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_NULL_TEST AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_PAINTING AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
+CREATE SEQUENCE PK_PAINTING1 AS BIGINT START WITH 200 INCREMENT BY 20 NO 
MAXVALUE NO CYCLE;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/docs/doc/pom.xml
----------------------------------------------------------------------
diff --git a/docs/doc/pom.xml b/docs/doc/pom.xml
index 6235672..44bdb0b 100644
--- a/docs/doc/pom.xml
+++ b/docs/doc/pom.xml
@@ -155,7 +155,7 @@
                        <plugin>
                                <artifactId>maven-javadoc-plugin</artifactId>
                                <configuration>
-                                       <!-- must use 
${project.build.directory}, as using relative path "target/sources" confuses 
the plugin -->
+                                       <!-- must use 
${projbuilduild.directory}, as using relative path "target/sources" confuses 
the plugin -->
                                        
<sourcepath>${project.build.directory}/sources</sourcepath>
 
                                        <!-- this is relative to 
target/site/apidocs  -->

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/modeler/cayenne-modeler-win/pom.xml
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win/pom.xml 
b/modeler/cayenne-modeler-win/pom.xml
index 61a4107..e39635a 100644
--- a/modeler/cayenne-modeler-win/pom.xml
+++ b/modeler/cayenne-modeler-win/pom.xml
@@ -80,7 +80,7 @@
        </build>
 
        <profiles>
-               <!-- Avoid assembly of Modeler on normal build -->
+               <!-- Avoid assembly of Modeler on norbuilduild -->
                <profile>
                        <id>windows</id>
                        <build>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/95f11997/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7f957cd..1f7065e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,7 @@
                <module>tutorials</module>
                <module>docs</module>
                <module>eventbridges</module>
+               <module>cayenne-gradle-plugin</module>
     </modules>
        <issueManagement>
                <system>jira</system>

Reply via email to