svn commit: samba r16819 - in branches/SOC/mkhl/testprogs-map/ejs: .

mkhl at samba.org mkhl at samba.org
Wed Jul 5 12:32:09 GMT 2006


Author: mkhl
Date: 2006-07-05 12:32:09 +0000 (Wed, 05 Jul 2006)
New Revision: 16819

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

Log:
Update samba3sam test script to
- disallow passing a different samba3 URL (that should go in a different test)
- update the list of used modules
- use the partition module
- adapt mapping to the new (partitioned) scheme

Martin


Modified:
   branches/SOC/mkhl/testprogs-map/ejs/samba3sam


Changeset:
Modified: branches/SOC/mkhl/testprogs-map/ejs/samba3sam
===================================================================
--- branches/SOC/mkhl/testprogs-map/ejs/samba3sam	2006-07-05 12:24:27 UTC (rev 16818)
+++ branches/SOC/mkhl/testprogs-map/ejs/samba3sam	2006-07-05 12:32:09 UTC (rev 16819)
@@ -7,86 +7,85 @@
 libinclude("base.js");
 var mypath = substr(ARGV[0], 0, -strlen("samba3sam"));
 
-/* TODO:
+var sys = sys_init();
+var s3url = "tdb://samba3.ldb";
+var s4url = "tdb://samba4.ldb";
+var s3 = ldb_init();
+var s4 = ldb_init();
+var ok;
 
-   1) register partitions:
+var basedn = new Object();
+basedn.BASEDN = "dc=vernstok,dc=nl";
 
-dn: @PARTITION
-partition: CN=Samba3Sam,${BASEDN}:tdb://samba3.ldb
-partition: ${BASEDN}:tdb://samba4.ldb
+var prt_ldif = sprintf("dn: @PARTITION
+partition: CN=Samba3Sam,${BASEDN}:%s
+partition: ${BASEDN}:%s", s3url, s4url);
 
-   2) register modules:
-
-dn: @MODULES
- at LIST: rootdse,kludge_acl,paged_results,server_sort,extended_dn,asq,samldb,objectclass,password_hash,operational,objectguid,rdn_name,samab3sam,partition
-
-   3) register mapping:
-
-dn: @MAP=samba3sam
+var map_ldif = "dn: @MAP=samba3sam
 @FROM: ${BASEDN}
 @TO: CN=Samba3Sam,${BASEDN}
+";
 
-*/
+var mod_ldif = "dn: @MODULES
+replace: @LIST
+ at LIST: rootdse,kludge_acl,paged_results,server_sort,extended_dn,asq,samldb,objectclass,password_hash,operational,objectguid,rdn_name,samba3sam,partition";
 
-var sys = sys_init();
-var s3url;
-var s3 = ldb_init();
-var ok;
+sys.unlink("samba3.ldb");
+ok = s3.connect(s3url);
+assert(ok);
 
-var basedn = new Object();
-basedn.BASEDN = "dc=vernstok,dc=nl";
+println("Initial samba3 LDIF...");
+var path = "../../testdata/samba3/samba3.ldif"
+var ldif = sys.file_load(mypath + path);
+ldif = substitute_var(ldif, basedn);
+assert(ldif != undefined);
+ok = s3.add(ldif);
+assert(ok);
 
-if (ARGV.length == 2) {
-	s3url = ARGV[1];
-	ok = s3.connect(s3url);
-	assert(ok);
-} else {
-	s3url = "tdb://samba3.ldb";
-	sys.unlink("samba3.ldb");
-	println("Adding samba3 LDIF...");
-	var s3 = ldb_init();
-	ok = s3.connect(s3url);
-	assert(ok);
-	var ldif = sys.file_load(mypath + "../../testdata/samba3/samba3.ldif");
-	ldif = substitute_var(ldif, basedn);
-	assert(ldif != undefined);
-	ok = s3.add(ldif);
-	assert(ok);
-}
-
-println("Initial samba4 LDIF...");
-var s4 = ldb_init();
 sys.unlink("samba4.ldb");
 ok = s4.connect("tdb://samba4.ldb");
 assert(ok);
 
-var ldif = sys.file_load(mypath + "../../source/setup/provision_init.ldif");
+println("Initial samba4 LDIF...");
+var path = "../../source/setup/provision_init.ldif";
+var ldif = sys.file_load(mypath + path);
 ldif = substitute_var(ldif, basedn);
 assert(ldif != undefined);
 ok = s4.add(ldif);
 assert(ok);
 
-var ldif = sys.file_load(mypath + "../../source/setup/provision_templates.ldif");
+var path = "../../source/setup/provision_templates.ldif";
+var ldif = sys.file_load(mypath + path);
 ldif = substitute_var(ldif, basedn);
 assert(ldif != undefined);
 ok = s4.add(ldif);
 assert(ok);
 
-ok = s4.add(sprintf("dn: @MAP=samba3sam
- at MAP_URL: %s", s3url));
+println("Registering partitions...");
+var ldif = substitute_var(prt_ldif, basedn);
+assert(ldif != undefined);
+ok = s4.add(ldif);
 assert(ok);
 
-ok = s4.modify("
-dn: @MODULES
-replace: @LIST
- at LIST: samldb,timestamps,objectguid,rdn_name,samba3sam");
+println("Registering mapping...");
+var ldif = substitute_var(map_ldif, basedn);
+assert(ldif != undefined);
+ok = s4.add(ldif);
 assert(ok);
 
-println("Reconnecting to LDB database");
+println("Registering modules...");
+var ldif = substitute_var(mod_ldif, basedn);
+assert(ldif != undefined);
+ok = s4.modify(ldif);
+assert(ok);
+
+println("Reconnecting to LDB database...");
 s4 = ldb_init();
-ok = s4.connect("tdb://samba4.ldb");
+ok = s4.connect(s4url);
 assert(ok);
 
+return 0;
+
 msg = s4.search("(ou=Users)");
 assert(msg.length == 1);
 



More information about the samba-cvs mailing list