Example usage for org.apache.hadoop.yarn.api.records NodeId setPort

List of usage examples for org.apache.hadoop.yarn.api.records NodeId setPort

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records NodeId setPort.

Prototype

@Private
    @Unstable
    protected abstract void setPort(int port);

Source Link

Usage

From source file:org.apache.tajo.worker.TaskRunnerTest.java

License:Apache License

public void testInit() throws Exception {
    ProtoAsyncRpcClient mockClient = mock(ProtoAsyncRpcClient.class);
    mockClient.close();//from   w  w  w .j av  a 2 s .c o m

    MasterWorkerProtocolService.Interface mockMaster = mock(MasterWorkerProtocolService.Interface.class);
    ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(q1.getApplicationId(),
            q1.getAttemptId());
    ContainerId cId = BuilderUtils.newContainerId(appAttemptId, 1);

    NodeId nodeId = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(NodeId.class);
    nodeId.setHost("host1");
    nodeId.setPort(9001);
    UserGroupInformation mockTaskOwner = mock(UserGroupInformation.class);
    when(mockTaskOwner.getShortUserName()).thenReturn("hyunsik");
    TaskRunner runner = new TaskRunner(sq1, nodeId, mockTaskOwner, mockMaster, cId);
    QueryConf conf = new QueryConf();
    conf.setOutputPath(new Path("/tmp/" + q1));
    runner.init(conf);
    runner.start();
    runner.stop();
}