@Test public void addRouteForCurrentService_2() throws Exception { mockCommand(""); mockCommand(0); Assert.assertTrue("Expected True as Route succesfully added, got", service.addRouteForCurrentService()); Assert.assertTrue("Expected True as Route was already created, got", service.addRouteForCurrentService()); }
@Override public synchronized boolean addRouteForCurrentService() { if (isRouteActive) { return true; } else if (executeCommand("sudo ip addr show").contains("inet " + addressToString(virtualIp))) { isRouteActive = true; return (true); } return (executeCommandRC(createIfaceSetIpCmd()) == 0); }
LinuxRoutingService implements Routing { @Override public synchronized boolean addRouteForCurrentService() { if (isRouteActive) { return true; } else if (executeCommand("sudo ip addr show").contains("inet " + addressToString(virtualIp))) { isRouteActive = true; return (true); } return (executeCommandRC(createIfaceSetIpCmd()) == 0); } }
LinuxRoutingService implements Routing { @Override public synchronized boolean addRouteForCurrentService() { if (isRouteActive) { return true; } else if (executeCommand("sudo ip addr show").contains("inet " + addressToString(virtualIp))) { isRouteActive = true; return (true); } return (executeCommandRC(createIfaceSetIpCmd()) == 0); } LinuxRoutingService(SystemCall systemCall, RoutingDefinition initializer); }
LinuxRoutingService implements Routing { @Override public synchronized boolean addRouteForCurrentService() { if (isRouteActive) { return true; } else if (executeCommand("sudo ip addr show").contains("inet " + addressToString(virtualIp))) { isRouteActive = true; return (true); } return (executeCommandRC(createIfaceSetIpCmd()) == 0); } LinuxRoutingService(SystemCall systemCall, RoutingDefinition initializer); String executeCommand(String command); int executeCommandRC(String command); @Override synchronized Routing setInterface(String inf); @Override Routing setNetmask(final IpAddress netmask); @Override IpAddress getNetmask(); @Override synchronized String getInterface(); @Override synchronized IpAddress getVirtualIp(); @Override synchronized boolean isActive(); @Override synchronized boolean removeRouteForCurrentService(); @Override synchronized boolean addRouteForCurrentService(); @Override boolean updateArpTableForCurrentService(); @Override String toString(); }
LinuxRoutingService implements Routing { @Override public synchronized boolean addRouteForCurrentService() { if (isRouteActive) { return true; } else if (executeCommand("sudo ip addr show").contains("inet " + addressToString(virtualIp))) { isRouteActive = true; return (true); } return (executeCommandRC(createIfaceSetIpCmd()) == 0); } LinuxRoutingService(SystemCall systemCall, RoutingDefinition initializer); String executeCommand(String command); int executeCommandRC(String command); @Override synchronized Routing setInterface(String inf); @Override Routing setNetmask(final IpAddress netmask); @Override IpAddress getNetmask(); @Override synchronized String getInterface(); @Override synchronized IpAddress getVirtualIp(); @Override synchronized boolean isActive(); @Override synchronized boolean removeRouteForCurrentService(); @Override synchronized boolean addRouteForCurrentService(); @Override boolean updateArpTableForCurrentService(); @Override String toString();  }