/// <summary>
        /// Starts a replication for the session
        /// </summary>
        /// <param name="username">The username to use for the replication</param>
        /// <param name="password">The password to use for replication auth (optional)</param>
        public static void StartReplication(string username, string password = null)
        {
            var authenticator = default(IAuthenticator);

            if (username != null && password != null)
            {
                authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, password);
            }

            var db     = AppWideManager.GetDatabase(username);
            var pusher = db.CreatePushReplication(SyncGatewayUrl);

            pusher.Continuous    = true;
            pusher.Authenticator = authenticator;
            pusher.Changed      += HandleReplicationChanged;


            var puller = db.CreatePullReplication(SyncGatewayUrl);

            puller.Continuous    = true;
            puller.Authenticator = authenticator;
            puller.Changed      += HandleReplicationChanged;

            pusher.Start();
            puller.Start();

            _pusher = pusher;
            _puller = puller;
        }
Exemple #2
0
        public void TestGetAuthenticationHeaderValue()
        {
            var username1  = "username1";
            var password1  = "password1";
            var credParam1 = Convert.ToBase64String(
                Encoding.UTF8.GetBytes(string.Format("{0}:{1}", username1, password1)));

            var auth       = AuthenticatorFactory.CreateBasicAuthenticator(username1, password1) as BasicAuthenticator;
            var authHeader = auth.AuthorizationHeaderValue;

            Assert.IsNotNull(authHeader);
            Assert.AreEqual(credParam1, authHeader.Split(' ')[1]);

            var username2  = "username2";
            var password2  = "password2";
            var credParam2 = Convert.ToBase64String(
                Encoding.UTF8.GetBytes(string.Format("{0}:{1}", username2, password2)));

            var userinfo = username2 + ":" + password2;
            var uri      = new Uri("http://" + userinfo + "@couchbase.com");

            auth       = (BasicAuthenticator)AuthenticatorFactory.CreateFromUri(uri);
            authHeader = auth.AuthorizationHeaderValue;
            Assert.IsNotNull(authHeader);
            Assert.AreEqual(credParam2, authHeader.Split(' ')[1]);

            uri  = new Uri("http://www.couchbase.com");
            auth = (BasicAuthenticator)AuthenticatorFactory.CreateFromUri(uri);
            Assert.IsNull(auth);

            var auth2 = AuthenticatorFactory.CreateFacebookAuthenticator("1234") as ICustomHeadersAuthorizer;

            Assert.IsNull(auth2);
        }
Exemple #3
0
        public void TestGetAuthenticationHeaderValue()
        {
            var username1  = "username1";
            var password1  = "password1";
            var credParam1 = Convert.ToBase64String(
                Encoding.UTF8.GetBytes(string.Format("{0}:{1}", username1, password1)));

            var auth       = AuthenticatorFactory.CreateBasicAuthenticator(username1, password1);
            var authHeader = AuthUtils.GetAuthenticationHeaderValue(auth, null);

            Assert.IsNotNull(authHeader);
            Assert.AreEqual(credParam1, authHeader.Parameter);

            var username2  = "username2";
            var password2  = "password2";
            var credParam2 = Convert.ToBase64String(
                Encoding.UTF8.GetBytes(string.Format("{0}:{1}", username2, password2)));

            var userinfo = username2 + ":" + password2;
            var uri      = new Uri("http://" + userinfo + "@couchbase.com");
            var request  = new HttpRequestMessage(HttpMethod.Get, uri);

            authHeader = AuthUtils.GetAuthenticationHeaderValue(auth, request.RequestUri);
            Assert.IsNotNull(authHeader);
            Assert.AreEqual(credParam2, authHeader.Parameter);

            uri        = new Uri("http://www.couchbase.com");
            request    = new HttpRequestMessage(HttpMethod.Get, uri);
            authHeader = AuthUtils.GetAuthenticationHeaderValue(null, request.RequestUri);
            Assert.IsNull(authHeader);

            auth       = AuthenticatorFactory.CreateFacebookAuthenticator("1234");
            authHeader = AuthUtils.GetAuthenticationHeaderValue(auth, null);
            Assert.IsNull(authHeader);
        }
Exemple #4
0
        public void TestBasicAuthenticationSuccess()
        {
            if (!Boolean.Parse((string)GetProperty("replicationTestsEnabled")))
            {
                Assert.Inconclusive("Server tests disabled.");
                return;
            }
            var username = "******";
            var password = "******";

            AddUser(username, password);

            var url        = GetReplicationURLWithoutCredentials();
            var replicator = database.CreatePushReplication(url);

            replicator.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, password);

            Assert.IsNotNull(replicator);
            Assert.IsNotNull(replicator.Authenticator);
            Assert.IsTrue(replicator.Authenticator is BasicAuthenticator);
            RunReplication(replicator);

            var lastError = replicator.LastError;

            Assert.IsNull(lastError);
            Thread.Sleep(200);
        }
        private static Replication SetupReplication(Manager manager, bool continuous, bool createTarget, Uri remoteUri, bool isPull, string user, string password)
        {
            if (remoteUri == null)
            {
                return(null);
            }

            var databaseName  = remoteUri.Segments.Last();
            var authenticator = default(IAuthenticator);

            if (user != null && password != null)
            {
                Console.WriteLine("Setting session credentials for user '{0}'", user);
                authenticator = AuthenticatorFactory.CreateBasicAuthenticator(user, password);
            }

            if (isPull)
            {
                Console.WriteLine("Pulling from <{0}> --> {1}", remoteUri, databaseName);
            }
            else
            {
                Console.WriteLine("Pushing {0} --> <{1}>", databaseName, remoteUri);
            }

            var db = manager.GetExistingDatabase(databaseName);

            if (isPull && db == null)
            {
                db = manager.GetDatabase(databaseName);
            }

            if (db == null)
            {
                Console.Error.WriteLine("Couldn't open database {0}", databaseName);
                return(null);
            }

            var repl = isPull ? db.CreatePullReplication(remoteUri) : db.CreatePushReplication(remoteUri);

            repl.Continuous    = continuous;
            repl.CreateTarget  = createTarget;
            repl.Authenticator = authenticator;
            repl.Changed      += (sender, e) =>
            {
                Console.WriteLine("*** Replicator status changed ({0} {1}/{2}) ***", e.Status, e.CompletedChangesCount, e.ChangesCount);
                if (e.LastError != null)
                {
                    Console.Error.WriteLine("*** Replicator reported error ***", e);
                }
                else if (e.Status == ReplicationStatus.Stopped)
                {
                    Console.WriteLine("*** Replicator finished ***");
                }
            };

            repl.Start();
            return(repl);
        }
        public static void Main(string[] args)
        {
            var syncGatewayUrl = new Uri("http://localhost:4984/db/");

            Manager  manager    = Manager.SharedInstance;
            Database airlineDb  = manager.GetDatabase("airline");
            Database routeDb    = manager.GetDatabase("route");
            Database airportDb  = manager.GetDatabase("airport");
            Database landmarkDb = manager.GetDatabase("landmark");
            Database hotelDb    = manager.GetDatabase("hotel");

            // Total docs: 31591
            var testDbs = new TestDatabase[] {
                new TestDatabase(airlineDb, "airline", "pass", 187),
                new TestDatabase(routeDb, "route", "pass", 24024),
                new TestDatabase(airportDb, "airport", "pass", 1968),
                new TestDatabase(landmarkDb, "landmark", "pass", 4495),
                new TestDatabase(hotelDb, "hotel", "pass", 917),
            };

            // Start continuous push / pull replications for each database
            foreach (var testDb in testDbs)
            {
                IAuthenticator replicationAuth = AuthenticatorFactory.CreateBasicAuthenticator(testDb.UserName, testDb.Password);

                Replication pullReplication = testDb.Database.CreatePullReplication(syncGatewayUrl);
                pullReplication.Authenticator = replicationAuth;
                pullReplication.Continuous    = true;
                pullReplication.Start();

                Replication pushReplication = testDb.Database.CreatePushReplication(syncGatewayUrl);
                pushReplication.Authenticator = replicationAuth;
                pushReplication.Continuous    = true;
                pushReplication.Start();
            }

            // Wait for replication to stop
            var timeout = TimeSpan.FromMinutes(20);

            // Poll until all dbs have the expected number of docs
            WaitForImport(testDbs, timeout);

            // Update each doc via Lite
            TouchAllDocs(testDbs);

            // Run python script to update all the docs via the SDK
            Console.WriteLine("\nWaiting for SDK to perform updates ...");
            var line = Console.ReadLine();

            // Wait for replication to stop
            WaitForSDKUpdates(testDbs, timeout);
        }
        private void StartReplications()
        {
            _pull = _db.CreatePullReplication(CreateSyncUri());
            _push = _db.CreatePushReplication(CreateSyncUri());
            var authenticator = AuthenticatorFactory.CreateBasicAuthenticator(User, Password);

            _pull.Authenticator = authenticator;
            _push.Authenticator = authenticator;
            _pull.Continuous    = true;
            _push.Continuous    = true;
            //       _pull.Start();
            //       _push.Start();
            _push.Changed += OnPushChanged;
        }
        public void TestBasicAuthenticationWrongPassword()
        {
            if (!Boolean.Parse((string)Runtime.Properties["replicationTestsEnabled"]))
            {
                Assert.Inconclusive("Server tests disabled.");
                return;
            }
            var username      = "******";
            var password      = "******";
            var wrongPassword = "******";

            AddUser(username, password);

            var url = GetReplicationURLWithoutCredentials();
            var httpClientFactory = new CouchbaseLiteHttpClientFactory(new CookieStore());

            manager.DefaultHttpClientFactory = httpClientFactory;

            var replicator = database.CreatePushReplication(url);

            replicator.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, wrongPassword);

            Assert.IsNotNull(replicator);
            Assert.IsNotNull(replicator.Authenticator);
            Assert.IsTrue(replicator.Authenticator is BasicAuthenticator);

            replicator.Start();

            var doneEvent = new ManualResetEvent(false);

            Task.Factory.StartNew(() =>
            {
                var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);
                var stop    = false;
                while (DateTime.UtcNow < timeout && !stop)
                {
                    stop |= replicator.Status != ReplicationStatus.Active;
                    Sleep(TimeSpan.FromMilliseconds(10));
                }
                doneEvent.Set();
            });
            doneEvent.WaitOne(TimeSpan.FromSeconds(10));
            Sleep(1000);
            var lastError = replicator.LastError;

            Assert.IsNotNull(lastError);
        }
        public void TestAuthenticationFactory()
        {
            var basicAuth = AuthenticatorFactory.CreateBasicAuthenticator("username", "password");

            Assert.IsNotNull(basicAuth);
            Assert.IsTrue(basicAuth is BasicAuthenticator);

            var facebookAuth = AuthenticatorFactory.CreateFacebookAuthenticator("DUMMY_TOKEN");

            Assert.IsNotNull(facebookAuth);
            Assert.IsTrue(facebookAuth is TokenAuthenticator);

            var personalAuth = AuthenticatorFactory.CreatePersonaAuthenticator("DUMMY_ASSERTION", null);

            Assert.IsNotNull(personalAuth);
            Assert.IsTrue(personalAuth is TokenAuthenticator);
        }
Exemple #10
0
        public virtual void TestAuthenticatorFactory()
        {
            Authenticator basicAuth = AuthenticatorFactory.CreateBasicAuthenticator("username"
                                                                                    , "password");

            NUnit.Framework.Assert.IsNotNull(basicAuth);
            NUnit.Framework.Assert.IsTrue(basicAuth is BasicAuthenticator);
            Authenticator facebookAuth = AuthenticatorFactory.CreateFacebookAuthenticator("DUMMY_TOKEN"
                                                                                          );

            NUnit.Framework.Assert.IsNotNull(facebookAuth);
            NUnit.Framework.Assert.IsTrue(facebookAuth is TokenAuthenticator);
            Authenticator personalAuth = AuthenticatorFactory.CreatePersonaAuthenticator("DUMMY_ASSERTION"
                                                                                         , null);

            NUnit.Framework.Assert.IsNotNull(personalAuth);
            NUnit.Framework.Assert.IsTrue(personalAuth is TokenAuthenticator);
        }
Exemple #11
0
        public void StartSyncGateway(string url = "")
        {
            pull = _database.CreatePullReplication(CreateSyncUri());
            push = _database.CreatePushReplication(CreateSyncUri());

            var authenticator = AuthenticatorFactory.CreateBasicAuthenticator("david", "12345");

            pull.Authenticator = authenticator;
            push.Authenticator = authenticator;

            pull.Continuous = true;
            push.Continuous = true;

            pull.Changed += Pull_Changed;
            push.Changed += Push_Changed;

            pull.Start();
            push.Start();
        }
        public MainPage()
        {
            InitializeComponent();

            Title = "Run Lover";

            mHistory = new List <RunData>();
            listHistory.ItemsSource = mHistory;

            ReadHistoryData();

            Database database = Couchbase.Lite.Manager.SharedInstance.GetDatabase(RunData.LOCAL_DB_NAME);

            Replication downloader = database.CreatePullReplication(new Uri(DATABASE_URL + "/" + DATABASE_NAME));

            downloader.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(USERNAME, PASSWORD);
            downloader.Changed      += OnReplicationChange;
            downloader.Start();
        }
Exemple #13
0
        public void TestBasicAuthenticationWrongPassword()
        {
            var username      = "******";
            var password      = "******";
            var wrongPassword = "******";

            AddUser(username, password);

            var url = GetReplicationURLWithoutCredentials();
            var httpClientFactory = new CouchbaseLiteHttpClientFactory(new CookieStore());

            manager.DefaultHttpClientFactory = httpClientFactory;

            var replicator = database.CreatePushReplication(url);

            replicator.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, wrongPassword);

            Assert.IsNotNull(replicator);
            Assert.IsNotNull(replicator.Authenticator);
            Assert.IsTrue(replicator.Authenticator is BasicAuthenticator);

            replicator.Start();

            var doneEvent = new ManualResetEvent(false);

            Task.Factory.StartNew(() =>
            {
                var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(30);
                var stop    = false;
                while (DateTime.UtcNow < timeout && !stop)
                {
                    stop |= !replicator.active;
                    Thread.Sleep(TimeSpan.FromMilliseconds(10));
                }
                doneEvent.Set();
            });
            doneEvent.WaitOne(TimeSpan.FromSeconds(35));
            Thread.Sleep(1000);
            var lastError = replicator.LastError;

            Assert.IsNotNull(lastError);
        }
Exemple #14
0
            /// <summary>
            /// Replicates all pending documents for a given replication and then returns.
            /// </summary>
            /// <param name="replication">The replication.</param>
            /// <returns>The number of replicated documents.</returns>
            private int ReplicatePending(Replication replication)
            {
                var isFinished = false;

                replication.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(UserId, Password);

                replication.Changed +=
                    (s, a) =>
                {
                    if (a.Status == ReplicationStatus.Stopped)
                    {
                        isFinished = true;
                    }
                };

                replication.Start();
                NeonHelper.WaitFor(() => isFinished, TimeSpan.FromSeconds(10));

                return(replication.CompletedChangesCount);
            }
Exemple #15
0
        public void StartSyncGateway(string scheme = "https", string hostname = "localhost", int port = 4984, string dbname = "beer", string username = "******", string password = "******")
        {
            Uri uri = CreateSyncUri(scheme, hostname, port, dbname);

            pull = _database.CreatePullReplication(uri);
            push = _database.CreatePushReplication(uri);

            var authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, password);

            pull.Authenticator = authenticator;
            push.Authenticator = authenticator;

            pull.Continuous = true;
            push.Continuous = true;

            pull.Changed += Pull_Changed;
            push.Changed += Push_Changed;

            pull.Start();
            push.Start();
        }
        private async void OnSaveClick()
        {
            Dictionary <string, object> data = RunData.CreateDictionary(
                new DateTimeOffset(mStartTime).ToUnixTimeMilliseconds(), (long)mDuration.TotalMilliseconds,
                mDistance, mStartCoordinate, mFinishCoordinate);

            Database database = Couchbase.Lite.Manager.SharedInstance.GetDatabase(RunData.LOCAL_DB_NAME);

            Document document = database.CreateDocument();

            document.PutProperties(data);

            Replication uploader = database.CreatePushReplication(new Uri(DATABASE_URL + "/" + DATABASE_NAME));

            uploader.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(USERNAME, PASSWORD);
            uploader.Start();

            await Navigation.PushAsync(new DetailPage(new RunData(data)));

            //Navigation.RemovePage(this);
        }
Exemple #17
0
        public void TestBasicAuthenticationWrongPassword()
        {
            if (!Boolean.Parse((string)GetProperty("replicationTestsEnabled")))
            {
                Assert.Inconclusive("Server tests disabled.");
                return;
            }
            var username      = "******";
            var password      = "******";
            var wrongPassword = "******";

            AddUser(username, password);

            CreateDocuments(database, 10);

            var url = GetReplicationURLWithoutCredentials();

            var replicator = database.CreatePushReplication(url);

            replicator.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(username, wrongPassword);

            Assert.IsNotNull(replicator);
            Assert.IsNotNull(replicator.Authenticator);
            Assert.IsTrue(replicator.Authenticator is BasicAuthenticator);

            RunReplication(replicator);

            var lastError = replicator.LastError as HttpResponseException;

            Assert.IsNotNull(lastError);
            Assert.AreEqual(HttpStatusCode.Unauthorized, lastError.StatusCode);
            Assert.IsTrue(lastError.Data.Contains("AuthChallenge"));
            var errorData = lastError.Data["AuthChallenge"].AsDictionary <string, string>();

            Assert.IsNotNull(errorData);
            Assert.AreEqual("Basic", errorData["Scheme"]);
            Assert.AreEqual("Couchbase Sync Gateway", errorData["realm"]);
        }
Exemple #18
0
        protected void Replicate(string localDbName, string remoteDbName, List <string> channels)
        {
            var url = new Uri(syncGateway + "/" + remoteDbName + "/");

            database = Manager.SharedInstance.GetDatabase(localDbName);

            pull = database.CreatePullReplication(url);
            push = database.CreatePushReplication(url);

            var auth = AuthenticatorFactory.CreateBasicAuthenticator(this.username, this.password);

            //Pull process
            pull.Channels      = channels;
            pull.Authenticator = auth;
            pull.Continuous    = true;
            pull.Changed      += PullChanged;
            pull.Start();

            //Push process
            push.Authenticator = auth;
            push.Continuous    = true;
            push.Start();
        }
Exemple #19
0
        public CouchDbGeoObjectsService()
        {
            var url  = new Uri("http://104.236.29.68:4985/sync_gateway/");
            var auth = AuthenticatorFactory.CreateBasicAuthenticator("mobile", "123123");

            var pull = _db.CreatePullReplication(url);

            pull.Continuous    = true;
            pull.Channels      = new[] { "geo" };
            pull.Authenticator = auth;
            pull.Start();

            var view = _db.GetView("geo");

            view.SetMap((document, emit) =>
            {
                if (document.ContainsKey("geometry") && document.ContainsKey("name"))
                {
                    emit(new[] { document["geometry"] }, document);
                }
            }, "1");

            _docs = view.CreateQuery().Run();
        }
        private void SetupReplication(Uri server)
        {
                        #if (!CB_SYNC_ENABLED)
            Console.WriteLine("Sync is DISABLED");
            return;
                        #endif

            Console.WriteLine("Setting up replication");

            var pull = _db.CreatePullReplication(server);
            var push = _db.CreatePushReplication(server);

            pull.Continuous = true;
            push.Continuous = true;

                        #if (CB_USER_AUTH_ENABLED)
            var userId = GetUserId();
            pull.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(userId, userId);
            push.Authenticator = AuthenticatorFactory.CreateBasicAuthenticator(userId, userId);
                        #endif

            pull.Start();
            push.Start();
        }
Exemple #21
0
        public async Task SingleUser()
        {
            // Perform an end-to-end integration test where we provision
            // the Sync Gateway with a user and verify that document R/W
            // and replication works.

            string   tempFolder = null;
            Database db0        = null;
            Database db1        = null;
            Manager  manager    = null;

            try
            {
                tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

                Directory.CreateDirectory(tempFolder);

                await TestCluster.ClearAsync();

                using (var gateway = TestCluster.CreateGateway())
                {
                    var gatewayManager = gateway.CreateManager();

                    await TestCluster.CreateDatabaseAsync("db");

                    await gatewayManager.RoleCreateAsync("db",
                                                         new RoleProperties()
                    {
                        Name          = "role0",
                        AdminChannels = new List <string>()
                        {
                            $"role-channel"
                        }
                    });

                    await gatewayManager.UserCreateAsync("db",
                                                         new UserProperties()
                    {
                        Name          = "user0",
                        Password      = "******",
                        Email         = "*****@*****.**",
                        IsDisabled    = false,
                        AdminChannels = new List <string>()
                        {
                            "user-channel"
                        },
                        Roles = new List <string>()
                        {
                            "role0"
                        }
                    });

                    // Create two local databases for the same user.

                    manager = new Manager(new DirectoryInfo(tempFolder), new ManagerOptions());

                    var auth = AuthenticatorFactory.CreateBasicAuthenticator("user0", "password0");

                    db0 = manager.GetDatabase("db0");
                    db1 = manager.GetDatabase("db1");

                    var db0ExternalChange = false;
                    var db1ExternalChange = false;

                    db0.Changed +=
                        (s, a) =>
                    {
                        Debug.Write($"*** db0: Count={a.Changes.Count()} External={a.IsExternal}");

                        if (a.Changes.Count() > 0 && a.IsExternal)
                        {
                            db0ExternalChange = true;
                        }
                    };

                    db1.Changed +=
                        (s, a) =>
                    {
                        Debug.Write($"*** db1: Count={a.Changes.Count()} External={a.IsExternal}");

                        if (a.Changes.Count() > 0 && a.IsExternal)
                        {
                            db1ExternalChange = true;
                        }
                    };

                    // Here's the meat of the test:
                    //
                    //      1. Create push and pull replicators for each database.
                    //      2. Write a document to one database
                    //      3. Verify that the source database's push replicator pushed the document
                    //      4. ...and the target database's pull replicator pulled the document

                    var db0Pull = db0.CreatePullReplication(new Uri(gateway.GetDatabaseUri("db")));

                    db0Pull.Authenticator = auth;
                    db0Pull.Continuous    = true;
                    db0Pull.Start();

                    var db0Push = db0.CreatePushReplication(new Uri(gateway.GetDatabaseUri("db")));

                    db0Push.Authenticator = auth;
                    db0Push.Continuous    = true;
                    db0Push.Start();

                    var db1Pull = db1.CreatePullReplication(new Uri(gateway.GetDatabaseUri("db")));

                    db1Pull.Authenticator = auth;
                    db1Pull.Continuous    = true;
                    db1Pull.Start();

                    var db1Push = db1.CreatePushReplication(new Uri(gateway.GetDatabaseUri("db")));

                    db1Push.Authenticator = auth;
                    db1Push.Continuous    = true;
                    db1Push.Start();

                    // Write a document to db0 and wait for the replication to db1.

                    var source     = db0.GetDocument("doc-0");
                    var properties = new Dictionary <string, object>()
                    {
                        { "+c", "doc0" },
                        { "+ch", new string[] { "user-channel" } }
                    };

                    source.PutProperties(properties);
                    var target = db0.GetDocument("doc-0");

                    Assert.Equal("doc0", target.Properties["+c"]);

                    NeonHelper.WaitFor(() => !db0Push.IsDocumentPending(target), MaxWait);
                    NeonHelper.WaitFor(() => db1ExternalChange, MaxWait);

                    target = db1.GetDocument("doc-0");

                    Assert.Equal("doc0", target.Properties["+c"]);

                    // Write a document to db1 and wait for the replication to db0.

                    db0ExternalChange = db1ExternalChange = false;

                    source     = db1.GetDocument("doc-1");
                    properties = new Dictionary <string, object>()
                    {
                        { "+c", "doc1" },
                        { "+ch", new string[] { "user-channel" } }
                    };

                    source.PutProperties(properties);
                    target = db1.GetDocument("doc-1");

                    Assert.Equal("doc1", target.Properties["+c"]);

                    NeonHelper.WaitFor(() => !db1Push.IsDocumentPending(target), MaxWait);
                    NeonHelper.WaitFor(() => db0ExternalChange, MaxWait);

                    target = db1.GetDocument("doc-1");

                    Assert.Equal("doc1", target.Properties["+c"]);
                }
            }
            finally
            {
                if (db0 != null)
                {
                    db0.Dispose();
                }

                if (db1 != null)
                {
                    db1.Dispose();
                }

                if (manager != null)
                {
                    manager.Close();
                }

                await TestCluster.ClearAsync();

                Directory.Delete(tempFolder, recursive: true);
            }
        }
 public IAuthenticator CreateAuthenticator(ReplicationDriverContext context)
 {
     return(AuthenticatorFactory.CreateBasicAuthenticator(this._username, this._password));
 }