Codota Logo
MockHost
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
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

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
  • getExternalFilesDir (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Collectors (java.util.stream)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now