Verifying generated SQL in integration-test hibernate4-maven-plugin-envers-sample
authorKai Moritz <kai@juplo.de>
Tue, 29 Apr 2014 16:07:44 +0000 (18:07 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 29 Apr 2014 16:34:25 +0000 (18:34 +0200)
src/it/hibernate4-maven-plugin-envers-sample/create-tables-hsqldb.sql [new file with mode: 0644]
src/it/hibernate4-maven-plugin-envers-sample/drop-tables-hsqldb.sql [new file with mode: 0644]
src/it/hibernate4-maven-plugin-envers-sample/verify.bsh [new file with mode: 0644]

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 (file)
index 0000000..fe6130e
--- /dev/null
@@ -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 (file)
index 0000000..1578d89
--- /dev/null
@@ -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 (file)
index 0000000..125f404
--- /dev/null
@@ -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;