summaryrefslogtreecommitdiff
path: root/container-compiler-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'container-compiler-plugin')
-rw-r--r--container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java10
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java8
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java14
3 files changed, 17 insertions, 15 deletions
diff --git a/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java b/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java
index c329ab3..d359029 100644
--- a/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java
+++ b/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java
@@ -82,10 +82,6 @@ public class TypeRef implements Comparable<TypeRef> {
this(fqName, name, false, array, args);
}
- public TypeRef args(List<String> args) {
- return new TypeRef(fqName, plainName, primitive, array, args);
- }
-
public boolean isPrimitive() {
return primitive;
}
@@ -108,10 +104,14 @@ public class TypeRef implements Comparable<TypeRef> {
return fqName;
}
+ public TypeRef args(List<String> args) {
+ return new TypeRef(fqName, plainName, primitive, array, args);
+ }
+
public TypeRef args(TypeRef... args) {
List<String> list = new ArrayList<>();
for (TypeRef arg : args) {
- list.add(arg.plainName);
+ list.add(arg.toString());
}
return args(list);
}
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 ed894c5..f8cecac 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,10 +62,12 @@ public class ProcessorTest {
assertThat(fileManager.codes.keySet()).containsOnly(
"io.trygvis.persistence.test.Sequences",
- "io.trygvis.persistence.test.TestEntityManager",
- "io.trygvis.persistence.test.TestEntityManagerFactory",
+ "io.trygvis.persistence.test.TestSqlSession",
+ "io.trygvis.persistence.test.TestSqlSessionFactory",
"io.trygvis.persistence.test.PersonDao",
- "io.trygvis.persistence.test.ChildEntityDao");
+ "io.trygvis.persistence.test.PersonRow",
+ "io.trygvis.persistence.test.ChildEntityDao",
+ "io.trygvis.persistence.test.ChildEntityRow");
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 dc69a03..fc63a8a 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
@@ -95,7 +95,7 @@ public class EntityMirrorTest {
public static Object[][] insertIntoMethodProvider() {
return new Object[][]{
new Object[]{new FieldMirror[]{name}, join(
- "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {",
+ "try (java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {",
" java.lang.String name = o.name;",
" if (name == null) {",
" stmt.setNull(1, java.sql.Types.VARCHAR);",
@@ -106,13 +106,13 @@ public class EntityMirrorTest {
"}")
},
new Object[]{new FieldMirror[]{year}, join(
- "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {",
+ "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)) {",
+ "try (java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {",
" stmt.setInt(1, o.age);",
" stmt.setInt(2, o.getYear());",
" stmt.executeUpdate();",
@@ -137,10 +137,10 @@ public class EntityMirrorTest {
public static Object[][] deleteMethodProvider() {
return new Object[][]{
new Object[]{new FieldMirror[]{idLong}, join(
- "deleteById(con, o.id);")
+ "deleteWatById(con, o.id);")
},
new Object[]{new FieldMirror[]{idMethod}, join(
- "deleteById(con, o.getId());")
+ "deleteWatById(con, o.getId());")
},
};
}
@@ -161,13 +161,13 @@ public class EntityMirrorTest {
public static Object[][] deleteByIdMethodProvider() {
return new Object[][]{
new Object[]{new FieldMirror[]{idLong}, join(
- "try(java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {",
+ "try (java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {",
" stmt.setLong(1, id);",
" stmt.executeUpdate();",
"}")
},
new Object[]{new FieldMirror[]{idMethod}, join(
- "try(java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {",
+ "try (java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {",
" stmt.setLong(1, id);",
" stmt.executeUpdate();",
"}")