use of org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer in project bgpcep by opendaylight.
the class BGPStateCollectorImplTest method getRibStatsTest.
@Test
public void getRibStatsTest() throws Exception {
doReturn(mock(BGPPeerState.class)).when(this.bgpPeerStateConsumer).getPeerState();
doReturn(mock(BGPRibState.class)).when(this.bgpribStateConsumer).getRIBState();
final BGPStateCollectorImpl collector = new BGPStateCollectorImpl();
final BGPRibStateConsumer ribStateConsumerNull = null;
collector.bind(ribStateConsumerNull);
assertTrue(collector.getRibStats().isEmpty());
final BGPPeerStateConsumer peerStateConsumerNull = null;
collector.bind(peerStateConsumerNull);
assertTrue(collector.getPeerStats().isEmpty());
collector.bind(this.bgpribStateConsumer);
collector.bind(this.bgpPeerStateConsumer);
assertFalse(collector.getRibStats().isEmpty());
assertFalse(collector.getPeerStats().isEmpty());
collector.unbind(this.bgpribStateConsumer);
collector.unbind(this.bgpPeerStateConsumer);
assertTrue(collector.getRibStats().isEmpty());
assertTrue(collector.getPeerStats().isEmpty());
}
use of org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer in project bgpcep by opendaylight.
the class BGPStateCollectorImplTest method getRibStatsEmptyRibTest.
@Test
public void getRibStatsEmptyRibTest() throws Exception {
doReturn(null).when(this.bgpribStateConsumer).getRIBState();
doReturn(null).when(this.bgpPeerStateConsumer).getPeerState();
final BGPStateCollectorImpl collector = new BGPStateCollectorImpl();
final BGPRibStateConsumer ribStateConsumerNull = null;
collector.bind(ribStateConsumerNull);
assertTrue(collector.getRibStats().isEmpty());
final BGPPeerStateConsumer peerStateConsumerNull = null;
collector.bind(peerStateConsumerNull);
assertTrue(collector.getPeerStats().isEmpty());
collector.bind(this.bgpribStateConsumer);
collector.bind(this.bgpPeerStateConsumer);
assertTrue(collector.getRibStats().isEmpty());
assertTrue(collector.getPeerStats().isEmpty());
}
use of org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer in project bgpcep by opendaylight.
the class BGPStateCollectorImplTest method getRibStatsEmptyPeerTest.
@Test
public void getRibStatsEmptyPeerTest() throws Exception {
doReturn(mock(BGPRibState.class)).when(this.bgpribStateConsumer).getRIBState();
doReturn(null).when(this.bgpPeerStateConsumer).getPeerState();
final BGPStateCollectorImpl collector = new BGPStateCollectorImpl();
final BGPRibStateConsumer ribStateConsumerNull = null;
collector.bind(ribStateConsumerNull);
assertTrue(collector.getRibStats().isEmpty());
final BGPPeerStateConsumer peerStateConsumerNull = null;
collector.bind(peerStateConsumerNull);
assertTrue(collector.getPeerStats().isEmpty());
collector.bind(this.bgpribStateConsumer);
collector.bind(this.bgpPeerStateConsumer);
assertFalse(collector.getRibStats().isEmpty());
assertTrue(collector.getPeerStats().isEmpty());
}
Aggregations