Example usage for org.apache.hadoop.mapreduce TaskInputOutputContext setStatus

List of usage examples for org.apache.hadoop.mapreduce TaskInputOutputContext setStatus

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce TaskInputOutputContext setStatus.

Prototype

public void setStatus(String msg);

Source Link

Document

Set the current status of the task to the given string.

Usage

From source file:org.apache.crunch.test.CrunchTestSupportTest.java

License:Apache License

@Test
public void testContext() {
    Configuration sampleConfig = new Configuration();
    String status = "test";
    TaskInputOutputContext<?, ?, ?, ?> testContext = CrunchTestSupport.getTestContext(sampleConfig);
    assertEquals(sampleConfig, testContext.getConfiguration());
    TaskAttemptID taskAttemptID = testContext.getTaskAttemptID();
    assertEquals(taskAttemptID, testContext.getTaskAttemptID());
    assertNotNull(taskAttemptID);/* w  w  w .j a  v a  2s .  c  o m*/
    assertNull(testContext.getStatus());
    testContext.setStatus(status);
    assertEquals(status, testContext.getStatus());
    assertEquals(0, testContext.getCounter(CT.ONE).getValue());
    testContext.getCounter(CT.ONE).increment(1);
    assertEquals(1, testContext.getCounter(CT.ONE).getValue());
    testContext.getCounter(CT.ONE).increment(4);
    assertEquals(5, testContext.getCounter(CT.ONE).getValue());
}