From: Kai Moritz Date: Tue, 29 Apr 2014 16:07:44 +0000 (+0200) Subject: Verifying generated SQL in integration-test hibernate4-maven-plugin-envers-sample X-Git-Tag: hibernate4-maven-plugin-1.0.4~4 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=1628bcf6c9290a729352215ee22e5b48fa628c4c;p=hibernate4-maven-plugin Verifying generated SQL in integration-test hibernate4-maven-plugin-envers-sample --- diff --git a/src/it/hibernate4-maven-plugin-envers-sample/create-tables-hsqldb.sql b/src/it/hibernate4-maven-plugin-envers-sample/create-tables-hsqldb.sql new file mode 100644 index 00000000..fe6130e0 --- /dev/null +++ b/src/it/hibernate4-maven-plugin-envers-sample/create-tables-hsqldb.sql @@ -0,0 +1,33 @@ + + create table TTL_AUDIT_REVISION ( + ID bigint not null, + EVENT_DATE timestamp, + ENVERS_TSTAMP bigint not null, + USER_NAME varchar(80) not null, + primary key (ID) + ); + + create table TTL_EVENT ( + ID bigint not null, + EVENT_DATE timestamp not null, + TITLE varchar(80) not null, + primary key (ID) + ); + + create table TTL_EVENT_AUD ( + ID bigint not null, + REV bigint not null, + REVTYPE tinyint, + EVENT_DATE timestamp, + TITLE varchar(80), + primary key (ID, REV) + ); + + alter table TTL_EVENT_AUD + add constraint FK_cjsh8995uabmdm9b30uvmyj6p + foreign key (REV) + references TTL_AUDIT_REVISION; + + create sequence TTL_AUDIT_REVISION_SEQ; + + create sequence TTL_EVENT_SEQ; diff --git a/src/it/hibernate4-maven-plugin-envers-sample/drop-tables-hsqldb.sql b/src/it/hibernate4-maven-plugin-envers-sample/drop-tables-hsqldb.sql new file mode 100644 index 00000000..1578d898 --- /dev/null +++ b/src/it/hibernate4-maven-plugin-envers-sample/drop-tables-hsqldb.sql @@ -0,0 +1,10 @@ + drop table TTL_AUDIT_REVISION if exists cascade; + + drop table TTL_EVENT if exists cascade; + + drop table TTL_EVENT_AUD if exists cascade; + + drop sequence TTL_AUDIT_REVISION_SEQ if exists ; + + drop sequence TTL_EVENT_SEQ if exists ; + diff --git a/src/it/hibernate4-maven-plugin-envers-sample/verify.bsh b/src/it/hibernate4-maven-plugin-envers-sample/verify.bsh new file mode 100644 index 00000000..125f4042 --- /dev/null +++ b/src/it/hibernate4-maven-plugin-envers-sample/verify.bsh @@ -0,0 +1,9 @@ +import de.juplo.test.FileComparator; + + +FileComparator comparator = new FileComparator(basedir); + +if (!comparator.isEqual("create-tables-hsqldb.sql","target/test-classes/sql/create-tables-hsqldb.sql")) + return false; +if (!comparator.isEqual("drop-tables-hsqldb.sql","target/test-classes/sql/drop-tables-hsqldb.sql")) + return false;