Skip to content

Commit

Permalink
GEODE-7754: show gatewaysender's running state instead of connected s…
Browse files Browse the repository at this point in the history
…tate (apache#4657)

* viewRemoteClusterStatus is only used by Pluse to gather gatewaysender status, so changing that to show the running state in Pulse.
  • Loading branch information
jinmeiliao authored Jan 31, 2020
1 parent 40d6b47 commit e8e9a13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ public void testPrepareErrorAbortsBackup() {
}

@Test
public void viewClusterStatusShouldBeTrueIfAllParallelSendersAreConnected() {
public void viewClusterStatusShouldBeTrueIfAllParallelSendersAreRunning() {
// parallel senders for dsid = 2
doReturn(true).when(bean1).isParallel();
doReturn(true).when(bean1).isConnected();
doReturn(true).when(bean1).isRunning();
doReturn(true).when(bean2).isParallel();
doReturn(true).when(bean2).isConnected();
doReturn(true).when(bean2).isRunning();

// parallel senders for dsid = 3
doReturn(true).when(bean3).isParallel();
doReturn(true).when(bean3).isConnected();
doReturn(true).when(bean3).isRunning();
doReturn(true).when(bean4).isParallel();
doReturn(true).when(bean4).isConnected();
doReturn(true).when(bean4).isRunning();

Map<String, Boolean> status = bridge.viewRemoteClusterStatus();
assertThat(status.keySet()).hasSize(2);
Expand All @@ -158,18 +158,18 @@ public void viewClusterStatusShouldBeTrueIfAllParallelSendersAreConnected() {
}

@Test
public void viewClusterStatusShouldBeFalseIfAnyParallelSendersIsNotConnected() {
public void viewClusterStatusShouldBeFalseIfAnyParallelSendersIsNotRunning() {
// parallel senders for dsid = 2
doReturn(true).when(bean1).isParallel();
doReturn(true).when(bean1).isConnected();
doReturn(true).when(bean1).isRunning();
doReturn(true).when(bean2).isParallel();
doReturn(true).when(bean2).isConnected();
doReturn(true).when(bean2).isRunning();

// parallel senders for dsid = 3
doReturn(true).when(bean3).isParallel();
doReturn(true).when(bean3).isConnected();
doReturn(true).when(bean3).isRunning();
doReturn(true).when(bean4).isParallel();
doReturn(false).when(bean4).isConnected();
doReturn(false).when(bean4).isRunning();

Map<String, Boolean> status = bridge.viewRemoteClusterStatus();
assertThat(status.keySet()).hasSize(2);
Expand All @@ -178,26 +178,26 @@ public void viewClusterStatusShouldBeFalseIfAnyParallelSendersIsNotConnected() {
}

@Test
public void viewClusterStatusShouldBeTrueIfASerialPrimaryIsConnected() {
public void viewClusterStatusShouldBeTrueIfASerialPrimaryIsRunning() {
// serial primary for dsid = 2
doReturn(false).when(bean1).isParallel();
doReturn(true).when(bean1).isPrimary();
doReturn(true).when(bean1).isConnected();
doReturn(true).when(bean1).isRunning();

// serial secondary for dsid = 2
doReturn(false).when(bean2).isParallel();
doReturn(false).when(bean2).isPrimary();
doReturn(false).when(bean2).isConnected();
doReturn(false).when(bean2).isRunning();

// serial primary for dsid = 3
doReturn(false).when(bean3).isParallel();
doReturn(true).when(bean3).isPrimary();
doReturn(true).when(bean3).isConnected();
doReturn(true).when(bean3).isRunning();

// serial secondary for dsid = 3
doReturn(false).when(bean4).isParallel();
doReturn(false).when(bean4).isPrimary();
doReturn(false).when(bean4).isConnected();
doReturn(false).when(bean4).isRunning();

Map<String, Boolean> status = bridge.viewRemoteClusterStatus();
assertThat(status.keySet()).hasSize(2);
Expand All @@ -206,26 +206,26 @@ public void viewClusterStatusShouldBeTrueIfASerialPrimaryIsConnected() {
}

@Test
public void viewClusterStatusShouldBeFalseIfASerialPrimaryIsNotConnected() {
public void viewClusterStatusShouldBeFalseIfASerialPrimaryIsNotRunning() {
// serial primary for dsid = 2
doReturn(false).when(bean1).isParallel();
doReturn(true).when(bean1).isPrimary();
doReturn(true).when(bean1).isConnected();
doReturn(true).when(bean1).isRunning();

// serial secondary for dsid = 2
doReturn(false).when(bean2).isParallel();
doReturn(false).when(bean2).isPrimary();
doReturn(false).when(bean2).isConnected();
doReturn(false).when(bean2).isRunning();

// serial primary for dsid = 3
doReturn(false).when(bean3).isParallel();
doReturn(true).when(bean3).isPrimary();
doReturn(false).when(bean3).isConnected();
doReturn(false).when(bean3).isRunning();

// serial secondary for dsid = 3
doReturn(false).when(bean4).isParallel();
doReturn(false).when(bean4).isPrimary();
doReturn(true).when(bean4).isConnected();
doReturn(true).when(bean4).isRunning();

Map<String, Boolean> status = bridge.viewRemoteClusterStatus();
assertThat(status.keySet()).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,10 @@ public Map<String, Boolean> viewRemoteClusterStatus() {
continue;
}
if (bean.isParallel()) {
senderMap.merge(String.valueOf(dsId), bean.isConnected(), Boolean::logicalAnd);
senderMap.merge(String.valueOf(dsId), bean.isRunning(), Boolean::logicalAnd);
} else {
if (bean.isPrimary()) {
senderMap.put(String.valueOf(dsId), bean.isConnected());
senderMap.put(String.valueOf(dsId), bean.isRunning());
}
}
}
Expand Down

0 comments on commit e8e9a13

Please sign in to comment.