diff --git a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/GenerateCommand.java b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/GenerateCommand.java index 45b837e991..452ea3a19e 100644 --- a/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/GenerateCommand.java +++ b/cobigen-cli/cli/src/main/java/com/devonfw/cobigen/cli/commands/GenerateCommand.java @@ -272,10 +272,11 @@ private void checkMonolithicConfigurationException() { try { CobiGenUtils.initializeCobiGen(this.templatesProject, false); } catch (DeprecatedMonolithicConfigurationException e) { + String monolithicConfigurationMessage = "Found monolithic configuration at:"; if (this.templatesProject == null) - LOG.warn("Found monolithic configuration at: {} ", ConfigurationFinder.findTemplatesLocation()); + LOG.warn(monolithicConfigurationMessage + "{} ", ConfigurationFinder.findTemplatesLocation()); else - LOG.warn("Found monolithic configuration at: {} ", this.templatesProject); + LOG.warn(monolithicConfigurationMessage + "{} ", this.templatesProject); LOG.warn(e.getMessage()); if (this.upgradeConfiguration) { startTemplatesUpgrader(); diff --git a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java index acb32203b1..6778a90355 100644 --- a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java +++ b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java @@ -59,7 +59,7 @@ public class ResourcesPluginUtil { /** * This variable is used to know if the templates got upgraded or not */ - public static boolean TemplatesUpgraded = false; + public static boolean templatesUpgraded = false; /** * This variable is used to know if we have a custom generator project @@ -307,7 +307,7 @@ public static void startTemplatesUpgrader(Path monolithicConfiguration) { templateAdapter = new TemplateAdapterImpl(monolithicConfiguration); } templateAdapter.upgradeMonolithicTemplates(monolithicConfiguration); - TemplatesUpgraded = true; + templatesUpgraded = true; } } diff --git a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/GeneratorWrapperFactory.java b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/GeneratorWrapperFactory.java index a6ea620e50..7614a8dd0a 100644 --- a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/GeneratorWrapperFactory.java +++ b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/GeneratorWrapperFactory.java @@ -225,7 +225,7 @@ private static CobiGen initializeGenerator(boolean allowMonolithicConfiguration) // we need to check if templates got upgraded then initialize cobigen again. Now with the new template-set // structure - if (ResourcesPluginUtil.TemplatesUpgraded) + if (ResourcesPluginUtil.templatesUpgraded) return initializeCobiGen(null, true); return initializeCobiGen(generatorProj, true); @@ -261,7 +261,7 @@ private static CobiGen initializeCobiGen(IProject generatorProj, boolean allowMo Path templateSetsAdaptedFolderPath = templatesDirectoryPath.resolve(ConfigurationConstants.ADAPTED_FOLDER); Path templateSetsDownloadedFolderPath = templatesDirectoryPath.resolve(ConfigurationConstants.DOWNLOADED_FOLDER); - if (!ResourcesPluginUtil.generatorProjExists || ResourcesPluginUtil.TemplatesUpgraded + if (!ResourcesPluginUtil.generatorProjExists || ResourcesPluginUtil.templatesUpgraded || generatorProj.getLocationURI() == null) { /* @@ -269,7 +269,7 @@ private static CobiGen initializeCobiGen(IProject generatorProj, boolean allowMo * or the upgrader will start again. This time the upgrader cannot start again because template-sets already * exists. */ - ResourcesPluginUtil.TemplatesUpgraded = false; + ResourcesPluginUtil.templatesUpgraded = false; // check adapted and downloaded folder if (Files.exists(templateSetsAdaptedFolderPath) || Files.exists(templateSetsDownloadedFolderPath)) { return CobiGenFactory.create(templatesDirectoryPath.toUri(), allowMonolithicConfiguration); diff --git a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/util/TimestampUtilTest.java b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/util/TimestampUtilTest.java index 525befb1c4..9cd9e9d0da 100644 --- a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/util/TimestampUtilTest.java +++ b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/util/TimestampUtilTest.java @@ -19,12 +19,12 @@ public class TimestampUtilTest { /** * - * Tests the read and write method from TimestampUtil also tests that only one Timestamp will be stored at a time + * Tests the write method from TimestampUtil also tests that only one Timestamp will be stored at a time * * @throws IOException */ @Test - public void testWriteAndReadTimestamp() throws IOException { + public void testWriteTimestamp() throws IOException { Path configFile = Paths.get("src/test/resources/testdata/unittest/config/util/config"); Timestamp InstantTimestamp = TimestampUtil.createInstantTimestamp(); @@ -39,4 +39,24 @@ public void testWriteAndReadTimestamp() throws IOException { } + /** + * + * Tests the readTimestamp method from TimestampUtil + * + * @throws IOException + */ + @Test + public void testReadTimestamp() throws IOException { + + Path configFile = Paths.get("src/test/resources/testdata/unittest/config/util/config"); + Timestamp InstantTimestamp = TimestampUtil.createInstantTimestamp(); + TimestampUtil.writeTimestamp(configFile, InstantTimestamp); + + Timestamp InstantTimestampCopy = TimestampUtil.readTimestamp(configFile); + + Assert.assertEquals(InstantTimestamp, InstantTimestampCopy); + + Files.delete(configFile.toFile()); + + } }