-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch back to mysql connector 5.1.x, so that the integration
tests run with java7, too. Add additional test for mysql connection 6.x, which only runs on java8. References #10
- Loading branch information
Showing
8 changed files
with
194 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
# | ||
# MySQL Connection 6 requires java8 | ||
# | ||
invoker.java.version = 1.8+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>@project.groupId@.it</groupId> | ||
<artifactId>liquibase-percona-it-allChangesLiquibase35MySQL6</artifactId> | ||
<description>Using a new mysql connector</description> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>my-app</name> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.liquibase</groupId> | ||
<artifactId>liquibase-maven-plugin</artifactId> | ||
<version>3.5.1</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>6.0.5</version> | ||
</dependency> | ||
</dependencies> | ||
<configuration> | ||
<changeLogFile>test-changelog.xml</changeLogFile> | ||
<driver>com.mysql.jdbc.Driver</driver> | ||
<url>jdbc:mysql://@config_host@:@config_port@/@config_dbname@</url> | ||
<username>@config_user@</username> | ||
<password>@config_password@</password> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>updateSQL</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>updateSQL</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>update</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>update</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def con, s; | ||
try { | ||
def props = new Properties(); | ||
props.setProperty("user", config_user) | ||
props.setProperty("password", config_password) | ||
con = new com.mysql.jdbc.Driver().connect("jdbc:mysql://${config_host}:${config_port}", props) | ||
s = con.createStatement(); | ||
s.execute("DROP DATABASE IF EXISTS `${config_dbname}`") | ||
s.execute("CREATE DATABASE `${config_dbname}`") | ||
} finally { | ||
s?.close(); | ||
con?.close(); | ||
} | ||
|
||
println "Prepared empty database `${config_dbname}`" | ||
|
||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> | ||
|
||
<changeSet id="1" author="Alice"> | ||
<createTable tableName="person"> | ||
<column name="name" type="varchar(255)"> | ||
<constraints primaryKey="true"/> | ||
</column> | ||
<column name="email" type="varchar(255)"/> | ||
</createTable> | ||
</changeSet> | ||
|
||
<changeSet id="2" author="Alice"> | ||
<addColumn tableName="person"> | ||
<column name="age" type="int"/> | ||
</addColumn> | ||
</changeSet> | ||
|
||
<changeSet id="3" author="Alice"> | ||
<dropColumn tableName="person" columnName="age"/> | ||
</changeSet> | ||
|
||
<changeSet id="4" author="Alice"> | ||
<createIndex indexName="emailIdx" tableName="person" unique="true"> | ||
<column name="email"/> | ||
</createIndex> | ||
</changeSet> | ||
|
||
<changeSet id="5" author="Alice"> | ||
<dropIndex indexName="emailIdx" tableName="person"/> | ||
</changeSet> | ||
|
||
<changeSet id="6" author="Alice"> | ||
<modifyDataType tableName="person" columnName="email" newDataType="VARCHAR(400)"/> | ||
</changeSet> | ||
|
||
<changeSet id="7" author="Alice"> | ||
<createTable tableName="address"> | ||
<column name="id" type="varchar(255)"> | ||
<constraints primaryKey="true"/> | ||
</column> | ||
<column name="person_id" type="varchar(255)"/> | ||
<column name="street" type="varchar(255)"/> | ||
</createTable> | ||
</changeSet> | ||
|
||
<changeSet id="8" author="Alice"> | ||
<addForeignKeyConstraint constraintName="fk_person_address" | ||
referencedTableName="person" referencedColumnNames="name" | ||
baseTableName="address" baseColumnNames="person_id"/> | ||
</changeSet> | ||
|
||
<changeSet id="9" author="Alice"> | ||
<dropForeignKeyConstraint baseTableName="address" constraintName="fk_person_address" /> | ||
</changeSet> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import java.sql.ResultSet; | ||
|
||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
File buildLog = new File( basedir, 'build.log' ) | ||
assert buildLog.exists() | ||
def buildLogText = buildLog.text; | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::2::Alice: Executing: pt-online-schema-change --alter=\"ADD COLUMN age INT NULL\" --alter-foreign-keys-method=auto --host=${config_host} --port=${config_port} --user=${config_user} --password=*** --execute D=testdb,t=person") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::3::Alice: Executing: pt-online-schema-change --alter=\"DROP COLUMN age\"") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::4::Alice: Executing: pt-online-schema-change --alter=\"ADD UNIQUE INDEX emailIdx (email)\"") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::5::Alice: Executing: pt-online-schema-change --alter=\"DROP INDEX emailIdx\"") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::6::Alice: Executing: pt-online-schema-change --alter=\"MODIFY email VARCHAR(400)\"") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::8::Alice: Executing: pt-online-schema-change --alter=\"ADD CONSTRAINT fk_person_address FOREIGN KEY (person_id) REFERENCES person (name)\"") | ||
assert buildLogText.contains("liquibase: test-changelog.xml: test-changelog.xml::9::Alice: Executing: pt-online-schema-change --alter=\"DROP FOREIGN KEY _fk_person_address\"") | ||
|
||
File sql = new File( basedir, 'target/liquibase/migrate.sql' ) | ||
assert sql.exists() | ||
def sqlText = sql.text; | ||
assert sqlText.contains("pt-online-schema-change --alter=\"ADD COLUMN age INT NULL\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"DROP COLUMN age\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"ADD UNIQUE INDEX emailIdx (email)\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"DROP INDEX emailIdx\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"MODIFY email VARCHAR(400)\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"ADD CONSTRAINT fk_person_address FOREIGN KEY (person_id) REFERENCES person (name)\"") | ||
assert sqlText.contains("pt-online-schema-change --alter=\"DROP FOREIGN KEY _fk_person_address\"") | ||
assert !sqlText.contains("password=${config_password}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters