Monday, November 08, 2010 at 12:02 AM.

system.verbs.apps.xmlStorageSystem.test.runAllProduceReports

<<4/8/01; 1:47:30 PM by DW
	<<Generate a table of wire dumps for all the xmlStorageSystem calls.

local (htmltext = "", indentlevel = 0, startticks);
on add (s) {
	htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
on addtohtml (callname, protocol, frequest, fresponse) {
	local (secs);
	bundle { //set secs
		local (s = string (double (clock.ticks () - startticks) / 60));
		local (lod = string.nthfield (s, ".", 1));
		local (rod = string.nthfield (s, ".", 2));
		if sizeof (rod) > 3 {
			rod = string.mid (rod, 1, 3)}
		else {
			if sizeof (rod) < 3 {
				rod = string.padwithzeros (rod, 3)}};
		secs = lod + "." + rod};
	local (pc = file.getpathchar ());
	local (requesturl = "http://www.ourfavoritesongs.com/users/dave@userland.com/" + string.replaceall (frequest - user.playlist.prefs.wwwfolder, pc, "/"));
	local (responseurl = "http://www.ourfavoritesongs.com/users/dave@userland.com/" + string.replaceall (fresponse - user.playlist.prefs.wwwfolder, pc, "/"));
	add ("<tr><td>xmlStorageSystem." + callname + "</td><td>" + protocol + "</td><td><a href=\"" + requesturl + "\">Request</a></td><td><a href=\"" + responseurl + "\">Response</a></td><td>" + secs + "</td></tr>")};
on oneSet (protocol) {
	on writeDumps (callname) {
		local (pc = file.getpathchar ());
		local (f = user.playlist.prefs.wwwfolder + "test" + pc + "xmlStorageSystemWireDumps" + pc + protocol + pc + callname + "xxx.html");
		file.surefilepath (f);
		on process (s) {
			s = string.replaceall (s, "<", "<");
			s = "<html><body><pre>" + s + "</pre></body></html>";
			return (string.replaceall (s, string.hashmd5 (user.xmlStorageSystem.password), string.hashmd5 ("x")))};
		local (frequest = string.replace (f, "xxx", "Request"));
		file.writewholefile (frequest, process (string (scratchpad.httpCommand)));
		local (fresponse = string.replace (f, "xxx", "Response"));
		file.writewholefile (fresponse, process (string (scratchpad.httpResult)));
		addtohtml (callname, protocol, frequest, fresponse);
		delete (@scratchpad.httpCommand);
		delete (@scratchpad.httpResult)};
	xmlStorageSystem.data.protocol = protocol;
	with user.xmlStorageSystem {
		startticks = clock.ticks ();
		xmlStorageSystem.getServerCapabilities (email, password, @scratchpad.serverCapabilities);
		writeDumps ("getServerCapabilities");
		startticks = clock.ticks ();
		xmlStorageSystem.pleaseNotify ("http://www.ourfavoritesongs.com/users/dave@userland.com/bogusTestFile.html", @workspace.clockChanged);
		writeDumps ("pleaseNotify");
		startticks = clock.ticks ();
		xmlStorageSystem.register (email, password, name, @greeting);
		writeDumps ("register");
		startticks = clock.ticks ();
		xmlStorageSystem.writeFile (email, password, "/test/clock2.html", clock.now (), @url);
		writeDumps ("writeFile");
		startticks = clock.ticks ();
		xmlStorageSystem.getMyDirectory (email, password, @scratchpad.myDirectory);
		writeDumps ("getMyDirectory")}};
window.about ();
xmlStorageSystem.data.flDebug = true;
add ("<table cellspacing=\"0\" cellpadding=\"7\">"); indentlevel++;
add ("<tr><td><b>Entry-point</b></td><td><b>Protocol</b></td><td><b>Request</b></td><td><b>Response</b></td><td><b>Secs</b></td></tr>");
oneSet ("soap");
oneSet ("xml-rpc");
add ("</table>"); indentlevel--;
clipboard.putvalue (htmltext);
xmlStorageSystem.data.flDebug = false



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.