Skip to content

Added `ResourceUtils` and `EphemeralUtils` to Common Kotlin

Channa Dias Perera requested to merge cdp/13-resourceutis-ephemeral into develop

ResourceUtils and EphemeralUtils contains common logic seen in various modules / projects across Digital Lab. This MR seeks to place such logic into Common Kotlin.

ResourceUtils contains logic for loading resources from src/test/resources.

EphemeralUtils contains logic for creating temporary files that are deleting upon exiting the JVM.

A couple of notes:

  • EphemeralUtils is hard to test when it comes to the deletion logic, since I believe cannot restart the JVM within a unit test. I have attached a note at the top of the EphermalUtilsTest about this, and I'm open to suggestions on how to test this.
  • @FWest98 mentioned that perhaps instead of deleting on exit, we could delete once the resource goes out of scope. I'm a bit vary of this, since this is different from deleting on JVM exit and I fear there is some case where they diverge in terms of behaviour.

Resolves #13 (closed)

Merge request reports