Exemple #1
0
        /// <exception cref="System.Exception"></exception>
        public virtual void StopReplication(Replication replication)
        {
            CountDownLatch replicationDoneSignal = new CountDownLatch(1);

            LiteTestCase.ReplicationStoppedObserver replicationStoppedObserver = new LiteTestCase.ReplicationStoppedObserver
                                                                                     (replicationDoneSignal);
            replication.AddChangeListener(replicationStoppedObserver);
            replication.Stop();
            bool success = replicationDoneSignal.Await(30, TimeUnit.Seconds);

            NUnit.Framework.Assert.IsTrue(success);
            // give a little padding to give it a chance to save a checkpoint
            Sharpen.Thread.Sleep(2 * 1000);
        }
        public void StopReplication(Replication replication)
        {
            var replicationDoneSignal      = new CountDownLatch(1);
            var replicationStoppedObserver = new ReplicationObserver(replicationDoneSignal);

            replication.Changed += replicationStoppedObserver.Changed;
            replication.Stop();

            var success = replicationDoneSignal.Await(TimeSpan.FromSeconds(30));

            Assert.IsTrue(success);

            // give a little padding to give it a chance to save a checkpoint
            System.Threading.Thread.Sleep(2 * 1000);
        }
        public void StopReplication(Replication replication)
        {
            if (replication.Status == ReplicationStatus.Stopped)
            {
                return;
            }

            var replicationDoneSignal      = new CountdownEvent(1);
            var replicationStoppedObserver = new ReplicationStoppedObserver(replicationDoneSignal);

            replication.Changed += replicationStoppedObserver.Changed;
            replication.Stop();

            var success = replicationDoneSignal.Wait(TimeSpan.FromSeconds(10));

            Assert.IsTrue(success);

            // give a little padding to give it a chance to save a checkpoint
            Sleep(2 * 1000);
        }
        public void StopReplication(Replication replication)
        {
            var replicationDoneSignal = new CountdownEvent(1);
            var replicationStoppedObserver = new ReplicationObserver(replicationDoneSignal);
            replication.Changed += replicationStoppedObserver.Changed;
            replication.Stop();

            var success = replicationDoneSignal.Wait(TimeSpan.FromSeconds(30));
            Assert.IsTrue(success);

            // give a little padding to give it a chance to save a checkpoint
            System.Threading.Thread.Sleep(2 * 1000);
        }
		private void RunReplication(Replication replication)
		{
//			var replicationDoneSignal = new CountDownLatch(1);
            var replicationDoneSignalPolling = ReplicationWatcherThread(replication);
            replication.Changed += (sender, e) => 
                replicationDoneSignalPolling.CountDown ();
			replication.Start();

			Log.D(Tag, "Waiting for replicator to finish");

			try
			{
                var success = replicationDoneSignalPolling.Await(TimeSpan.FromSeconds(15));
				Assert.IsTrue(success);
                Sharpen.Thread.Sleep(5000);
                replication.Stop();
                Log.D(Tag, "replicator finished");
			}
			catch (Exception e)
			{
				Runtime.PrintStackTrace(e);
			}
		}