Search in sources :

Example 1 with BGPPeerStateConsumer

use of org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer 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());
}
Also used : BGPRibStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer) BGPPeerState(org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerState) BGPRibState(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState) BGPPeerStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer) Test(org.junit.Test)

Example 2 with BGPPeerStateConsumer

use of org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer 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());
}
Also used : BGPRibStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer) BGPPeerStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer) Test(org.junit.Test)

Example 3 with BGPPeerStateConsumer

use of org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer 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());
}
Also used : BGPRibStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer) BGPRibState(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState) BGPPeerStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 BGPPeerStateConsumer (org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer)3 BGPRibStateConsumer (org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer)3 BGPRibState (org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState)2 BGPPeerState (org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerState)1