summaryrefslogtreecommitdiff
path: root/container-compiler-plugin/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'container-compiler-plugin/src/test/java')
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java5
-rw-r--r--container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java31
2 files changed, 20 insertions, 16 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 4fa9e87..e7affa3 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
@@ -41,7 +41,6 @@ public class ProcessorTest {
"io.trygvis.persistence.test.basic.ChildEntity",
},
new String[]{
- "io.trygvis.persistence.test.basic.Sequences",
"io.trygvis.persistence.test.basic.BasicSqlSession",
"io.trygvis.persistence.test.basic.BasicSqlSessionFactory",
"io.trygvis.persistence.test.basic.PersonDao",
@@ -52,9 +51,9 @@ public class ProcessorTest {
}, new Object[]{
new String[]{
"io.trygvis.persistence.test.inheritance.package-info",
- "io.trygvis.persistence.test.inheritance.A",},
+ "io.trygvis.persistence.test.inheritance.A",
+ },
new String[]{
- "io.trygvis.persistence.test.inheritance.Sequences",
"io.trygvis.persistence.test.inheritance.InheritanceSqlSession",
"io.trygvis.persistence.test.inheritance.InheritanceSqlSessionFactory",
"io.trygvis.persistence.test.inheritance.DDao",
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 c978ec9..a76c640 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
@@ -11,13 +11,14 @@ import org.testng.annotations.Test;
import java.io.CharArrayWriter;
import java.io.PrintWriter;
+import java.util.Collections;
import static io.trygvis.container.compiler.Utils.EOL;
import static io.trygvis.persistence.FieldMirror.FieldType.PRIMITIVE;
import static io.trygvis.persistence.FieldMirror.FieldType.REFERENCE;
-import static io.trygvis.persistence.FieldMirror.GetterType;
-import static io.trygvis.persistence.FieldMirror.SetterType;
import static java.lang.String.format;
+import static javax.persistence.AccessType.FIELD;
+import static javax.persistence.AccessType.PROPERTY;
import static org.testng.Assert.assertEquals;
public class EntityMirrorTest {
@@ -25,19 +26,19 @@ public class EntityMirrorTest {
GeneratorConfiguration generatorConfiguration = new GeneratorConfiguration();
static TypeRef entityType = new TypeRef("Wat");
- static FieldMirror idLong = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.FIELD,
+ static FieldMirror idLong = new FieldMirror(PRIMITIVE, true, FIELD, FIELD,
new TypeRef(Long.class), "id", "id", true, false, true);
- static FieldMirror idString = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.FIELD,
+ static FieldMirror idString = new FieldMirror(PRIMITIVE, true, FIELD, FIELD,
new TypeRef(String.class), "id", "id", true, false, true);
- static FieldMirror idMethod = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.METHOD,
+ static FieldMirror idMethod = new FieldMirror(PRIMITIVE, true, PROPERTY, PROPERTY,
new TypeRef(Long.class), "id", "id", true, false, true);
- static FieldMirror name = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.FIELD,
+ static FieldMirror name = new FieldMirror(PRIMITIVE, true, FIELD, FIELD,
new TypeRef(String.class), "name", "name", false, false, false);
- static FieldMirror age = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.FIELD,
+ static FieldMirror age = new FieldMirror(PRIMITIVE, true, FIELD, FIELD,
new TypeRef(Integer.class), "age", "age", false, true, false);
- static FieldMirror year = new FieldMirror(PRIMITIVE, SetterType.CONSTRUCTOR, GetterType.METHOD,
+ static FieldMirror year = new FieldMirror(PRIMITIVE, true, PROPERTY, PROPERTY,
new TypeRef(Integer.class), "year", "year", false, true, false);
- static FieldMirror ref = new FieldMirror(REFERENCE, SetterType.CONSTRUCTOR, GetterType.FIELD,
+ static FieldMirror ref = new FieldMirror(REFERENCE, true, FIELD, FIELD,
entityType, "parent", "parent", false, false, false);
@DataProvider(name = "insertIntoSql", parallel = true)
@@ -78,7 +79,8 @@ public class EntityMirrorTest {
@Test(dataProvider = "insertIntoSql")
public void testInsertIntoSql(FieldMirror[] fields, String insert, String delete, String create) throws Exception {
- EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, "my_table");
+ EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, null,
+ Collections.<String>emptyList(), "my_table");
for (FieldMirror field : fields) {
myTable.add(field);
}
@@ -127,7 +129,8 @@ public class EntityMirrorTest {
}
private MethodRef insertInto(FieldMirror... fields) {
- EntityMirror myTable = new EntityMirror(generatorConfiguration, entityType, true, null, "my_table");
+ EntityMirror myTable = new EntityMirror(generatorConfiguration, entityType, true, null, null,
+ Collections.<String>emptyList(), "my_table");
myTable.add(fields);
SqlUnitModel unit = new SqlUnitModel().add(myTable);
return new DaoUtilsGenerator(unit, generatorConfiguration, myTable).insertInto(new Imports());
@@ -151,7 +154,8 @@ public class EntityMirrorTest {
}
private MethodRef delete(FieldMirror... fields) {
- EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, "my_table");
+ EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, null,
+ Collections.<String>emptyList(), "my_table");
myTable.add(fields);
SqlUnitModel unit = new SqlUnitModel().add(myTable);
return new DaoUtilsGenerator(unit, generatorConfiguration, myTable).delete(new Imports());
@@ -181,7 +185,8 @@ public class EntityMirrorTest {
}
private MethodRef deleteById(FieldMirror... fields) {
- EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, "my_table");
+ EntityMirror myTable = new EntityMirror(new GeneratorConfiguration(), entityType, true, null, null,
+ Collections.<String>emptyList(), "my_table");
myTable.add(fields);
SqlUnitModel unit = new SqlUnitModel().add(myTable);
return new DaoUtilsGenerator(unit, generatorConfiguration, myTable).deleteById(new Imports());