ijokarumawak commented on a change in pull request #3647: NIFI-6530 - HTTP
SiteToSite server returns 201 in case no data is ava…
URL: https://github.com/apache/nifi/pull/3647#discussion_r321067035
##########
File path:
nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/TestPeerSelector.java
##########
@@ -212,44 +213,48 @@ public void testFetchRemotePeerStatuses() throws
IOException {
throw new IOException("Connection refused. " +
peerFetchStatusesFrom + " is not running.");
}).when(peerStatusProvider).fetchRemotePeerStatuses(any(PeerDescription.class));
+
+ ArrayList<PeerStatus> peers;
+
// 1st attempt. It uses the bootstrap node.
peerSelector.refreshPeers();
- PeerStatus peerStatus =
peerSelector.getNextPeerStatus(TransferDirection.RECEIVE);
- assertNotNull(peerStatus);
+ peers = peerSelector.getPeerStatuses(TransferDirection.RECEIVE);
+ assert(!peers.isEmpty());
// Proceed time so that peer selector refresh statuses.
peerStatuses.remove(bootstrapNodeStatus);
systemTime.offset += TimeUnit.MILLISECONDS.convert(1,
TimeUnit.MINUTES) + 1;
// 2nd attempt.
peerSelector.refreshPeers();
- peerStatus = peerSelector.getNextPeerStatus(TransferDirection.RECEIVE);
- assertNotNull(peerStatus);
- assertEquals("Node2 should be returned since node 2 is the only
available node.", node2, peerStatus.getPeerDescription());
+ peers = peerSelector.getPeerStatuses(TransferDirection.RECEIVE);
+ assert(!peers.isEmpty());
+ assertEquals("Node2 should be returned since node 2 is the only
available node.", node2, peers.get(0).getPeerDescription());
// Proceed time so that peer selector refresh statuses.
systemTime.offset += TimeUnit.MILLISECONDS.convert(1,
TimeUnit.MINUTES) + 1;
// 3rd attempt.
peerSelector.refreshPeers();
- peerStatus = peerSelector.getNextPeerStatus(TransferDirection.RECEIVE);
- assertNotNull(peerStatus);
- assertEquals("Node2 should be returned since node 2 is the only
available node.", node2, peerStatus.getPeerDescription());
+ peers = peerSelector.getPeerStatuses(TransferDirection.RECEIVE);
+ assert(!peers.isEmpty());
+ assertEquals("Node2 should be returned since node 2 is the only
available node.", node2, peers.get(0).getPeerDescription());
// Remove node2 to simulate that it goes down. There's no available
node at this point.
peerStatuses.remove(node2Status);
systemTime.offset += TimeUnit.MILLISECONDS.convert(1,
TimeUnit.MINUTES) + 1;
peerSelector.refreshPeers();
- peerStatus = peerSelector.getNextPeerStatus(TransferDirection.RECEIVE);
- assertNull("PeerSelector should return null as next peer status, since
there's no available peer", peerStatus);
+ peers = peerSelector.getPeerStatuses(TransferDirection.RECEIVE);
+ assertTrue("PeerSelector should return null as next peer status, since
there's no available peer", peers.isEmpty());
Review comment:
Knit-picking...
"PeerSelector should return null as next peer status"
should be
"PeerSelector should return an empty list as next peer statuses"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services