aboutsummaryrefslogtreecommitdiffstats
path: root/tests/com/iciql/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-08 11:12:50 -0400
committerJames Moger <james.moger@gmail.com>2011-08-08 11:12:50 -0400
commit35973f16d6e408fff3e9eeeda4dac4ab3f7cb048 (patch)
treebd266925e65837ecbfe18ac3b734a05d6bf49bdc /tests/com/iciql/test
parentf7485f5f18e49cef057782c0c3137e64a5af542c (diff)
downloadiciql-35973f16d6e408fff3e9eeeda4dac4ab3f7cb048.tar.gz
iciql-35973f16d6e408fff3e9eeeda4dac4ab3f7cb048.zip
Documentation. EnumType default is NAME.
Diffstat (limited to 'tests/com/iciql/test')
-rw-r--r--tests/com/iciql/test/ModelsTest.java2
-rw-r--r--tests/com/iciql/test/PrimitivesTest.java29
-rw-r--r--tests/com/iciql/test/models/EnumModels.java2
-rw-r--r--tests/com/iciql/test/models/SupportedTypes.java8
4 files changed, 26 insertions, 15 deletions
diff --git a/tests/com/iciql/test/ModelsTest.java b/tests/com/iciql/test/ModelsTest.java
index 75c2073..8a933ae 100644
--- a/tests/com/iciql/test/ModelsTest.java
+++ b/tests/com/iciql/test/ModelsTest.java
@@ -163,7 +163,7 @@ public class ModelsTest {
true);
assertEquals(1, models.size());
// a poor test, but a start
- assertEquals(1697, models.get(0).length());
+ assertEquals(1780, models.get(0).length());
}
@Test
diff --git a/tests/com/iciql/test/PrimitivesTest.java b/tests/com/iciql/test/PrimitivesTest.java
index aee2479..2d591c3 100644
--- a/tests/com/iciql/test/PrimitivesTest.java
+++ b/tests/com/iciql/test/PrimitivesTest.java
@@ -37,22 +37,27 @@ public class PrimitivesTest {
db.insert(model);
PrimitivesModel p = new PrimitivesModel();
-
+
// retrieve model and compare
PrimitivesModel retrievedModel = db.from(p).selectFirst();
assertTrue(model.equivalentTo(retrievedModel));
- // retrieve with conditions and compare
-// StatementLogger.activateConsoleLogger();
-// retrievedModel = db.from(p).where(p.myLong).is(model.myLong).and(p.myInteger).is(model.myInteger)
-// .selectFirst();
-// assertTrue(model.equivalentTo(retrievedModel));
-//
-// // update myInteger and compare
-// db.from(p).set(p.myInteger).to(10).where(p.myLong).is(model.myLong).update();
-// retrievedModel = db.from(p).selectFirst();
-
-// assertEquals(10, retrievedModel.myInteger);
+ retrievedModel = db.from(p).where("mylong = ? and myinteger = ?", model.myLong, model.myInteger)
+ .selectFirst();
+ assertTrue(model.equivalentTo(retrievedModel));
+
+ // retrieve with conditions and compare
+ // StatementLogger.activateConsoleLogger();
+ // retrievedModel =
+ // db.from(p).where(p.myLong).is(model.myLong).and(p.myInteger).is(model.myInteger)
+ // .selectFirst();
+ // assertTrue(model.equivalentTo(retrievedModel));
+ //
+ // // update myInteger and compare
+ // db.from(p).set(p.myInteger).to(10).where(p.myLong).is(model.myLong).update();
+ // retrievedModel = db.from(p).selectFirst();
+
+ // assertEquals(10, retrievedModel.myInteger);
db.close();
}
diff --git a/tests/com/iciql/test/models/EnumModels.java b/tests/com/iciql/test/models/EnumModels.java
index bd9d88a..e5f6f39 100644
--- a/tests/com/iciql/test/models/EnumModels.java
+++ b/tests/com/iciql/test/models/EnumModels.java
@@ -127,7 +127,7 @@ public abstract class EnumModels {
// override the enumtype to string
// ensure that we specify a length so that the column is VARCHAR
- @IQEnum(EnumType.STRING)
+ @IQEnum(EnumType.NAME)
@IQColumn(length = 25)
private Tree tree;
diff --git a/tests/com/iciql/test/models/SupportedTypes.java b/tests/com/iciql/test/models/SupportedTypes.java
index b8abf2d..49dd951 100644
--- a/tests/com/iciql/test/models/SupportedTypes.java
+++ b/tests/com/iciql/test/models/SupportedTypes.java
@@ -96,7 +96,11 @@ public class SupportedTypes {
@IQColumn
private byte[] myBlob;
- @IQEnum(EnumType.STRING)
+ // test default enum type NAME
+ @IQColumn(trim = true, length = 25)
+ private Flower myDefaultFlower;
+
+ @IQEnum(EnumType.NAME)
@IQColumn(trim = true, length = 25)
private Flower myFavoriteFlower;
@@ -139,6 +143,7 @@ public class SupportedTypes {
s.mySqlTime = new java.sql.Time(rand.nextLong());
s.mySqlTimestamp = new java.sql.Timestamp(rand.nextLong());
s.myBlob = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ s.myDefaultFlower = Flower.DAFFODIL;
s.myFavoriteFlower = Flower.MUM;
s.myOtherFavoriteFlower = Flower.MARIGOLD;
s.myFavoriteTree = Tree.BIRCH;
@@ -162,6 +167,7 @@ public class SupportedTypes {
same &= mySqlTime.toString().equals(s.mySqlTime.toString());
same &= myString.equals(s.myString);
same &= compare(myBlob, s.myBlob);
+ same &= myDefaultFlower.equals(s.myDefaultFlower);
same &= myFavoriteFlower.equals(s.myFavoriteFlower);
same &= myOtherFavoriteFlower.equals(s.myOtherFavoriteFlower);
same &= myFavoriteTree.equals(s.myFavoriteTree);