use of com.yahoo.config.model.test.MockHosts in project vespa by vespa-engine.
the class FileDistributorTestCase method fileDistributor.
@Test
public void fileDistributor() {
MockHosts hosts = new MockHosts();
FileDistributor fileDistributor = new FileDistributor(new MockFileRegistry(), null);
String file1 = "component/path1";
String file2 = "component/path2";
FileReference ref1 = fileDistributor.sendFileToHosts(file1, Arrays.asList(hosts.host1, hosts.host2));
FileReference ref2 = fileDistributor.sendFileToHosts(file2, Arrays.asList(hosts.host3));
assertEquals(new HashSet<>(Arrays.asList(hosts.host1, hosts.host2, hosts.host3)), fileDistributor.getTargetHosts());
assertTrue(ref1 != null);
assertTrue(ref2 != null);
MockFileDistribution dbHandler = new MockFileDistribution();
fileDistributor.sendDeployedFiles(dbHandler);
// One time for each host
assertEquals(3, dbHandler.filesToDownloadCalled);
}
Aggregations