Search in sources :

Example 1 with MockHosts

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);
}
Also used : MockHosts(com.yahoo.config.model.test.MockHosts) FileReference(com.yahoo.config.FileReference) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) Test(org.junit.Test)

Aggregations

FileReference (com.yahoo.config.FileReference)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 MockHosts (com.yahoo.config.model.test.MockHosts)1 Test (org.junit.Test)1