public virtual void RunReplication(Replication replication) { CountDownLatch replicationDoneSignal = new CountDownLatch(1); LiteTestCase.ReplicationFinishedObserver replicationFinishedObserver = new LiteTestCase.ReplicationFinishedObserver (replicationDoneSignal); replication.AddChangeListener(replicationFinishedObserver); replication.Start(); CountDownLatch replicationDoneSignalPolling = ReplicationWatcherThread(replication ); Log.D(Tag, "Waiting for replicator to finish"); try { bool success = replicationDoneSignal.Await(300, TimeUnit.Seconds); NUnit.Framework.Assert.IsTrue(success); success = replicationDoneSignalPolling.Await(300, TimeUnit.Seconds); NUnit.Framework.Assert.IsTrue(success); Log.D(Tag, "replicator finished"); } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } replication.RemoveChangeListener(replicationFinishedObserver); }
/// <exception cref="System.Exception"></exception> private void PutReplicationOnline(Replication replication) { CountDownLatch wentOnline = new CountDownLatch(1); Replication.ChangeListener onlineChangeListener = new _ChangeListener_1915(wentOnline ); replication.AddChangeListener(onlineChangeListener); replication.GoOnline(); bool succeeded = wentOnline.Await(30, TimeUnit.Seconds); NUnit.Framework.Assert.IsTrue(succeeded); replication.RemoveChangeListener(onlineChangeListener); }