import static org.junit.Assert.assertTrue;
import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.bgp.mode.impl.AbstractRouteEntryTest;
}
private void testWriteEmptyBestPath() {
- this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport, this.tx);
- assertEquals(0, this.yIIChanges.size());
+ this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport,
+ this.tx);
+ assertEquals(0, this.yiichanges.size());
}
private void testAddRouteSelectBestAndWriteOnDS() {
- this.testBARE.addRoute(ROUTER_ID, REMOTE_PATH_ID, this.ribSupport.routeAttributesIdentifier(), this.attributes);
+ this.testBARE.addRoute(ROUTER_ID, REMOTE_PATH_ID, this.ribSupport.routeAttributesIdentifier(),
+ this.attributes);
assertFalse(this.testBARE.isEmpty());
assertTrue(this.testBARE.selectBest(AS));
/** Add AddPath Route **/
- this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx, ROUTE_ID_PA_ADD_PATH);
- Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+ this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx,
+ ROUTE_ID_PA_ADD_PATH);
+ final Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
assertEquals(3, yiiCount.size());
assertEquals(1, (long) yiiCount.get(this.routePaAddPathYii));
assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYii));
}
private void testInitializePeerWithExistentRoute() {
- assertEquals(3, this.yIIChanges.size());
- this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA_ADD_PATH, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport, this.tx);
- assertEquals(5, this.yIIChanges.size());
- final Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream()
- .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+ assertEquals(3, this.yiichanges.size());
+ this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA_ADD_PATH, PEER_YII2, this.peg, TABLES_KEY, this.peerPT,
+ this.ribSupport, this.tx);
+ assertEquals(5, this.yiichanges.size());
+ final Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYiiPeer2));
assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYiiPeer2));
}
private void testRemoveRoute() {
- Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+ Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
assertEquals(5, yiiCount.size());
assertEquals(1, (long) yiiCount.get(this.routePaAddPathYii));
assertTrue(this.testBARE.removeRoute(ROUTER_ID, REMOTE_PATH_ID));
assertTrue(this.testBARE.selectBest(AS));
- this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx, ROUTE_ID_PA_ADD_PATH);
- yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+ this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx,
+ ROUTE_ID_PA_ADD_PATH);
+ yiiCount = collectInfo();
assertEquals(2, yiiCount.size());
assertFalse(yiiCount.containsKey(this.routePaAddPathYii));
assertFalse(yiiCount.containsKey(this.routeAddRiboutYii));