summaryrefslogtreecommitdiff
path: root/container-compiler-plugin/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'container-compiler-plugin/src/test')
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java3
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java11
-rw-r--r--container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ChildEntity.java18
-rw-r--r--container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ParentEntity.java6
4 files changed, 32 insertions, 6 deletions
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();",
"}")
},
diff --git a/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ChildEntity.java b/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ChildEntity.java
index d886fca..a341fd2 100644
--- a/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ChildEntity.java
+++ b/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ChildEntity.java
@@ -10,4 +10,22 @@ public class ChildEntity extends ParentEntity {
super(id);
this.name = name;
}
+
+ // -----------------------------------------------------------------------
+ // These static versions shouldn't affect anything
+ // -----------------------------------------------------------------------
+
+ public static void setSetterOnly(int x) {
+ }
+
+ public static int getAccessorPair() {
+ return 0;
+ }
+
+ public static void setAccessorPair(int x) {
+ }
+
+ public static int getGetterOnly() {
+ return 0;
+ }
}
diff --git a/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ParentEntity.java b/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ParentEntity.java
index 4695739..9925f7e 100644
--- a/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ParentEntity.java
+++ b/container-compiler-plugin/src/test/resources/io/trygvis/persistence/test/ParentEntity.java
@@ -4,14 +4,14 @@ import javax.persistence.Id;
public class ParentEntity {
@Id
- public final Long id;
+ public Long id;
+
+ private Integer age;
public ParentEntity(Long id) {
this.id = id;
}
- private Integer age;
-
public Integer getAge() {
return age;
}