Lines Matching refs:lp
236 private void assertAllRoutesHaveInterface(String iface, LinkProperties lp) {
237 for (RouteInfo r : lp.getRoutes()) {
249 LinkProperties lp = new LinkProperties();
251 assertTrue(lp.addRoute(r));
252 assertEquals(1, lp.getRoutes().size());
253 assertAllRoutesHaveInterface(null, lp);
256 assertFalse(lp.addRoute(r));
257 assertEquals(1, lp.getRoutes().size());
262 lp.addRoute(r);
263 fail("Adding wlan0 route to LP with no interface, expect exception");
267 lp.setInterfaceName("rmnet0");
268 assertAllRoutesHaveInterface("rmnet0", lp);
272 lp.addRoute(r);
273 fail("Adding wlan0 route to rmnet0 LP, expect exception");
278 lp.setInterfaceName("wlan0");
279 lp.addRoute(r);
280 assertEquals(2, lp.getRoutes().size());
281 assertAllRoutesHaveInterface("wlan0", lp);
285 lp.addRoute(r);
286 assertEquals(3, lp.getRoutes().size());
287 assertAllRoutesHaveInterface("wlan0", lp);
290 LinkProperties lp2 = new LinkProperties(lp);
291 assertAllRoutesHaveInterface("wlan0", lp);
292 assertEquals(0, lp.compareAllRoutes(lp2).added.size());
293 assertEquals(0, lp.compareAllRoutes(lp2).removed.size());
297 assertEquals(3, lp.compareAllRoutes(lp2).added.size());
298 assertEquals(3, lp.compareAllRoutes(lp2).removed.size());
353 private LinkAddress getFirstLinkAddress(LinkProperties lp) {
354 return lp.getLinkAddresses().iterator().next();
359 LinkProperties lp = new LinkProperties();
362 assertFalse(lp.hasIPv4Address());
363 assertFalse(lp.hasGlobalIPv6Address());
368 lp.addStackedLink(stacked);
373 assertFalse(lp.hasIPv4Address());
374 assertFalse(lp.hasGlobalIPv6Address());
375 lp.removeStackedLink("stacked");
376 assertFalse(lp.hasIPv4Address());
377 assertFalse(lp.hasGlobalIPv6Address());
382 assertEquals(0, lp.getLinkAddresses().size());
383 assertTrue(lp.addLinkAddress(LINKADDRV6));
384 assertEquals(1, lp.getLinkAddresses().size());
385 assertFalse(lp.hasIPv4Address());
386 assertTrue(lp.hasGlobalIPv6Address());
388 assertTrue(lp.removeLinkAddress(LINKADDRV6));
389 assertEquals(0, lp.getLinkAddresses().size());
391 assertTrue(lp.addLinkAddress(LINKADDRV6LINKLOCAL));
392 assertEquals(1, lp.getLinkAddresses().size());
393 assertFalse(lp.hasGlobalIPv6Address());
395 assertTrue(lp.addLinkAddress(LINKADDRV4));
396 assertEquals(2, lp.getLinkAddresses().size());
397 assertTrue(lp.hasIPv4Address());
398 assertFalse(lp.hasGlobalIPv6Address());
400 assertTrue(lp.addLinkAddress(LINKADDRV6));
401 assertEquals(3, lp.getLinkAddresses().size());
402 assertTrue(lp.hasIPv4Address());
403 assertTrue(lp.hasGlobalIPv6Address());
405 assertTrue(lp.removeLinkAddress(LINKADDRV6LINKLOCAL));
406 assertEquals(2, lp.getLinkAddresses().size());
407 assertTrue(lp.hasIPv4Address());
408 assertTrue(lp.hasGlobalIPv6Address());
412 assertFalse(lp.addLinkAddress(LINKADDRV4));
413 assertEquals(2, lp.getLinkAddresses().size());
414 assertTrue(lp.hasIPv4Address());
415 assertTrue(lp.removeLinkAddress(LINKADDRV4));
416 assertEquals(1, lp.getLinkAddresses().size());
417 lp.hasIPv4Address());
418 assertFalse(lp.removeLinkAddress(LINKADDRV4));
419 assertEquals(1, lp.getLinkAddresses().size());
424 assertEquals(1, lp.getLinkAddresses().size());
425 assertEquals(LINKADDRV6, getFirstLinkAddress(lp));
434 assertTrue(lp.addLinkAddress(deprecated));
435 assertEquals(1, lp.getLinkAddresses().size());
436 assertEquals(deprecated, getFirstLinkAddress(lp));
437 assertFalse(LINKADDRV6.equals(getFirstLinkAddress(lp)));
440 assertTrue(lp.removeLinkAddress(LINKADDRV6));
441 assertEquals(0, lp.getLinkAddresses().size());
446 LinkProperties lp = new LinkProperties();
447 lp.addLinkAddress(LINKADDRV4);
448 lp.addLinkAddress(LINKADDRV6);
453 assertFalse(lp.equals(lp2));
455 lp2.setLinkAddresses(lp.getLinkAddresses());
456 assertTrue(lp.equals(lp));