summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-01-29 20:08:54 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-01-29 20:08:54 +0000
commit0fc0c2d630abe0f4b6cc37c7f92728d1fe156ff3 (patch)
tree4a7727a9db0c07676d8ba44fdab09291bf928da7 /share/www/script/test
parentadb2703aa1f7b13d30e033a8b47bc625f8c492cc (diff)
Thanks Filipe Manana. Closes COUCHDB-631.
Replicator option to replicate a list of docids (bypasses by_seq index). Usage: POST to /_replicate with a JSON body of: {"source": "myfoo", "target" : "http://remotedb.com/theirfoo", "doc_ids": ["foo1", "foo3", "foo666"]} This will copy the listed docs from the source to the target database. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@904615 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/replication.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js
index 78678937..d3725a17 100644
--- a/share/www/script/test/replication.js
+++ b/share/www/script/test/replication.js
@@ -301,4 +301,61 @@ couchTests.replication = function(debug) {
});
TEquals("test_suite_db_b", dbB.info().db_name,
"Target database should exist");
+
+
+ // test replication object option doc_ids
+
+ var dbA = new CouchDB("test_suite_rep_docs_db_a", {"X-Couch-Full-Commit":"false"});
+ var dbB = new CouchDB("test_suite_rep_docs_db_b", {"X-Couch-Full-Commit":"false"});
+
+ dbA.deleteDb();
+ dbA.createDb();
+ dbB.deleteDb();
+ dbB.createDb();
+
+ T(dbA.save({_id:"foo1",value:"a"}).ok);
+ T(dbA.save({_id:"foo2",value:"b"}).ok);
+ T(dbA.save({_id:"foo3",value:"c"}).ok);
+
+ var dbPairs = [
+ {source:"test_suite_rep_docs_db_a",
+ target:"test_suite_rep_docs_db_b"},
+ {source:"test_suite_rep_docs_db_a",
+ target:"http://" + host + "/test_suite_rep_docs_db_b"},
+ {source:"http://" + host + "/test_suite_rep_docs_db_a",
+ target:"test_suite_rep_docs_db_b"},
+ {source:"http://" + host + "/test_suite_rep_docs_db_a",
+ target:"http://" + host + "/test_suite_rep_docs_db_b"}
+ ];
+
+ for (var i = 0; i < dbPairs.length; i++) {
+ var dbA = dbPairs[i].source;
+ var dbB = dbPairs[i].target;
+
+ var repResult = CouchDB.replicate(dbA, dbB, {
+ body: {"doc_ids": ["foo1", "foo3", "foo666"]}
+ });
+
+ T(repResult.ok);
+ T(repResult.docs_written === 2);
+ T(repResult.docs_read === 2);
+ T(repResult.doc_write_failures === 0);
+
+ dbB = new CouchDB("test_suite_rep_docs_db_b");
+
+ var docFoo1 = dbB.open("foo1");
+ T(docFoo1 !== null);
+ T(docFoo1.value === "a");
+
+ var docFoo2 = dbB.open("foo2");
+ T(docFoo2 === null);
+
+ var docFoo3 = dbB.open("foo3");
+ T(docFoo3 !== null);
+ T(docFoo3.value === "c");
+
+ var docFoo666 = dbB.open("foo666");
+ T(docFoo666 === null);
+ }
+
};