public class AppPeerTest extends AbstractConfig {
private static final AppPeer APP_PEER = new AppPeer();
+ private final Neighbor neighbor = new NeighborBuilder()
+ .setNeighborAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
-
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@Test
public void testAppPeer() throws Exception {
- final Neighbor neighbor = new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
- APP_PEER.start(this.rib, neighbor, this.mappingService, this.configurationWriter);
+ APP_PEER.start(this.rib, this.neighbor, this.mappingService, this.configurationWriter);
Mockito.verify(this.rib).getYangRibId();
Mockito.verify(this.rib).getService();
Mockito.verify(this.rib).getRibIServiceGroupIdentifier();
Mockito.verify(this.rib).registerClusterSingletonService(any(ClusterSingletonService.class));
this.singletonService.instantiateServiceInstance();
+ Mockito.verify(this.rib, times(2)).getYangRibId();
Mockito.verify(this.configurationWriter).apply();
Mockito.verify(this.rib).getRibSupportContext();
Mockito.verify(this.rib).getLocalTablesKeys();
Mockito.verify(this.domTx).newWriteOnlyTransaction();
+ APP_PEER.close();
+ Mockito.verify(this.singletonServiceRegistration).close();
+
APP_PEER.restart(this.rib, this.mappingService);
this.singletonService.instantiateServiceInstance();
Mockito.verify(this.rib, times(4)).getYangRibId();
this.singletonService.closeServiceInstance();
Mockito.verify(this.listener, times(2)).close();
- assertTrue(APP_PEER.containsEqualConfiguration(new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build()));
- assertFalse(APP_PEER.containsEqualConfiguration(new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("127.0.0.2"))).build()));
+ assertTrue(APP_PEER.containsEqualConfiguration(this.neighbor));
+ assertFalse(APP_PEER.containsEqualConfiguration(new NeighborBuilder()
+ .setNeighborAddress(new IpAddress(new Ipv4Address("127.0.0.2"))).build()));
APP_PEER.close();
- Mockito.verify(this.singletonServiceRegistration).close();
+ Mockito.verify(this.singletonServiceRegistration, times(2)).close();
}
}
\ No newline at end of file