From 77bb75ead0b5b13539ab89531542cc2e9813fda4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 29 Jul 2006 01:13:53 +0000 Subject: r17299: Improve the partition module to replicate attribute records into all partitions. Test that we do that correctly. Andrew Bartlett (This used to be commit 90c07b88010b848423dee9556a24e8d181c365dd) --- testprogs/ejs/ldb.js | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'testprogs') diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js index 0d2de577d3..fb1a2d4b0d 100755 --- a/testprogs/ejs/ldb.js +++ b/testprogs/ejs/ldb.js @@ -101,6 +101,16 @@ partition: cn=Sub,cn=Sub,cn=PartTest:" + prefix + "testsubsub.ldb function modules_test(ldb) { println("Running modules tests"); + + ok = ldb.add(" +dn: @ATTRIBUTES +caseattr: CASE_INSENSITIVE +"); + if (!ok) { + println("Failed to add: " + ldb.errstring()); + assert(ok); + } + ok = ldb.add(" dn: cn=x8,cn=PartTest objectClass: foo @@ -207,6 +217,57 @@ x: 11 assert(res8[0].name == "x11"); assert(res8[0].cn == "x11"); + ok = ldb.add(" +dn: caseattr=XY,cn=PartTest +objectClass: foo +x: Y +"); + if (!ok) { + println("Failed to add: " + ldb.errstring()); + assert(ok); + } + + ok = ldb.add(" +dn: caseattr=XZ,cn=PartTest +objectClass: foo +x: Z +caseattr: XZ +"); + if (!ok) { + println("Failed to add: " + ldb.errstring()); + assert(ok); + } + + ok = ldb.add(" +dn: caseattr2=XZ,cn=PartTest +objectClass: foo +x: Z +caseattr2: XZ +"); + if (!ok) { + println("Failed to add: " + ldb.errstring()); + assert(ok); + } + + var resX = ldb.search("caseattr=xz", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); + assert(resX.length == 1); + assert(resX[0].objectGUID != undefined); + assert(resX[0].createTimestamp != undefined); + assert(resX[0].whenCreated != undefined); + assert(resX[0].name == "XZ"); + + var rescount = ldb.search("(|(caseattr=*)(cn=*))", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); + assert(rescount.length == 5); + + /* Check this attribute is *not* case sensitive */ + var resXcount = ldb.search("caseattr=x*", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); + assert(resXcount.length == 2); + + /* Check that this attribute *is* case sensitive */ + var resXcount2 = ldb.search("caseattr2=xz", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); + assert(resXcount2.length == 0); + + /* Now abort the transaction to show that even with * partitions, it is aborted everywhere */ ok = ldb.transaction_cancel(); @@ -229,6 +290,10 @@ x: 11 var res11 = ldb.search("x=10", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); assert(res11.length == 0); + var attrs = new Array("*"); + var res12 = ldb.search("caseattr=*", "cn=parttest", ldb.SCOPE_DEFAULT, attrs); + assert(res12.length == 0); + } sys = sys_init(); -- cgit