r9886 - sandbox/test/tests

[email protected] Mon, 14 Sep 2009 16:45:45 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090914144545.A3C363D0E3@mia>
Author: hannes
Date: 2009-09-14 16:45:45 +0200 (Mon, 14 Sep 2009)
New Revision: 9886

Added:
   sandbox/test/tests/HopObjectCollection.js
Modified:
   sandbox/test/tests/HopObjectGroupBy.js
Log:
Add test for generic large collection, run groupby test on large collection.

Details at http://dev.helma.org/trac/helma/changeset/9886

Added: sandbox/test/tests/HopObjectCollection.js

Modified: sandbox/test/tests/HopObjectGroupBy.js
===================================================================
--- sandbox/test/tests/HopObjectGroupBy.js	2009-09-11 18:02:11 UTC (rev 9885)
+++ sandbox/test/tests/HopObjectGroupBy.js	2009-09-14 14:45:45 UTC (rev 9886)
@@ -5,11 +5,20 @@
    "testGroupTransient"
 ];
 
+// todo: run with different sizes
+var size = 1234;
+
 function setup() {
+    for (var i = 0; i < size; i++) {
+        var org = new Organisation();
+        org.name = "Organisation " + i;
+        org.country = "C" + i;
+        root.organisations.add(org);
+    }
+    res.commit();
 }
 
 function testGroupByAddRemoveCommit() {
-
    var countryCount = root.organisationsByCountry.count();
    var org = new Organisation();
    org.country = "AT" + Math.random();
@@ -124,4 +133,8 @@
 }
 
 function cleanup() {
+    var orgs = root.organisations.list();
+    for each (var org in orgs) {
+        org.remove();
+    }
 }
\ No newline at end of file