Пример #1
0
        public virtual RemoteDatabase CreateDatabase(string name)
        {
            var retVal = new RemoteDatabase(this, name, "jim", "borden");

            retVal.Create();
            return(retVal);
        }
Пример #2
0
        public virtual RemoteDatabase CreateDatabase(string name, string user = "******", string password = "******")
        {
            var retVal = new RemoteDatabase(this, name, user, password);

            retVal.Create();
            return(retVal);
        }
Пример #3
0
 public void DeleteDatabase(RemoteDatabase db)
 {
     var server = _regularUri.AppendPath(db.Name);
     var deleteRequest = HttpWebRequest.Create(server);
     deleteRequest.Method = "DELETE";
     try {
         var response = (HttpWebResponse)deleteRequest.GetResponse();
         Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
     } catch(WebException ex) {
         if (ex.Status == WebExceptionStatus.ProtocolError) {
             var response = ex.Response as HttpWebResponse;
             if (response != null) {
                 Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
             } else {
                 Assert.Fail("Error from CouchDB: {0}", response.StatusCode);
             }
         } else {
             Assert.Fail("Error from CouchDB: {0}", ex);
         }
     }
 }
        private void CreatePullAndTest(int docCount, RemoteDatabase db, Action<Replication> tester)
        {
            db.AddDocuments(20, false);

            var pull = database.CreatePullReplication(db.RemoteUri);
            RunReplication(pull);

            WriteDebug("Document count at end {0}", database.GetDocumentCount());
            tester(pull);
        }
        private void CreatePullAndTest(int docCount, RemoteDatabase db, Action<Replication> tester)
        {
            for (int i = 0; i < docCount; i++)
            {
                var docIdTimestamp = Convert.ToString (Runtime.CurrentTimeMillis ());
                var docId = string.Format ("doc{0}-{1}", i, docIdTimestamp);

                db.AddDocument(docId, null);
            }

            var pull = database.CreatePullReplication(db.RemoteUri);
            RunReplication(pull);

            Log.D("TestPullManyDocuments", "Document count at end {0}", database.DocumentCount);
            tester(pull);
        }
        private void CreatePullAndTest(int docCount, RemoteDatabase db, Action<Replication> tester)
        {
            db.AddDocuments(20, false);

            var pull = database.CreatePullReplication(db.RemoteUri);
            RunReplication(pull);

            Log.D("TestPullManyDocuments", "Document count at end {0}", database.DocumentCount);
            tester(pull);
        }
Пример #7
0
 public void DeleteDatabase(RemoteDatabase db)
 {
     Task.Delay(1000).ContinueWith(t =>
     {
         var server = _adminUri.AppendPath(db.Name);
         var deleteRequest = WebRequest.CreateHttp(server);
         deleteRequest.Method = "DELETE";
         try {
             var response = (HttpWebResponse)deleteRequest.GetResponse();
             Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
         } catch (WebException ex) {
             if (ex.Status == WebExceptionStatus.ProtocolError) {
                 var response = ex.Response as HttpWebResponse;
                 if (response != null) {
                     Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
                 } else {
                     Assert.Fail("Error from Sync Gateway: {0}", response.StatusCode);
                 }
             } else {
                 Assert.Fail("Error from Sync Gateway: {0}", ex);
             }
         }
     });
 }
 public virtual RemoteDatabase CreateDatabase(string name, string user = "******", string password = "******")
 {
     var retVal = new RemoteDatabase(this, name, user, password);
     retVal.Create();
     return retVal;
 }
 public virtual RemoteDatabase CreateDatabase(string name)
 {
     var retVal = new RemoteDatabase(this, name, "jim", "borden");
     retVal.Create();
     return retVal;
 }