-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DAT-11269] updated test-harness, unified init script (#149)
* updated test-harness, unified init script * fixed typo in folder name, added expected files * added cleanup files for snpashot test for java 11 * removed redundant files * updated TH to 1.0.6
- Loading branch information
1 parent
fd6e307
commit 2472b9f
Showing
56 changed files
with
295 additions
and
96 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
31 changes: 31 additions & 0 deletions
31
src/main/java/liquibase/ext/cassandra/sqlgenerator/SetTableRemarksGeneratorCassandra.java
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,31 @@ | ||
package liquibase.ext.cassandra.sqlgenerator; | ||
|
||
import liquibase.database.Database; | ||
import liquibase.database.core.MSSQLDatabase; | ||
import liquibase.database.core.MySQLDatabase; | ||
import liquibase.ext.cassandra.database.CassandraDatabase; | ||
import liquibase.sql.Sql; | ||
import liquibase.sql.UnparsedSql; | ||
import liquibase.sqlgenerator.SqlGeneratorChain; | ||
import liquibase.sqlgenerator.core.SetTableRemarksGenerator; | ||
import liquibase.statement.core.SetTableRemarksStatement; | ||
import liquibase.structure.DatabaseObject; | ||
import liquibase.util.StringUtil; | ||
|
||
public class SetTableRemarksGeneratorCassandra extends SetTableRemarksGenerator { | ||
@Override | ||
public int getPriority() { | ||
return PRIORITY_DATABASE; | ||
} | ||
|
||
@Override | ||
public boolean supports(SetTableRemarksStatement statement, Database database) { | ||
return database instanceof CassandraDatabase; | ||
} | ||
|
||
public Sql[] generateSql(SetTableRemarksStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { | ||
String remarksEscaped = database.escapeStringForDatabase(StringUtil.trimToEmpty(statement.getRemarks())); | ||
String sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) + " WITH comment = '" + remarksEscaped + "'"; | ||
return new Sql[]{new UnparsedSql(sql, this.getAffectedTable(statement))}; | ||
} | ||
} |
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
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
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
46 changes: 46 additions & 0 deletions
46
src/test/resources/liquibase/harness/change/changelogs/cassandra/mergeColumns.xml
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,46 @@ | ||
<?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.8.xsd"> | ||
<!-- This changelog overrides default inherited from test harness because--> | ||
<!-- tables in Cassandra need a primary key, added column `id`--> | ||
<changeSet id="1" author="as"> | ||
<createTable tableName="full_name_table"> | ||
<column name="id" | ||
type="int"> | ||
<constraints primaryKey="true"/> | ||
</column> | ||
<column name="first_name" | ||
type="varchar"/> | ||
<column name="last_name" | ||
type="varchar"/> | ||
</createTable> | ||
<rollback/> | ||
</changeSet> | ||
<changeSet id="2" author="as"> | ||
<insert tableName="full_name_table"> | ||
<column name="id" value="1"/> | ||
<column name="first_name" value="John"/> | ||
<column name="last_name" value="Doe"/> | ||
</insert> | ||
<insert tableName="full_name_table"> | ||
<column name="id" value="2"/> | ||
<column name="first_name" value="Jane"/> | ||
<column name="last_name" value="Doe"/> | ||
</insert> | ||
<rollback/> | ||
</changeSet> | ||
<changeSet id="3" author="as"> | ||
<mergeColumns column1Name="first_name" | ||
column2Name="last_name" | ||
finalColumnName="full_name" | ||
finalColumnType="varchar" | ||
joinString=" " | ||
tableName="full_name_table"/> | ||
<rollback> | ||
<dropTable tableName="full_name_table"/> | ||
</rollback> | ||
</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
17 changes: 17 additions & 0 deletions
17
src/test/resources/liquibase/harness/change/changelogs/cassandra/setTableRemarks.xml
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 @@ | ||
<?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-4.3.xsd"> | ||
<!-- This changelog overrides default inherited from test harness because--> | ||
<!--there is no rollback for setTable remarks, setting empty string--> | ||
<changeSet id="1" author="as"> | ||
<setTableRemarks remarks="A Test Remark" | ||
tableName="authors"/> | ||
<rollback> | ||
<setTableRemarks remarks="" | ||
tableName="authors"/> | ||
</rollback> | ||
</changeSet> | ||
</databaseChangeLog> |
3 changes: 3 additions & 0 deletions
3
src/test/resources/liquibase/harness/change/changelogs/cassandra/sqlFile.txt
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,3 @@ | ||
insert into sqltest (id) values (1); | ||
insert into sqltest (id) values (2); | ||
insert into sqltest (id) values (3); |
24 changes: 24 additions & 0 deletions
24
src/test/resources/liquibase/harness/change/changelogs/cassandra/sqlFile.xml
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,24 @@ | ||
<?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.8.xsd"> | ||
<changeSet id="1" author="as"> | ||
<comment>Creates a table and inserts values into the table with actual SQL</comment> | ||
<createTable tableName="sqltest"> | ||
<column name="id" type="int"> | ||
<constraints primaryKey="true"/> | ||
</column> | ||
</createTable> | ||
<rollback/> | ||
</changeSet> | ||
<changeSet id="2" author="as"> | ||
<sqlFile path="sqlFile.txt" | ||
relativeToChangelogFile="true" | ||
stripComments="true"/> | ||
<rollback> | ||
<dropTable tableName="sqltest"/> | ||
</rollback> | ||
</changeSet> | ||
</databaseChangeLog> |
21 changes: 21 additions & 0 deletions
21
src/test/resources/liquibase/harness/change/expectedSnapshot/cassandra/mergeColumns.json
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,21 @@ | ||
{ | ||
"snapshot": { | ||
"objects": { | ||
"liquibase.structure.core.Table": [ | ||
{ | ||
|
||
"table": { | ||
"name": "full_name_table" | ||
} | ||
} | ||
], | ||
"liquibase.structure.core.Column": [ | ||
{ | ||
"column": { | ||
"name": "full_name" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/addAutoIncrement.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra doesn't support auto increment as it is decentralized DB and managing autoincrement require cental place and synch |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/addCheckConstraint.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra doesn't support check constraint |
6 changes: 3 additions & 3 deletions
6
src/test/resources/liquibase/harness/change/expectedSql/cassandra/addColumn.sql
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ALTER TABLE authors ADD varcharColumn VARCHAR | ||
ALTER TABLE authors ADD intColumn INT | ||
ALTER TABLE authors ADD dateColumn date | ||
ALTER TABLE betterbotz.authors ADD varcharColumn VARCHAR | ||
ALTER TABLE betterbotz.authors ADD intColumn INT | ||
ALTER TABLE betterbotz.authors ADD dateColumn date |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/alterSequence.sql
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,2 @@ | ||
INVALID TEST | ||
--Cassandra doesn't support sequences |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createFunction.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra isn't among PRO supported databases |
4 changes: 2 additions & 2 deletions
4
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createIndex.sql
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE INDEX idx_first_name ON authors(first_name) | ||
CREATE INDEX idx_last_name ON authors(last_name) | ||
CREATE INDEX idx_first_name ON betterbotz.authors(first_name) | ||
CREATE INDEX idx_last_name ON betterbotz.authors(last_name) |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createPackage.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra isn't among PRO supported databases |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createPackageBody.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra isn't among PRO supported databases |
2 changes: 1 addition & 1 deletion
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createTable.sql
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 |
---|---|---|
@@ -1 +1 @@ | ||
CREATE TABLE test_table (test_id INT, test_column VARCHAR, PRIMARY KEY (test_id)) | ||
CREATE TABLE betterbotz.test_table (test_id INT, test_column VARCHAR, PRIMARY KEY (test_id)) |
2 changes: 1 addition & 1 deletion
2
...test/resources/liquibase/harness/change/expectedSql/cassandra/createTableDataTypeText.sql
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 |
---|---|---|
@@ -1 +1 @@ | ||
CREATE TABLE createTableDataTypeText (textCol TEXT, PRIMARY KEY (textCol)) | ||
CREATE TABLE betterbotz.createTableDataTypeText (textCol TEXT, PRIMARY KEY (textCol)) |
2 changes: 1 addition & 1 deletion
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createTableTimestamp.sql
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 |
---|---|---|
@@ -1 +1 @@ | ||
CREATE TABLE test_table_timestamp (test_id INT, test_column timestamp, PRIMARY KEY (test_id)) | ||
CREATE TABLE betterbotz.test_table_timestamp (test_id INT, test_column timestamp, PRIMARY KEY (test_id)) |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/createTrigger.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra isn't among PRO supported databases |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/disableCheckConstraint.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra doesn't support check constraint |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/disableTrigger.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra isn't among PRO supported databases |
2 changes: 2 additions & 0 deletions
2
src/test/resources/liquibase/harness/change/expectedSql/cassandra/dropCheckConstraint.sql
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,2 @@ | ||
INVALID TEST | ||
Cassandra doesn't support check constraint |
4 changes: 2 additions & 2 deletions
4
src/test/resources/liquibase/harness/change/expectedSql/cassandra/dropColumn.sql
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ALTER TABLE posts ADD varcharColumn VARCHAR | ||
ALTER TABLE posts DROP varcharColumn | ||
ALTER TABLE betterbotz.posts ADD varcharColumn VARCHAR | ||
ALTER TABLE betterbotz.posts DROP varcharColumn |
Oops, something went wrong.