summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/ldb.js57
1 files changed, 55 insertions, 2 deletions
diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js
index fb1a2d4b0d..6851ee0b30 100755
--- a/testprogs/ejs/ldb.js
+++ b/testprogs/ejs/ldb.js
@@ -92,18 +92,22 @@ partition: cn=SideTest:" + prefix + "testside.ldb
partition: cn=Sub,cn=PartTest:" + prefix + "testsub.ldb
partition: cn=PartTest:" + prefix + "testpartition.ldb
partition: cn=Sub,cn=Sub,cn=PartTest:" + prefix + "testsubsub.ldb
+replicateEntries: @SUBCLASSES
+replicateEntries: @ATTRIBUTES
+replicateEntries: @INDEXLIST
");
}
/* Test the basic operation of the timestamps,objectguid and name_rdn
modules */
-function modules_test(ldb)
+function modules_test(ldb, parttestldb)
{
println("Running modules tests");
ok = ldb.add("
dn: @ATTRIBUTES
+cn: CASE_INSENSITIVE
caseattr: CASE_INSENSITIVE
");
if (!ok) {
@@ -111,6 +115,10 @@ caseattr: CASE_INSENSITIVE
assert(ok);
}
+ /* Confirm that the attributes were replicated */
+ var res_attrs = parttestldb.search("cn=*", "@ATTRIBUTES", parttestldb.SCOPE_BASE);
+ assert(res_attrs[0].cn == "CASE_INSENSITIVE");
+
ok = ldb.add("
dn: cn=x8,cn=PartTest
objectClass: foo
@@ -132,6 +140,17 @@ cn: X9
assert(ok);
}
+ ok = ldb.add("
+dn: cn=X9,cn=PartTest
+objectClass: foo
+x: 9
+cn: X9
+");
+ if (ok) {
+ println("Should have failed to add cn=X9,cn=PartTest");
+ assert(!ok);
+ }
+
var res = ldb.search("x=8", "cn=PartTest", ldb.SCOPE_DEFAULT);
assert(res[0].objectGUID != undefined);
assert(res[0].createTimestamp == undefined);
@@ -139,6 +158,14 @@ cn: X9
assert(res[0].name == "x8");
assert(res[0].cn == "x8");
+ /* Confirm that this ended up in the correct LDB */
+ var res_otherldb = parttestldb.search("x=8", "cn=PartTest", parttestldb.SCOPE_DEFAULT);
+ assert(res_otherldb[0].objectGUID != undefined);
+ assert(res_otherldb[0].createTimestamp == undefined);
+ assert(res_otherldb[0].whenCreated != undefined);
+ assert(res_otherldb[0].name == "x8");
+ assert(res_otherldb[0].cn == "x8");
+
var attrs = new Array("*", "createTimestamp");
var res2 = ldb.search("x=9", "cn=PartTest", ldb.SCOPE_DEFAULT, attrs);
assert(res2[0].objectGUID != undefined);
@@ -239,6 +266,17 @@ caseattr: XZ
}
ok = ldb.add("
+dn: caseattr=xz,cn=PartTest
+objectClass: foo
+x: Z
+caseattr: xz
+");
+ if (ok) {
+ println("Should have failed to add caseattr=xz,cn=PartTest");
+ assert(!ok);
+ }
+
+ ok = ldb.add("
dn: caseattr2=XZ,cn=PartTest
objectClass: foo
x: Z
@@ -249,6 +287,17 @@ caseattr2: XZ
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);
@@ -315,7 +364,11 @@ ldb = ldb_init();
var ok = ldb.connect("tdb://" + prefix + dbfile);
assert(ok);
-modules_test(ldb);
+parttestldb = ldb_init();
+var ok = parttestldb.connect("tdb://" + prefix + "testpartition.ldb");
+assert(ok);
+
+modules_test(ldb, parttestldb);
sys.unlink(prefix + dbfile);
sys.unlink(prefix + "testpartition.ldb");