SdxParticipantsConfig extends Config<ApplicationId> { public void removePeer(IpAddress peerIp) { ArrayNode peersArray = (ArrayNode) object.get(PEERS); for (int i = 0; i < peersArray.size(); i++) { if (peersArray.get(i).get(IP).asText().equals(peerIp.toString())) { peersArray.remove(i); return; } } }  Set<PeerConfig> bgpPeers(); ConnectPoint getPortForPeer(IpAddress peerAddress); String getInterfaceNameForPeer(IpAddress peerAddress); PeerConfig getPeerForName(Optional<String> peerName); void addPeer(PeerConfig peer); PeerConfig getPeerForIp(IpAddress ip); void removePeer(IpAddress peerIp); static final String PEERS; static final String NAME; static final String IP; static final String CONN_POINT; static final String INTF_NAME; }
@Test public void testRemovePeer() throws Exception { int initialSize = peersConfig.bgpPeers().size(); peersConfig.removePeer(IP1); assertEquals(initialSize - 1, peersConfig.bgpPeers().size()); peers.remove(peer1); assertEquals(peers, peersConfig.bgpPeers()); }