Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jan-vcapgemini opened this issue Mar 31, 2023 · 0 comments
Open

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

jan-vcapgemini opened this issue Mar 31, 2023 · 0 comments

Comments

@jan-vcapgemini
Copy link
Collaborator

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. Check 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant