You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2017/01/31 07:38:05 UTC
[4/8] cayenne git commit: CAY-2214 cdbimport: rename
maven-cayenne-plugin - change module and folder name to
"cayenne-maven-plugin" - artifactId still is "maven-cayenne-plugin"
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorMojo.java b/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorMojo.java
deleted file mode 100644
index 72c524f..0000000
--- a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorMojo.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*****************************************************************
- * 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.access.DbGenerator;
-import org.apache.cayenne.datasource.DriverDataSource;
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.dbsync.DbSyncModule;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.DIBootstrap;
-import org.apache.cayenne.di.Injector;
-import org.apache.cayenne.log.NoopJdbcEventLogger;
-import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.MapLoader;
-import org.apache.cayenne.tools.configuration.ToolsModule;
-import org.apache.cayenne.util.Util;
-import org.apache.commons.logging.Log;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.xml.sax.InputSource;
-
-import java.io.File;
-import java.sql.Driver;
-
-/**
- * Maven mojo to perform class generation from data map. This class is a Maven
- * adapter to DefaultClassGenerator class.
- *
- * @since 3.0
- *
- * @phase pre-integration-test
- * @goal cdbgen
- */
-public class DbGeneratorMojo extends AbstractMojo {
-
- /**
- * DataMap XML file to use as a schema descriptor.
- *
- * @parameter map="map"
- * @required
- */
- private File map;
-
- /**
- * Java class implementing org.apache.cayenne.dba.DbAdapter. While this
- * attribute is optional (a generic JdbcAdapter is used if not set), it is
- * highly recommended to specify correct target adapter.
- *
- * @parameter adapter="adapter"
- */
- private String adapter;
-
- /**
- * A class of JDBC driver to use for the target database.
- *
- * @parameter driver="driver"
- * @required
- */
- private String driver;
-
- /**
- * JDBC connection URL of a target database.
- *
- * @parameter url="url"
- * @required
- */
- private String url;
-
- /**
- * Database user name.
- *
- * @parameter username="username"
- */
- private String username;
-
- /**
- * Database user password.
- *
- * @parameter password="password"
- */
- private String password;
-
- /**
- * Defines whether cdbgen should drop the tables before attempting to create
- * new ones. Default is <code>false</code>.
- *
- * @parameter dropTables="dropTables" default-value="false"
- */
- private boolean dropTables;
-
- /**
- * Defines whether cdbgen should drop Cayenne primary key support objects.
- * Default is <code>false</code>.
- *
- * @parameter dropPK="dropPK" default-value="false"
- */
- private boolean dropPK;
-
- /**
- * Defines whether cdbgen should create new tables. Default is
- * <code>true</code>.
- *
- * @parameter createTables="createTables" default-value="true"
- */
- private boolean createTables;
-
- /**
- * Defines whether cdbgen should create Cayenne-specific auto PK objects.
- * Default is <code>true</code>.
- *
- * @parameter createPK="createPK" default-value="true"
- */
- private boolean createPK;
-
- /**
- * Defines whether cdbgen should create foreign key copnstraints. Default is
- * <code>true</code>.
- *
- * @parameter createFK="createFK" default-value="true"
- */
- private boolean createFK;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
-
- Log logger = new MavenLogger(this);
- Injector injector = DIBootstrap.createInjector(new DbSyncModule(), new ToolsModule(logger));
- AdhocObjectFactory objectFactory = injector.getInstance(AdhocObjectFactory.class);
-
- logger.info(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver, url, username));
-
- logger.info(String.format(
- "generator options - [dropTables: %s, dropPK: %s, createTables: %s, createPK: %s, createFK: %s]",
- dropTables, dropPK, createTables, createPK, createFK));
-
- try {
- final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory.newInstance(DbAdapter.class,
- JdbcAdapter.class.getName()) : (DbAdapter) objectFactory.newInstance(DbAdapter.class, adapter);
-
- // Load the data map and run the db generator.
- DataMap dataMap = loadDataMap();
- DbGenerator generator = new DbGenerator(adapterInst, dataMap, NoopJdbcEventLogger.getInstance());
- generator.setShouldCreateFKConstraints(createFK);
- generator.setShouldCreatePKSupport(createPK);
- generator.setShouldCreateTables(createTables);
- generator.setShouldDropPKSupport(dropPK);
- generator.setShouldDropTables(dropTables);
-
- // load driver taking custom CLASSPATH into account...
- DriverDataSource dataSource = new DriverDataSource((Driver) Class.forName(driver).newInstance(), url,
- username, password);
-
- generator.runGenerator(dataSource);
- } catch (Exception ex) {
- Throwable th = Util.unwindException(ex);
-
- String message = "Error generating database";
-
- if (th.getLocalizedMessage() != null) {
- message += ": " + th.getLocalizedMessage();
- }
-
- logger.error(message);
- throw new MojoExecutionException(message, th);
- }
- }
-
- /** Loads and returns DataMap based on <code>map</code> attribute. */
- protected DataMap loadDataMap() throws Exception {
- InputSource in = new InputSource(map.getCanonicalPath());
- return new MapLoader().loadDataMap(in);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImportDataSourceConfig.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImportDataSourceConfig.java b/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImportDataSourceConfig.java
deleted file mode 100644
index 8fa4b56..0000000
--- a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImportDataSourceConfig.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************
- * 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;
-
-/**
- * @since 4.0
- */
-public class DbImportDataSourceConfig {
-
- /**
- * A class of JDBC driver to use for the target database.
- */
- private String driver;
-
- /**
- * JDBC connection URL of a target database.
- */
- private String url;
-
- /**
- * Database user name.
- */
- private String username;
-
- /**
- * Database user password.
- */
- private String password;
-
- public String getDriver() {
- return driver;
- }
-
- public String getUrl() {
- return url;
- }
-
- public String getUsername() {
- return username;
- }
-
- public String getPassword() {
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/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
deleted file mode 100644
index 9c9cddf..0000000
--- a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*****************************************************************
- * 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.dbimport.ReverseEngineering;
-import org.apache.cayenne.dbsync.DbSyncModule;
-import org.apache.cayenne.dbsync.reverse.filters.FiltersConfigBuilder;
-import org.apache.cayenne.di.DIBootstrap;
-import org.apache.cayenne.di.Injector;
-import org.apache.cayenne.tools.configuration.ToolsModule;
-import org.apache.cayenne.tools.dbimport.DbImportAction;
-import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
-import org.apache.cayenne.tools.dbimport.DbImportModule;
-import org.apache.cayenne.util.Util;
-import org.apache.commons.logging.Log;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-
-import java.io.File;
-
-/**
- * Maven mojo to reverse engineer datamap from DB.
- *
- * @since 3.0
- */
-@Mojo(name = "cdbimport", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
-public class DbImporterMojo extends AbstractMojo {
-
- /**
- * Java class implementing org.apache.cayenne.dba.DbAdapter. This attribute
- * is optional, the default is AutoAdapter, i.e. Cayenne would try to guess
- * the DB type.
- */
- @Parameter(defaultValue = "org.apache.cayenne.dba.AutoAdapter")
- private String adapter;
-
- /**
- * Connection properties.
- *
- * @see DbImportDataSourceConfig
- * @since 4.0
- */
- @Parameter(required = true)
- private DbImportDataSourceConfig dataSource = new DbImportDataSourceConfig();
-
- /**
- * DataMap XML file to use as a base for DB importing.
- */
- @Parameter(required = true)
- private File map;
-
- /**
- * An object that contains reverse engineering rules.
- */
- @Parameter(name = "dbimport", property = "dbimport", alias = "dbImport")
- private ReverseEngineering dbImportConfig = new ReverseEngineering();
-
- /**
- * @deprecated use {@code <dataSource>} tag to set connection properties
- */
- @Deprecated @Parameter(name = "url", property = "url")
- private final String oldUrl = ""; // TODO remove in 4.0.BETA
-
- /**
- * @deprecated moved to {@code <dbimport>} section
- */
- @Deprecated @Parameter(name = "meaningfulPkTables", property = "meaningfulPkTables")
- private final String oldMeaningfulPkTables = ""; // TODO remove in 4.0.BETA
-
- /**
- * @deprecated use {@code <dataSource>} tag to set connection properties
- */
- @Deprecated @Parameter(name = "driver", property = "driver")
- private final String oldDriver = ""; // TODO remove in 4.0.BETA
-
- /**
- * @deprecated moved to {@code <dbimport>} section
- */
- @Deprecated @Parameter(name = "defaultPackage", property = "defaultPackage")
- private final String oldDefaultPackage = ""; // TODO remove in 4.0.BETA
-
-
- public void execute() throws MojoExecutionException, MojoFailureException {
-
- Log logger = new MavenLogger(this);
-
- DbImportConfiguration config = createConfig(logger);
- Injector injector = DIBootstrap.createInjector(
- new DbSyncModule(), new ToolsModule(logger), new DbImportModule());
-
- DbImportConfigurationValidator validator = new DbImportConfigurationValidator(
- dbImportConfig, config, injector);
- try {
- validator.validate();
- } catch (Exception ex) {
- throw new MojoExecutionException(ex.getMessage(), ex);
- }
-
- try {
- injector.getInstance(DbImportAction.class).execute(config);
- } catch (Exception ex) {
- Throwable th = Util.unwindException(ex);
-
- String message = "Error importing database schema";
-
- if (th.getLocalizedMessage() != null) {
- message += ": " + th.getLocalizedMessage();
- }
-
- getLog().error(message);
- throw new MojoExecutionException(message, th);
- }
- }
-
- DbImportConfiguration createConfig(Log logger) {
-
- DbImportConfiguration config = new DbImportConfiguration();
- config.setAdapter(adapter);
- config.setDefaultPackage(dbImportConfig.getDefaultPackage());
- config.setDriver(dataSource.getDriver());
- config.setFiltersConfig(new FiltersConfigBuilder(dbImportConfig).build());
- config.setForceDataMapCatalog(dbImportConfig.isForceDataMapCatalog());
- config.setForceDataMapSchema(dbImportConfig.isForceDataMapSchema());
- config.setLogger(logger);
- config.setMeaningfulPkTables(dbImportConfig.getMeaningfulPkTables());
- config.setNamingStrategy(dbImportConfig.getNamingStrategy());
- config.setPassword(dataSource.getPassword());
- config.setSkipRelationshipsLoading(dbImportConfig.getSkipRelationshipsLoading());
- config.setSkipPrimaryKeyLoading(dbImportConfig.getSkipPrimaryKeyLoading());
- config.setStripFromTableNames(dbImportConfig.getStripFromTableNames());
- config.setTableTypes(dbImportConfig.getTableTypes());
- config.setTargetDataMap(map);
- config.setUrl(dataSource.getUrl());
- config.setUsername(dataSource.getUsername());
- config.setUsePrimitives(dbImportConfig.isUsePrimitives());
-
- return config;
- }
-
- public File getMap() {
- return map;
- }
-
- /**
- * Used only in tests, Maven will inject value directly into the "map" field
- */
- public void setMap(File map) {
- this.map = map;
- }
-
- /**
- * This setter is used by Maven when defined {@code <dbimport>} tag
- */
- public void setDbimport(ReverseEngineering dbImportConfig) {
- this.dbImportConfig = dbImportConfig;
- }
-
- /**
- * This setter is used by Maven {@code <dbImport>} tag
- */
- public void setDbImport(ReverseEngineering dbImportConfig) {
- this.dbImportConfig = dbImportConfig;
- }
-
- public ReverseEngineering getReverseEngineering() {
- return dbImportConfig;
- }
-
- // TODO \u2b07\u2b07\u2b07 All following setters should be removed in 4.0.BETA \u2b07\u2b07\u2b07
- @Deprecated
- public void setUrl(String url) {
- throw new UnsupportedOperationException("Connection properties were replaced with <dataSource> tag since 4.0.M5.\n\tFor additional information see http://cayenne.apache.org/docs/4.0/cayenne-guide/including-cayenne-in-project.html#maven-projects");
- }
-
- @Deprecated
- public void setDriver(String driver) {
- throw new UnsupportedOperationException("Connection properties were replaced with <dataSource> tag since 4.0.M5.\n\tFor additional information see http://cayenne.apache.org/docs/4.0/cayenne-guide/including-cayenne-in-project.html#maven-projects");
- }
-
- @Deprecated
- public void setMeaningfulPkTables(String meaningfulPkTables) {
- throw new UnsupportedOperationException("meaningfulPkTables property has been moved to <dbimport> tag since 4.0.M5.\n\tFor additional information see http://cayenne.apache.org/docs/4.0/cayenne-guide/including-cayenne-in-project.html#maven-projects");
- }
-
- @Deprecated
- public void setDefaultPackage(String defaultPackage) {
- throw new UnsupportedOperationException("defaultPackage property has been deprecated since 4.0.M5.\n\tFor additional information see http://cayenne.apache.org/docs/4.0/cayenne-guide/including-cayenne-in-project.html#maven-projects");
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/MavenLogger.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/MavenLogger.java b/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/MavenLogger.java
deleted file mode 100644
index c439f98..0000000
--- a/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/MavenLogger.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************
- * 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.maven.plugin.AbstractMojo;
-
-/**
- * @since 3.0
- */
-class MavenLogger implements org.apache.commons.logging.Log {
-
- private org.apache.maven.plugin.logging.Log logger;
-
- public MavenLogger(AbstractMojo parent) {
- this.logger = parent.getLog();
- }
-
- public void debug(Object message, Throwable th) {
- logger.debug(String.valueOf(message), th);
- }
-
- public void debug(Object message) {
- logger.debug(String.valueOf(message));
- }
-
- public void error(Object message, Throwable th) {
- logger.error(String.valueOf(message), th);
- }
-
- public void error(Object message) {
- logger.error(String.valueOf(message));
- }
-
- public void fatal(Object message, Throwable th) {
- logger.error(String.valueOf(message), th);
- }
-
- public void fatal(Object message) {
- logger.error(String.valueOf(message));
- }
-
- public void info(Object message, Throwable th) {
- logger.info(String.valueOf(message), th);
- }
-
- public void info(Object message) {
- logger.info(String.valueOf(message));
- }
-
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
- }
-
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled();
- }
-
- public boolean isFatalEnabled() {
- return logger.isErrorEnabled();
- }
-
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled();
- }
-
- public boolean isTraceEnabled() {
- return logger.isDebugEnabled();
- }
-
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled();
- }
-
- public void trace(Object message, Throwable th) {
- logger.debug(String.valueOf(message), th);
- }
-
- public void trace(Object message) {
- logger.debug(String.valueOf(message));
- }
-
- public void warn(Object message, Throwable th) {
- logger.warn(String.valueOf(message), th);
- }
-
- public void warn(Object message) {
- logger.warn(String.valueOf(message));
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/plugins/maven-cayenne-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
deleted file mode 100644
index e5de2d0..0000000
--- a/plugins/maven-cayenne-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- 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.
--->
-<lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <goals>
- <goal>cgen</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute>
- <runOnIncremental>true</runOnIncremental>
- <runOnConfiguration>true</runOnConfiguration>
- </execute>
- </action>
- </pluginExecution>
- </pluginExecutions>
-</lifecycleMappingMetadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
deleted file mode 100644
index 734e93c..0000000
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************
- * 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.commons.io.FileUtils;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-
-import java.io.File;
-
-public class CayenneGeneratorMojoTest extends AbstractMojoTestCase {
-
- public void testCgenExecution() throws Exception {
-
- File pom = getTestFile("src/test/resources/cgen/project-to-test/pom.xml");
- assertNotNull(pom);
- assertTrue(pom.exists());
-
- CayenneGeneratorMojo myMojo = (CayenneGeneratorMojo) lookupMojo("cgen",
- pom);
- assertNotNull(myMojo);
- myMojo.execute();
-
- File superTestEntity = new File(
- "target/cayenneGeneratedClasses/superPkg/_TestEntity.txt");
- File testEntity = new File(
- "target/cayenneGeneratedClasses/pack/TestEntity.txt");
-
- File superEmbeddable = new File(
- "target/cayenneGeneratedClasses/superPkg/_Embeddable.txt");
- File embeddable = new File(
- "target/cayenneGeneratedClasses/pack/Embeddable.txt");
-
- File superNotIncludedEntity = new File(
- "target/cayenneGeneratedClasses/pack/_NotIncludedEntity.txt");
-
- File notIncludedEntity = new File(
- "target/cayenneGeneratedClasses/pack/NotIncludedEntity.txt");
-
- File superExcludedEntity = new File(
- "target/cayenneGeneratedClasses/pack/_TestExcludedEntity.txt");
- File excludedEntity = new File(
- "target/cayenneGeneratedClasses/pack/TestExcludedEntity.txt");
-
- assertTrue(superTestEntity.exists());
- assertTrue(testEntity.exists());
-
- assertTrue(superEmbeddable.exists());
- assertTrue(embeddable.exists());
-
- assertFalse(superNotIncludedEntity.exists());
- assertFalse(notIncludedEntity.exists());
-
- assertFalse(superExcludedEntity.exists());
- assertFalse(excludedEntity.exists());
-
- String content = FileUtils.readFileToString(superTestEntity);
- assertTrue(content.contains("public static final Property<List<TestRelEntity>> ADDITIONAL_REL = Property.create(\"additionalRel\", List.class);"));
- assertTrue(content.contains("public void addToAdditionalRel(TestRelEntity obj)"));
- assertTrue(content.contains("public void removeFromAdditionalRel(TestRelEntity obj)"));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
deleted file mode 100644
index 5b871f6..0000000
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoConfigurationTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************
- * 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.dbimport.Catalog;
-import org.apache.cayenne.dbimport.Schema;
-import org.apache.cayenne.dbsync.reverse.filters.FiltersConfig;
-import org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter;
-import org.apache.cayenne.dbsync.reverse.filters.PatternFilter;
-import org.apache.cayenne.dbsync.reverse.filters.TableFilter;
-import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeSet;
-import java.util.regex.Pattern;
-
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertCatalog;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertCatalogAndSchema;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertFlat;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertSchemaContent;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertSkipPrimaryKeyLoading;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertSkipRelationshipsLoading;
-import static org.apache.cayenne.dbimport.DefaultReverseEngineeringLoaderTest.assertTableTypes;
-import static org.mockito.Mockito.mock;
-
-public class DbImporterMojoConfigurationTest extends AbstractMojoTestCase {
-
- @Test
- public void testLoadCatalog() throws Exception {
- Map<String, Catalog> catalogs = new HashMap<>();
- for (Catalog c : getCdbImport("pom-catalog.xml").getReverseEngineering().getCatalogs()) {
- catalogs.put(c.getName(), c);
- }
-
- assertEquals(3, catalogs.size());
- Catalog c3 = catalogs.get("catalog-name-03");
- assertNotNull(c3);
- assertCatalog(c3);
- }
-
- @Test
- public void testLoadSchema() throws Exception {
- Map<String, Schema> schemas = new HashMap<>();
- for (Schema s : getCdbImport("pom-schema.xml").getReverseEngineering().getSchemas()) {
- schemas.put(s.getName(), s);
- }
-
- assertEquals(3, schemas.size());
- Schema s3 = schemas.get("schema-name-03");
- assertNotNull(s3);
- assertSchemaContent(s3);
- }
-
- @Test
- public void testLoadSchema2() throws Exception {
- FiltersConfig filters = getCdbImport("pom-schema-2.xml").createConfig(mock(Log.class))
- .getDbLoaderConfig().getFiltersConfig();
-
- TreeSet<IncludeTableFilter> includes = new TreeSet<>();
- includes.add(new IncludeTableFilter(null, new PatternFilter().exclude("^ETL_.*")));
-
- TreeSet<Pattern> excludes = new TreeSet<>(PatternFilter.PATTERN_COMPARATOR);
- excludes.add(PatternFilter.pattern("^ETL_.*"));
-
- assertEquals(filters.tableFilter(null, "NHL_STATS"),
- new TableFilter(includes, excludes));
- }
-
- @Test
- public void testLoadCatalogAndSchema() throws Exception {
- assertCatalogAndSchema(getCdbImport("pom-catalog-and-schema.xml").getReverseEngineering());
- }
-
- @Test
- public void testDefaultPackage() throws Exception {
- DbImportConfiguration config = getCdbImport("pom-default-package.xml").createConfig(mock(Log.class));
- assertEquals("com.example.test", config.getDefaultPackage());
- }
-
- @Test
- public void testLoadFlat() throws Exception {
- assertFlat(getCdbImport("pom-flat.xml").getReverseEngineering());
- }
-
- @Test
- public void testSkipRelationshipsLoading() throws Exception {
- assertSkipRelationshipsLoading(getCdbImport("pom-skip-relationships-loading.xml").getReverseEngineering());
- }
-
- @Test
- public void testSkipPrimaryKeyLoading() throws Exception {
- assertSkipPrimaryKeyLoading(getCdbImport("pom-skip-primary-key-loading.xml").getReverseEngineering());
- }
-
- @Test
- public void testTableTypes() throws Exception {
- assertTableTypes(getCdbImport("pom-table-types.xml").getReverseEngineering());
- }
-
- private DbImporterMojo getCdbImport(String pomFileName) throws Exception {
- return (DbImporterMojo) lookupMojo("cdbimport",
- getTestFile("src/test/resources/org/apache/cayenne/tools/config/" + pomFileName));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/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
deleted file mode 100644
index 7d8cbfe..0000000
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*****************************************************************
- * 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.dbimport.Catalog;
-import org.apache.cayenne.dbimport.IncludeTable;
-import org.apache.cayenne.dbimport.Schema;
-import org.apache.cayenne.test.jdbc.SQLReader;
-import org.apache.cayenne.test.resource.ResourceUtil;
-import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codehaus.plexus.util.FileUtils;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.ElementNameAndAttributeQualifier;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-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 java.util.Objects;
-
-import static org.apache.commons.lang.StringUtils.isBlank;
-import static org.mockito.Mockito.mock;
-
-
-public class DbImporterMojoTest extends AbstractMojoTestCase {
-
- private static DerbyManager derbyAssembly;
-
- static {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
- @BeforeClass
- public static void beforeClass() throws IOException, SQLException {
- derbyAssembly = new DerbyManager("target/derby");
- }
-
- @AfterClass
- public static void afterClass() throws IOException, SQLException {
- derbyAssembly.shutdown();
- derbyAssembly = null;
- }
-
- @Test
- public void testToParameters_MeaningfulPkTables() throws Exception {
-
- DbImportConfiguration parameters1 = getCdbImport("dbimporter-pom1.xml").createConfig(mock(Log.class));
- assertNull(parameters1.getMeaningfulPkTables());
- assertPathEquals("target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml", parameters1.getTargetDataMap()
- .getPath());
-
- assertEquals("x,b*", getCdbImport("dbimporter-pom2.xml").createConfig(mock(Log.class)).getMeaningfulPkTables());
- assertEquals("*", getCdbImport("dbimporter-pom3.xml").createConfig(mock(Log.class)).getMeaningfulPkTables());
- }
-
- public void testToParameters_Map() throws Exception {
-
- DbImportConfiguration parameters1 = getCdbImport("dbimporter-pom1.xml").createConfig(mock(Log.class));
- assertNotNull(parameters1.getTargetDataMap());
- assertPathEquals("target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml", parameters1.getTargetDataMap()
- .getPath());
-
- assertNull(getCdbImport("dbimporter-pom2.xml").createConfig(mock(Log.class)).getTargetDataMap());
- }
-
- private DbImporterMojo getCdbImport(String pomFileName) throws Exception {
- return (DbImporterMojo) lookupMojo("cdbimport",
- getTestFile("src/test/resources/org/apache/cayenne/tools/" + pomFileName));
- }
-
- private void assertPathEquals(String expectedPath, String actualPath) {
- assertEquals(new File(expectedPath), new File(actualPath));
- }
-
- @Test
- public void testImportNewDataMap() throws Exception {
- test("testImportNewDataMap");
- }
-
- @Test
- public void testImportWithoutChanges() throws Exception {
- test("testImportWithoutChanges");
- }
-
- @Test
- public void testImportAddTableAndColumn() throws Exception {
- test("testImportAddTableAndColumn");
- }
-
- @Test
- public void testFilteringWithSchema() throws Exception {
- test("testFilteringWithSchema");
- }
-
- @Test
- public void testSchemasAndTableExclude() throws Exception {
- test("testSchemasAndTableExclude");
- }
-
- @Test
- public void testViewsExclude() throws Exception {
- test("testViewsExclude");
- }
-
- @Test
- public void testTableTypes() throws Exception {
- test("testTableTypes");
- }
-
- @Test
- public void testDefaultPackage() throws Exception {
- test("testDefaultPackage");
- }
-
- @Test
- public void testSkipRelationshipsLoading() throws Exception {
- test("testSkipRelationshipsLoading");
- }
-
- @Test
- public void testSkipPrimaryKeyLoading() throws Exception {
- test("testSkipPrimaryKeyLoading");
- }
-
- @Test
- public void testOneToOne() throws Exception {
- test("testOneToOne");
- }
-
- /**
- * Q: what happens if an attribute or relationship is unmapped in the object layer, but then the underlying table
- * changes.
- * A: it should not recreate unmapped attributes/relationships. Only add an attribute for the new column.
- *
- * @throws Exception
- */
- @Test
- public void testPreserveCustomObjMappings() throws Exception {
- test("testPreserveCustomObjMappings");
- }
-
- /**
- * Q: what happens if a relationship existed over a column that was later deleted? and \u2018skipRelLoading\u2019 is true
- * A: it should remove relationship and column
- *
- * @throws Exception
- */
- @Test
- public void testPreserveRelationships() throws Exception {
- test("testPreserveRelationships");
- }
-
- /**
- * By default many-to-many are flattened during reverse engineering.
- * But if a user un-flattens a given N:M manually, we\u2019d like this choice to be preserved on the next run
- */
- @Test
- public void testUnFlattensManyToMany() throws Exception {
- // TODO: this should be "xYs" : <db-relationship name="xIes"
- test("testUnFlattensManyToMany");
- }
-
- /**
- * Make sure any merges preserve custom object layer settings, like "usePrimitives", PK mapping as attribute, etc.
- */
- @Test
- public void testCustomObjectLayerSettings() throws Exception {
- test("testCustomObjectLayerSettings");
- }
-
- @Test
- public void testDbAttributeChange() throws Exception {
- test("testDbAttributeChange");
- }
-
- @Test
- public void testForceDataMapSchema() throws Exception {
- test("testForceDataMapSchema");
- }
-
- @Test
- public void testComplexChangeOrder() throws Exception {
- test("testComplexChangeOrder");
- }
-
- /**
- * CREATE TABLE APP.A (
- * id INTEGER NOT NULL,
- * <p>
- * PRIMARY KEY (id)
- * );
- * <p>
- * CREATE TABLE APP.A_A (
- * A1_ID INTEGER NOT NULL,
- * A2_ID INTEGER NOT NULL,
- * <p>
- * PRIMARY KEY (A1_ID, A2_ID),
- * CONSTRAINT A_A1 FOREIGN KEY (A1_ID) REFERENCES APP.A (ID),
- * CONSTRAINT A_A2 FOREIGN KEY (A2_ID) REFERENCES APP.A (ID)
- * );
- * <p>
- * If one table has many-to-many relationship with it self ObjEntity should have two
- * collection attributes in both directions
- *
- * @throws Exception
- */
- @Test
- @Ignore("Investigate why on different environment entity relationships order are different.")
- public void te_stFlattensManyToManyWithRecursiveLink() throws Exception {
- test("testFlattensManyToManyWithRecursiveLink");
- }
-
- @Test
- public void testFkAttributeRename() throws Exception {
- test("testFkAttributeRename");
- }
-
- @Test
- public void testFilteringConfig() throws Exception {
- DbImporterMojo cdbImport = getCdbImport("config/pom-01.xml");
-
- assertEquals(2, cdbImport.getReverseEngineering().getCatalogs().size());
- Iterator<Catalog> iterator = cdbImport.getReverseEngineering().getCatalogs().iterator();
- assertEquals("catalog-name-01", iterator.next().getName());
-
- Catalog catalog = iterator.next();
- assertEquals("catalog-name-02", catalog.getName());
- Iterator<Schema> schemaIterator = catalog.getSchemas().iterator();
-
- assertEquals("schema-name-01", schemaIterator.next().getName());
-
- Schema schema = schemaIterator.next();
- assertEquals("schema-name-02", schema.getName());
-
- Iterator<IncludeTable> includeTableIterator = schema.getIncludeTables().iterator();
- assertEquals("incTable-01", includeTableIterator.next().getPattern());
-
- IncludeTable includeTable = includeTableIterator.next();
- assertEquals("incTable-02", includeTable.getPattern());
- assertEquals("includeColumn-01", includeTable.getIncludeColumns().iterator().next().getPattern());
- assertEquals("excludeColumn-01", includeTable.getExcludeColumns().iterator().next().getPattern());
-
- assertEquals("includeColumn-02", schema.getIncludeColumns().iterator().next().getPattern());
- assertEquals("excludeColumn-02", schema.getExcludeColumns().iterator().next().getPattern());
-
- assertEquals("includeColumn-03", catalog.getIncludeColumns().iterator().next().getPattern());
- assertEquals("excludeColumn-03", catalog.getExcludeColumns().iterator().next().getPattern());
-
- schemaIterator = cdbImport.getReverseEngineering().getSchemas().iterator();
- schema = schemaIterator.next();
- assertEquals("schema-name-03", schema.getName());
-
- schema = schemaIterator.next();
- assertEquals("schema-name-04", schema.getName());
-
- includeTableIterator = schema.getIncludeTables().iterator();
- assertEquals("incTable-04", includeTableIterator.next().getPattern());
- assertEquals("excTable-04", schema.getExcludeTables().iterator().next().getPattern());
-
- includeTable = includeTableIterator.next();
- assertEquals("incTable-05", includeTable.getPattern());
- assertEquals("includeColumn-04", includeTable.getIncludeColumns().iterator().next().getPattern());
- assertEquals("excludeColumn-04", includeTable.getExcludeColumns().iterator().next().getPattern());
-
- assertEquals("includeColumn-04", schema.getIncludeColumns().iterator().next().getPattern());
- assertEquals("excludeColumn-04", schema.getExcludeColumns().iterator().next().getPattern());
-
- assertEquals("includeColumn-03", catalog.getIncludeColumns().iterator().next().getPattern());
- 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 in <dbimport> configuration.";
-
- try {
- cdbImport.execute();
- } catch (MojoExecutionException ex) {
- exceptedException = ex;
- }
-
- assertNotNull(exceptedException);
- assertEquals(exceptedMessage, exceptedException.getCause().getMessage());
- }
-
- private void test(String name) throws Exception {
- DbImporterMojo cdbImport = getCdbImport("dbimport/" + name + "-pom.xml");
- File mapFile = cdbImport.getMap();
- File mapFileCopy = new File(mapFile.getParentFile(), "copy-" + mapFile.getName());
- if (mapFile.exists()) {
- FileUtils.copyFile(mapFile, mapFileCopy);
- cdbImport.setMap(mapFileCopy);
- } else {
- mapFileCopy = mapFile;
- }
-
- DbImportConfiguration parameters = cdbImport.createConfig(mock(Log.class));
- prepareDatabase(name, parameters);
-
- try {
- cdbImport.execute();
- verifyResult(mapFile, mapFileCopy);
- } finally {
- cleanDb(parameters);
- }
- }
-
- private void cleanDb(DbImportConfiguration dbImportConfiguration) throws Exception {
-
- // TODO: refactor to common DB management code... E.g. bootique-jdbc-test?
- // TODO: with in-memory Derby, it is easier to just stop and delete the database.. again see bootique-jdbc-test
-
- Class.forName(dbImportConfiguration.getDriver()).newInstance();
-
- try (Connection connection = DriverManager.getConnection(dbImportConfiguration.getUrl())) {
-
- try (Statement stmt = connection.createStatement()) {
-
- try (ResultSet views = connection.getMetaData().getTables(null, null, null, new String[]{"VIEW"})) {
- while (views.next()) {
- String schema = views.getString("TABLE_SCHEM");
- execute(stmt, "DROP VIEW " + (isBlank(schema) ? "" : schema + ".") + views.getString("TABLE_NAME"));
- }
- }
-
- try (ResultSet tables = connection.getMetaData().getTables(null, null, null, new String[]{"TABLE"})) {
- while (tables.next()) {
- String schema = tables.getString("TABLE_SCHEM");
- String tableName = tables.getString("TABLE_NAME");
- String tableNameFull = (isBlank(schema) ? "" : schema + ".") + tableName;
-
- ResultSet keys = connection.getMetaData().getExportedKeys(null, schema, tableName);
- while (keys.next()) {
- String fkTableSchem = keys.getString("FKTABLE_SCHEM");
- String fkTableName = keys.getString("FKTABLE_NAME");
- String fkTableNameFull = (isBlank(fkTableSchem) ? "" : fkTableSchem + ".") + fkTableName;
- execute(stmt, "ALTER TABLE " + fkTableNameFull + " DROP CONSTRAINT " + keys.getString("FK_NAME"));
- }
-
- String sql = "DROP TABLE " + tableNameFull;
- execute(stmt, sql);
- }
- }
-
- try (ResultSet schemas = connection.getMetaData().getSchemas()) {
- while (schemas.next()) {
- String schem = schemas.getString("TABLE_SCHEM");
- if (schem.startsWith("SCHEMA")) {
- execute(stmt, "DROP SCHEMA " + schem + " RESTRICT");
- }
- }
- }
- }
- }
- }
-
- private void execute(Statement stmt, String sql) throws SQLException {
- stmt.execute(sql);
- }
-
- private void verifyResult(File map, File mapFileCopy) {
- try {
- FileReader control = new FileReader(map.getAbsolutePath() + "-result");
- FileReader test = new FileReader(mapFileCopy);
-
- Diff prototype = new Diff(control, test);
- prototype.overrideElementQualifier(new ElementNameAndAttributeQualifier());
- DetailedDiff diff = new DetailedDiff(prototype);
-
- if (!diff.similar()) {
- fail(diff.toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- private void prepareDatabase(String sqlFile, DbImportConfiguration dbImportConfiguration) throws Exception {
-
- URL sqlUrl = Objects.requireNonNull(ResourceUtil.getResource(getClass(), "dbimport/" + sqlFile + ".sql"));
-
- // TODO: refactor to common DB management code... E.g. bootique-jdbc-test?
-
- Class.forName(dbImportConfiguration.getDriver()).newInstance();
-
- try (Connection connection = DriverManager.getConnection(dbImportConfiguration.getUrl())) {
- try (Statement stmt = connection.createStatement();) {
- for (String sql : SQLReader.statements(sqlUrl, ";")) {
- stmt.execute(sql);
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DerbyManager.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DerbyManager.java b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DerbyManager.java
deleted file mode 100644
index 82faace..0000000
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DerbyManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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;
-
-/**
- * @since 4.0
- */
-
-import org.apache.commons.io.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-
-public class DerbyManager {
-
- public static final OutputStream DEV_NULL = new OutputStream() {
-
- @Override
- public void write(int b) {
- }
- };
-
- DerbyManager(String location) {
-
- System.setProperty("derby.stream.error.field", DerbyManager.class.getName() + ".DEV_NULL");
-
- File derbyDir = new File(location);
- if (derbyDir.isDirectory()) {
- try {
- FileUtils.deleteDirectory(derbyDir);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- void shutdown() {
- try {
- DriverManager.getConnection("jdbc:derby:;shutdown=true");
- } catch (SQLException e) {
- // the exception is actually expected on shutdown... go figure...
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/cgen/cayenne-testDomain.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/cgen/cayenne-testDomain.xml b/plugins/maven-cayenne-plugin/src/test/resources/cgen/cayenne-testDomain.xml
deleted file mode 100644
index 3f63c14..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/cgen/cayenne-testDomain.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<domain project-version="6">
- <map name="testDomainMap"/>
- <map name="testAdditionalMap"/>
-</domain>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/cgen/project-to-test/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/cgen/project-to-test/pom.xml b/plugins/maven-cayenne-plugin/src/test/resources/cgen/project-to-test/pom.xml
deleted file mode 100644
index 41d545c..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/cgen/project-to-test/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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>Test CayenneGeneratorMojo</name>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>src/test/resources/cgen/testDomainMap.map.xml</map>
- <destDir>target/cayenneGeneratedClasses</destDir>
- <additionalMaps>src/test/resources/cgen/</additionalMaps>
- <outputPattern>*.txt</outputPattern>
- <makePairs>true</makePairs>
- <usePkgPath>true</usePkgPath>
- <superPkg>superPkg</superPkg>
- <encoding>UTF-8</encoding>
- <includeEntities>Test*</includeEntities>
- <excludeEntities>TestExcludedEntity</excludeEntities>
- <mode>all</mode>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/cgen/testAdditionalMap.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/cgen/testAdditionalMap.map.xml b/plugins/maven-cayenne-plugin/src/test/resources/cgen/testAdditionalMap.map.xml
deleted file mode 100644
index f9a80fb..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/cgen/testAdditionalMap.map.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
- project-version="6">
- <property name="defaultPackage" value="pack"/>
- <db-entity name="TestRelEntity">
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="NAME" type="VARCHAR" length="200"/>
- </db-entity>
- <obj-entity name="TestRelEntity" className="pack.TestRelEntity" dbEntityName="TestRelEntity">
- <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
- </obj-entity>
- <db-relationship name="additionalRel" source="TestRelEntity" target="TestEntity" toMany="false">
- <db-attribute-pair source="ID" target="TestRelEntity_ID"/>
- </db-relationship>
- <obj-relationship name="additionalRel" source="TestRelEntity" target="TestEntity" deleteRule="Nullify" db-relationship-path="additionalRel"/>
-</data-map>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/cgen/testDomainMap.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/cgen/testDomainMap.map.xml b/plugins/maven-cayenne-plugin/src/test/resources/cgen/testDomainMap.map.xml
deleted file mode 100644
index d0ff3f5..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/cgen/testDomainMap.map.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
- project-version="6">
- <property name="defaultPackage" value="pack"/>
- <embeddable className="pack.Embeddable">
- <embeddable-attribute name="embAttr" type="java.lang.String" db-attribute-name="EMB_ATTR"/>
- </embeddable>
- <db-entity name="NotIncludedEntity">
- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="name" type="VARCHAR" length="255"/>
- </db-entity>
- <db-entity name="TestEntity">
- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="testAttr" type="VARCHAR" length="255"/>
- <db-attribute name="TestRelEntity_ID" type="INTEGER"/>
- </db-entity>
- <db-entity name="TestExcludedEntity">
- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="name" type="VARCHAR" length="255"/>
- </db-entity>
- <obj-entity name="NotIncludedEntity" className="pack.NotIncludedEntity" dbEntityName="NotIncludedEntity">
- <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
- </obj-entity>
- <obj-entity name="TestEntity" className="pack.TestEntity" dbEntityName="TestEntity">
- <embedded-attribute name="embeddedAtr" type="pack.Embeddable"/>
- <obj-attribute name="testAttr" type="java.lang.String" db-attribute-path="testAttr"/>
- </obj-entity>
- <obj-entity name="TestExcludedEntity" className="pack.TestExcludedEntity" dbEntityName="TestExcludedEntity">
- <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
- </obj-entity>
- <db-relationship name="childrenRel" source="TestEntity" target="TestEntity" toMany="true">
- <db-attribute-pair source="id" target="id"/>
- </db-relationship>
- <db-relationship name="parentRel" source="TestEntity" target="TestEntity" toMany="false">
- <db-attribute-pair source="id" target="id"/>
- </db-relationship>
- <db-relationship name="additionalRel" source="TestEntity" target="TestRelEntity" toMany="true">
- <db-attribute-pair source="TestRelEntity_ID" target="ID"/>
- </db-relationship>
- <obj-relationship name="childrenRel" source="TestEntity" target="TestEntity" deleteRule="Deny" db-relationship-path="childrenRel"/>
- <obj-relationship name="parentRel" source="TestEntity" target="TestEntity" deleteRule="Nullify" db-relationship-path="parentRel"/>
- <obj-relationship name="additionalRel" source="TestEntity" target="TestRelEntity" deleteRule="Deny" db-relationship-path="additionalRel"/>
-</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
deleted file mode 100644
index a4a6955..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
-
- <dbimport>
- <catalog>catalog-name-01</catalog>
-
- <catalog>
- <name>catalog-name-02</name>
-
- <schema>schema-name-01</schema>
-
- <schema>
- <name>schema-name-02</name>
-
- <includeTable>incTable-01</includeTable>
- <excludeTable>excTable-01</excludeTable>
-
- <includeTable>
- <pattern>incTable-02</pattern>
-
- <includeColumn>includeColumn-01</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- </includeTable>
-
- <includeColumn>includeColumn-02</includeColumn>
- <excludeColumn>excludeColumn-02</excludeColumn>
- </schema>
-
- <includeColumn>includeColumn-03</includeColumn>
- <excludeColumn>excludeColumn-03</excludeColumn>
- </catalog>
-
- <schema>schema-name-03</schema>
-
- <schema>
- <name>schema-name-04</name>
-
- <includeTable>incTable-04</includeTable>
- <excludeTable>excTable-04</excludeTable>
-
- <includeTable>
- <pattern>incTable-05</pattern>
-
- <includeColumn>includeColumn-04</includeColumn>
- <excludeColumn>excludeColumn-04</excludeColumn>
- </includeTable>
-
- <includeColumn>includeColumn-04</includeColumn>
- <excludeColumn>excludeColumn-04</excludeColumn>
- </schema>
-
- <includeTable>incTable-06</includeTable>
- <excludeTable>excTable-06</excludeTable>
-
- <includeTable>
- <pattern>incTable-07</pattern>
-
- <includeColumn>includeColumn-06</includeColumn>
- <excludeColumn>excludeColumn-06</excludeColumn>
- </includeTable>
-
- <includeColumn>includeColumn-05</includeColumn>
- <excludeColumn>excludeColumn-05</excludeColumn>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
deleted file mode 100644
index d3828ce..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
-
- <dbimport>
- <catalog>
- <name>catalog-name</name>
- <schema>
- <name>schema-name</name>
- <includeTable>includeTable-01</includeTable>
-
- <includeTable>
- <pattern>includeTable-02</pattern>
- </includeTable>
-
- <includeTable>
- <pattern>includeTable-03</pattern>
-
- <includeColumn>includeColumn-01</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- </includeTable>
-
- <excludeTable>excludeTable-01</excludeTable>
- <excludeTable>
- <pattern>excludeTable-02</pattern>
- </excludeTable>
- <excludeTable>excludeTable-03</excludeTable>
-
- <includeColumn>includeColumn-01</includeColumn>
- <includeColumn>
- <pattern>includeColumn-02</pattern>
- </includeColumn>
- <includeColumn>includeColumn-03</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- <excludeColumn>
- <pattern>excludeColumn-02</pattern>
- </excludeColumn>
- <excludeColumn>excludeColumn-03</excludeColumn>
-
- <includeProcedure>includeProcedure-01</includeProcedure>
- <includeProcedure>
- <pattern>includeProcedure-02</pattern>
- </includeProcedure>
- <includeProcedure>includeProcedure-03</includeProcedure>
- <excludeProcedure>excludeProcedure-01</excludeProcedure>
- <excludeProcedure>
- <pattern>excludeProcedure-02</pattern>
- </excludeProcedure>
- <excludeProcedure>excludeProcedure-03</excludeProcedure>
- </schema>
- </catalog>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
deleted file mode 100644
index 9c919e8..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
-
- <dbimport>
- <catalog>catalog-name-01</catalog>
-
- <catalog>
- <name>catalog-name-02</name>
- </catalog>
-
- <catalog>
- <name>catalog-name-03</name>
- <includeTable>includeTable-01</includeTable>
-
- <includeTable>
- <pattern>includeTable-02</pattern>
- </includeTable>
-
- <includeTable>
- <pattern>includeTable-03</pattern>
-
- <includeColumn>includeColumn-01</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- </includeTable>
-
- <excludeTable>excludeTable-01</excludeTable>
- <excludeTable>
- <pattern>excludeTable-02</pattern>
- </excludeTable>
- <excludeTable>excludeTable-03</excludeTable>
-
- <includeColumn>includeColumn-01</includeColumn>
- <includeColumn>
- <pattern>includeColumn-02</pattern>
- </includeColumn>
- <includeColumn>includeColumn-03</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- <excludeColumn>
- <pattern>excludeColumn-02</pattern>
- </excludeColumn>
- <excludeColumn>excludeColumn-03</excludeColumn>
-
- <includeProcedure>includeProcedure-01</includeProcedure>
- <includeProcedure>
- <pattern>includeProcedure-02</pattern>
- </includeProcedure>
- <includeProcedure>includeProcedure-03</includeProcedure>
- <excludeProcedure>excludeProcedure-01</excludeProcedure>
- <excludeProcedure>
- <pattern>excludeProcedure-02</pattern>
- </excludeProcedure>
- <excludeProcedure>excludeProcedure-03</excludeProcedure>
- </catalog>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
deleted file mode 100644
index 7f09b88..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
- <dbimport>
- <defaultPackage>com.example.test</defaultPackage>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
deleted file mode 100644
index 6987454..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
-
- <dbimport>
- <includeTable>includeTable-01</includeTable>
-
- <includeTable>
- <pattern>includeTable-02</pattern>
- </includeTable>
-
- <includeTable>
- <pattern>includeTable-03</pattern>
-
- <includeColumn>includeColumn-01</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- </includeTable>
-
- <excludeTable>excludeTable-01</excludeTable>
- <excludeTable>
- <pattern>excludeTable-02</pattern>
- </excludeTable>
- <excludeTable>excludeTable-03</excludeTable>
-
- <includeColumn>includeColumn-01</includeColumn>
- <includeColumn>
- <pattern>includeColumn-02</pattern>
- </includeColumn>
- <includeColumn>includeColumn-03</includeColumn>
- <excludeColumn>excludeColumn-01</excludeColumn>
- <excludeColumn>
- <pattern>excludeColumn-02</pattern>
- </excludeColumn>
- <excludeColumn>excludeColumn-03</excludeColumn>
-
- <includeProcedure>includeProcedure-01</includeProcedure>
- <includeProcedure>
- <pattern>includeProcedure-02</pattern>
- </includeProcedure>
- <includeProcedure>includeProcedure-03</includeProcedure>
- <excludeProcedure>excludeProcedure-01</excludeProcedure>
- <excludeProcedure>
- <pattern>excludeProcedure-02</pattern>
- </excludeProcedure>
- <excludeProcedure>excludeProcedure-03</excludeProcedure>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
deleted file mode 100644
index 10c99da..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
-
- <typeMapper >
- <mapperClassName>class</mapperClassName>
- <usePrimitives>false</usePrimitives>
-
- <type>
- <java>my.personal.type</java>
- <jdbc>varchar</jdbc>
- </type>
- <type>
- <java>java-01</java>
- <jdbc>jdbc-01</jdbc>
- </type>
- <type>
- <java>java-02</java>
- <jdbc>jdbc-02</jdbc>
- <length>21</length>
- <notNull>true</notNull>
- </type>
- <type>
- <java>java-03</java>
- <jdbc>jdbc-03</jdbc>
- <precision>5</precision>
- <scale>2</scale>
- </type>
- <type>
- <java>java-03</java>
- <jdbc>jdbc-03</jdbc>
- <precision>7</precision>
- <notNull>true</notNull>
- </type>
- </typeMapper>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
deleted file mode 100644
index 05342fd..0000000
--- a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-cayenne-plugin</artifactId>
- <configuration>
- <dbimport>
- <schema>
- <name>NHL_STATS</name>
- <excludeTable>^ETL_.*</excludeTable>
- <excludeColumn>^ETL_.*</excludeColumn>
- </schema>
- </dbimport>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>