summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-30 19:26:27 -0400
committerJames Moger <james.moger@gmail.com>2011-08-30 19:26:27 -0400
commit69f2302c957a737564988aff2d9ae7b66287fe9d (patch)
tree7a454ca375a961b4fca57e275c37c348d2cb5181 /tests
parent5b1113a29cc76253351616a9893b486b2996ea85 (diff)
downloadiciql-69f2302c957a737564988aff2d9ae7b66287fe9d.tar.gz
iciql-69f2302c957a737564988aff2d9ae7b66287fe9d.zip
Undeprecated interface configuration. Added more Define methods.
I've revised my thinking about interface configuration. I think its a good option and should be supported. Field scope is now ignored across the board. If the developer does not want to map a field and is using the interface configuration approach, then the field should be annotated with IQIgnore.
Diffstat (limited to 'tests')
-rw-r--r--tests/com/iciql/test/AnnotationsTest.java3
-rw-r--r--tests/com/iciql/test/models/Product.java2
-rw-r--r--tests/com/iciql/test/models/ProductMixedAnnotation.java6
3 files changed, 9 insertions, 2 deletions
diff --git a/tests/com/iciql/test/AnnotationsTest.java b/tests/com/iciql/test/AnnotationsTest.java
index 30e46bb..ad229d9 100644
--- a/tests/com/iciql/test/AnnotationsTest.java
+++ b/tests/com/iciql/test/AnnotationsTest.java
@@ -135,6 +135,9 @@ public class AnnotationsTest {
// public String mappedField is reflectively mapped by iciql
assertEquals(10, db.from(p).where(p.mappedField).is("mapped").selectCount());
+ // test IQIgnore annotation
+ assertEquals(null, db.from(p).selectFirst().productDescription);
+
// test IQColumn.primaryKey=true
try {
db.insertAll(ProductMixedAnnotation.getList());
diff --git a/tests/com/iciql/test/models/Product.java b/tests/com/iciql/test/models/Product.java
index 106e51d..241a3d3 100644
--- a/tests/com/iciql/test/models/Product.java
+++ b/tests/com/iciql/test/models/Product.java
@@ -56,7 +56,7 @@ public class Product implements Iciql {
primaryKey(productId);
length(productName, 255);
length(category, 255);
- index(productName, category);
+ index("MyIndex", IndexType.STANDARD, productName, category);
}
private static Product create(int productId, String productName, String category, double unitPrice,
diff --git a/tests/com/iciql/test/models/ProductMixedAnnotation.java b/tests/com/iciql/test/models/ProductMixedAnnotation.java
index 703f8cd..a893a69 100644
--- a/tests/com/iciql/test/models/ProductMixedAnnotation.java
+++ b/tests/com/iciql/test/models/ProductMixedAnnotation.java
@@ -37,6 +37,9 @@ public class ProductMixedAnnotation implements Iciql {
public Integer unitsInStock;
public String mappedField;
+ @IQIgnore
+ public String productDescription;
+
@IQColumn(name = "cat", length = 255)
public String category;
@@ -45,7 +48,7 @@ public class ProductMixedAnnotation implements Iciql {
@IQColumn(name = "name", length = 255)
private String productName;
-
+
public ProductMixedAnnotation() {
// public constructor
}
@@ -58,6 +61,7 @@ public class ProductMixedAnnotation implements Iciql {
this.unitPrice = unitPrice;
this.unitsInStock = unitsInStock;
this.mappedField = mappedField;
+ this.productDescription = category + ": " + productName;
}
private static ProductMixedAnnotation create(int productId, String productName, String category,