use of org.apache.hadoop.hive.llap.daemon.ContainerRunner in project hive by apache.
the class TestLlapDaemonProtocolServerImpl method testSimpleCall.
@Test(timeout = 10000)
public void testSimpleCall() throws ServiceException, IOException {
LlapDaemonConfiguration daemonConf = new LlapDaemonConfiguration();
int numHandlers = HiveConf.getIntVar(daemonConf, ConfVars.LLAP_DAEMON_RPC_NUM_HANDLERS);
ContainerRunner containerRunnerMock = mock(ContainerRunner.class);
LlapProtocolServerImpl server = new LlapProtocolServerImpl(null, numHandlers, containerRunnerMock, new AtomicReference<InetSocketAddress>(), new AtomicReference<InetSocketAddress>(), 0, 0, null);
when(containerRunnerMock.submitWork(any(SubmitWorkRequestProto.class))).thenReturn(SubmitWorkResponseProto.newBuilder().setSubmissionState(SubmissionStateProto.ACCEPTED).build());
try {
server.init(new Configuration());
server.start();
InetSocketAddress serverAddr = server.getBindAddress();
LlapProtocolBlockingPB client = new LlapProtocolClientImpl(new Configuration(), serverAddr.getHostName(), serverAddr.getPort(), null, null, null);
SubmitWorkResponseProto responseProto = client.submitWork(null, SubmitWorkRequestProto.newBuilder().setAmHost("amhost").setAmPort(2000).build());
assertEquals(responseProto.getSubmissionState().name(), SubmissionStateProto.ACCEPTED.name());
} finally {
server.stop();
}
}
Aggregations