Skip to content

CobiGen can't handle a version conflict of template sets #1665

@jan-vcapgemini

Description

@jan-vcapgemini

Expected behavior

As a CobiGen user, I want to have two different versions of a template set in my adapted folder but only the latest version should get loaded.

Actual behavior

CobiGen generates for both template sets incrementally, overwriting each other.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Fix this ignored test:
    /**
    * Tests the usage of sample logic classes to be used in different template set versions. Test resources use an equal
    * utility class name with a different implementation to simulate a version a conflict
    *
    * @throws Exception test fails
    */
    @Test
    @Ignore
    public void callClassLoadingTemplateSetTestWithVersionConflict() throws Exception {
    // Mocking
    CobiGen cobigen = CobiGenFactory.create(new File(testTemplateSetFileRootPath + "conflicted/template-sets").toURI());
    Object input = cobigen.read(
    new File("src/test/java/com/devonfw/cobigen/systemtest/testobjects/io/generator/logic/api/to/InputEto.java")
    .toPath(),
    Charset.forName("UTF-8"), getClass().getClassLoader());
    // Useful to see generates if necessary, comment the generationRootFolder above then
    File generationRootFolder = this.tmpFolder.newFolder("generationRootFolder");
    // pre-processing
    List<TemplateTo> templates = cobigen.getMatchingTemplates(input);
    // Execution
    GenerationReportTo report = cobigen.generate(input, templates.get(0), Paths.get(generationRootFolder.toURI()),
    false);
    // Verification
    File expectedResult = new File(testTemplateSetFileRootPath, "expected-conflicted/generated.txt");
    File generatedFile = new File(generationRootFolder, "generated.txt");
    assertThat(report).isSuccessful();
    assertThat(generatedFile).exists();
    assertThat(generatedFile).isFile().hasSameContentAs(expectedResult);
    }

Related/Dependent Issues

Comments/Hints:

Affected version:

  • OS: Windows/Linux/Mac?
  • Browser: Chrome/Firefox/Safari?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions