@@ -2664,7 +2664,7 @@ private void putReplicationOnline(Replication replication) throws InterruptedExc
26642664
26652665 // this was a useless test, the replication wasn't even started
26662666 final CountDownLatch wentOnline = new CountDownLatch (1 );
2667- Replication .ChangeListener changeListener = new ReplicationActiveObserver (wentOnline );
2667+ Replication .ChangeListener changeListener = new ReplicationRunningObserver (wentOnline );
26682668 replication .addChangeListener (changeListener );
26692669
26702670 replication .goOnline ();
@@ -2979,7 +2979,7 @@ public void testGetReplicatorWithCustomHeader() throws Throwable {
29792979 replicator .start ();
29802980
29812981 final CountDownLatch replicationStarted = new CountDownLatch (1 );
2982- replicator .addChangeListener (new ReplicationActiveObserver (replicationStarted ));
2982+ replicator .addChangeListener (new ReplicationRunningObserver (replicationStarted ));
29832983
29842984 boolean success = replicationStarted .await (30 , TimeUnit .SECONDS );
29852985 assertTrue (success );
@@ -3040,7 +3040,7 @@ public void testGetReplicator() throws Throwable {
30403040 replicator .start ();
30413041
30423042 final CountDownLatch replicationStarted = new CountDownLatch (1 );
3043- replicator .addChangeListener (new ReplicationActiveObserver (replicationStarted ));
3043+ replicator .addChangeListener (new ReplicationRunningObserver (replicationStarted ));
30443044
30453045 boolean success = replicationStarted .await (30 , TimeUnit .SECONDS );
30463046 assertTrue (success );
@@ -3299,7 +3299,7 @@ public void testContinuousPullEntersIdleState() throws Exception {
32993299 pullReplication .addChangeListener (new Replication .ChangeListener () {
33003300 @ Override
33013301 public void changed (Replication .ChangeEvent event ) {
3302- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
3302+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
33033303 enteredIdleState .countDown ();
33043304 }
33053305 }
@@ -4209,7 +4209,7 @@ public void testContinuousPullReplicationGoesIdleTwice() throws Exception {
42094209 pullReplication .addChangeListener (new Replication .ChangeListener () {
42104210 @ Override
42114211 public void changed (Replication .ChangeEvent event ) {
4212- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4212+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
42134213 Log .e (TAG , "Replication is IDLE 1" );
42144214 enteredIdleState1 .countDown ();
42154215 pullReplication .removeChangeListener (this );
@@ -4237,15 +4237,15 @@ public void changed(Replication.ChangeEvent event) {
42374237 pullReplication .addChangeListener (new Replication .ChangeListener () {
42384238 @ Override
42394239 public void changed (Replication .ChangeEvent event ) {
4240- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_ACTIVE ) {
4240+ if (event .getTransition ().getDestination () == ReplicationState . RUNNING ) {
42414241 if (enteredRunningState .getCount () > 0 ) {
42424242 Log .e (TAG , "Replication is RUNNING" );
42434243 enteredRunningState .countDown ();
42444244 }
42454245 }
42464246 // second IDLE change listener
42474247 // handling IDLE event here. It seems IDLE event was fired before set IDLE event handler
4248- else if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4248+ else if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
42494249 if (enteredRunningState .getCount () <= 0 && enteredIdleState2 .getCount () > 0 ) {
42504250 Log .e (TAG , "Replication is IDLE 2" );
42514251 enteredIdleState2 .countDown ();
@@ -4312,11 +4312,12 @@ public void testContinuousPullReplicationSendStoppedOnce() throws Exception {
43124312 pullReplication .addChangeListener (new Replication .ChangeListener () {
43134313 @ Override
43144314 public void changed (Replication .ChangeEvent event ) {
4315- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4315+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
43164316 Log .d (TAG , "Replication is IDLE" );
43174317 enteredIdleState .countDown ();
4318- } else if (event .getSource ().getStatus () == Replication .ReplicationStatus .REPLICATION_STOPPED ) {
4319- Log .d (TAG , "Replication is STOPPED" );
4318+ } else if (event .getTransition ().getDestination () == ReplicationState .STOPPED ) {
4319+ event .getTransition ().getDestination ();
4320+ Log .e (TAG , "Replication is STOPPED" , new Exception ("HELLO WORLD" ));
43204321 enteredStoppedState .countDown ();
43214322 }
43224323 }
@@ -4383,8 +4384,7 @@ public void testOneTimePullReplicationSendStoppedOnce() throws Exception {
43834384 pullReplication .addChangeListener (new Replication .ChangeListener () {
43844385 @ Override
43854386 public void changed (Replication .ChangeEvent event ) {
4386- if (event .getSource ().getStatus () == Replication .ReplicationStatus .REPLICATION_STOPPED &&
4387- event .getTransition ().getDestination () == ReplicationState .STOPPED ) {
4387+ if (event .getTransition ().getDestination () == ReplicationState .STOPPED ) {
43884388 Log .d (TAG , "Replication is STOPPED" );
43894389 enteredStoppedState .countDown ();
43904390 }
@@ -4450,7 +4450,7 @@ public void testPullReplicatonSendIdleStateAfterCheckPoint() throws Exception {
44504450 pullReplication .addChangeListener (new Replication .ChangeListener () {
44514451 @ Override
44524452 public void changed (Replication .ChangeEvent event ) {
4453- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4453+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
44544454 pullInitialIdleState .countDown ();
44554455 }
44564456 }
@@ -4469,20 +4469,20 @@ public void changed(Replication.ChangeEvent event) {
44694469
44704470
44714471 // 2. Update change event handler for handling ACTIVE and IDLE
4472- final CountDownLatch activeSignal = new CountDownLatch (1 );
4472+ final CountDownLatch runningSignal = new CountDownLatch (1 );
44734473 final CountDownLatch idleSignal = new CountDownLatch (1 );
44744474 pullReplication .addChangeListener (new Replication .ChangeListener () {
44754475 @ Override
44764476 public void changed (Replication .ChangeEvent event ) {
44774477 Log .e (TAG , "[changed] PULL -> " + event );
4478- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4478+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
44794479 // make sure pull replicator becomes IDLE after ACTIVE state.
44804480 // so ignore any IDLE state before ACTIVE.
4481- if (activeSignal .getCount () == 0 ) {
4481+ if (runningSignal .getCount () == 0 ) {
44824482 idleSignal .countDown ();
44834483 }
4484- } else if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_ACTIVE ) {
4485- activeSignal .countDown ();
4484+ } else if (event .getTransition ().getDestination () == ReplicationState . RUNNING ) {
4485+ runningSignal .countDown ();
44864486 }
44874487 }
44884488 });
@@ -4510,8 +4510,8 @@ public void changed(Replication.ChangeEvent event) {
45104510 mockChangesFeedNoResponse2 .setSticky (true );
45114511 dispatcher .enqueueResponse (MockHelper .PATH_REGEX_CHANGES , mockChangesFeedNoResponse2 );
45124512
4513- // 6. wait for Replication IDLE -> ACTIVE -> IDLE
4514- success = activeSignal .await (30 , TimeUnit .SECONDS );
4513+ // 6. wait for Replication IDLE -> RUNNING -> IDLE
4514+ success = runningSignal .await (30 , TimeUnit .SECONDS );
45154515 assertTrue (success );
45164516 success = idleSignal .await (30 , TimeUnit .SECONDS );
45174517 assertTrue (success );
@@ -4634,7 +4634,7 @@ public void changed(Replication.ChangeEvent event) {
46344634 if (event .getError () != null ) {
46354635 Assert .fail ("Should not have any error...." );
46364636 }
4637- if (event .getSource ().getStatus () == Replication . ReplicationStatus . REPLICATION_IDLE ) {
4637+ if (event .getTransition ().getDestination () == ReplicationState . IDLE ) {
46384638 idleSignal1 .countDown ();
46394639 idleSignal2 .countDown ();
46404640 }
@@ -4787,7 +4787,7 @@ public void testPushReplActiveState() throws Exception {
47874787
47884788 // Event handler for ACTIVE
47894789 CountDownLatch activeSignal = new CountDownLatch (1 );
4790- ReplicationActiveObserver activeObserver = new ReplicationActiveObserver (activeSignal );
4790+ ReplicationRunningObserver activeObserver = new ReplicationRunningObserver (activeSignal );
47914791 pullReplication .addChangeListener (activeObserver );
47924792
47934793 // Event handler for IDLE2
0 commit comments