You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mrunit.apache.org by "Brock Noland (Commented) (JIRA)" <ji...@apache.org> on 2011/11/02 21:45:32 UTC

[jira] [Commented] (MRUNIT-31) Support Hadoop 0.22 and 0.23

    [ https://issues.apache.org/jira/browse/MRUNIT-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142497#comment-13142497 ] 

Brock Noland commented on MRUNIT-31:
------------------------------------

If we used a mock library we would just mock Mapper.Context (and reducer) in both cases?

{code}
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public static <KEYIN, VALUEIN, KEYOUT, VALUEOUT> Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context 
  create(final List<Pair<KEYIN, VALUEIN>> in, final Counters counters, Configuration conf) {
    Class<org.apache.hadoop.mapreduce.Mapper.Context> mapContext = org.apache.hadoop.mapreduce.Mapper.Context.class;    
    Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = (Mapper.Context) mock(mapContext);
    when(context.getCounter((Enum)any())).thenAnswer(new Answer<Counter>() {
      @Override
      public Counter answer(InvocationOnMock invocation) {
        Object[] args = invocation.getArguments();
        // should use guava preconditions
        return counters.findCounter((Enum)args[0]);
      }
    });
    return context;
  }
{code}
                
> Support Hadoop 0.22 and 0.23
> ----------------------------
>
>                 Key: MRUNIT-31
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-31
>             Project: MRUnit
>          Issue Type: Improvement
>            Reporter: Tom White
>         Attachments: MRUNIT-31.patch, MRUNIT-31.patch
>
>
> The new MapReduce API changed in 0.21 (MAPREDUCE-954) in such a way as to break MRUnit.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira