Uploaded image for project: 'MRUnit'
  1. MRUnit
  2. MRUNIT-122

Context should be mockable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.9.0
    • 1.0.0
    • None

    Description

      We should allow users to mock the Context object. I have thought about this and I think there are two ways to go about it. In MRUnit we have a single codebase which supports Hadoop 0.20 - 2.0.
      However, Context itself was changed from a class in 0.20 to an interface in > 0.20. As such, we use Mockito to create the object regardless of the version of Hadoop the user is using.

      There are two ways to implement providing a custom context to MRUnit.

      1) User provides MRUnit context object
      Pros
      User can use any mocking tool they wish
      Cons
      Puts massive ugliness into MRUnit code (I implemented this)
      MRUnit is not providing much value since inputs/outputs and such come from Context.

      2) User can "get" context from MRUnit and then override any mocked methods via Mockito
      Pros
      Much cleaner to implement
      Cons
      User must use Mockito to override methods on context

      Attachments

        1. MRUNIT-122-1.patch
          28 kB
          Brock Noland

        Activity

          People

            brocknoland Brock Noland
            brocknoland Brock Noland
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: