From 6d4c6960e69b53c124bd84beb3d008bd5a4bb319 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 4 Aug 2013 18:50:18 +0200 Subject: wip o Adding Joda time's DateTime and UUID. o Registering @SequenceGenerator's on fields and getters. o Skipping static methods. o Generating SQL to drop sequences. --- .../java/io/trygvis/container/compiler/ProcessorTest.java | 3 ++- .../test/java/io/trygvis/persistence/EntityMirrorTest.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'container-compiler-plugin/src/test/java/io') diff --git a/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java b/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java index c7891fc..f30b731 100644 --- a/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java +++ b/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java @@ -62,7 +62,8 @@ public class ProcessorTest { assertThat(fileManager.codes.keySet()).containsOnly( "io.trygvis.persistence.test.Sequences", "io.trygvis.persistence.test.Session", - "io.trygvis.persistence.test.PersonDao"); + "io.trygvis.persistence.test.PersonDao", + "io.trygvis.persistence.test.ChildEntityDao"); assertThat(collector.getDiagnostics()).isEmpty(); assertThat(result).isTrue(); diff --git a/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java b/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java index 52b33ca..85e3741 100644 --- a/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java +++ b/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java @@ -71,7 +71,7 @@ public class EntityMirrorTest { myTable.add(field); } - SqlUnitModel unit = new SqlUnitModel().add(myTable).add(new SequenceMirror("id_seq")); + SqlUnitModel unit = new SqlUnitModel().add(myTable).add(new SequenceMirror("seq-gen", "id_seq", 0, 0)); assertEquals(myTable.insertIntoSql(unit), insert); assertEquals(myTable.deleteFromSql(), delete); @@ -92,9 +92,16 @@ public class EntityMirrorTest { " stmt.executeUpdate();", "}") }, - new Object[]{new FieldMirror[]{age}, join( + new Object[]{new FieldMirror[]{year}, join( + "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", + " stmt.setInt(1, o.getYear());", + " stmt.executeUpdate();", + "}") + }, + new Object[]{new FieldMirror[]{age, year, idLong}, join( "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", " stmt.setInt(1, o.age);", + " stmt.setInt(2, o.getYear());", " stmt.executeUpdate();", "}") }, -- cgit v1.2.3