コード例 #1
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                Log.D(Tag, replicator + " changed.  " + replicator.GetCompletedChangesCount() + " / "
                      + replicator.GetChangesCount());
                NUnit.Framework.Assert.IsTrue(replicator.GetCompletedChangesCount() <= replicator
                                              .GetChangesCount());
                if (replicator.GetCompletedChangesCount() > replicator.GetChangesCount())
                {
                    throw new RuntimeException("replicator.getCompletedChangesCount() > replicator.getChangesCount()"
                                               );
                }
                if (!replicator.IsRunning())
                {
                    replicationFinished = true;
                    string msg = string.Format("ReplicationFinishedObserver.changed called, set replicationFinished to: %b"
                                               , replicationFinished);
                    Log.D(Tag, msg);
                    doneSignal.CountDown();
                }
                else
                {
                    string msg = string.Format("ReplicationFinishedObserver.changed called, but replicator still running, so ignore it"
                                               );
                    Log.D(Tag, msg);
                }
            }
コード例 #2
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                if (replicator.GetLastError() != null)
                {
                    doneSignal.CountDown();
                }
            }
コード例 #3
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                if (replicator.GetStatus() == Replication.ReplicationStatus.ReplicationIdle)
                {
                    doneSignal.CountDown();
                }
            }
コード例 #4
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                if (replicator.IsRunning())
                {
                    doneSignal.CountDown();
                }
            }
コード例 #5
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                if (!replicator.IsRunning())
                {
                    this.replicationFinished = true;
                    string msg = string.Format("myobserver.update called, set replicationFinished to: %b"
                                               , this.replicationFinished);
                    Log.D(ReplicationTest.Tag, msg);
                    this.doneSignal.CountDown();
                }
                else
                {
                    string msg = string.Format("myobserver.update called, but replicator still running, so ignore it"
                                               );
                    Log.D(ReplicationTest.Tag, msg);
                }
            }
コード例 #6
0
            public void Changed(Replication.ChangeEvent @event)
            {
                Replication replication = @event.GetSource();

                if (replication.GetLastError() != null)
                {
                    Exception lastError = replication.GetLastError();
                    if (lastError is HttpResponseException)
                    {
                        HttpResponseException responseException = (HttpResponseException)lastError;
                        if (responseException.GetStatusCode() == 401)
                        {
                            this._enclosing.onSyncUnauthorizedObservable.NotifyChanges();
                        }
                    }
                }
                this._enclosing.UpdateSyncProgress(replication.GetCompletedChangesCount(), replication
                                                   .GetChangesCount());
            }
コード例 #7
0
            public virtual void Changed(Replication.ChangeEvent @event)
            {
                Replication replicator = @event.GetSource();

                Log.D(Tag, replicator + " changed.  " + replicator.GetCompletedChangesCount() + " / "
                      + replicator.GetChangesCount());
                if (replicator.GetCompletedChangesCount() < 0)
                {
                    string msg = string.Format("%s: replicator.getCompletedChangesCount() < 0", replicator
                                               );
                    Log.D(Tag, msg);
                    throw new RuntimeException(msg);
                }
                if (replicator.GetChangesCount() < 0)
                {
                    string msg = string.Format("%s: replicator.getChangesCount() < 0", replicator);
                    Log.D(Tag, msg);
                    throw new RuntimeException(msg);
                }
                // see https://github.com/couchbase/couchbase-lite-java-core/issues/100
                if (replicator.GetCompletedChangesCount() > replicator.GetChangesCount())
                {
                    string msg = string.Format("replicator.getCompletedChangesCount() - %d > replicator.getChangesCount() - %d"
                                               , replicator.GetCompletedChangesCount(), replicator.GetChangesCount());
                    Log.D(Tag, msg);
                    throw new RuntimeException(msg);
                }
                if (!replicator.IsRunning())
                {
                    replicationFinished = true;
                    string msg = string.Format("ReplicationFinishedObserver.changed called, set replicationFinished to: %b"
                                               , replicationFinished);
                    Log.D(Tag, msg);
                    doneSignal.CountDown();
                }
                else
                {
                    string msg = string.Format("ReplicationFinishedObserver.changed called, but replicator still running, so ignore it"
                                               );
                    Log.D(Tag, msg);
                }
            }