Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-796

org.apache.mesos.Log isn't mockable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • java api, replicated log
    • None

    Description

      Currently, the Log class (org.apache.mesos.Log) in the Java API has a static initializer that calls MesosNativeLibrary.load(). This static initialization causes issues when mocking this class.

      Per JLS, using the Class name shouldn't trigger the static initialization. However, the ClassProxy in EasyMock performs some reflection tricks which trigger the static initializer. Since the static initializer needs a native library which would be otherwise be linked dynamically in it's path, it makes our unit tests flaky.

      After considering a few possibilities, the cleanest solution seems to be
      (a) Make org.apache.mesos.Log an interface so users using the Java-API can mock the interface. or
      (b) Add a new interface that org.apache.mesos.Log implements, which the clients can use for mocking.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mansu Suman Karumuri
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: