Search in sources :

Example 1 with ContainerRunner

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();
    }
}
Also used : LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) ContainerRunner(org.apache.hadoop.hive.llap.daemon.ContainerRunner) LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) Configuration(org.apache.hadoop.conf.Configuration) InetSocketAddress(java.net.InetSocketAddress) SubmitWorkRequestProto(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SubmitWorkRequestProto) SubmitWorkResponseProto(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SubmitWorkResponseProto) LlapProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapProtocolClientImpl) LlapProtocolBlockingPB(org.apache.hadoop.hive.llap.protocol.LlapProtocolBlockingPB) Test(org.junit.Test)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 Configuration (org.apache.hadoop.conf.Configuration)1 LlapDaemonConfiguration (org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration)1 ContainerRunner (org.apache.hadoop.hive.llap.daemon.ContainerRunner)1 SubmitWorkRequestProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SubmitWorkRequestProto)1 SubmitWorkResponseProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SubmitWorkResponseProto)1 LlapProtocolClientImpl (org.apache.hadoop.hive.llap.impl.LlapProtocolClientImpl)1 LlapProtocolBlockingPB (org.apache.hadoop.hive.llap.protocol.LlapProtocolBlockingPB)1 Test (org.junit.Test)1