Build: #797 was successful Scheduled with changes by 4 people

Code commits

openmrs-core master

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

    teleivo <teleivo@users.noreply.github.com> 6dc1a7451c3fc60a9687e7ebb31f197d8b443932

    TRUNK-5816 Attempt fix failing HandlerTests on Windows
    according to spotbugs
    https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html#obl-method-may-fail-to-clean-up-stream-or-resource-obl-unsatisfied-obligation
    both Handlers that have failing tests on Windows are not cleaning up
    InputStream's on their getObs() method

    I am trying to close these streams since we know in the test the
    ComplexData.data is an InputStream

    • api/src/test/java/org/openmrs/obs/BinaryStreamHandlerTest.java (version 6dc1a7451c3fc60a9687e7ebb31f197d8b443932)
    • api/src/test/java/org/openmrs/obs/MediaHandlerTest.java (version 6dc1a7451c3fc60a9687e7ebb31f197d8b443932)
  • teleivo <teleivo@users.noreply.github.com>

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

    TRUNK-5816 Disable failing HandlerTests on Windows
    only for now. We need to replicate what developers are seeing on Windows
    see discussion at https://talk.openmrs.org/t/tests-failing-in-core-on-windows/29471/16
    the tests still run in our pipelines (Travis/Bamboo) which ensures that
    the behaviour stays the same. This will at least unblock developers on
    Windows until we find the root cause.

    • api/src/test/java/org/openmrs/obs/BinaryStreamHandlerTest.java (version aff6a214fe2a2ed3fe6da29799fc12eef21e94a2)
    • api/src/test/java/org/openmrs/obs/MediaHandlerTest.java (version aff6a214fe2a2ed3fe6da29799fc12eef21e94a2)
  • teleivo <teleivo@users.noreply.github.com>

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

    TRUNK-5816 powermock reflect is enough for api tests
    to set the OpenmrsConstants for more info refer to
    bc4adc1efaa488c889d3fd2ab61f8178b7e704b4

    • api/pom.xml (version d5585afd4142a3facb1d12340e0c4588f0db6565)
  • teleivo <teleivo@users.noreply.github.com>

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

    TRUNK-5816 Do not allow PowerMock tests in api package
    since PowerMock does not run on JUnit 5 see
    https://github.com/powermock/powermock/issues/929

    we should prevent new contributions from adding tests written with
    PowerMock

    We still rely on powermock-api-mockito2 to set the

    public static final String OPENMRS_VERSION

    of OpenmrsConstants during testing.

    There might also be a way to replace this usage and simply use
    reflection. That could be investigated at a later point.

    Most importantly for our migration to JUnit 5 is that we prevent JUnit 4
    tests (and therefore also PowerMock tests) from entering openmrs-core.

    We should in general avoid reaching for services via the static Context
    methods since that makes testing in isolation hard. Springs dependency
    injection allows us to wonderfully configure our services during testing
    and production. This is what we need to leverage instead of static
    methods that need PowerMock during testing. This also just hides the
    fact that a Service has certain dependencies and is an easy way out in
    designing our system.

    • api/pom.xml (version bc4adc1efaa488c889d3fd2ab61f8178b7e704b4)
  • achilep <39851246+achilep@users.noreply.github.com>

    achilep <39851246+achilep@users.noreply.github.com> ca23425a3c6688edeee13a9609418f96e3865110

    TRUNK-5817: Migrate web and webapp package tests to Junit 5 (#3378)
    Co-authored-by: achilep <you@example.com>

    • api/src/test/java/org/openmrs/module/BaseModuleActivatorTest.java (version ca23425a3c6688edeee13a9609418f96e3865110)
    • api/src/test/java/org/openmrs/module/ModuleActivatorTest.java (version ca23425a3c6688edeee13a9609418f96e3865110)
    • api/src/test/java/org/openmrs/test/jupiter/BaseModuleActivatorTest.java (version ca23425a3c6688edeee13a9609418f96e3865110)
    • web/src/test/java/org/openmrs/web/test/WebModuleActivatorTest.java (version ca23425a3c6688edeee13a9609418f96e3865110)
  • Trust Birungi <diamondtrust66@gmail.com>

    Trust Birungi <diamondtrust66@gmail.com> 3604c6bd0692a75dfdbe2faa1670bef4fae10e69

    TRUNK-5702: Ordered patient programs by enrollment date (#3355)

    • api/src/main/java/org/openmrs/api/db/hibernate/HibernateProgramWorkflowDAO.java (version 3604c6bd0692a75dfdbe2faa1670bef4fae10e69)
    • api/src/test/java/org/openmrs/api/db/ProgramWorkflowDAOTest.java (version 3604c6bd0692a75dfdbe2faa1670bef4fae10e69)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 0ee2d1f6bcde882268a76062efef640b8360e088

    TRUNK-5816 Close streams in test
    both tests fail on Windows with an error like

    [INFO] Running org.openmrs.obs.BinaryStreamHandlerTest
    Jul 17, 2020 11:42:59 AM org.junit.jupiter.engine.execution.JupiterEngineExecutionContext close
    SEVERE: Caught exception while closing extension context: org.junit.jupiter.engine.descriptor.MethodExtensionContext@4fa274
    java.io.IOException: Failed to delete temp directory ...\AppData\Local\Temp\junit9081338062257189768. The following paths could not be deleted (see suppressed exceptions for details): , TestingComplexObsSaving_1d883c5b-ae87-4e42-b5aa-2171b58c51da.dat, TestingComplexObsSaving_27cc4781-b820-466d-834c-70b4d221d24f.dat
    ...
            Suppressed: java.nio.file.FileSystemException: ...\AppData\Local\Temp\junit9081338062257189768\TestingComplexObsSaving_1d883c5b-ae87-4e42-b5aa-2171b58c51da.dat: The process cannot access the file because it is being used by another process.

    Looking at https://github.com/spring-io/initializr/issues/862 it could
    well be that we are facing the same problem that we are not properly
    closing our streams before exiting the test. Thus wrapping them in a
    try-with resource block.

    This theory makes sense since the saveObs uses OpenmrsUtil.copyFile
    which does not close the inputstream but only the outputstream.

    • api/src/test/java/org/openmrs/obs/BinaryStreamHandlerTest.java (version 0ee2d1f6bcde882268a76062efef640b8360e088)
    • api/src/test/java/org/openmrs/obs/MediaHandlerTest.java (version 0ee2d1f6bcde882268a76062efef640b8360e088)
  • achilep <39851246+achilep@users.noreply.github.com>

    achilep <39851246+achilep@users.noreply.github.com> 45204cbafdc631f7f4163065c9aec41efa767098

    TRUNK-5817 : Migrate web and webapp package tests to Junit 5 (#3377)
    Co-authored-by: achilep <you@example.com>

    • web/src/test/java/org/openmrs/web/context/AltAuthSchemeContextTest.java (version 45204cbafdc631f7f4163065c9aec41efa767098)
    • web/src/test/java/org/openmrs/web/filter/update/GZIPFilterTest.java (version 45204cbafdc631f7f4163065c9aec41efa767098)
    • web/src/test/java/org/openmrs/web/filter/update/UpdateFilterTest.java (version 45204cbafdc631f7f4163065c9aec41efa767098)
    • web/src/test/java/org/openmrs/web/filter/update/util/FilterUtilTest.java (version 45204cbafdc631f7f4163065c9aec41efa767098)
    • web/src/test/java/org/openmrs/web/test/BaseWebContextSensitiveTest.java (version 45204cbafdc631f7f4163065c9aec41efa767098)
  • achilep <you@example.com>

    achilep <you@example.com> 544d32c8abb7aa6478dad28b4ddc2bca5bb610ef

    TRUNK-5817: Migrate web and webapp package tests to Junit 5

    • web/pom.xml (version 544d32c8abb7aa6478dad28b4ddc2bca5bb610ef)
    • web/src/test/java/org/openmrs/web/WebDaemonTest.java (version 544d32c8abb7aa6478dad28b4ddc2bca5bb610ef)
    • web/src/test/java/org/openmrs/web/WebUtilTest.java (version 544d32c8abb7aa6478dad28b4ddc2bca5bb610ef)
    • web/src/test/java/org/openmrs/web/test/WebTestHelper.java (version 544d32c8abb7aa6478dad28b4ddc2bca5bb610ef)
  • teleivo <teleivo@users.noreply.github.com>

    teleivo <teleivo@users.noreply.github.com> 8676bea7f0cd55a92e7bac4cc110e777e4d13762

    TRUNK-5817 No message properties exist in webapp
    so when this test is executed in the pipeline no tests are actually run.

    A parametrized JUnit 5 test can be introduced if needed in the future.

    • webapp/pom.xml (version 8676bea7f0cd55a92e7bac4cc110e777e4d13762)
    • webapp/src/test/java/org/openmrs/MessagePropertiesFilesTest.java (version 8676bea7f0cd55a92e7bac4cc110e777e4d13762)
    • webapp/src/test/java/org/openmrs/MessagePropertiesHelper.java (version 8676bea7f0cd55a92e7bac4cc110e777e4d13762)
    • webapp/src/test/java/org/openmrs/PropertiesFileValidator.java (version 8676bea7f0cd55a92e7bac4cc110e777e4d13762)
  • achilep <you@example.com>

    achilep <you@example.com> 1093eabecc3e7da6db0658873ab856e054977546

    TRUNK-5816: Migrate api package tests to Junit

    • api/src/test/java/org/openmrs/obs/AbstractHandlerTest.java (version 1093eabecc3e7da6db0658873ab856e054977546)
  • achilep <you@example.com>

    achilep <you@example.com> 8ceeaecdf8309ffbd48edfa2a3bc1f58c5cbecf7

    TRUNK-5816: Migrate api package tests to Junit

    • api/src/test/java/org/openmrs/obs/BinaryDataHandlerTest.java (version 8ceeaecdf8309ffbd48edfa2a3bc1f58c5cbecf7)
  • achilep <you@example.com>

    achilep <you@example.com> 4a96fa2fed6a363685b09a66b0ebb0a85e38c300

    TRUNK-5816: Migrate api package tests to Junit

    • api/src/test/java/org/openmrs/obs/BinaryStreamHandlerTest.java (version 4a96fa2fed6a363685b09a66b0ebb0a85e38c300)