use of org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.NMContainerStatusPBImpl in project hadoop by apache.
the class TestProtocolRecords method testNMContainerStatus.
@Test
public void testNMContainerStatus() {
ApplicationId appId = ApplicationId.newInstance(123456789, 1);
ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 1);
ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
Resource resource = Resource.newInstance(1000, 200);
NMContainerStatus report = NMContainerStatus.newInstance(containerId, 0, ContainerState.COMPLETE, resource, "diagnostics", ContainerExitStatus.ABORTED, Priority.newInstance(10), 1234);
NMContainerStatus reportProto = new NMContainerStatusPBImpl(((NMContainerStatusPBImpl) report).getProto());
Assert.assertEquals("diagnostics", reportProto.getDiagnostics());
Assert.assertEquals(resource, reportProto.getAllocatedResource());
Assert.assertEquals(ContainerExitStatus.ABORTED, reportProto.getContainerExitStatus());
Assert.assertEquals(ContainerState.COMPLETE, reportProto.getContainerState());
Assert.assertEquals(containerId, reportProto.getContainerId());
Assert.assertEquals(Priority.newInstance(10), reportProto.getPriority());
Assert.assertEquals(1234, reportProto.getCreationTime());
}
Aggregations