Tabnine Logo
MockHost
Code IndexAdd Tabnine to your IDE (free)

How to use
MockHost
in
com.liveramp.hank.test.coordinator

Best Java code snippets using com.liveramp.hank.test.coordinator.MockHost (Showing top 9 results out of 315)

origin: LiveRamp/hank

@Override
public Host addHost(PartitionServerAddress address,
          List<String> flags) throws IOException {
 MockHost host = new MockHost(address);
 hosts.add(host);
 return host;
}
origin: LiveRamp/hank

@Override
public void removeDomain(Domain domain) throws IOException {
 removedDomains.add(domain);
 HostDomain hostDomain = getHostDomain(domain);
 if (hostDomain != null) {
  hostDomains.remove(hostDomain);
 }
}
origin: LiveRamp/hank

@Override
public HostCommand nextCommand() throws IOException {
 if (commandQueue.size() > 0) {
  setCurrentCommand(commandQueue.remove(0));
  notifyCommandQueueChangeListeners();
 } else {
  setCurrentCommand(null);
 }
 return currentCommand;
}
origin: LiveRamp/hank

 @Test
 public void testGetHostsInState() throws Exception {
  final MockHost h1 = new MockHost(new PartitionServerAddress("localhost", 1));
  final MockHost h2 = new MockHost(new PartitionServerAddress("localhost", 2));
  final MockHost h3 = new MockHost(new PartitionServerAddress("localhost", 3));

  SlightlyLessAbstractRing rc = new SlightlyLessAbstractRing(1, null) {
   @Override
   public Set<Host> getHosts() {
    return new HashSet<Host>(Arrays.asList(h1, h2, h3));
   }
  };

  h1.setState(HostState.IDLE);
  h2.setState(HostState.SERVING);
  h3.setState(HostState.OFFLINE);

  assertEquals(Collections.singleton(h1), Rings.getHostsInState(rc, HostState.IDLE));
  assertEquals(Collections.singleton(h2), Rings.getHostsInState(rc, HostState.SERVING));
  assertEquals(Collections.singleton(h3), Rings.getHostsInState(rc, HostState.OFFLINE));
 }
}
origin: LiveRamp/hank

@Override
public void clearCommandQueue() throws IOException {
 commandQueue.clear();
 notifyCommandQueueChangeListeners();
}
origin: LiveRamp/hank

@Override
public void setState(HostState state) throws IOException {
 this.state = state;
 notifyHostStateChangeListeners();
}
origin: LiveRamp/hank

public void setCurrentCommand(HostCommand command) {
 currentCommand = command;
 notifyCurrentCommandChangeListeners();
}
origin: LiveRamp/hank

@Override
public void enqueueCommand(HostCommand command) throws IOException {
 commandQueue.add(command);
 lastEnqueuedCommand = command;
 notifyCommandQueueChangeListeners();
}
origin: LiveRamp/hank

@Test
public void testCommandAll() throws IOException {
 final Host hc = new MockHost(LOCALHOST);
 SlightlyLessAbstractRing rc = new SlightlyLessAbstractRing(1, null) {
  @Override
  public Set<Host> getHosts() {
   return Collections.singleton(hc);
  }
 };
 assertNull(hc.getCurrentCommand());
 assertTrue(hc.getCommandQueue().isEmpty());
 Rings.commandAll(rc, HostCommand.SERVE_DATA);
 assertNull(hc.getCurrentCommand());
 assertEquals(Arrays.asList(HostCommand.SERVE_DATA), hc.getCommandQueue());
}
com.liveramp.hank.test.coordinatorMockHost

Most used methods

  • <init>
  • getHostDomain
  • notifyCommandQueueChangeListeners
  • notifyCurrentCommandChangeListeners
  • notifyHostStateChangeListeners
  • setCurrentCommand
  • setState

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getExternalFilesDir (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Option (scala)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now