From 6b5c205d49a069ab5596aa741b1af18a2d63ee92 Mon Sep 17 00:00:00 2001 From: fabrizzio-dotCMS Date: Wed, 12 Jun 2024 21:48:07 -0600 Subject: [PATCH] #28594 --- .../main/java/com/dotcms/api/BuiltVersionService.java | 9 +++++++-- .../java/com/dotcms/api/BuiltVersionServiceImpl.java | 8 -------- .../test/java/com/dotcms/api/BuiltVersionServiceIT.java | 3 --- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionService.java b/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionService.java index f3dc015219e0..40f1338d4607 100644 --- a/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionService.java +++ b/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionService.java @@ -3,10 +3,15 @@ import com.dotcms.model.asset.BuildVersion; import java.util.Optional; +/** + * Service to get the version of the build + */ public interface BuiltVersionService { - boolean isBuildPropertiesFileFound(); - + /** + * Check if the build.properties file was found + * @return true if the build.properties file was found + */ Optional version(); } diff --git a/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionServiceImpl.java b/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionServiceImpl.java index 101ad0536414..3d5afef29d69 100644 --- a/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionServiceImpl.java +++ b/tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/BuiltVersionServiceImpl.java @@ -63,12 +63,4 @@ private Properties loadProperties() throws IOException{ return props; } - public boolean isBuildPropertiesFileFound(){ - try (InputStream input = getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE)) { - return input != null; - } catch (IOException e) { - return false; - } - } - } diff --git a/tools/dotcms-cli/api-data-model/src/test/java/com/dotcms/api/BuiltVersionServiceIT.java b/tools/dotcms-cli/api-data-model/src/test/java/com/dotcms/api/BuiltVersionServiceIT.java index 77317cdb1e07..37277caeda4b 100644 --- a/tools/dotcms-cli/api-data-model/src/test/java/com/dotcms/api/BuiltVersionServiceIT.java +++ b/tools/dotcms-cli/api-data-model/src/test/java/com/dotcms/api/BuiltVersionServiceIT.java @@ -24,9 +24,6 @@ class BuiltVersionServiceIT { */ @Test void testVersion() { - - Assertions.assertTrue(builtVersionService.isBuildPropertiesFileFound(), "The build.properties file was not found"); - Optional version = builtVersionService.version(); Assertions.assertTrue(version.isPresent()); Assertions.assertNotNull(version.get().name());