You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by ab...@apache.org on 2019/04/26 08:31:15 UTC

[cayenne] branch master updated (cbb96b1 -> 6cd9e91)

This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


    from cbb96b1  CAY-2571 DataDomainFlushAction redesign cleanup
     new 1192a95  CAY-2570 Use MySQL adapter for latest versions of MariaDB
     new 782a458  Merge PR #380
     new 6cd9e91  cleanup

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 RELEASE-NOTES.txt                                  |  1 +
 cayenne-client/pom.xml                             | 33 +++++++++++
 cayenne-dbsync/pom.xml                             | 33 +++++++++++
 .../dbsync/reverse/configuration/ToolsModule.java  |  3 +-
 cayenne-jcache/pom.xml                             | 33 +++++++++++
 cayenne-server/pom.xml                             | 33 +++++++++++
 .../cayenne/configuration/server/ServerModule.java |  4 +-
 .../MariaDBSniffer.java}                           | 22 ++++----
 .../server/DataDomainProviderTest.java             | 12 ++--
 pom.xml                                            | 64 ++++++++++++++++++++++
 10 files changed, 221 insertions(+), 17 deletions(-)
 copy cayenne-server/src/main/java/org/apache/cayenne/dba/{firebird/FirebirdSniffer.java => mariadb/MariaDBSniffer.java} (73%)


[cayenne] 03/03: cleanup

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 6cd9e91ea422e9e7ab496063ccd78b05ee77793c
Author: Arseni Bulatski <an...@gmail.com>
AuthorDate: Fri Apr 26 11:30:38 2019 +0300

    cleanup
---
 .../src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java   | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java b/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java
index c4b452d..57c59da 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java
@@ -28,9 +28,6 @@ import org.apache.cayenne.dba.mysql.MySQLAdapter;
 import org.apache.cayenne.di.AdhocObjectFactory;
 import org.apache.cayenne.di.Inject;
 
-/**
- * @since 4.2
- */
 public class MariaDBSniffer implements DbAdapterDetector {
 
     public static final String DEFAULT_STORAGE_ENGINE = "InnoDB";


[cayenne] 01/03: CAY-2570 Use MySQL adapter for latest versions of MariaDB

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 1192a95c79a57db68d8e1c0b2e990ce95c6716e4
Author: Arseni Bulatski <an...@gmail.com>
AuthorDate: Thu Apr 25 17:40:11 2019 +0300

    CAY-2570 Use MySQL adapter for latest versions of MariaDB
---
 RELEASE-NOTES.txt                                  |  1 +
 cayenne-client/pom.xml                             | 33 +++++++++++
 cayenne-dbsync/pom.xml                             | 33 +++++++++++
 .../dbsync/reverse/configuration/ToolsModule.java  |  9 ++-
 cayenne-jcache/pom.xml                             | 33 +++++++++++
 cayenne-server/pom.xml                             | 33 +++++++++++
 .../cayenne/configuration/server/ServerModule.java |  4 +-
 .../apache/cayenne/dba/mariadb/MariaDBSniffer.java | 54 ++++++++++++++++++
 .../server/DataDomainProviderTest.java             | 12 ++--
 pom.xml                                            | 64 ++++++++++++++++++++++
 10 files changed, 265 insertions(+), 11 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index ff23f3f..30575af 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -31,6 +31,7 @@ CAY-2555 Use explicit ArcId in GraphChangeHandler methods
 CAY-2563 Deprecate old scalarQuery methods in SQLSelect
 CAY-2568 Class Generation: Superclass Package setting persistence
 CAY-2569 Custom 'Naming Strategy' in Cayenne Modeler
+CAY-2570 Use MySQL adapter for latest versions of MariaDB
 
 Bug Fixes:
 
diff --git a/cayenne-client/pom.xml b/cayenne-client/pom.xml
index a9f0b38..f3175dd 100644
--- a/cayenne-client/pom.xml
+++ b/cayenne-client/pom.xml
@@ -165,6 +165,39 @@
             </build>
         </profile>
         <profile>
+            <id>mariadb-docker</id>
+            <activation>
+                <property>
+                    <name>cayenneTestConnection</name>
+                    <value>mariadb-docker</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>start-mariadb</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>start</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>stop-mariadb</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
             <id>sqlserver-docker</id>
             <activation>
                 <property>
diff --git a/cayenne-dbsync/pom.xml b/cayenne-dbsync/pom.xml
index 01a7af4..5bffab3 100644
--- a/cayenne-dbsync/pom.xml
+++ b/cayenne-dbsync/pom.xml
@@ -202,6 +202,39 @@
 			</build>
 		</profile>
 		<profile>
+			<id>mariadb-docker</id>
+			<activation>
+				<property>
+					<name>cayenneTestConnection</name>
+					<value>mariadb-docker</value>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>io.fabric8</groupId>
+						<artifactId>docker-maven-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>start-mariadb</id>
+								<phase>pre-integration-test</phase>
+								<goals>
+									<goal>start</goal>
+								</goals>
+							</execution>
+							<execution>
+								<id>stop-mariadb</id>
+								<phase>post-integration-test</phase>
+								<goals>
+									<goal>stop</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
 			<id>sqlserver-docker</id>
 			<activation>
 				<property>
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
index 0f41ffd..7941517 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/ToolsModule.java
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.dbsync.reverse.configuration;
 
+import java.util.Objects;
+
 import org.apache.cayenne.access.translator.batch.BatchTranslatorFactory;
 import org.apache.cayenne.access.translator.batch.DefaultBatchTranslatorFactory;
 import org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry;
@@ -48,14 +50,13 @@ import org.apache.cayenne.dba.frontbase.FrontBaseSniffer;
 import org.apache.cayenne.dba.h2.H2Sniffer;
 import org.apache.cayenne.dba.hsqldb.HSQLDBSniffer;
 import org.apache.cayenne.dba.ingres.IngresSniffer;
+import org.apache.cayenne.dba.mariadb.MariaDBSniffer;
 import org.apache.cayenne.dba.mysql.MySQLSniffer;
 import org.apache.cayenne.dba.openbase.OpenBaseSniffer;
 import org.apache.cayenne.dba.oracle.OracleSniffer;
 import org.apache.cayenne.dba.postgres.PostgresSniffer;
 import org.apache.cayenne.dba.sqlite.SQLiteSniffer;
-import org.apache.cayenne.dba.sqlserver.SQLServerAdapter;
 import org.apache.cayenne.dba.sqlserver.SQLServerSniffer;
-import org.apache.cayenne.dba.sybase.SybasePkGenerator;
 import org.apache.cayenne.dba.sybase.SybaseSniffer;
 import org.apache.cayenne.di.AdhocObjectFactory;
 import org.apache.cayenne.di.Binder;
@@ -73,8 +74,6 @@ import org.apache.cayenne.resource.ResourceLocator;
 import org.slf4j.Logger;
 import org.xml.sax.XMLReader;
 
-import java.util.Objects;
-
 /**
  * A DI module to bootstrap DI container for Cayenne Ant tasks and Maven
  * plugins.
@@ -115,7 +114,7 @@ public class ToolsModule implements Module {
                 .add(FrontBaseSniffer.class).add(IngresSniffer.class).add(SQLiteSniffer.class).add(DB2Sniffer.class)
                 .add(H2Sniffer.class).add(HSQLDBSniffer.class).add(SybaseSniffer.class).add(DerbySniffer.class)
                 .add(SQLServerSniffer.class).add(OracleSniffer.class).add(PostgresSniffer.class)
-                .add(MySQLSniffer.class);
+                .add(MySQLSniffer.class).add(MariaDBSniffer.class);
 
         binder.bind(PkGeneratorFactoryProvider.class).to(PkGeneratorFactoryProvider.class);
         binder.bind(PkGenerator.class).to(JdbcPkGenerator.class);
diff --git a/cayenne-jcache/pom.xml b/cayenne-jcache/pom.xml
index ea2388e..8879956 100644
--- a/cayenne-jcache/pom.xml
+++ b/cayenne-jcache/pom.xml
@@ -189,6 +189,39 @@
             </build>
         </profile>
         <profile>
+            <id>mariadb-docker</id>
+            <activation>
+                <property>
+                    <name>cayenneTestConnection</name>
+                    <value>mariadb-docker</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>start-mariadb</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>start</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>stop-mariadb</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
             <id>sqlserver-docker</id>
             <activation>
                 <property>
diff --git a/cayenne-server/pom.xml b/cayenne-server/pom.xml
index a73159e..03bf2d5 100644
--- a/cayenne-server/pom.xml
+++ b/cayenne-server/pom.xml
@@ -271,6 +271,39 @@
             </build>
         </profile>
 		<profile>
+			<id>mariadb-docker</id>
+			<activation>
+				<property>
+					<name>cayenneTestConnection</name>
+					<value>mariadb-docker</value>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>io.fabric8</groupId>
+						<artifactId>docker-maven-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>start-mariadb</id>
+								<phase>pre-integration-test</phase>
+								<goals>
+									<goal>start</goal>
+								</goals>
+							</execution>
+							<execution>
+								<id>stop-mariadb</id>
+								<phase>post-integration-test</phase>
+								<goals>
+									<goal>stop</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
 			<id>sqlserver-docker</id>
 			<activation>
 				<property>
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
index 197ad72..b98d286 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
@@ -107,6 +107,7 @@ import org.apache.cayenne.dba.hsqldb.HSQLDBSniffer;
 import org.apache.cayenne.dba.ingres.IngresAdapter;
 import org.apache.cayenne.dba.ingres.IngresPkGenerator;
 import org.apache.cayenne.dba.ingres.IngresSniffer;
+import org.apache.cayenne.dba.mariadb.MariaDBSniffer;
 import org.apache.cayenne.dba.mysql.MySQLAdapter;
 import org.apache.cayenne.dba.mysql.MySQLPkGenerator;
 import org.apache.cayenne.dba.mysql.MySQLSniffer;
@@ -366,7 +367,8 @@ public class ServerModule implements Module {
                 .add(SQLServerSniffer.class)
                 .add(OracleSniffer.class)
                 .add(PostgresSniffer.class)
-                .add(MySQLSniffer.class);
+                .add(MySQLSniffer.class)
+                .add(MariaDBSniffer.class);
 
         //installing Pk for adapters
         binder.bind(PkGeneratorFactoryProvider.class).to(PkGeneratorFactoryProvider.class);
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java b/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java
new file mode 100644
index 0000000..c4b452d
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/mariadb/MariaDBSniffer.java
@@ -0,0 +1,54 @@
+/*****************************************************************
+ *   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.dba.mariadb;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import org.apache.cayenne.configuration.server.DbAdapterDetector;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.mysql.MySQLAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+
+/**
+ * @since 4.2
+ */
+public class MariaDBSniffer implements DbAdapterDetector {
+
+    public static final String DEFAULT_STORAGE_ENGINE = "InnoDB";
+    protected AdhocObjectFactory objectFactory;
+
+    public MariaDBSniffer(@Inject AdhocObjectFactory objectFactory) {
+        this.objectFactory = objectFactory;
+    }
+
+    @Override
+    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {
+        String dbName = md.getDatabaseProductName();
+        if(dbName == null || !dbName.toUpperCase().contains("MARIADB")) {
+            return null;
+        }
+
+        MySQLAdapter adapter = objectFactory.newInstance(MySQLAdapter.class, MySQLAdapter.class.getName());
+        adapter.setStorageEngine(DEFAULT_STORAGE_ENGINE);
+        return adapter;
+    }
+}
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
index 90446c9..7e8d117 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
@@ -18,6 +18,10 @@
  ****************************************************************/
 package org.apache.cayenne.configuration.server;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.cayenne.ConfigurationException;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.ObjectId;
@@ -72,6 +76,7 @@ import org.apache.cayenne.dba.hsqldb.HSQLDBSniffer;
 import org.apache.cayenne.dba.ingres.IngresAdapter;
 import org.apache.cayenne.dba.ingres.IngresPkGenerator;
 import org.apache.cayenne.dba.ingres.IngresSniffer;
+import org.apache.cayenne.dba.mariadb.MariaDBSniffer;
 import org.apache.cayenne.dba.mysql.MySQLAdapter;
 import org.apache.cayenne.dba.mysql.MySQLPkGenerator;
 import org.apache.cayenne.dba.mysql.MySQLSniffer;
@@ -114,10 +119,6 @@ import org.apache.cayenne.resource.ResourceLocator;
 import org.apache.cayenne.resource.mock.MockResource;
 import org.junit.Test;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicInteger;
-
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -175,7 +176,8 @@ public class DataDomainProviderTest {
                     .add(OpenBaseSniffer.class).add(FrontBaseSniffer.class).add(IngresSniffer.class)
                     .add(SQLiteSniffer.class).add(DB2Sniffer.class).add(H2Sniffer.class).add(HSQLDBSniffer.class)
                     .add(SybaseSniffer.class).add(DerbySniffer.class).add(SQLServerSniffer.class)
-                    .add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class);
+                    .add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class)
+                    .add(MariaDBSniffer.class);
             ServerModule.contributeDomainFilters(binder);
             ServerModule.contributeDomainQueryFilters(binder);
             ServerModule.contributeDomainSyncFilters(binder);
diff --git a/pom.xml b/pom.xml
index aaa9dd4..1a326f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1397,6 +1397,70 @@
 			</build>
 		</profile>
 		<profile>
+			<id>mariadb-docker</id>
+			<activation>
+				<property>
+					<name>cayenneTestConnection</name>
+					<value>mariadb-docker</value>
+				</property>
+			</activation>
+			<dependencies>
+				<dependency>
+					<groupId>mysql</groupId>
+					<artifactId>mysql-connector-java</artifactId>
+					<version>5.1.42</version>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-failsafe-plugin</artifactId>
+						<configuration>
+							<systemPropertyVariables>
+								<!-- See https://hub.docker.com/_/mariadb/ for details-->
+								<!-- ${db.host} and ${db.port} are dynamically set by docker-maven-plugin below -->
+								<cayenneAdapter>org.apache.cayenne.dba.mysql.MySQLAdapter</cayenneAdapter>
+								<cayenneJdbcUsername>root</cayenneJdbcUsername>
+								<cayenneJdbcPassword />
+								<cayenneJdbcUrl>jdbc:mysql://${db.host}:${db.port}/cayenne?useUnicode=true&amp;characterEncoding=UTF-8&amp;generateSimpleParameterMetadata=true&amp;useSSL=false</cayenneJdbcUrl>
+								<cayenneJdbcDriver>com.mysql.jdbc.Driver</cayenneJdbcDriver>
+							</systemPropertyVariables>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>io.fabric8</groupId>
+						<artifactId>docker-maven-plugin</artifactId>
+						<configuration>
+							<images>
+								<image>
+									<alias>db</alias>
+									<name>mariadb:10.4</name>
+									<run>
+										<ports>
+											<port>${db.host}:${db.port}:3306</port>
+										</ports>
+										<wait>
+											<log>MySQL init process done. Ready for start up.</log>
+											<time>60000</time>
+										</wait>
+										<env>
+											<MYSQL_ALLOW_EMPTY_PASSWORD>yes</MYSQL_ALLOW_EMPTY_PASSWORD>
+											<MYSQL_DATABASE>cayenne</MYSQL_DATABASE>
+										</env>
+										<cmd>
+											--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
+										</cmd>
+									</run>
+								</image>
+							</images>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
 			<id>oracle</id>
 			<activation>
 				<property>


[cayenne] 02/03: Merge PR #380

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 782a458a718099619608a07836861481b47bfcac
Merge: cbb96b1 1192a95
Author: Arseni Bulatski <an...@gmail.com>
AuthorDate: Fri Apr 26 11:28:43 2019 +0300

    Merge PR #380

 RELEASE-NOTES.txt                                  |  1 +
 cayenne-client/pom.xml                             | 33 +++++++++++
 cayenne-dbsync/pom.xml                             | 33 +++++++++++
 .../dbsync/reverse/configuration/ToolsModule.java  |  3 +-
 cayenne-jcache/pom.xml                             | 33 +++++++++++
 cayenne-server/pom.xml                             | 33 +++++++++++
 .../cayenne/configuration/server/ServerModule.java |  4 +-
 .../apache/cayenne/dba/mariadb/MariaDBSniffer.java | 54 ++++++++++++++++++
 .../server/DataDomainProviderTest.java             | 12 ++--
 pom.xml                                            | 64 ++++++++++++++++++++++
 10 files changed, 263 insertions(+), 7 deletions(-)