summaryrefslogtreecommitdiff
path: root/java/test/Freeze/dbmap/Client.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2005-04-15 21:28:14 +0000
committerBernard Normier <bernard@zeroc.com>2005-04-15 21:28:14 +0000
commit19ef346898914027a7d15ce2f39c7b22f1bcfdf9 (patch)
tree6e643b9eb8866a203d2e9a06a4c8eb4fb320d7a4 /java/test/Freeze/dbmap/Client.java
parentMerged Freeze Map index fix from 2.1 (diff)
downloadice-19ef346898914027a7d15ce2f39c7b22f1bcfdf9.tar.bz2
ice-19ef346898914027a7d15ce2f39c7b22f1bcfdf9.tar.xz
ice-19ef346898914027a7d15ce2f39c7b22f1bcfdf9.zip
Merged updates from 2.1
Diffstat (limited to 'java/test/Freeze/dbmap/Client.java')
-rw-r--r--java/test/Freeze/dbmap/Client.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/java/test/Freeze/dbmap/Client.java b/java/test/Freeze/dbmap/Client.java
index d175bd83ebe..a9b76b433e2 100644
--- a/java/test/Freeze/dbmap/Client.java
+++ b/java/test/Freeze/dbmap/Client.java
@@ -556,6 +556,74 @@ public class Client
System.out.println("ok");
}
+
+ System.out.print("testing index creation... ");
+ System.out.flush();
+
+ {
+ IntIdentityMap iim = new IntIdentityMap(connection, "intIdentity", true);
+
+ Ice.Identity odd = new Ice.Identity();
+ odd.name = "foo";
+ odd.category = "odd";
+
+ Ice.Identity even = new Ice.Identity();
+ even.name = "bar";
+ even.category = "even";
+
+ Transaction tx = connection.beginTransaction();
+ for(int i = 0; i < 1000; i++)
+ {
+ if(i % 2 == 0)
+ {
+ iim.fastPut(new Integer(i), even);
+ }
+ else
+ {
+ iim.fastPut(new Integer(i), odd);
+ }
+ }
+ tx.commit();
+ iim.close();
+ }
+
+ {
+ //
+ // Need true to create the index
+ //
+ IntIdentityMapWithIndex iim = new IntIdentityMapWithIndex(connection, "intIdentity", true);
+
+ test(iim.categoryCount("even") == 500);
+ test(iim.categoryCount("odd") == 500);
+
+ int count = 0;
+ java.util.Iterator p = iim.findByCategory("even");
+ while(p.hasNext())
+ {
+ java.util.Map.Entry e = (java.util.Map.Entry)p.next();
+ int k = ((Integer)e.getKey()).intValue();
+ test(k % 2 == 0);
+ ++count;
+ }
+ test(count == 500);
+
+ count = 0;
+ p = iim.findByCategory("odd");
+ while(p.hasNext())
+ {
+ java.util.Map.Entry e = (java.util.Map.Entry)p.next();
+ int k = ((Integer)e.getKey()).intValue();
+ test(k % 2 == 1);
+ ++count;
+ }
+ test(count == 500);
+
+ iim.closeAllIterators();
+ iim.clear();
+ }
+
+ System.out.println("ok");
+
connection.close();
return 0;
@@ -600,6 +668,7 @@ public class Client
status = 1;
}
+
if(communicator != null)
{
try