svn commit: samba r19727 - in branches/SAMBA_4_0/testprogs/ejs: .

metze at samba.org metze at samba.org
Wed Nov 15 18:14:37 GMT 2006


Author: metze
Date: 2006-11-15 18:14:37 +0000 (Wed, 15 Nov 2006)
New Revision: 19727

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19727

Log:
make it possible to run the ldap.js tests against non global catalog servers

metze
Modified:
   branches/SAMBA_4_0/testprogs/ejs/ldap.js


Changeset:
Modified: branches/SAMBA_4_0/testprogs/ejs/ldap.js
===================================================================
--- branches/SAMBA_4_0/testprogs/ejs/ldap.js	2006-11-15 17:35:24 UTC (rev 19726)
+++ branches/SAMBA_4_0/testprogs/ejs/ldap.js	2006-11-15 18:14:37 UTC (rev 19727)
@@ -203,15 +203,17 @@
 
 	assert(res[0].dn == res3[0].dn);
 
-	println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
-	var res3gc = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
-	if (res3gc.length != 1) {
-		println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
-		assert(res3gc.length == 1);
+	if (gc_ldb != undefined) {
+		println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
+		var res3gc = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
+		if (res3gc.length != 1) {
+			println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
+			assert(res3gc.length == 1);
+		}
+	
+		assert(res[0].dn == res3gc[0].dn);
 	}
 
-	assert(res[0].dn == res3gc[0].dn);
-
 	ok = ldb.del(res[0].dn);
 	if (!ok) {
 		println(ldb.errstring());
@@ -248,15 +250,17 @@
 
 	assert(res[0].dn == res2[0].dn);
 
-	println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
-	var res2gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
-	if (res2gc.length != 1) {
-		println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
-		assert(res2gc.length == 1);
+	if (gc_ldb != undefined) {
+		println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
+		var res2gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
+		if (res2gc.length != 1) {
+			println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
+			assert(res2gc.length == 1);
+		}
+
+		assert(res[0].dn == res2gc[0].dn);
 	}
 
-	assert(res[0].dn == res2[0].dn);
-
 	println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))");
 	var res3 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
 	if (res3.length != 1) {
@@ -266,15 +270,17 @@
 
 	assert(res[0].dn == res3[0].dn);
 
-	println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
-	var res3gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
-	if (res3gc.length != 1) {
-		println("Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
-		assert(res3gc.length == 1);
+	if (gc_ldb != undefined) {
+		println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
+		var res3gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
+		if (res3gc.length != 1) {
+			println("Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
+			assert(res3gc.length == 1);
+		}
+
+		assert(res[0].dn == res3gc[0].dn);
 	}
 
-	assert(res[0].dn == res3gc[0].dn);
-
 	println("Testing ldb.search for (&(cn=ldaptestcomp*r)(objectCategory=compuTER))");
 	var res4 = ldb.search("(&(cn=ldaptestcomp*r)(objectCategory=compuTER))");
 	if (res4.length != 1) {
@@ -399,21 +405,23 @@
 	var res = ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs);
 	assert (res.length == 0);
 
-	println("Testing that we do find configuration elements in the global catlog");
-	var attrs = new Array("cn");
-	var res = gc_ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs);
-	assert (res.length > 0);
+	if (gc_ldb != undefined) {
+		println("Testing that we do find configuration elements in the global catlog");
+		var attrs = new Array("cn");
+		var res = gc_ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs);
+		assert (res.length > 0);
+	
+		println("Testing that we do find configuration elements and user elements at the same time");
+		var attrs = new Array("cn");
+		var res = gc_ldb.search("(|(objectClass=crossRef)(objectClass=person))", base_dn, ldb.SCOPE_SUBTREE, attrs);
+		assert (res.length > 0);
 
-	println("Testing that we do find configuration elements and user elements at the same time");
-	var attrs = new Array("cn");
-	var res = gc_ldb.search("(|(objectClass=crossRef)(objectClass=person))", base_dn, ldb.SCOPE_SUBTREE, attrs);
-	assert (res.length > 0);
+		println("Testing that we do find configuration elements in the global catlog, with the configuration basedn");
+		var attrs = new Array("cn");
+		var res = gc_ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs);
+		assert (res.length > 0);
+	}
 
-	println("Testing that we do find configuration elements in the global catlog, with the configuration basedn");
-	var attrs = new Array("cn");
-	var res = gc_ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs);
-	assert (res.length > 0);
-
 	println("Testing that we can get at the configuration DN on the main LDAP port");
 	var attrs = new Array("cn");
 	var res = ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs);
@@ -448,6 +456,9 @@
 printf("baseDN: %s\n", base_dn);
 
 var ok = gc_ldb.connect("ldap://" + host + ":3268");
+if (!ok) {
+	gc_ldb = undefined;
+}
 
 basic_tests(ldb, gc_ldb, base_dn, configuration_dn)
 



More information about the samba-cvs mailing list