aboutsummaryrefslogtreecommitdiffstats
path: root/tests/com/iciql/test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/com/iciql/test')
-rw-r--r--tests/com/iciql/test/AnnotationsTest.java9
-rw-r--r--tests/com/iciql/test/ModelsTest.java6
-rw-r--r--tests/com/iciql/test/models/ProductAnnotationOnly.java12
-rw-r--r--tests/com/iciql/test/models/ProductMixedAnnotation.java2
-rw-r--r--tests/com/iciql/test/models/SupportedTypes.java11
5 files changed, 27 insertions, 13 deletions
diff --git a/tests/com/iciql/test/AnnotationsTest.java b/tests/com/iciql/test/AnnotationsTest.java
index 367e6e1..92e0d5e 100644
--- a/tests/com/iciql/test/AnnotationsTest.java
+++ b/tests/com/iciql/test/AnnotationsTest.java
@@ -69,15 +69,18 @@ public class AnnotationsTest {
public void testIndexCreation() throws SQLException {
// test indexes are created, and columns are in the right order
DatabaseMetaData meta = db.getConnection().getMetaData();
- ResultSet rs = meta.getIndexInfo(null, "PUBLIC", "ANNOTATED" + "PRODUCT", false, true);
+ ResultSet rs = meta.getIndexInfo(null, "PUBLIC", "ANNOTATEDPRODUCT", false, true);
assertTrue(rs.next());
assertStartsWith(rs.getString("INDEX_NAME"), "PRIMARY_KEY");
assertTrue(rs.next());
- assertStartsWith(rs.getString("INDEX_NAME"), "ANNOTATED" + "PRODUCT_");
+ assertStartsWith(rs.getString("INDEX_NAME"), "ANNOTATEDPRODUCT_0");
assertStartsWith(rs.getString("COLUMN_NAME"), "NAME");
assertTrue(rs.next());
- assertStartsWith(rs.getString("INDEX_NAME"), "ANNOTATED" + "PRODUCT_");
+ assertStartsWith(rs.getString("INDEX_NAME"), "ANNOTATEDPRODUCT_0");
assertStartsWith(rs.getString("COLUMN_NAME"), "CAT");
+ assertTrue(rs.next());
+ assertStartsWith(rs.getString("INDEX_NAME"), "NAMEIDX");
+ assertStartsWith(rs.getString("COLUMN_NAME"), "NAME");
assertFalse(rs.next());
}
diff --git a/tests/com/iciql/test/ModelsTest.java b/tests/com/iciql/test/ModelsTest.java
index b3974b8..851da92 100644
--- a/tests/com/iciql/test/ModelsTest.java
+++ b/tests/com/iciql/test/ModelsTest.java
@@ -34,7 +34,7 @@ import com.iciql.Db;
import com.iciql.DbInspector;
import com.iciql.DbUpgrader;
import com.iciql.DbVersion;
-import com.iciql.Iciql.IQDatabase;
+import com.iciql.Iciql.IQVersion;
import com.iciql.ValidationRemark;
import com.iciql.test.models.Product;
import com.iciql.test.models.ProductAnnotationOnly;
@@ -115,7 +115,7 @@ public class ModelsTest {
true);
assertEquals(1, models.size());
// a poor test, but a start
- assertEquals(1361, models.get(0).length());
+ assertEquals(1564, models.get(0).length());
}
@Test
@@ -157,7 +157,7 @@ public class ModelsTest {
/**
* A sample database upgrader class.
*/
- @IQDatabase(version = 2)
+ @IQVersion(2)
class TestDbUpgrader implements DbUpgrader {
final AtomicInteger oldVersion = new AtomicInteger(0);
final AtomicInteger newVersion = new AtomicInteger(0);
diff --git a/tests/com/iciql/test/models/ProductAnnotationOnly.java b/tests/com/iciql/test/models/ProductAnnotationOnly.java
index 7921237..6b8d420 100644
--- a/tests/com/iciql/test/models/ProductAnnotationOnly.java
+++ b/tests/com/iciql/test/models/ProductAnnotationOnly.java
@@ -22,14 +22,17 @@ import java.util.List;
import com.iciql.Iciql.IQColumn;
import com.iciql.Iciql.IQIndex;
+import com.iciql.Iciql.IQIndexes;
import com.iciql.Iciql.IQTable;
+import com.iciql.Iciql.IndexType;
/**
* A table containing product data.
*/
@IQTable(name = "AnnotatedProduct", primaryKey = "id")
-@IQIndex(standard = "name, cat")
+@IQIndexes({ @IQIndex({ "name", "cat" }),
+ @IQIndex(name = "nameidx", type = IndexType.HASH, value = "name") })
public class ProductAnnotationOnly {
@IQColumn(autoIncrement = true)
@@ -67,9 +70,10 @@ public class ProductAnnotationOnly {
this.unmappedField = unmappedField;
}
- private static ProductAnnotationOnly create(int productId, String productName, String category, double unitPrice,
- int unitsInStock, String unmappedField) {
- return new ProductAnnotationOnly(productId, productName, category, unitPrice, unitsInStock, unmappedField);
+ private static ProductAnnotationOnly create(int productId, String productName, String category,
+ double unitPrice, int unitsInStock, String unmappedField) {
+ return new ProductAnnotationOnly(productId, productName, category, unitPrice, unitsInStock,
+ unmappedField);
}
public static List<ProductAnnotationOnly> getList() {
diff --git a/tests/com/iciql/test/models/ProductMixedAnnotation.java b/tests/com/iciql/test/models/ProductMixedAnnotation.java
index f90bd65..1d3cb8f 100644
--- a/tests/com/iciql/test/models/ProductMixedAnnotation.java
+++ b/tests/com/iciql/test/models/ProductMixedAnnotation.java
@@ -29,7 +29,7 @@ import com.iciql.Iciql.IQTable;
*/
@IQTable(annotationsOnly = false)
-@IQIndex(standard = "name, cat")
+@IQIndex({"name", "cat" })
public class ProductMixedAnnotation {
public Double unitPrice;
diff --git a/tests/com/iciql/test/models/SupportedTypes.java b/tests/com/iciql/test/models/SupportedTypes.java
index 26692fc..66c25d4 100644
--- a/tests/com/iciql/test/models/SupportedTypes.java
+++ b/tests/com/iciql/test/models/SupportedTypes.java
@@ -22,13 +22,19 @@ import java.util.List;
import java.util.Random;
import com.iciql.Iciql.IQColumn;
+import com.iciql.Iciql.IQIndex;
+import com.iciql.Iciql.IQIndexes;
import com.iciql.Iciql.IQTable;
+import com.iciql.Iciql.IQVersion;
+import com.iciql.Iciql.IndexType;
import com.iciql.util.Utils;
/**
* A data class that contains a column for each data type.
*/
-@IQTable(strictTypeMapping = true, version = 1)
+@IQTable(strictTypeMapping = true)
+@IQIndexes({ @IQIndex({ "myLong", "myInteger" }), @IQIndex(type = IndexType.HASH, value = "myString") })
+@IQVersion(1)
public class SupportedTypes {
public static final SupportedTypes SAMPLE = new SupportedTypes();
@@ -123,7 +129,8 @@ public class SupportedTypes {
/**
* This class demonstrates the table upgrade.
*/
- @IQTable(name = "SupportedTypes", version = 2, inheritColumns = true, strictTypeMapping = true)
+ @IQTable(name = "SupportedTypes", inheritColumns = true, strictTypeMapping = true)
+ @IQVersion(2)
public static class SupportedTypes2 extends SupportedTypes {
public SupportedTypes2() {