use of org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol in project hadoop by apache.
the class TestPBLocalizerRPC method testLocalizerRPC.
@Test
public void testLocalizerRPC() throws Exception {
InetSocketAddress locAddr = new InetSocketAddress("0.0.0.0", 8040);
LocalizerService server = new LocalizerService(locAddr);
try {
server.start();
Configuration conf = new Configuration();
YarnRPC rpc = YarnRPC.create(conf);
LocalizationProtocol client = (LocalizationProtocol) rpc.getProxy(LocalizationProtocol.class, locAddr, conf);
LocalizerStatus status = recordFactory.newRecordInstance(LocalizerStatus.class);
status.setLocalizerId("localizer0");
LocalizerHeartbeatResponse response = client.heartbeat(status);
assertEquals(dieHBResponse(), response);
} finally {
server.stop();
}
assertTrue(true);
}
use of org.apache.hadoop.yarn.server.nodemanager.api.LocalizationProtocol in project hadoop by apache.
the class TestContainerLocalizer method testMainFailure.
@Test(timeout = 15000)
public void testMainFailure() throws Exception {
ContainerLocalizerWrapper wrapper = new ContainerLocalizerWrapper();
ContainerLocalizer localizer = wrapper.setupContainerLocalizerForTest();
LocalizationProtocol nmProxy = wrapper.nmProxy;
mockOutDownloads(localizer);
// Assume the NM heartbeat fails say because of absent tokens.
when(nmProxy.heartbeat(isA(LocalizerStatus.class))).thenThrow(new YarnException("Sigh, no token!"));
// run localization, it should fail
try {
localizer.runLocalization(nmAddr);
Assert.fail("Localization succeeded unexpectedly!");
} catch (IOException e) {
Assert.assertTrue(e.getMessage().contains("Sigh, no token!"));
}
}
Aggregations