@Test public void extractRoutingDefinition() throws Exception { final Routing routingService = Mockito.mock(Routing.class); Mockito.when(routingService.getInterface()).thenReturn(DUMMY_IFACE); Mockito.when(routingService.getVirtualIp()).thenReturn(IpAddressBuilder.getDefaultInstance(DUMMY_ADDRESS_IPV4)); Mockito.when(routingService.getNetmask()).thenReturn(IpAddressBuilder.getDefaultInstance(DUMMY_NETMASK_IPV4)); final RoutingDefinition actual = RouteUtil.extractRoutingDefinition(routingService); Assert.assertEquals(DUMMY_ADDRESS_IPV4, String.valueOf(actual.getIpAddress().stringValue())); Assert.assertEquals(DUMMY_NETMASK_IPV4, String.valueOf(actual.getNetmask().stringValue())); Assert.assertEquals(DUMMY_IFACE, actual.getInterface()); }
public static RoutingDefinition extractRoutingDefinition(final Routing existingRouting) { return new RoutingDefinitionBuilder().setIpAddress(existingRouting.getVirtualIp()) .setNetmask(existingRouting.getNetmask()) .setInterface(existingRouting.getInterface()) .build(); }
RouteUtil { public static RoutingDefinition extractRoutingDefinition(final Routing existingRouting) { return new RoutingDefinitionBuilder().setIpAddress(existingRouting.getVirtualIp()) .setNetmask(existingRouting.getNetmask()) .setInterface(existingRouting.getInterface()) .build(); } }
RouteUtil { public static RoutingDefinition extractRoutingDefinition(final Routing existingRouting) { return new RoutingDefinitionBuilder().setIpAddress(existingRouting.getVirtualIp()) .setNetmask(existingRouting.getNetmask()) .setInterface(existingRouting.getInterface()) .build(); }  }
RouteUtil { public static RoutingDefinition extractRoutingDefinition(final Routing existingRouting) { return new RoutingDefinitionBuilder().setIpAddress(existingRouting.getVirtualIp()) .setNetmask(existingRouting.getNetmask()) .setInterface(existingRouting.getInterface()) .build(); }  static String addressToString(IpAddress address); static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp,
            final Collection<SxpNode> sxpNodes); static RoutingDefinition createOperationalRouteDefinition(
            @Nonnull final RoutingDefinition originalDefinition, final boolean consistent, final String info); static RoutingDefinition extractRoutingDefinition(final Routing existingRouting); }
RouteUtil { public static RoutingDefinition extractRoutingDefinition(final Routing existingRouting) { return new RoutingDefinitionBuilder().setIpAddress(existingRouting.getVirtualIp()) .setNetmask(existingRouting.getNetmask()) .setInterface(existingRouting.getInterface()) .build(); }  static String addressToString(IpAddress address); static Collection<SxpNode> findSxpNodesOnVirtualIp(final IpAddress virtualIp,
            final Collection<SxpNode> sxpNodes); static RoutingDefinition createOperationalRouteDefinition(
            @Nonnull final RoutingDefinition originalDefinition, final boolean consistent, final String info); static RoutingDefinition extractRoutingDefinition(final Routing existingRouting);  }