diff --git a/cobigen/cobigen-core-systemtest/src/test/java/com/devonfw/cobigen/systemtest/ClassLoadingIT.java b/cobigen/cobigen-core-systemtest/src/test/java/com/devonfw/cobigen/systemtest/ClassLoadingIT.java index 82d61fd777..52cf76ef81 100644 --- a/cobigen/cobigen-core-systemtest/src/test/java/com/devonfw/cobigen/systemtest/ClassLoadingIT.java +++ b/cobigen/cobigen-core-systemtest/src/test/java/com/devonfw/cobigen/systemtest/ClassLoadingIT.java @@ -121,8 +121,6 @@ public void callClassLoadingTemplateSetTest() throws Exception { * @throws Exception test fails */ @Test - @Ignore // TODO: re-enable when versions can be detected and version handling was implemented, see: - // https://github.com/devonfw/cobigen/issues/1665 public void callClassLoadingTemplateSetTestWithVersionConflict() throws Exception { // Mocking diff --git a/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java b/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java new file mode 100644 index 0000000000..e0df9f3f81 --- /dev/null +++ b/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java @@ -0,0 +1,12 @@ +public class JarredClass { + +public String methodOne(String str) { + return str; +} + +public int methodTwo(int a, int b) { + + return a+b; + +} +} \ No newline at end of file diff --git a/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java b/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java new file mode 100644 index 0000000000..2446d6e7f4 --- /dev/null +++ b/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java @@ -0,0 +1,12 @@ +public class JarredClass { + +public String methodOne(String str) { + return str; +} + +public int methodTwo(int a, int b) { + + return a-b; + +} +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/config/reader/TemplateSetConfigurationManager.java b/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/config/reader/TemplateSetConfigurationManager.java index ddc0cbb428..cff3df4ee1 100644 --- a/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/config/reader/TemplateSetConfigurationManager.java +++ b/cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/config/reader/TemplateSetConfigurationManager.java @@ -1,16 +1,25 @@ package com.devonfw.cobigen.impl.config.reader; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.devonfw.cobigen.api.constants.ConfigurationConstants; import com.devonfw.cobigen.api.exception.InvalidConfigurationException; +import com.devonfw.cobigen.api.util.MavenCoordinate; import com.devonfw.cobigen.api.util.TemplatesJarUtil; import com.devonfw.cobigen.impl.util.FileSystemUtil; @@ -21,6 +30,9 @@ */ public class TemplateSetConfigurationManager { + /** Logger instance */ + private static final Logger LOG = LoggerFactory.getLogger(TemplateSetConfigurationManager.class); + /** List with the paths of the configuration locations for the template-set.xml files */ private Map configLocations; @@ -47,10 +59,13 @@ public Map getConfigLocations() { * @param configRoot root directory of the configuration template-sets/adapted * @return List of Paths to the adapted templateSetFiles */ - protected List loadTemplateSetFilesAdapted(Path configRoot) { + public List loadTemplateSetFilesAdapted(Path configRoot) { List templateSetDirectories = retrieveTemplateSetDirectories(configRoot); + // Create a map to hold template set info and their paths + Map templateSetInfoMap = new HashMap<>(); + List adaptedTemplateSets = new ArrayList<>(); for (Path templateDirectory : templateSetDirectories) { Path templateSetFilePath = templateDirectory.resolve(ConfigurationConstants.MAVEN_CONFIGURATION_RESOURCE_FOLDER) @@ -58,12 +73,46 @@ protected List loadTemplateSetFilesAdapted(Path configRoot) { // makes sure that only valid template set folders get added if (Files.exists(templateSetFilePath)) { - adaptedTemplateSets.add(templateSetFilePath); - - this.configLocations.put(templateSetFilePath, templateDirectory); + + // Parse POM to get Maven coordinates + MavenCoordinate mavenCoordinate = parsePomFromTemplateSet(templateDirectory); + if (mavenCoordinate != null) { + String key = mavenCoordinate.getGroupId() + ":" + mavenCoordinate.getArtifactId(); + TemplateSetInfo newInfo = new TemplateSetInfo(templateSetFilePath, templateDirectory, mavenCoordinate); + + // Check if we already have a template set with the same groupId:artifactId + TemplateSetInfo existingInfo = templateSetInfoMap.get(key); + if (existingInfo == null || compareVersions(mavenCoordinate.getVersion(), existingInfo.coordinate.getVersion()) > 0) { + // This version is newer or it's the first one we've seen + templateSetInfoMap.put(key, newInfo); + LOG.debug("Found template set {}:{}:{} at {}", + mavenCoordinate.getGroupId(), + mavenCoordinate.getArtifactId(), + mavenCoordinate.getVersion(), + templateDirectory); + } else { + LOG.debug("Skipping older template set {}:{}:{} at {} in favor of version {}", + mavenCoordinate.getGroupId(), + mavenCoordinate.getArtifactId(), + mavenCoordinate.getVersion(), + templateDirectory, + existingInfo.coordinate.getVersion()); + } + } else { + // Fallback: if POM parsing fails, include it anyway + LOG.warn("Could not parse Maven coordinates from template set at {}, including anyway", templateDirectory); + adaptedTemplateSets.add(templateSetFilePath); + this.configLocations.put(templateSetFilePath, templateDirectory); + } } } + // Add the final selected template sets + for (TemplateSetInfo info : templateSetInfoMap.values()) { + adaptedTemplateSets.add(info.templateSetFilePath); + this.configLocations.put(info.templateSetFilePath, info.templateDirectory); + } + return adaptedTemplateSets; } @@ -94,7 +143,7 @@ private List retrieveTemplateSetDirectories(Path configRoot) { * @param configRoot root directory of the configuration template-sets/downloaded * @return List of Paths to the downloaded templateSetFiles */ - protected List loadTemplateSetFilesDownloaded(Path configRoot) { + public List loadTemplateSetFilesDownloaded(Path configRoot) { // TODO: add check for valid templatesetjar util List templateJars = TemplatesJarUtil.getJarFiles(configRoot); @@ -116,4 +165,114 @@ protected List loadTemplateSetFilesDownloaded(Path configRoot) { return downloadedTemplateSets; } + /** + * Parses the pom.xml file from a template set directory to extract Maven coordinates + * + * @param templateDirectory the template set directory + * @return MavenCoordinate or null if parsing fails + */ + private MavenCoordinate parsePomFromTemplateSet(Path templateDirectory) { + + Path pomPath = templateDirectory.resolve("pom.xml"); + if (!Files.exists(pomPath)) { + return null; + } + + try (InputStream is = Files.newInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(is); + + String groupId = model.getGroupId(); + String artifactId = model.getArtifactId(); + String version = model.getVersion(); + + // Handle parent POM inheritance + if (groupId == null && model.getParent() != null) { + groupId = model.getParent().getGroupId(); + } + if (version == null && model.getParent() != null) { + version = model.getParent().getVersion(); + } + + if (groupId != null && artifactId != null && version != null) { + return new MavenCoordinate(groupId, artifactId, version); + } + + } catch (IOException | XmlPullParserException e) { + LOG.warn("Failed to parse POM file at {}: {}", pomPath, e.getMessage()); + } + + return null; + } + + /** + * Compares two version strings. Returns positive if version1 > version2, negative if version1 < version2, 0 if equal. + * + * This is a simple version comparison that handles semantic versioning and snapshot versions. + * + * @param version1 first version to compare + * @param version2 second version to compare + * @return comparison result + */ + private int compareVersions(String version1, String version2) { + + if (version1.equals(version2)) { + return 0; + } + + // Remove snapshot suffix for comparison + String v1 = version1.replace("-SNAPSHOT", ""); + String v2 = version2.replace("-SNAPSHOT", ""); + + String[] parts1 = v1.split("\\."); + String[] parts2 = v2.split("\\."); + + int maxLength = Math.max(parts1.length, parts2.length); + + for (int i = 0; i < maxLength; i++) { + String part1 = i < parts1.length ? parts1[i] : "0"; + String part2 = i < parts2.length ? parts2[i] : "0"; + + try { + int num1 = Integer.parseInt(part1); + int num2 = Integer.parseInt(part2); + int result = Integer.compare(num1, num2); + if (result != 0) { + return result; + } + } catch (NumberFormatException e) { + // Fall back to string comparison if parts are not numeric + int result = part1.compareTo(part2); + if (result != 0) { + return result; + } + } + } + + // If all numeric parts are equal, prefer non-snapshot over snapshot + if (version1.contains("-SNAPSHOT") && !version2.contains("-SNAPSHOT")) { + return -1; + } else if (!version1.contains("-SNAPSHOT") && version2.contains("-SNAPSHOT")) { + return 1; + } + + return 0; + } + + /** + * Helper class to hold template set information + */ + private static class TemplateSetInfo { + + final Path templateSetFilePath; + final Path templateDirectory; + final MavenCoordinate coordinate; + + TemplateSetInfo(Path templateSetFilePath, Path templateDirectory, MavenCoordinate coordinate) { + this.templateSetFilePath = templateSetFilePath; + this.templateDirectory = templateDirectory; + this.coordinate = coordinate; + } + } + } diff --git a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/InputEto.java b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/InputEto.java new file mode 100644 index 0000000000..a6dfd7f6b4 --- /dev/null +++ b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/InputEto.java @@ -0,0 +1,29 @@ +package com.devonfw.cobigen.systemtest.testobjects.io.generator.logic.api.to; + +public class InputEto { + + private String input; + + private int complexity; + + public String getInput() { + + return this.input; + } + + public void setInput(String input) { + + this.input = input; + } + + public int getComplexity() { + + return this.complexity; + } + + public void setComplexity(int complexity) { + + this.complexity = complexity; + } + +} diff --git a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/test.yaml b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/test.yaml new file mode 100644 index 0000000000..14b9ec10cf --- /dev/null +++ b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/systemtest/io/generator/logic/api/to/test.yaml @@ -0,0 +1,131 @@ +openapi: 3.0.0 +servers: + - url: 'https://localhost:8081/server/services/rest' +info: + title: Devon Example + description: Example of a API definition + version: 1.0.0 + x-rootpackage: com.devonfw.demo +paths: + /datamanagement/v1/someData/{id}: + get: + operationId: findSomeData + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int64 + minimum: 0 + maximum: 50 + responses: + '200': + description: Any + content: + application/json: + schema: + $ref: '#/components/schemas/EvenMoreData' + text/plain: + schema: + type: string + /datamanagement/v1/moreData/{id}: + get: + operationId: findMoreData + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int64 + minimum: 10 + maximum: 200 + responses: + '200': + description: Any + /datamanagement/v1/someData/: + post: + responses: + '200': + description: Any + requestBody: + $ref: '#/components/requestBodies/SomeData' + tags: + - searchCriteria + /datamanagement/v1/moreData/validateMoreData: + post: + responses: + '200': + description: Any + requestBody: + $ref: '#/components/requestBodies/MoreData' +components: + schemas: + SomeData: + x-component: DataManagement + description: Entity definiton of SomeData + type: object + properties: + AnyString: + type: string + maxLength: 100 + minLength: 5 + uniqueItems: true + furtherData: + type: array + items: + $ref: '#/components/schemas/FurtherData' + MoreData: + x-component: DataManagement + description: Entity definiton of Moredata + type: object + properties: + anyNumber: + type: number + format: int64 + maximum: 100 + minimum: 0 + someData: + $ref: '#/components/schemas/SomeData' + allSomeData: + type: array + description: 'All SomeData' + items: + $ref: '#/components/schemas/SomeData' + required: + - saleExample + FurtherData: + x-component: AnotherComponent + type: object + properties: + parent: + $ref: '#/components/schemas/SomeData' + valid: + type: boolean + someList: + type: array + items: + type: string + EvenMoreData: + x-component: AnotherComponent + description: Entity definiton of more data + type: object + properties: + id: + type: integer + format: int64 + uniqueItems: true + requestBodies: + SomeData: + content: + application/json: + schema: + $ref: '#/components/schemas/SomeData' + required: true + MoreData: + content: + application/json: + schema: + $ref: '#/components/schemas/MoreData' + required: true diff --git a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/TemplateSetConfigurationManagerTest.java b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/TemplateSetConfigurationManagerTest.java new file mode 100644 index 0000000000..ad45805cb6 --- /dev/null +++ b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/TemplateSetConfigurationManagerTest.java @@ -0,0 +1,30 @@ +package com.devonfw.cobigen.unittest.config.reader; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import org.junit.Test; + +import com.devonfw.cobigen.impl.config.reader.TemplateSetConfigurationManager; + +public class TemplateSetConfigurationManagerTest { + + @Test + public void testVersionConflictResolution() throws Exception { + + Path configRoot = Paths.get("src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted"); + + TemplateSetConfigurationManager manager = new TemplateSetConfigurationManager(); + List templateSetFiles = manager.loadTemplateSetFilesAdapted(configRoot); + + // Should only load one template set (the newest version) + assertThat(templateSetFiles).hasSize(1); + + // Should be template-set2 (version 1.1) which is newer than template-set1 (version 1) + assertThat(templateSetFiles.get(0).toString()).contains("template-set2"); + } +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/VersionConflictIntegrationTest.java b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/VersionConflictIntegrationTest.java new file mode 100644 index 0000000000..fb8cfd41b5 --- /dev/null +++ b/cobigen/cobigen-core/src/test/java/com/devonfw/cobigen/unittest/config/reader/VersionConflictIntegrationTest.java @@ -0,0 +1,48 @@ +package com.devonfw.cobigen.unittest.config.reader; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import org.junit.Test; + +import com.devonfw.cobigen.impl.config.reader.TemplateSetConfigurationManager; + +public class VersionConflictIntegrationTest { + + @Test + public void testVersionConflictResolution() throws Exception { + + // Test that version conflict resolution is working correctly + Path configRoot = Paths.get("src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted"); + + TemplateSetConfigurationManager manager = new TemplateSetConfigurationManager(); + List templateSetFiles = manager.loadTemplateSetFilesAdapted(configRoot); + + // Should only load one template set (the newest version) + assertThat(templateSetFiles).hasSize(1); + + // Should be template-set2 (version 1.1) which is newer than template-set1 (version 1) + assertThat(templateSetFiles.get(0).toString()).contains("template-set2"); + + // Verify the path contains the newer version + assertThat(templateSetFiles.get(0).toString()).contains("template-set2"); + assertThat(templateSetFiles.get(0).toString()).doesNotContain("template-set1"); + } + + @Test + public void testNoTemplateConflict() throws Exception { + + // Test that when there's no conflict, all template sets are loaded + Path configRoot = Paths.get("src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted"); + + TemplateSetConfigurationManager manager = new TemplateSetConfigurationManager(); + List templateSetFiles = manager.loadTemplateSetFilesAdapted(configRoot); + + // Should load the single template set since there's no conflict + assertThat(templateSetFiles).hasSize(1); + assertThat(templateSetFiles.get(0).toString()).contains("template-set1"); + } +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/pom.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/pom.xml new file mode 100644 index 0000000000..31ebb749b4 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + com.devonfw.test + classpath-template-set-load-test + jar + dev-SNAPSHOT-1 + + 1.8 + 1.8 + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java new file mode 100644 index 0000000000..e0df9f3f81 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/java/JarredClass.java @@ -0,0 +1,12 @@ +public class JarredClass { + +public String methodOne(String str) { + return str; +} + +public int methodTwo(int a, int b) { + + return a+b; + +} +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/template-set.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/template-set.xml new file mode 100644 index 0000000000..623e32c4de --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/template-set.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl new file mode 100644 index 0000000000..7933008564 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl @@ -0,0 +1,2 @@ +Testing JarredClass: +String is ${JarredClass.methodTwo(3,1)} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/pom.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/pom.xml new file mode 100644 index 0000000000..95050ccd70 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + com.devonfw.test + classpath-template-set-load-test + jar + dev-SNAPSHOT-1.1 + + 1.8 + 1.8 + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java new file mode 100644 index 0000000000..2446d6e7f4 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/java/JarredClass.java @@ -0,0 +1,12 @@ +public class JarredClass { + +public String methodOne(String str) { + return str; +} + +public int methodTwo(int a, int b) { + + return a-b; + +} +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/template-set.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/template-set.xml new file mode 100644 index 0000000000..010b94529a --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/template-set.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/templates/generated.txt.ftl b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/templates/generated.txt.ftl new file mode 100644 index 0000000000..7933008564 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/conflicted/template-sets/adapted/template-set2/src/main/resources/templates/generated.txt.ftl @@ -0,0 +1,2 @@ +Testing JarredClass: +String is ${JarredClass.methodTwo(3,1)} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected-conflicted/generated.txt b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected-conflicted/generated.txt new file mode 100644 index 0000000000..8be2db595a --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected-conflicted/generated.txt @@ -0,0 +1,2 @@ +Testing JarredClass: +String is 2 \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected/generated.txt b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected/generated.txt new file mode 100644 index 0000000000..554cc0ce7c --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/expected/generated.txt @@ -0,0 +1,4 @@ +Testing JarredClass: +String is Something +5 +generator \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/pom.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/pom.xml new file mode 100644 index 0000000000..09c2256fa8 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + com.devonfw.test + classpath-template-set-load-test + jar + dev-SNAPSHOT + + 1.8 + 1.8 + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/java/JarredClass.java b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/java/JarredClass.java new file mode 100644 index 0000000000..e0df9f3f81 --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/java/JarredClass.java @@ -0,0 +1,12 @@ +public class JarredClass { + +public String methodOne(String str) { + return str; +} + +public int methodTwo(int a, int b) { + + return a+b; + +} +} \ No newline at end of file diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/template-set.xml b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/template-set.xml new file mode 100644 index 0000000000..623e32c4de --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/template-set.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl new file mode 100644 index 0000000000..d1a48913eb --- /dev/null +++ b/cobigen/cobigen-core/src/test/resources/testdata/systemtest/ClassLoadTemplateSetTest/template-sets/adapted/template-set1/src/main/resources/templates/generated.txt.ftl @@ -0,0 +1,4 @@ +Testing JarredClass: +String is ${JarredClass.methodOne("Something")} +${variables.etoName} +${variables.etoName2} \ No newline at end of file