http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/add.png ---------------------------------------------------------------------- diff --git a/share/www/image/add.png b/share/www/image/add.png deleted file mode 100644 index 34e8c7d..0000000 Binary files a/share/www/image/add.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/apply.gif ---------------------------------------------------------------------- diff --git a/share/www/image/apply.gif b/share/www/image/apply.gif deleted file mode 100644 index 63de0d5..0000000 Binary files a/share/www/image/apply.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/bg.png ---------------------------------------------------------------------- diff --git a/share/www/image/bg.png b/share/www/image/bg.png deleted file mode 100644 index ec81524..0000000 Binary files a/share/www/image/bg.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/cancel.gif ---------------------------------------------------------------------- diff --git a/share/www/image/cancel.gif b/share/www/image/cancel.gif deleted file mode 100644 index 4329076..0000000 Binary files a/share/www/image/cancel.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/compact.png ---------------------------------------------------------------------- diff --git a/share/www/image/compact.png b/share/www/image/compact.png deleted file mode 100644 index ea8985d..0000000 Binary files a/share/www/image/compact.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/delete-mini.png ---------------------------------------------------------------------- diff --git a/share/www/image/delete-mini.png b/share/www/image/delete-mini.png deleted file mode 100644 index ad5588d..0000000 Binary files a/share/www/image/delete-mini.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/delete.png ---------------------------------------------------------------------- diff --git a/share/www/image/delete.png b/share/www/image/delete.png deleted file mode 100644 index e838401..0000000 Binary files a/share/www/image/delete.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/grippie.gif ---------------------------------------------------------------------- diff --git a/share/www/image/grippie.gif b/share/www/image/grippie.gif deleted file mode 100644 index a880789..0000000 Binary files a/share/www/image/grippie.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/hgrad.gif ---------------------------------------------------------------------- diff --git a/share/www/image/hgrad.gif b/share/www/image/hgrad.gif deleted file mode 100644 index 08aa80c..0000000 Binary files a/share/www/image/hgrad.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/key.png ---------------------------------------------------------------------- diff --git a/share/www/image/key.png b/share/www/image/key.png deleted file mode 100644 index e04ed10..0000000 Binary files a/share/www/image/key.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/load.png ---------------------------------------------------------------------- diff --git a/share/www/image/load.png b/share/www/image/load.png deleted file mode 100644 index 07b4f79..0000000 Binary files a/share/www/image/load.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/logo.png ---------------------------------------------------------------------- diff --git a/share/www/image/logo.png b/share/www/image/logo.png deleted file mode 100644 index d21ac02..0000000 Binary files a/share/www/image/logo.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/order-asc.gif ---------------------------------------------------------------------- diff --git a/share/www/image/order-asc.gif b/share/www/image/order-asc.gif deleted file mode 100644 index d2a237a..0000000 Binary files a/share/www/image/order-asc.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/order-desc.gif ---------------------------------------------------------------------- diff --git a/share/www/image/order-desc.gif b/share/www/image/order-desc.gif deleted file mode 100644 index 1043b49..0000000 Binary files a/share/www/image/order-desc.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/path.gif ---------------------------------------------------------------------- diff --git a/share/www/image/path.gif b/share/www/image/path.gif deleted file mode 100644 index 01ec717..0000000 Binary files a/share/www/image/path.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/progress.gif ---------------------------------------------------------------------- diff --git a/share/www/image/progress.gif b/share/www/image/progress.gif deleted file mode 100644 index d84f653..0000000 Binary files a/share/www/image/progress.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/rarrow.png ---------------------------------------------------------------------- diff --git a/share/www/image/rarrow.png b/share/www/image/rarrow.png deleted file mode 100644 index 507e87e..0000000 Binary files a/share/www/image/rarrow.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/run-mini.png ---------------------------------------------------------------------- diff --git a/share/www/image/run-mini.png b/share/www/image/run-mini.png deleted file mode 100644 index b2fcbd8..0000000 Binary files a/share/www/image/run-mini.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/run.png ---------------------------------------------------------------------- diff --git a/share/www/image/run.png b/share/www/image/run.png deleted file mode 100644 index a1d79f6..0000000 Binary files a/share/www/image/run.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/running.png ---------------------------------------------------------------------- diff --git a/share/www/image/running.png b/share/www/image/running.png deleted file mode 100644 index 9b50cd6..0000000 Binary files a/share/www/image/running.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/save.png ---------------------------------------------------------------------- diff --git a/share/www/image/save.png b/share/www/image/save.png deleted file mode 100644 index a04e4bc..0000000 Binary files a/share/www/image/save.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/sidebar-toggle.png ---------------------------------------------------------------------- diff --git a/share/www/image/sidebar-toggle.png b/share/www/image/sidebar-toggle.png deleted file mode 100644 index 3ea32ff..0000000 Binary files a/share/www/image/sidebar-toggle.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/spinner.gif ---------------------------------------------------------------------- diff --git a/share/www/image/spinner.gif b/share/www/image/spinner.gif deleted file mode 100644 index 6239655..0000000 Binary files a/share/www/image/spinner.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/spinner_33.gif ---------------------------------------------------------------------- diff --git a/share/www/image/spinner_33.gif b/share/www/image/spinner_33.gif deleted file mode 100644 index 5ad5192..0000000 Binary files a/share/www/image/spinner_33.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/spinner_6b.gif ---------------------------------------------------------------------- diff --git a/share/www/image/spinner_6b.gif b/share/www/image/spinner_6b.gif deleted file mode 100644 index 4e3d972..0000000 Binary files a/share/www/image/spinner_6b.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/test_failure.gif ---------------------------------------------------------------------- diff --git a/share/www/image/test_failure.gif b/share/www/image/test_failure.gif deleted file mode 100644 index 2a873b2..0000000 Binary files a/share/www/image/test_failure.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/test_success.gif ---------------------------------------------------------------------- diff --git a/share/www/image/test_success.gif b/share/www/image/test_success.gif deleted file mode 100644 index 6df8bae..0000000 Binary files a/share/www/image/test_success.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/thead-key.gif ---------------------------------------------------------------------- diff --git a/share/www/image/thead-key.gif b/share/www/image/thead-key.gif deleted file mode 100644 index 42a43b5..0000000 Binary files a/share/www/image/thead-key.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/thead.gif ---------------------------------------------------------------------- diff --git a/share/www/image/thead.gif b/share/www/image/thead.gif deleted file mode 100644 index 1587b1f..0000000 Binary files a/share/www/image/thead.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/toggle-collapse.gif ---------------------------------------------------------------------- diff --git a/share/www/image/toggle-collapse.gif b/share/www/image/toggle-collapse.gif deleted file mode 100644 index f097930..0000000 Binary files a/share/www/image/toggle-collapse.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/toggle-expand.gif ---------------------------------------------------------------------- diff --git a/share/www/image/toggle-expand.gif b/share/www/image/toggle-expand.gif deleted file mode 100644 index 03fa836..0000000 Binary files a/share/www/image/toggle-expand.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/image/twisty.gif ---------------------------------------------------------------------- diff --git a/share/www/image/twisty.gif b/share/www/image/twisty.gif deleted file mode 100644 index 5ba57a1..0000000 Binary files a/share/www/image/twisty.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/index.html ---------------------------------------------------------------------- diff --git a/share/www/index.html b/share/www/index.html deleted file mode 100644 index ecbe8dd..0000000 --- a/share/www/index.html +++ /dev/null @@ -1,94 +0,0 @@ -<!DOCTYPE html> -<!-- - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - ---> -<html lang="en"> - <head> - <title>Overview</title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> - <link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css"> - <script src="script/json2.js"></script> - <script src="script/sha1.js"></script> - <script src="script/jquery.js"></script> - <script src="script/jquery.couch.js"></script> - <script src="script/jquery.dialog.js"></script> - <script src="script/futon.js"></script> - <script src="script/futon.browse.js"></script> - <script src="script/futon.format.js"></script> - <script> - var page = new $.futon.CouchIndexPage(); - $(document).ready(function() { - if (!/index\.html$/.test(location.pathname)) { - $.futon.navigation.ready(function() { - this.updateSelection(location.pathname + "index.html"); - }); - } - var dbsPerPage = parseInt($.futon.storage.get("per_page")); - if (dbsPerPage) $("#perpage").val(dbsPerPage); - $("#perpage").change(function() { - page.updateDatabaseListing(); - $.futon.storage.set("per_page", this.value); - }); - - page.updateDatabaseListing(); - - $("#toolbar button.add").click(function() { - page.addDatabase(); - }); - }); - </script> - </head> - <body> - <div id="wrap"> - <h1><strong>Overview</strong></h1> - <div id="content"> - <ul id="toolbar"> - <li><button class="add">Create Database â¦</button></li> - </ul> - - <table class="listing" id="databases" cellspacing="0"> - <caption>Databases</caption> - <thead> - <tr> - <th>Name</th> - <th class="size">Size</th> - <th class="count">Number of Documents</th> - <th class="seq">Update Seq</th> - </tr> - </thead> - <tbody class="content"> - </tbody> - <tbody class="footer"> - <tr> - <td colspan="5"> - <div id="paging"> - <a class="prev">â Previous Page</a> | - <label>Rows per page: <select id="perpage"> - <option selected>10</option> - <option>25</option> - <option>50</option> - <option>100</option> - </select></label> | - <a class="next">Next Page â</a> - </div> - <span></span> - </td> - </tr> - </tbody> - </table> - </div> - - </div> - </body> -</html> http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/plugins.html ---------------------------------------------------------------------- diff --git a/share/www/plugins.html b/share/www/plugins.html deleted file mode 100644 index 7f8da53..0000000 --- a/share/www/plugins.html +++ /dev/null @@ -1,121 +0,0 @@ -<!DOCTYPE html> -<!-- - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - ---> -<html lang="en"> - <head> - <title>Plugins</title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> - <link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css"> - <script src="script/json2.js"></script> - <script src="script/sha1.js"></script> - <script src="script/jquery.js"></script> - <script src="script/jquery.couch.js"></script> - <script src="script/jquery.dialog.js"></script> - <script src="script/futon.js"></script> - </head> - <body><div id="wrap"> - <h1> - <a href="index.html">Overview</a> - <strong>Plugins</strong> - </h1> - <div id="content"> - <div class="row"> - <h2>GeoCouch</h2> - <p>Version: <strong>couchdb1.2.x_v0.3.0-11-g66e6219</strong></p> - <p>Author: Volker Mische</p> - <p> - Available Erlang Versions: - <ul> - <li>CouchDB 1.4.0-XXX R15B01</li> - </ul> - </p> - <p> - <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"1.4.0": {"R15B03":"D5QPhrJTAifM42DXqAj4RxzfEtI="}}' data-name="geocouch" data-version="couchdb1.2.x_v0.3.0-16-g66e6219">Install GeoCouch Now</button> - </p> - </div> - <div class="row"> - <h2>CouchPerUser</h2> - <p>Version: <strong>1.0.0</strong></p> - <p>Author: Bob Ippolito</p> - <p> - Available Erlang Versions: - <ul> - <li>CouchDB 1.4.0-XXX R15B01</li> - </ul> - </p> - <p> - <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"1.4.0": {"R15B03":"Aj3mjC6M75NA62q5/xkP0tl8Hws="}}' data-name="couchperuser" data-version="1.0.0">Install CouchPerUser Now</button> - </p> - </div> - </div> - </div></body> - <script> - $('.install-plugin').each(function() { - var button = $(this); - var name = button.data('name'); - var version = button.data('version'); - $.get("/_config/plugins/" + name + "/", function(body, textStatus) { - body = JSON.parse(body); - if(body == version) { - button.html('Already Installed. Click to Uninstall'); - button.data('delete', true); - } else { - button.html('Other Version Installed: ' + body); - button.attr('disabled', true); - } - }); - }); - - $('.install-plugin').click(function(event) { - var button = $(this); - var delete_plugin = button.data('delete') || false; - var plugin_spec = JSON.stringify({ - name: button.data('name'), - url: button.data('url'), - version: button.data('version'), - checksums: button.data('checksums'), - "delete": delete_plugin - }); - var url = '/_plugins' - $.ajax({ - url: url, - type: 'POST', - data: plugin_spec, - contentType: 'application/json', // what we send to the server - dataType: 'json', // expected from the server - processData: false, // keep our precious JSON - success: function(data, textStatus, jqXhr) { - if(textStatus == "success") { - var action = delete_plugin ? 'Uninstalled' : 'Installed'; - button.html('Sucessfully ' + action); - button.attr('disabled', true); - } else { - button.html(textStatus); - } - }, - beforeSend: function(xhr) { - xhr.setRequestHeader('Accept', 'application/json'); - }, - }); - }); - </script> - <style type="text/css"> - .row { - background-color: #EEE; - padding:1em; - margin-bottom:1em; - } - </style> -</html> http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/replicator.html ---------------------------------------------------------------------- diff --git a/share/www/replicator.html b/share/www/replicator.html deleted file mode 100644 index eb6ecc0..0000000 --- a/share/www/replicator.html +++ /dev/null @@ -1,184 +0,0 @@ -<!DOCTYPE html> -<!-- - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - ---> -<html lang="en"> - <head> - <title>Replicator</title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> - <link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css"> - <link rel="stylesheet" href="style/jquery-ui-1.8.11.custom.css" type="text/css"> - <script src="script/json2.js"></script> - <script src="script/sha1.js"></script> - <script src="script/jquery.js"></script> - <script src="script/jquery.couch.js"></script> - <script src="script/jquery.dialog.js"></script> - <script src="script/futon.js"></script> - <script src="script/jquery-ui-1.8.11.custom.min.js"></script> - <script> - $(document).ready(function() { - var allDatabases; - - $("fieldset input[type=radio]").click(function() { - var radio = this; - var fieldset = $(this).parents("fieldset").get(0); - $("input[type=text]", fieldset).each(function() { - this.disabled = radio.value == "local"; - if (!this.disabled) this.focus(); - }); - $('.local', fieldset).each(function() { - this.disabled = radio.value == "remote"; - if (!this.disabled) this.focus(); - }); - }); - - var getDatabases = function() { - $.couch.allDbs({ - success: function(dbs) { - allDatabases = dbs.sort(); - - $("fieldset select").each(function() { - var select = this; - $.each(dbs, function(idx, dbName) { - $("<option></option>").text(dbName).appendTo(select); - }); - select.selectedIndex = 0; - }); - - $('#to_name').autocomplete({ source: dbs }); - } - }); - }; - getDatabases(); - - $("button#swap").click(function() { - var fromName = $("#source select").val(); - $("#source select").val($("#target select").val()); - $("#target select").val(fromName); - - var fromUrl = $("#source input[type=text]").val(); - $("#source input[type=text]").val($("#target input[type=text]").val()); - $("#target input[type=text]").val(fromUrl); - - var fromType = $("#source input[type=radio]").filter(function() { - return this.checked; - }).val(); - var toType = $("#target input[type=radio]").filter(function() { - return this.checked; - }).val(); - $("#source input[value=" + toType + "]").click(); - $("#target input[value=" + fromType + "]").click(); - - $("#replicate").get(0).focus(); - return false; - }); - - $("button#replicate").click(function() { - $("#records tbody.content").empty(); - var targetIsLocal = $('#to_local:checked').length > 0; - var source = $("#from_local")[0].checked ? $("#from_name").val() : $("#from_url").val(); - var target = targetIsLocal ? $("#to_name").val() : $("#to_url").val(); - var repOpts = {}; - - if (targetIsLocal && $.inArray(target, allDatabases) < 0) { - if(!confirm('This will create a database named '+target+'. Ok?')) { - return; - } - else { - repOpts.create_target = true; - } - } - - if ($("#continuous")[0].checked) { - repOpts.continuous = true; - } - $.couch.replicate(source, target, { - success: function(resp) { - if (resp._local_id) { - $("<tr><th></th></tr>") - .find("th").text(JSON.stringify(resp)).end() - .appendTo("#records tbody.content"); - $("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd"); - } else { - $.each(resp.history, function(idx, record) { - $("<tr><th></th></tr>") - .find("th").text(JSON.stringify(record)).end() - .appendTo("#records tbody.content"); - }); - $("#records tbody tr").removeClass("odd").filter(":odd").addClass("odd"); - $("#records tbody.footer td").text("Replication session " + resp.session_id); - - if (repOpts.create_target) { - getDatabases(); - } - } - } - }, repOpts); - }); - }); - </script> - </head> - <body><div id="wrap"> - <h1> - <a href="index.html">Overview</a> - <strong>Replicator</strong> - </h1> - <div id="content"> - - <form id="replicator"> - <fieldset id="source"> - <legend>Replicate changes from:</legend> - <p> - <input type="radio" id="from_local" name="from_type" value="local" checked> - <label for="from_local">Local Database: </label> - <select id="from_name" name="from_name" class="local"></select> - </p><p> - <input type="radio" id="from_to_remote" name="from_type" value="remote"> - <label for="from_to_remote">Remote database: </label> - <input type="text" id="from_url" name="from_url" size="30" value="http://" disabled> - </p> - </fieldset> - <p class="swap"><button id="swap" tabindex="99">â</button></p> - <fieldset id="target"> - <legend>to:</legend> - <p> - <input type="radio" id="to_local" name="to_type" value="local" checked> - <label for="to_local">Local database: </label> - <input type="text" id="to_name" name="to_name" class="local"></select> - </p><p> - <input type="radio" id="to_remote" name="to_type" value="remote"> - <label for="to_remote">Remote database: </label> - <input type="text" id="to_url" name="to_url" size="30" value="http://" disabled> - </p> - </fieldset> - <p class="actions"> - <label><input type="checkbox" name="continuous" value="continuous" id="continuous"> Continuous</label> - <button id="replicate" type="button">Replicate</button> - </p> - </form> - - <table id="records" class="listing" cellspacing="0"> - <caption>Replication History</caption> - <thead><tr> - <th>Event</th> - </tr></thead> - <tbody class="content"></tbody> - <tbody class="footer"><tr> - <td colspan="4">No replication</td> - </tr></tbody> - </table> - - </div> - </div></body> -</html> http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/script/base64.js ---------------------------------------------------------------------- diff --git a/share/www/script/base64.js b/share/www/script/base64.js deleted file mode 100644 index e0aab30..0000000 --- a/share/www/script/base64.js +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright (C) 1999 Masanao Izumo <i...@onicos.co.jp> - * Version: 1.0 - * LastModified: Dec 25 1999 - * This library is free. You can redistribute it and/or modify it. - */ - /* Modified by Chris Anderson to not use CommonJS */ - /* Modified by Dan Webb not to require Narwhal's binary library */ - -var Base64 = {}; -(function(exports) { - - var encodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var decodeChars = [ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 - ]; - - exports.encode = function (str) { - var out, i, length; - var c1, c2, c3; - - length = len(str); - i = 0; - out = []; - while(i < length) { - c1 = str.charCodeAt(i++) & 0xff; - if(i == length) - { - out.push(encodeChars.charCodeAt(c1 >> 2)); - out.push(encodeChars.charCodeAt((c1 & 0x3) << 4)); - out.push("=".charCodeAt(0)); - out.push("=".charCodeAt(0)); - break; - } - c2 = str.charCodeAt(i++); - if(i == length) - { - out.push(encodeChars.charCodeAt(c1 >> 2)); - out.push(encodeChars.charCodeAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4))); - out.push(encodeChars.charCodeAt((c2 & 0xF) << 2)); - out.push("=".charCodeAt(0)); - break; - } - c3 = str.charCodeAt(i++); - out.push(encodeChars.charCodeAt(c1 >> 2)); - out.push(encodeChars.charCodeAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4))); - out.push(encodeChars.charCodeAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6))); - out.push(encodeChars.charCodeAt(c3 & 0x3F)); - } - - var str = ""; - out.forEach(function(chr) { str += String.fromCharCode(chr) }); - return str; - }; - - exports.decode = function (str) { - var c1, c2, c3, c4; - var i, length, out; - - length = len(str); - i = 0; - out = []; - while(i < length) { - /* c1 */ - do { - c1 = decodeChars[str.charCodeAt(i++) & 0xff]; - } while(i < length && c1 == -1); - if(c1 == -1) - break; - - /* c2 */ - do { - c2 = decodeChars[str.charCodeAt(i++) & 0xff]; - } while(i < length && c2 == -1); - if(c2 == -1) - break; - - out.push(String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4))); - - /* c3 */ - do { - c3 = str.charCodeAt(i++) & 0xff; - if(c3 == 61) - return out.join(''); - c3 = decodeChars[c3]; - } while(i < length && c3 == -1); - if(c3 == -1) - break; - - out.push(String.fromCharCode(((c2 & 0xF) << 4) | ((c3 & 0x3C) >> 2))); - - /* c4 */ - do { - c4 = str.charCodeAt(i++) & 0xff; - if(c4 == 61) - return out.join(''); - c4 = decodeChars[c4]; - } while(i < length && c4 == -1); - - if(c4 == -1) - break; - - out.push(String.fromCharCode(((c3 & 0x03) << 6) | c4)); - } - - return out.join(''); - }; - - var len = function (object) { - if (object.length !== undefined) { - return object.length; - } else if (object.getLength !== undefined) { - return object.getLength(); - } else { - return undefined; - } - }; -})(Base64); http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/script/couch.js ---------------------------------------------------------------------- diff --git a/share/www/script/couch.js b/share/www/script/couch.js deleted file mode 100644 index 7e4eeed..0000000 --- a/share/www/script/couch.js +++ /dev/null @@ -1,520 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -// A simple class to represent a database. Uses XMLHttpRequest to interface with -// the CouchDB server. - -function CouchDB(name, httpHeaders) { - this.name = name; - this.uri = "/" + encodeURIComponent(name) + "/"; - - // The XMLHttpRequest object from the most recent request. Callers can - // use this to check result http status and headers. - this.last_req = null; - - this.request = function(method, uri, requestOptions) { - requestOptions = requestOptions || {}; - requestOptions.headers = combine(requestOptions.headers, httpHeaders); - return CouchDB.request(method, uri, requestOptions); - }; - - // Creates the database on the server - this.createDb = function() { - this.last_req = this.request("PUT", this.uri); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // Deletes the database on the server - this.deleteDb = function() { - this.last_req = this.request("DELETE", this.uri + "?sync=true"); - if (this.last_req.status == 404) { - return false; - } - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // Save a document to the database - this.save = function(doc, options, http_headers) { - if (doc._id == undefined) { - doc._id = CouchDB.newUuids(1)[0]; - } - http_headers = http_headers || {}; - this.last_req = this.request("PUT", this.uri + - encodeURIComponent(doc._id) + encodeOptions(options), - {body: JSON.stringify(doc), headers: http_headers}); - CouchDB.maybeThrowError(this.last_req); - var result = JSON.parse(this.last_req.responseText); - doc._rev = result.rev; - return result; - }; - - // Open a document from the database - this.open = function(docId, url_params, http_headers) { - this.last_req = this.request("GET", this.uri + encodeURIComponent(docId) - + encodeOptions(url_params), {headers:http_headers}); - if (this.last_req.status == 404) { - return null; - } - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // Deletes a document from the database - this.deleteDoc = function(doc) { - this.last_req = this.request("DELETE", this.uri + encodeURIComponent(doc._id) - + "?rev=" + doc._rev); - CouchDB.maybeThrowError(this.last_req); - var result = JSON.parse(this.last_req.responseText); - doc._rev = result.rev; //record rev in input document - doc._deleted = true; - return result; - }; - - // Deletes an attachment from a document - this.deleteDocAttachment = function(doc, attachment_name) { - this.last_req = this.request("DELETE", this.uri + encodeURIComponent(doc._id) - + "/" + attachment_name + "?rev=" + doc._rev); - CouchDB.maybeThrowError(this.last_req); - var result = JSON.parse(this.last_req.responseText); - doc._rev = result.rev; //record rev in input document - return result; - }; - - this.bulkSave = function(docs, options) { - // first prepoulate the UUIDs for new documents - var newCount = 0; - for (var i=0; i<docs.length; i++) { - if (docs[i]._id == undefined) { - newCount++; - } - } - var newUuids = CouchDB.newUuids(newCount); - var newCount = 0; - for (var i=0; i<docs.length; i++) { - if (docs[i]._id == undefined) { - docs[i]._id = newUuids.pop(); - } - } - var json = {"docs": docs}; - // put any options in the json - for (var option in options) { - json[option] = options[option]; - } - this.last_req = this.request("POST", this.uri + "_bulk_docs", { - body: JSON.stringify(json) - }); - if (this.last_req.status == 417) { - return {errors: JSON.parse(this.last_req.responseText)}; - } - else { - CouchDB.maybeThrowError(this.last_req); - var results = JSON.parse(this.last_req.responseText); - for (var i = 0; i < docs.length; i++) { - if(results[i] && results[i].rev && results[i].ok) { - docs[i]._rev = results[i].rev; - } - } - return results; - } - }; - - this.ensureFullCommit = function() { - this.last_req = this.request("POST", this.uri + "_ensure_full_commit"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // Applies the map function to the contents of database and returns the results. - this.query = function(mapFun, reduceFun, options, keys, language) { - var body = {language: language || "javascript"}; - if(keys) { - body.keys = keys ; - } - if (typeof(mapFun) != "string") { - mapFun = mapFun.toSource ? mapFun.toSource() : "(" + mapFun.toString() + ")"; - } - body.map = mapFun; - if (reduceFun != null) { - if (typeof(reduceFun) != "string") { - reduceFun = reduceFun.toSource ? - reduceFun.toSource() : "(" + reduceFun.toString() + ")"; - } - body.reduce = reduceFun; - } - if (options && options.options != undefined) { - body.options = options.options; - delete options.options; - } - this.last_req = this.request("POST", this.uri + "_temp_view" - + encodeOptions(options), { - headers: {"Content-Type": "application/json"}, - body: JSON.stringify(body) - }); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.view = function(viewname, options, keys) { - var viewParts = viewname.split('/'); - var viewPath = this.uri + "_design/" + viewParts[0] + "/_view/" - + viewParts[1] + encodeOptions(options); - if(!keys) { - this.last_req = this.request("GET", viewPath); - } else { - this.last_req = this.request("POST", viewPath, { - headers: {"Content-Type": "application/json"}, - body: JSON.stringify({keys:keys}) - }); - } - if (this.last_req.status == 404) { - return null; - } - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // gets information about the database - this.info = function() { - this.last_req = this.request("GET", this.uri); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // gets information about a design doc - this.designInfo = function(docid) { - this.last_req = this.request("GET", this.uri + docid + "/_info"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.allDocs = function(options,keys) { - if(!keys) { - this.last_req = this.request("GET", this.uri + "_all_docs" - + encodeOptions(options)); - } else { - this.last_req = this.request("POST", this.uri + "_all_docs" - + encodeOptions(options), { - headers: {"Content-Type": "application/json"}, - body: JSON.stringify({keys:keys}) - }); - } - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.designDocs = function() { - return this.allDocs({startkey:"_design", endkey:"_design0"}); - }; - - this.changes = function(options) { - this.last_req = this.request("GET", this.uri + "_changes" - + encodeOptions(options)); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.compact = function() { - this.last_req = this.request("POST", this.uri + "_compact"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.viewCleanup = function() { - this.last_req = this.request("POST", this.uri + "_view_cleanup"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.setDbProperty = function(propId, propValue) { - this.last_req = this.request("PUT", this.uri + propId,{ - body:JSON.stringify(propValue) - }); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.getDbProperty = function(propId) { - this.last_req = this.request("GET", this.uri + propId); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.setSecObj = function(secObj) { - this.last_req = this.request("PUT", this.uri + "_security",{ - body:JSON.stringify(secObj) - }); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - this.getSecObj = function() { - this.last_req = this.request("GET", this.uri + "_security"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - }; - - // Convert a options object to an url query string. - // ex: {key:'value',key2:'value2'} becomes '?key="value"&key2="value2"' - function encodeOptions(options) { - var buf = []; - if (typeof(options) == "object" && options !== null) { - for (var name in options) { - if (!options.hasOwnProperty(name)) { continue; }; - var value = options[name]; - if (name == "key" || name == "keys" || name == "startkey" || name == "endkey" || (name == "open_revs" && value !== "all")) { - value = toJSON(value); - } - buf.push(encodeURIComponent(name) + "=" + encodeURIComponent(value)); - } - } - if (!buf.length) { - return ""; - } - return "?" + buf.join("&"); - } - - function toJSON(obj) { - return obj !== null ? JSON.stringify(obj) : null; - } - - function combine(object1, object2) { - if (!object2) { - return object1; - } - if (!object1) { - return object2; - } - - for (var name in object2) { - object1[name] = object2[name]; - } - return object1; - } - -} - -// this is the XMLHttpRequest object from last request made by the following -// CouchDB.* functions (except for calls to request itself). -// Use this from callers to check HTTP status or header values of requests. -CouchDB.last_req = null; -CouchDB.urlPrefix = ''; - -CouchDB.login = function(name, password) { - CouchDB.last_req = CouchDB.request("POST", "/_session", { - headers: {"Content-Type": "application/x-www-form-urlencoded", - "X-CouchDB-WWW-Authenticate": "Cookie"}, - body: "name=" + encodeURIComponent(name) + "&password=" - + encodeURIComponent(password) - }); - return JSON.parse(CouchDB.last_req.responseText); -} - -CouchDB.logout = function() { - CouchDB.last_req = CouchDB.request("DELETE", "/_session", { - headers: {"Content-Type": "application/x-www-form-urlencoded", - "X-CouchDB-WWW-Authenticate": "Cookie"} - }); - return JSON.parse(CouchDB.last_req.responseText); -}; - -CouchDB.session = function(options) { - options = options || {}; - CouchDB.last_req = CouchDB.request("GET", "/_session", options); - CouchDB.maybeThrowError(CouchDB.last_req); - return JSON.parse(CouchDB.last_req.responseText); -}; - -CouchDB.allDbs = function() { - CouchDB.last_req = CouchDB.request("GET", "/_all_dbs"); - CouchDB.maybeThrowError(CouchDB.last_req); - return JSON.parse(CouchDB.last_req.responseText); -}; - -CouchDB.allDesignDocs = function() { - var ddocs = {}, dbs = CouchDB.allDbs(); - for (var i=0; i < dbs.length; i++) { - var db = new CouchDB(dbs[i]); - ddocs[dbs[i]] = db.designDocs(); - }; - return ddocs; -}; - -CouchDB.getVersion = function() { - CouchDB.last_req = CouchDB.request("GET", "/"); - CouchDB.maybeThrowError(CouchDB.last_req); - return JSON.parse(CouchDB.last_req.responseText).version; -}; - -CouchDB.reloadConfig = function() { - CouchDB.last_req = CouchDB.request("POST", "/_config/_reload"); - CouchDB.maybeThrowError(CouchDB.last_req); - return JSON.parse(CouchDB.last_req.responseText); -}; - -CouchDB.replicate = function(source, target, rep_options) { - rep_options = rep_options || {}; - var headers = rep_options.headers || {}; - var body = rep_options.body || {}; - body.source = source; - body.target = target; - CouchDB.last_req = CouchDB.request("POST", "/_replicate", { - headers: headers, - body: JSON.stringify(body) - }); - CouchDB.maybeThrowError(CouchDB.last_req); - return JSON.parse(CouchDB.last_req.responseText); -}; - -CouchDB.newXhr = function() { - if (typeof(XMLHttpRequest) != "undefined") { - return new XMLHttpRequest(); - } else if (typeof(ActiveXObject) != "undefined") { - return new ActiveXObject("Microsoft.XMLHTTP"); - } else { - throw new Error("No XMLHTTPRequest support detected"); - } -}; - -CouchDB.xhrbody = function(xhr) { - if (xhr.responseText) { - return xhr.responseText; - } else if (xhr.body) { - return xhr.body - } else { - throw new Error("No XMLHTTPRequest support detected"); - } -} - -CouchDB.xhrheader = function(xhr, header) { - if(xhr.getResponseHeader) { - return xhr.getResponseHeader(header); - } else if(xhr.headers) { - return xhr.headers[header] || null; - } else { - throw new Error("No XMLHTTPRequest support detected"); - } -} - -CouchDB.proxyUrl = function(uri) { - if(uri.substr(0, CouchDB.protocol.length) != CouchDB.protocol) { - uri = CouchDB.urlPrefix + uri; - } - return uri; -} - -CouchDB.request = function(method, uri, options) { - options = typeof(options) == 'object' ? options : {}; - options.headers = typeof(options.headers) == 'object' ? options.headers : {}; - options.headers["Content-Type"] = options.headers["Content-Type"] || options.headers["content-type"] || "application/json"; - options.headers["Accept"] = options.headers["Accept"] || options.headers["accept"] || "application/json"; - var req = CouchDB.newXhr(); - uri = CouchDB.proxyUrl(uri); - req.open(method, uri, false); - if (options.headers) { - var headers = options.headers; - for (var headerName in headers) { - if (!headers.hasOwnProperty(headerName)) { continue; } - req.setRequestHeader(headerName, headers[headerName]); - } - } - req.send(options.body || ""); - return req; -}; - -CouchDB.requestStats = function(path, test) { - var query_arg = ""; - if(test !== null) { - query_arg = "?flush=true"; - } - - var url = "/_stats/" + path.join("/") + query_arg; - var stat = CouchDB.request("GET", url).responseText; - return JSON.parse(stat); -}; - -CouchDB.uuids_cache = []; - -CouchDB.newUuids = function(n, buf) { - buf = buf || 100; - if (CouchDB.uuids_cache.length >= n) { - var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n); - if(CouchDB.uuids_cache.length - n == 0) { - CouchDB.uuids_cache = []; - } else { - CouchDB.uuids_cache = - CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n); - } - return uuids; - } else { - CouchDB.last_req = CouchDB.request("GET", "/_uuids?count=" + (buf + n)); - CouchDB.maybeThrowError(CouchDB.last_req); - var result = JSON.parse(CouchDB.last_req.responseText); - CouchDB.uuids_cache = - CouchDB.uuids_cache.concat(result.uuids.slice(0, buf)); - return result.uuids.slice(buf); - } -}; - -CouchDB.maybeThrowError = function(req) { - if (req.status >= 400) { - try { - var result = JSON.parse(req.responseText); - } catch (ParseError) { - var result = {error:"unknown", reason:req.responseText}; - } - - throw (new CouchError(result)); - } -} - -CouchDB.params = function(options) { - options = options || {}; - var returnArray = []; - for(var key in options) { - var value = options[key]; - returnArray.push(key + "=" + value); - } - return returnArray.join("&"); -}; -// Used by replication test -if (typeof window == 'undefined' || !window) { - var hostRE = RegExp("https?://([^\/]+)"); - var getter = function () { - return (new CouchHTTP).base_url.match(hostRE)[1]; - }; - if(Object.defineProperty) { - Object.defineProperty(CouchDB, "host", { - get : getter, - enumerable : true - }); - } else { - CouchDB.__defineGetter__("host", getter); - } - CouchDB.protocol = "http://"; - CouchDB.inBrowser = false; -} else { - CouchDB.host = window.location.host; - CouchDB.inBrowser = true; - CouchDB.protocol = window.location.protocol + "//"; -} - -// Turns an {error: ..., reason: ...} response into an Error instance -function CouchError(error) { - var inst = new Error(error.reason); - inst.name = 'CouchError'; - inst.error = error.error; - inst.reason = error.reason; - return inst; -} -CouchError.prototype.constructor = CouchError; http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/script/couch_test_runner.js ---------------------------------------------------------------------- diff --git a/share/www/script/couch_test_runner.js b/share/www/script/couch_test_runner.js deleted file mode 100644 index efc4dc2..0000000 --- a/share/www/script/couch_test_runner.js +++ /dev/null @@ -1,465 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -// *********************** Test Framework of Sorts ************************* // - - -function loadScript(url) { - // disallow loading remote URLs - var re = /^[a-z0-9_]+(\/[a-z0-9_]+)*\.js#?$/; - if (!re.test(url)) { - throw "Not loading remote test scripts"; - } - if (typeof document != "undefined") document.write('<script src="'+url+'"></script>'); -}; - -function patchTest(fun) { - var source = fun.toString(); - var output = ""; - var i = 0; - var testMarker = "T("; - while (i < source.length) { - var testStart = source.indexOf(testMarker, i); - if (testStart == -1) { - output = output + source.substring(i, source.length); - break; - } - var testEnd = source.indexOf(");", testStart); - var testCode = source.substring(testStart + testMarker.length, testEnd); - output += source.substring(i, testStart) + "T(" + testCode + "," + JSON.stringify(testCode); - i = testEnd; - } - try { - return eval("(" + output + ")"); - } catch (e) { - return null; - } -} - -function runAllTests() { - var rows = $("#tests tbody.content tr"); - $("td", rows).text(""); - $("td.status", rows).removeClass("error").removeClass("failure").removeClass("success").text("not run"); - var offset = 0; - function runNext() { - if (offset < rows.length) { - var row = rows.get(offset); - runTest($("th button", row).get(0), function() { - offset += 1; - setTimeout(runNext, 100); - }, false, true); - } else { - saveTestReport(); - } - } - runNext(); -} - -var numFailures = 0; -var currentRow = null; - -function runTest(button, callback, debug, noSave) { - - // offer to save admins - if (currentRow != null) { - alert("Can not run multiple tests simultaneously."); - return; - } - var row = currentRow = $(button).parents("tr").get(0); - $("td.status", row).removeClass("error").removeClass("failure").removeClass("success"); - $("td", row).text(""); - $("#toolbar li.current").text("Running: "+row.id); - var testFun = couchTests[row.id]; - function run() { - numFailures = 0; - var start = new Date().getTime(); - try { - if (debug == undefined || !debug) { - testFun = patchTest(testFun) || testFun; - } - testFun(debug); - var status = numFailures > 0 ? "failure" : "success"; - } catch (e) { - var status = "error"; - if ($("td.details ol", row).length == 0) { - $("<ol></ol>").appendTo($("td.details", row)); - } - $("<li><b>Exception raised:</b> <code class='error'></code></li>") - .find("code").text(JSON.stringify(e)).end() - .appendTo($("td.details ol", row)); - if (debug) { - currentRow = null; - throw e; - } - } - if ($("td.details ol", row).length) { - $("<a href='#'>Run with debugger</a>").click(function() { - runTest(this, undefined, true); - }).prependTo($("td.details ol", row)); - } - var duration = new Date().getTime() - start; - $("td.status", row).removeClass("running").addClass(status).text(status); - $("td.duration", row).text(duration + "ms"); - $("#toolbar li.current").text("Finished: "+row.id); - updateTestsFooter(); - currentRow = null; - if (callback) callback(); - if (!noSave) saveTestReport(); - } - $("td.status", row).addClass("running").text("runningâ¦"); - setTimeout(run, 100); -} - -function showSource(cell) { - var name = $(cell).text(); - var win = window.open("", name, "width=700,height=500,resizable=yes,scrollbars=yes"); - win.document.location = "script/test/" + name + ".js"; -} - -var readyToRun; -function setupAdminParty(fun) { - if (readyToRun) { - fun(); - } else { - function removeAdmins(confs, doneFun) { - // iterate through the config and remove current user last - // current user is at front of list - var remove = confs.pop(); - if (remove) { - $.couch.config({ - success : function() { - removeAdmins(confs, doneFun); - } - }, "admins", remove[0], null); - } else { - doneFun(); - } - }; - $.couch.session({ - success : function(resp) { - var userCtx = resp.userCtx; - if (userCtx.name && userCtx.roles.indexOf("_admin") != -1) { - // admin but not admin party. dialog offering to make admin party - $.showDialog("dialog/_admin_party.html", { - submit: function(data, callback) { - $.couch.config({ - success : function(conf) { - var meAdmin, adminConfs = []; - for (var name in conf) { - if (name == userCtx.name) { - meAdmin = [name, conf[name]]; - } else { - adminConfs.push([name, conf[name]]); - } - } - adminConfs.unshift(meAdmin); - removeAdmins(adminConfs, function() { - callback(); - $.futon.session.sidebar(); - readyToRun = true; - setTimeout(fun, 500); - }); - } - }, "admins"); - } - }); - } else if (userCtx.roles.indexOf("_admin") != -1) { - // admin party! - readyToRun = true; - fun(); - } else { - // not an admin - alert("Error: You need to be an admin to run the tests."); - }; - } - }); - } -}; - -function updateTestsListing() { - for (var name in couchTests) { - var testFunction = couchTests[name]; - var row = $("<tr><th></th><td></td><td></td><td></td></tr>") - .find("th").text(name).attr("title", "Show source").click(function() { - showSource(this); - }).end() - .find("td:nth(0)").addClass("status").text("not run").end() - .find("td:nth(1)").addClass("duration").end() - .find("td:nth(2)").addClass("details").end(); - $("<button type='button' class='run' title='Run test'></button>").click(function() { - this.blur(); - var self = this; - // check for admin party - setupAdminParty(function() { - runTest(self); - }); - return false; - }).prependTo(row.find("th")); - row.attr("id", name).appendTo("#tests tbody.content"); - } - $("#tests tr").removeClass("odd").filter(":odd").addClass("odd"); - updateTestsFooter(); -} - -function updateTestsFooter() { - var tests = $("#tests tbody.content tr td.status"); - var testsRun = tests.filter(".success, .error, .failure"); - var testsFailed = testsRun.not(".success"); - var totalDuration = 0; - $("#tests tbody.content tr td.duration:contains('ms')").each(function() { - var text = $(this).text(); - totalDuration += parseInt(text.substr(0, text.length - 2), 10); - }); - $("#tests tbody.footer td").html("<span>"+testsRun.length + " of " + tests.length + - " test(s) run, " + testsFailed.length + " failures (" + - totalDuration + " ms)</span> "); -} - -// make report and save to local db -// display how many reports need replicating to the mothership -// have button to replicate them - -function saveTestReport(report) { - var report = makeTestReport(); - if (report) { - var db = $.couch.db("test_suite_reports"); - var saveReport = function(db_info) { - report.db = db_info; - $.couch.info({success : function(node_info) { - report.node = node_info; - db.saveDoc(report); - }}); - }; - var createDb = function() { - db.create({success: function() { - db.info({success:saveReport}); - }}); - }; - db.info({error: createDb, success:saveReport}); - } -}; - -function makeTestReport() { - var report = {}; - report.summary = $("#tests tbody.footer td").text(); - report.platform = testPlatform(); - var date = new Date(); - report.timestamp = date.getTime(); - report.timezone = date.getTimezoneOffset(); - report.tests = []; - $("#tests tbody.content tr").each(function() { - var status = $("td.status", this).text(); - if (status != "not run") { - var test = {}; - test.name = this.id; - test.status = status; - test.duration = parseInt($("td.duration", this).text()); - test.details = []; - $("td.details li", this).each(function() { - test.details.push($(this).text()); - }); - if (test.details.length == 0) { - delete test.details; - } - report.tests.push(test); - } - }); - if (report.tests.length > 0) return report; -}; - -function testPlatform() { - var b = $.browser; - var bs = ["mozilla", "msie", "opera", "safari"]; - for (var i=0; i < bs.length; i++) { - if (b[bs[i]]) { - return {"browser" : bs[i], "version" : b.version}; - } - }; - return {"browser" : "undetected"}; -} - - -function reportTests() { - // replicate the database to couchdb.couchdb.org -} - -// Use T to perform a test that returns false on failure and if the test fails, -// display the line that failed. -// Example: -// T(MyValue==1); -function T(arg1, arg2, testName) { - if (!arg1) { - if (currentRow) { - if ($("td.details ol", currentRow).length == 0) { - $("<ol></ol>").appendTo($("td.details", currentRow)); - } - var message = (arg2 != null ? arg2 : arg1).toString(); - $("<li><b>Assertion " + (testName ? "'" + testName + "'" : "") + " failed:</b> <code class='failure'></code></li>") - .find("code").text(message).end() - .appendTo($("td.details ol", currentRow)); - } - numFailures += 1; - } -} - -function TIsnull(actual, testName) { - T(actual === null, "expected 'null', got '" - + repr(actual) + "'", testName); -} - -function TEquals(expected, actual, testName) { - T(equals(expected, actual), "expected '" + repr(expected) + - "', got '" + repr(actual) + "'", testName); -} - -function TEqualsIgnoreCase(expected, actual, testName) { - T(equals(expected.toUpperCase(), actual.toUpperCase()), "expected '" + repr(expected) + - "', got '" + repr(actual) + "'", testName); -} - -function equals(a,b) { - if (a === b) return true; - try { - return repr(a) === repr(b); - } catch (e) { - return false; - } -} - -function repr(val) { - if (val === undefined) { - return null; - } else if (val === null) { - return "null"; - } else { - return JSON.stringify(val); - } -} - -function makeDocs(start, end, templateDoc) { - var templateDocSrc = templateDoc ? JSON.stringify(templateDoc) : "{}"; - if (end === undefined) { - end = start; - start = 0; - } - var docs = []; - for (var i = start; i < end; i++) { - var newDoc = eval("(" + templateDocSrc + ")"); - newDoc._id = (i).toString(); - newDoc.integer = i; - newDoc.string = (i).toString(); - docs.push(newDoc); - } - return docs; -} - -function run_on_modified_server(settings, fun) { - try { - // set the settings - for(var i=0; i < settings.length; i++) { - var s = settings[i]; - var xhr = CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, { - body: JSON.stringify(s.value), - headers: {"X-Couch-Persist": "false"} - }); - CouchDB.maybeThrowError(xhr); - s.oldValue = xhr.responseText; - } - // run the thing - fun(); - } finally { - // unset the settings - for(var j=0; j < i; j++) { - var s = settings[j]; - if(s.oldValue == "\"\"\n") { // unset value - CouchDB.request("DELETE", "/_config/" + s.section + "/" + s.key, { - headers: {"X-Couch-Persist": "false"} - }); - } else { - CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, { - body: s.oldValue, - headers: {"X-Couch-Persist": "false"} - }); - } - } - } -} - -function stringFun(fun) { - var string = fun.toSource ? fun.toSource() : "(" + fun.toString() + ")"; - return string; -} - -function waitForSuccess(fun, tag) { - var start = new Date(); - while(true) { - if (new Date() - start > 5000) { - throw("timeout: "+tag); - } else { - try { - fun(); - break; - } catch (e) {} - // sync http req allow async req to happen - try { - CouchDB.request("GET", "/test_suite_db/?tag="+encodeURIComponent(tag)); - } catch (e) {} - } - } -} - -function getCurrentToken() { - var xhr = CouchDB.request("GET", "/_restart/token"); - return JSON.parse(xhr.responseText).token; -}; - - -function restartServer() { - var token = getCurrentToken(); - var token_changed = false; - var tDelta = 5000; - var t0 = new Date(); - var t1; - - CouchDB.request("POST", "/_restart"); - - do { - try { - if(token != getCurrentToken()) { - token_changed = true; - } - } catch (e) { - // Ignore errors while the server restarts - } - t1 = new Date(); - } while(((t1 - t0) <= tDelta) && !token_changed); - - if(!token_changed) { - throw("Server restart failed"); - } -} - -// legacy functions for CouchDB < 1.2.0 -// we keep them to make sure we keep BC -CouchDB.user_prefix = "org.couchdb.user:"; - -CouchDB.prepareUserDoc = function(user_doc, new_password) { - user_doc._id = user_doc._id || CouchDB.user_prefix + user_doc.name; - if (new_password) { - user_doc.password = new_password; - } - user_doc.type = "user"; - if (!user_doc.roles) { - user_doc.roles = []; - } - return user_doc; -}; http://git-wip-us.apache.org/repos/asf/couchdb/blob/4b24def6/share/www/script/couch_tests.js ---------------------------------------------------------------------- diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js deleted file mode 100644 index 62443f7..0000000 --- a/share/www/script/couch_tests.js +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - - -CouchDB.urlPrefix = ".."; -var couchTests = {}; - -function loadTest(file) { - loadScript("script/test/"+file); -}; -// keep first -loadTest("basics.js"); - -// keep sorted -loadTest("all_docs.js"); -loadTest("attachments.js"); -loadTest("attachments_multipart.js"); -loadTest("attachment_names.js"); -loadTest("attachment_paths.js"); -loadTest("attachment_ranges.js"); -loadTest("attachment_views.js"); -loadTest("auth_cache.js"); -loadTest("batch_save.js"); -loadTest("bulk_docs.js"); -loadTest("changes.js"); -loadTest("coffee.js"); -loadTest("compact.js"); -loadTest("config.js"); -loadTest("conflicts.js"); -loadTest("content_negotiation.js"); -loadTest("cookie_auth.js"); -loadTest("copy_doc.js"); -loadTest("delayed_commits.js"); -loadTest("design_docs.js"); -loadTest("design_options.js"); -loadTest("design_paths.js"); -loadTest("erlang_views.js"); -loadTest("etags_head.js"); -loadTest("etags_views.js"); -loadTest("form_submit.js"); -loadTest("http.js"); -loadTest("invalid_docids.js"); -loadTest("jsonp.js"); -loadTest("large_docs.js"); -loadTest("list_views.js"); -loadTest("lots_of_docs.js"); -loadTest("method_override.js"); -loadTest("multiple_rows.js"); -loadScript("script/oauth.js"); -loadScript("script/sha1.js"); -loadTest("oauth.js"); -loadTest("oauth_users_db.js"); -loadTest("proxyauth.js"); -loadTest("purge.js"); -loadTest("reader_acl.js"); -loadTest("recreate_doc.js"); -loadTest("reduce.js"); -loadTest("reduce_builtin.js"); -loadTest("reduce_false.js"); -loadTest("reduce_false_temp.js"); -loadTest("replication.js"); -loadScript("script/replicator_db_inc.js"); -loadTest("replicator_db_bad_rep_id.js"); -loadTest("replicator_db_by_doc_id.js"); -loadTest("replicator_db_compact_rep_db.js"); -loadTest("replicator_db_continuous.js"); -loadTest("replicator_db_credential_delegation.js"); -loadTest("replicator_db_field_validation.js"); -loadTest("replicator_db_filtered.js"); -loadTest("replicator_db_identical.js"); -loadTest("replicator_db_identical_continuous.js"); -loadTest("replicator_db_invalid_filter.js"); -loadTest("replicator_db_simple.js"); -loadTest("replicator_db_successive.js"); -loadTest("replicator_db_survives.js"); -loadTest("replicator_db_swap_rep_db.js"); -loadTest("replicator_db_update_security.js"); -loadTest("replicator_db_user_ctx.js"); -loadTest("replicator_db_write_auth.js"); -loadTest("replicator_db_security.js"); -loadTest("rev_stemming.js"); -loadTest("rewrite.js"); -loadTest("security_validation.js"); -loadTest("show_documents.js"); -loadTest("stats.js"); -loadTest("update_documents.js"); -loadTest("users_db.js"); -loadTest("users_db_security.js"); -loadTest("utf8.js"); -loadTest("uuids.js"); -loadTest("view_collation.js"); -loadTest("view_collation_raw.js"); -loadTest("view_conflicts.js"); -loadTest("view_compaction.js"); -loadTest("view_errors.js"); -loadTest("view_include_docs.js"); -loadTest("view_multi_key_all_docs.js"); -loadTest("view_multi_key_design.js"); -loadTest("view_multi_key_temp.js"); -loadTest("view_offsets.js"); -loadTest("view_pagination.js"); -loadTest("view_sandboxing.js"); -loadTest("view_update_seq.js"); -// keep sorted -