Sonar metrics for OpenMRS Core Master

Build: #2502 was successful Scheduled with changes by teleivo <teleivo@users.noreply.github.com>

Code commits

Git

  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 58635cf8593a80cca75659a91124844a4c64f2ea

    TRUNK-5816 Use MockitoExtension in BaseContextSensitiveTest
    this is a JUnit 5 extension that initializes and cleans up mocks
    its set to strict by default which will help us keep our tests free of
    unused mocks. We already use this mechanism in the jupiter/BaseContextMockTest

    • api/src/test/java/org/openmrs/test/jupiter/BaseContextSensitiveTest.java (version 58635cf8593a80cca75659a91124844a4c64f2ea)
    • web/pom.xml (version 58635cf8593a80cca75659a91124844a4c64f2ea)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 7cffb3746f55dad924a816075e6a9ac150b330df

    TRUNK-5816 Do not allow JUnit 4 tests to be added to the api
    we allow only a handful that we need to ensure module devs can still
    write JUnit 4 tests. If there is a bug and you would need to add another
    one please name them with JUnit4 like the examples. This will allow us
    to remove them once we are on JUnit 5. Every other new test should be written
    in JUnit 5 :)

    • api/src/test/java/org/openmrs/OpenmrsTestsTest.java (version 7cffb3746f55dad924a816075e6a9ac150b330df)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 18c9c2a4c5a922c56aab240cdf9401441ff1b3ce

    TRUNK-5816 Add JUnit 4 tests
    to ensure the annotations work on JUnit 4 with the JUnit 4 helper
    classes

    • api/src/test/java/org/openmrs/annotation/OpenmrsProfileExcludeFilterWithModulesJUnit4Test.java (version 18c9c2a4c5a922c56aab240cdf9401441ff1b3ce)
    • api/src/test/java/org/openmrs/annotation/OpenmrsProfileExcludeFilterWithModulesTest.java (version 18c9c2a4c5a922c56aab240cdf9401441ff1b3ce)
    • api/src/test/java/org/openmrs/annotation/StartModuleAnnotationReuseJUnit4Test.java (version 18c9c2a4c5a922c56aab240cdf9401441ff1b3ce)
    • api/src/test/java/org/openmrs/annotation/StartModuleAnnotationReuseTest.java (version 18c9c2a4c5a922c56aab240cdf9401441ff1b3ce)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> a1637013f199f38e3f3547eb579e4f5fd411b697

    WIP

    • api/src/test/java/org/openmrs/OpenmrsTestsTest.java (version a1637013f199f38e3f3547eb579e4f5fd411b697)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> cb59c583153ccc22f59aafd17a26e69bd519dd10

    TRUNK-5816 Test StartModuleAnnotation on JUnit 4 & 5

    • api/src/test/java/org/openmrs/annotation/StartModuleAnnotationJUnit4Test.java (version cb59c583153ccc22f59aafd17a26e69bd519dd10)
    • api/src/test/java/org/openmrs/annotation/StartModuleAnnotationTest.java (version cb59c583153ccc22f59aafd17a26e69bd519dd10)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 9671c340cf314dc45b89fa79e8acb1c8dabff1b9

    TRUNK-5816 Port fix of StartModuleExecutionListener to JUnit 5 one
    fix of Daniel at 13e58851c is necessary to run a
    StartModuleAnnotationTest against our JUnit 5
    BaseContextSensitiveTest+StartModule annotation

    • api/src/test/java/org/openmrs/test/jupiter/StartModuleExecutionListener.java (version 9671c340cf314dc45b89fa79e8acb1c8dabff1b9)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> c29a802fa97e1ab784cef8c3d75546a76ff3d702

    TRUNK-5816 Make StartModuleExecutionListener JUnit independend
    its enough to fail a test using a @StartModule if we through an
    AssertionError. Spring created this class to allow independence of the
    testing framework. We can leverage that so we can reuse the StartModuleExecutionListener

    • api/src/test/java/org/openmrs/test/StartModuleExecutionListener.java (version c29a802fa97e1ab784cef8c3d75546a76ff3d702)
    • api/src/test/java/org/openmrs/test/jupiter/StartModuleExecutionListener.java (version c29a802fa97e1ab784cef8c3d75546a76ff3d702)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 7481583d88a189d795cae83767536f9caec26cbd

    TRUNK-5816 Run StartModuleAnnotationTest
    tests in folder test are not run. Not sure when this test was ever run.
    See surefire exclusions for why.

    We cannot run a BaseContextSensitive with a BaseModuleContextSensitive
    test in the same package. You can run it in isolation but as soon as you
    add another test extending the other base class you get

    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.921 s <<< FAILURE! - in org.openmrs.annotation.StartModuleAnnotationTest
    [ERROR] shouldStartModules  Time elapsed: 0.003 s  <<< ERROR!
    java.lang.IllegalStateException: Failed to load ApplicationContext
    ...
    Caused by: org.hibernate.cache.CacheException:
    net.sf.ehcache.CacheException: Another CacheManager with same name 'hibernateCache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
    1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
    2. Shutdown the earlier cacheManager before creating new one with same name.
    The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
    Caused by: net.sf.ehcache.CacheException:
    Another CacheManager with same name 'hibernateCache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
    1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
    2. Shutdown the earlier cacheManager before creating new one with same name.
    The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]

    Both will want to create an applicationContext with most likely a lot of
    the same beans. The cause here is the duplicate ehCache with the same
    name

    • api/src/test/java/org/openmrs/annotation/StartModuleAnnotationTest.java (version 7481583d88a189d795cae83767536f9caec26cbd)
    • api/src/test/java/org/openmrs/test/StartModuleAnnotationTest.java (version 7481583d88a189d795cae83767536f9caec26cbd)