@Test public void noMatchingHost() { SpecificHostPolicy policy = new SpecificHostPolicy("worker3"); List<BlockWorkerInfo> workerInfoList = new ArrayList<>(); workerInfoList.add(new BlockWorkerInfo(new WorkerNetAddress().setHost("worker1F") .setRpcPort(PORT).setDataPort(PORT).setWebPort(PORT), Constants.GB, 0)); workerInfoList.add(new BlockWorkerInfo(new WorkerNetAddress().setHost("worker2") .setRpcPort(PORT).setDataPort(PORT).setWebPort(PORT), Constants.GB, 0)); GetWorkerOptions options = GetWorkerOptions.defaults().setBlockWorkerInfos(workerInfoList) .setBlockInfo(new BlockInfo().setLength(2 * (long) Constants.GB)); Assert.assertNull(policy.getWorker(options)); }
@Override public WorkerNetAddress getWorker(GetWorkerOptions options) { for (BlockWorkerInfo info : options.getBlockWorkerInfos()) { if (info.getNetAddress().getHost().equals(mHostname)) { return info.getNetAddress(); } } return null; }
SpecificHostPolicy implements BlockLocationPolicy { @Override public WorkerNetAddress getWorker(GetWorkerOptions options) { for (BlockWorkerInfo info : options.getBlockWorkerInfos()) { if (info.getNetAddress().getHost().equals(mHostname)) { return info.getNetAddress(); } } return null; } }
SpecificHostPolicy implements BlockLocationPolicy { @Override public WorkerNetAddress getWorker(GetWorkerOptions options) { for (BlockWorkerInfo info : options.getBlockWorkerInfos()) { if (info.getNetAddress().getHost().equals(mHostname)) { return info.getNetAddress(); } } return null; } SpecificHostPolicy(AlluxioConfiguration conf);  SpecificHostPolicy(String hostname); }
SpecificHostPolicy implements BlockLocationPolicy { @Override public WorkerNetAddress getWorker(GetWorkerOptions options) { for (BlockWorkerInfo info : options.getBlockWorkerInfos()) { if (info.getNetAddress().getHost().equals(mHostname)) { return info.getNetAddress(); } } return null; } SpecificHostPolicy(AlluxioConfiguration conf);  SpecificHostPolicy(String hostname); @Override WorkerNetAddress getWorker(GetWorkerOptions options); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
SpecificHostPolicy implements BlockLocationPolicy { @Override public WorkerNetAddress getWorker(GetWorkerOptions options) { for (BlockWorkerInfo info : options.getBlockWorkerInfos()) { if (info.getNetAddress().getHost().equals(mHostname)) { return info.getNetAddress(); } } return null; } SpecificHostPolicy(AlluxioConfiguration conf);  SpecificHostPolicy(String hostname); @Override WorkerNetAddress getWorker(GetWorkerOptions options); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }