Skip to content

Commit

Permalink
1495 fixed working branch adapt templates feature (devonfw#1645)
Browse files Browse the repository at this point in the history
* devonfw#1495 All changes in one commit

* devonfw#1495 Resolved merge conflicts

* devonfw#1495 Resolved conflicts

* devonfw#1495 applied stash

* devonfw#1495 deleted obsolete classes

* devonfw#1495 removed useless method

* devonfw#1495 Fixed templates.xml upgrader tests

* trigger map will be loaded correctly

* devonfw#1495 Fix for core-systemtests

* devonfw#1495 Removed duplicates

* fixed tests

* Revert "fixed tests"

This reverts commit da30dda.

* added cli test

* devonfw#1495 new core tests for tempalate-set.xml

* devonfw#1495 Implemented a specifier for the reader

* Revert "devonfw#1495 Implemented a specifier for the reader"

This reverts commit 0edc655.

* devonfw#1495 Changed templateSetConfiguration schema structure

* devonfw#1495 Fixed TemplateSetConfigurationReader to read the new templateSetConfiguration.xsd
added new Core tests and test resources

* fixed install templates test

* devonfw#1495 Added new test for Templatescan

* devonfw#1495 Deleted unnecessary resources

* Merged context.xml and templates.xml into template-set.xml for:
- crud-openapi-java-server-app
- crud-openapi-net
- crud-typescript-angular-client-app
- kafka-documentation
- named-queries
- openapi-documentation
- rest-documentation
- security-permissions
- testdata-builder

* devonfw#1495 Merged context.xml and templates.xml to template-set.xml

* devonfw#1495 Fixed template-scan issue

* devonfw#1495 Fixed syntax errors in template-set.xml Files

* devonfw#1495 Fixed Templatescan not finding the templates location

* devonfw#1495 TemplateSetReader combination test
added new constructors to template and context readers
cleaned up TemplateSetConfigurationReader
added templates and context configuration getters to TemplateSetConfigurationReader
changed all versioned imports to default io
initialized templates and context readers in TemplateSetConfiguration readConfiguration method
removed template set detection in templates and context configuration

* devonfw#1495 re-added template set condition
created templates and context configuration readers in template set readConfiguration method
added configFilePath to TemplatesConfiguration constructor
initialized templates and context configuration readers in template set readConfiguration method
cleaned up template set template scan test

* devonfw#1495 added more tests + resources
cleaned up test resources

* devonfw#1495 fixes
added ConfigurationHolder to TemplateSetConfiguration
added javadocs
fixed configFilePath in TemplatesConfigurationReader for template-sets
added templateSetConfigurationFile to TemplatesConfigurationReader
fixed templates subfolder being used for rootTemplateFolder
added a 2nd template-set to GenerationTestTemplateSetsXml

* devonfw#1495 removed unused method

* devonfw#1495 adjusted readConfiguration
removed readConfiguration call from TemplateSetConfigurationReader
added readConfiguration to TemplateSetConfiguration
filled maps of triggers and templates in TemplateSetConfiguration readConfiguration method
reformatted and adjusted test resource template-set.xmls

* devonfw#1495 fixed create and generate
replaced triggers in ContextConfiguration readConfiguration with template set triggers
added extra check to getConfigLocationForTrigger (checks if template set is available)
added getter for triggers to TemplateSetConfiguration
temporary fix for missing templateFolder in trigger
renamed test

* devonfw#1495 Added TemplateSetConfiguration directly into the configuraion holder
#	cobigen-cli/cli-systemtest/src/test/java/com/devonfw/cobigen/cli/systemtest/GenerateCommandIT.java
#	cobigen/cobigen-core-api/src/main/java/com/devonfw/cobigen/api/constants/ConfigurationConstants.java
#	cobigen/cobigen-core/pom.xml
#	cobigen/cobigen-core/src/main/resources/schema/v6.0/templateSetConfiguration.xsd

* devonfw#1495 fixed tests
added wip hack for template_scan conflict with "templates/templates" paths
moved "template/templates" root path creation into extra method initializeTemplateSetTemplatesRoot
fixed templateScan paths in test resources (jar file too)

* devonfw#1495 replaced mocked java plug-in
added testdata_builder template-set to core-systemtest resources
replaced mocked java plug-in with real input class

* devonfw#1495 Made the ConfigurationHolder a singleton and some other refactors

* devonfw#1495 removed ConfigurationFactory
moved retrieveTemplatesConfiguration and retrieveTemplateSetConfiguration to ConfigurationHolder

* devonfw#1495 removed singleeton again because this pattern didn't make sense here in the first place

* devonfw#1495 Lots of optimizations and cleanup
moved detection of template set from ContextConfiguration to ConfigurationHolder
added lots of javadoc comments
cleaned up AbstractContextConfiguration
replaced TemplateSetConfiguration in ContextConfiguration with ConfigurationHolder
added new Map rootTemplateFolders to ConfigurationHolder (replaces triggerConfigLocations?)

* devonfw#1495 added 2nd template to overrideMerge test

* devonfw#1495 more optimizations and cleanups
moved isTemplateSet check from TemplatesConfiguration to ConfigurationHolder
added new templatesConfigurations getter to ConfigurationHolder
cleaned up ContextConfiguration constructor (made sure that triggers won't be loaded again)
added a getter for increments to TemplateSetConfiguration

* devonfw#1495 initialized proper templates list
added templatesConfigurations to TemplateSetConfiguration
passed properly initialized TemplatesConfigurations to getMatchingTemplates if we are in template set

* devonfw#1495 more optimizations and cleanups
removed Context and TemplatesConfigurationReaders from TemplateSetConfigurationReader
initialized Context and TemplatesConfigurationReaders in TemplateSetConfiguration
removed retrieveTemplatesConfiguration method (moved logic into readTemplatesConfiguration)

* devonfw#1495 fixed template_scan root folder lookup

* devonfw#1495 added and cleaned up tests
added new classLoadingTemplateSetTest and resources
added new testTemplateSetCorrectDestinationResolution test and resources
reduced current test resource complexity
renamed testReadTwoTemplateSetXml to testReadMultipleTemplateSetXmls

* devonfw#1495 refactored loadTemplateSetFilesAdapted
moved retrieval of template set root folders to new method

* devonfw#1495 fixed conflict with templateRoot and utilsLocation
added new retrieveTemplateSetUtilsLocationForTrigger method

* devonfw#1495 fixed callClassLoadingTemplateSetTest
added proper resources

* devonfw#1495 added variableAssignments
added variableAssignments to ClassLoading template set system test
re-added fileSystemDependentPath handling to getConfigurationLocationforTrigger
fixed ClassLoading template set system test

* devonfw#1495
Some refactors

* devonfw#1495 Fixed error from previous push

* devonfw#1495 fixed fileSystem conflict replaced 2nd if condition with else fixed unit tests changed templateSetFiles field (might be unnecessary)

* devonfw#1495 disabled templates generation integration test

* devonfw#1495 added example template-set integration test
added example template-set integration test for crud-java-server-app template set
moved functions.ftl into root template folder of crud-java-server-app

* devonfw#1495 refactoring

* devonfw#1495 added a test for version conflict detection
some cleanup
added test resources

* devonfw#1495 removed static call

* devonfw#1495 more optimizations and fixes
split adapted and downloaded paths
removed duplicated methods from TemplateSetConfigurationReader (can be found in TemplateSetConfigurationManager)
fixed typos
added getter for configuration locations to TemplateSetConfigurationManager
removed file system creation and isZipFile check in ContextConfiguration retrieveConfigRootByTrigger and retrieveTemplateSetUtilsLocaitonByTrigger

* devonfw#1495 added example template-set integration test
added example template-set integration test for crud-openapi-java-server-app template set
moved functions.ftl and makros.ftl into root template folder of crud-openapi-java-server-app

* devonfw#1495 cleanup and test fixes
removed unnecessary templateSetFiles field
removed getTemplateSetFiles and addTemplateSetFiles methods
fixed TemplateSetConfigurationReader check if configurations were found (added downloaded template set paths check)
fixed template set reader unit tests

* devonfw#1495 fixed makros and functions
moved makros and functions into templates folder

* devonfw#1495 disabled version conflict test

* devonfw#1495 fixed github workflow
enabled enableCrossOsArchive for eclipse-test cache restore

* devonfw#1495 implemented requested changes
reverted changes on AccumulationType Matcher

* devonfw#1495 implemented requested changes
removed unused imports

* devonfw#1495 implemented requested changes
changed version float number
adjusted javadoc

* devonfw#1495 implemented requested changes
adjusted TemplateSetConfiguration initial release description

* devonfw#1495 implemented requested changes
adjusted/enhanced javadocs
fixed typos
removed links to Path

* devonfw#1495 implemented requested changes
changed throws from generic Exception to more specific ones
adjusted javadocs

* devonfw#1495 implemented requested changes
changed compare to equals (sonatype issue fixed)

* devonfw#1496 removed resource build
removed src/main/templates dependency

* devonfw#1495
updated javadoc for templateSetConfigurations

* added import that was lost in a merge

* devonfw#1495 renamed test resources and changed folder structure

* cleaning up the ressources and changing the structure to the new template set structure

* adjusted ressources after merge

* devonfw#1495 finallized test folder structure

* Began implementing new test case

* devonfw#1495 fixed template set test structure
moved templates and config files into src/main/resources

* devonfw#1495 fixed template set resolving
replaced src/main/templates with src/main/resources in TemplateSetConfigurationManager
removed template resource folder inside downloaded template set detection
removed initializeTemplateSetTemplatesRoot (will be handled by ts_scan configuration now)

* devonfw#1495 fixed template set tests
fixed template set resource configurations
disabled testTemplateSetsDuplicatedThrowsError test
added templates folder to each template set test resource configuration (fixes template_scan conflict)
added downloaded projects to test resources and built them in core pom.xml (removes dependency on binaries)
removed binaries from test resources
added test resource jars to .gitignore

* devonfw#1495 fixed template set projects
moved functions and makros into src/main/resources

* devonfw#1495 fixed cli tests
added downloaded test project and automatic build
replaced src/main/templates with src/main/resources

* devonfw#1495 fixed template set resource folder
fixed template set resource folder in crud-java-server-app template set test

* Fixed adaptTemplateSetTest

* Implemented extractTemplateSetsTest

* began implementing methods into new test

* devonfw#1495 optimized template set tests
renamed single template set tests
removed unnecessary file copy operations in setupDevtemplates method
added test data builder test
added crud angular client app test

* devonfw#1495 fixed conflicted class load template set test

* devonfw#1495 added crud openapi net test to template set

* devonfw#1495 fixed template set jars

* devonfw#1495 adjusted GenerationIT system test
added template set jar test projects to system test
made sure that generation of all template sets (including downloaded jars) gets tested
added generated jars to .gitignore

* devonfw#1495 fixed plugin loading and jar pathing
added OpenApi test resource and test
renamed GenerationIT tests
added OpenApi dependency to core-systemtest and root pom

* devonfw#1495 resolved TODO
renamed src/main/resources constant to MAVEN_CONFIGURATION_RESOURCE_FOLDER

* devonfw#1495 resolved TODO
added javadoc for templateSetConfigurationFile
removed throws declaration

* devonfw#1495 modularized old monolithic template tests
added individual templateSet tests and resources to each templateSet project

* devonfw#1495 added missing typescript templateSet test

* devonfw#1495 resolved TODO
removed unused loadConfig method

* devonfw#1495 resolved TODOs
removed FileNotFoundException
made templateSetPaths private
removed TODOs which are not needed anymore

* devonfw#1495 resolved TODO
added extra condition for optional template folders in template sets
removed todo

* Identified todos

* added pattern

* implemented basic logic for information gathering

* simplified the new method and embedded new information into the mavencoordinatestate object

* added mavencoordinates package; implemented a wrapper class for pairs of MavenCoordinateStates; implemented errors and logs into getTemplateSetJarFolderStructure

* successfully implemented getTemplateSetJarFolderStructure with test

* modified the test for getTemplateSetJarFolderStructure to extensively test the method

* Fixed the test

* extensively tested the new MavenCoordinatePair data structure

* adapt command makes use of new data structure

* devonfw#1495 Fixed folder structure in crud-java-ea-uml

* added missing jars to ignore

* devonfw#1495 temporarily disabled test

* devonfw#1495 temporarily disabled tests

* template adapter rework is completed and tested

* template adapter rework is completed and tested

* core builds now

* dependency cycle dissolved

* added mavencoordinates to downloadjar

* devonfw#1642 made adapt template set process functional
added proper adapt templates process
renamed getValue0 and getValue1 to getSourcesJar and getClassesJar
adjusted tests to check for correct folder structure after adapt process
re-enabled CLI adaptTemplateSetTest

* devonfw#1642 re-enabled CLI adaptTemplatesTest

* devonfw#1642 added test resources to CLI
added template set test resource projects (will be converted to downloaded jars automatically)

* devonfw#1642 added build test resources to ignore

* devonfw#1642 changed adaptTemplateSetsTest to use template sets from test ressources

* devonfw#1645 made adapt template set process functional
removed MavenCoordinateState model
removed MavenCoordinateStatePair model
adjusted tests
added template set projects to test resources
added changes from EduardKrieger to TemplateAdapterImpl

* devonfw#1645 removed null return from TemplateAdapter
replaced null with empty list
adjusted tests
added more tests

* devonfw#1645 re-added template-set projects

* devonfw#1645 removed javatuples dependency

---------

Co-authored-by: KHucklenbroich <[email protected]>
Co-authored-by: MansourD <[email protected]>
Co-authored-by: MansourD <[email protected]>
Co-authored-by: EduardKrieger <[email protected]>
Co-authored-by: Lurian <[email protected]>
Co-authored-by: jan-vcapgemini <[email protected]>
Co-authored-by: Malte Brunnlieb <[email protected]>
Co-authored-by: cedricarnauld123 <[email protected]>
  • Loading branch information
9 people authored Mar 22, 2023
1 parent 0b79b14 commit af182c4
Show file tree
Hide file tree
Showing 33 changed files with 862 additions and 163 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ objectdb
/cobigen/cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/GenerationTestTemplateSetsXml/template-sets/downloaded/downloaded-template-set2-test-test.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/GenerationTestTemplateSetsXml/template-sets/downloaded/downloaded-template-set2-test-test.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/GenerationTestTemplateSetsXml/template-sets/downloaded/downloaded-template-set1-test-test.jar
cobigen-cli/cli-systemtest/src/test/resources/testdata/AdaptTemplatesCommandIT/template-sets/downloaded/crud-java-server-app-1.0.0.jar
cobigen-cli/cli-systemtest/src/test/resources/testdata/AdaptTemplatesCommandIT/template-sets/downloaded/crud-java-server-app-1.0.0-sources.jar
cobigen-cli/cli-systemtest/src/test/resources/testdata/AdaptTemplatesCommandIT/template-sets/downloaded/crud-java-server-app-complex-1.0.0.jar
cobigen-cli/cli-systemtest/src/test/resources/testdata/AdaptTemplatesCommandIT/template-sets/downloaded/crud-java-server-app-complex-1.0.0-sources.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-1.0.0.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-1.0.0-sources.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-complex-1.0.0.jar
cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-complex-1.0.0-sources.jar
42 changes: 41 additions & 1 deletion cobigen-cli/cli-systemtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<properties>
<maven.test.path>src\test\resources\testdata\localmavenproject\maven.project</maven.test.path>
<maven.test.templates.path>src\test\resources\testdata\templatesproject\templates-devon4j</maven.test.templates.path>
<maven.test.templateset.downloaded.path>src\test\resources\testdata\templatesproject\template-sets/downloaded/crud-java-server-app</maven.test.templateset.downloaded.path>
<maven.test.templateset.downloaded.path>src\test\resources\testdata\templatesproject\template-sets\downloaded\crud-java-server-app</maven.test.templateset.downloaded.path>
<maven.test.AdaptTemplatesCommandIT.downloaded.path1>src\test\resources\testdata\AdaptTemplatesCommandIT\template-sets\adapted\crud-java-server-app</maven.test.AdaptTemplatesCommandIT.downloaded.path1>
<maven.test.AdaptTemplatesCommandIT.downloaded.path2>src\test\resources\testdata\AdaptTemplatesCommandIT\template-sets\adapted\crud-java-server-app-complex</maven.test.AdaptTemplatesCommandIT.downloaded.path2>
</properties>

<dependencies>
Expand Down Expand Up @@ -131,6 +133,44 @@
</arguments>
</configuration>
</execution>
<execution>
<id>Install AdaptTemplatesCommandIT downloaded project1</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<workingDirectory>${maven.test.AdaptTemplatesCommandIT.downloaded.path1}</workingDirectory>
<arguments>
<argument>install</argument>
<!-- https://stackoverflow.com/a/66801171 -->
<argument>-Djansi.force=true</argument>
<argument>-Djansi.passthrough=true</argument>
<argument>-B</argument>
<argument>-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>Install AdaptTemplatesCommandIT downloaded project2</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<workingDirectory>${maven.test.AdaptTemplatesCommandIT.downloaded.path2}</workingDirectory>
<arguments>
<argument>install</argument>
<!-- https://stackoverflow.com/a/66801171 -->
<argument>-Djansi.force=true</argument>
<argument>-Djansi.passthrough=true</argument>
<argument>-B</argument>
<argument>-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Ignore;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import com.devonfw.cobigen.api.constants.ConfigurationConstants;
Expand All @@ -17,28 +17,23 @@
*/
public class AdaptTemplatesCommandIT extends AbstractCliTest {

/** Test resources root path */
private static String testFileRootPath = "src/test/resources/testdata/AdaptTemplatesCommandIT/template-sets/downloaded";

/**
* Checks if adapt-templates command successfully created adapted folder and its sub folders
*
* @throws Exception test fails
*/
@Test
@Ignore // TODO: re-enable when template set adaptation is implemented
public void adaptTemplateSetTest() throws Exception {

Path cliSystemTestPath = new File(
AdaptTemplatesCommandIT.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile()
.getParentFile().toPath();
Path templateJar = cliSystemTestPath.resolve("src/test/resources/testdata/crud-java-server-app.jar");
if (Files.exists(templateJar)) {
Path downloadedTemplateSetsPath = this.currentHome.resolve(ConfigurationConstants.TEMPLATE_SETS_FOLDER)
.resolve(ConfigurationConstants.DOWNLOADED_FOLDER);
if (!Files.exists(downloadedTemplateSetsPath)) {
Files.createDirectories(downloadedTemplateSetsPath);
}
Files.copy(templateJar, downloadedTemplateSetsPath.resolve(templateJar.getFileName()));
Path downloadedTemplateSetsPath = this.currentHome.resolve(ConfigurationConstants.TEMPLATE_SETS_FOLDER)
.resolve(ConfigurationConstants.DOWNLOADED_FOLDER);
if (!Files.exists(downloadedTemplateSetsPath)) {
Files.createDirectories(downloadedTemplateSetsPath);
}

FileUtils.copyDirectory(new File(testFileRootPath), downloadedTemplateSetsPath.toFile());
String args[] = new String[2];
args[0] = "adapt-templates";
args[1] = "--all";
Expand All @@ -54,32 +49,66 @@ public void adaptTemplateSetTest() throws Exception {
assertThat(downloadedTemplateSetsFolderPath).exists();
assertThat(adaptedTemplateSetsFolderPath).exists();

Path templateSetSimple = adaptedTemplateSetsFolderPath.resolve("crud-java-server-app-1.0.0");
Path templateSetComplex = adaptedTemplateSetsFolderPath.resolve("crud-java-server-app-complex-1.0.0");

// check if adapted template set exists
Path templateSet = adaptedTemplateSetsFolderPath.resolve("crud-java-server-app");
assertThat(templateSet).exists();
// check if context configuration exists
assertThat(templateSet.resolve(ConfigurationConstants.TEMPLATE_RESOURCE_FOLDER)).exists();
assertThat(templateSet.resolve(ConfigurationConstants.TEMPLATE_RESOURCE_FOLDER)
assertThat(templateSetSimple).exists();
assertThat(templateSetComplex).exists();

Path templateSetResourcesPath = templateSetSimple
.resolve(ConfigurationConstants.MAVEN_CONFIGURATION_RESOURCE_FOLDER);
Path templateSetResourcesPathComplex = templateSetComplex
.resolve(ConfigurationConstants.MAVEN_CONFIGURATION_RESOURCE_FOLDER);

// check if templates folder exists
assertThat(templateSetSimple.resolve(templateSetResourcesPath).resolve(ConfigurationConstants.TEMPLATES_FOLDER))
.exists();
assertThat(
templateSetComplex.resolve(templateSetResourcesPathComplex).resolve(ConfigurationConstants.TEMPLATES_FOLDER))
.exists();

// check if template-set.xml exists
assertThat(templateSetSimple.resolve(templateSetResourcesPath)
.resolve(ConfigurationConstants.TEMPLATE_SET_CONFIG_FILENAME)).exists();
assertThat(templateSetComplex.resolve(templateSetResourcesPathComplex)
.resolve(ConfigurationConstants.TEMPLATE_SET_CONFIG_FILENAME)).exists();

// validate correct folder structure
assertThat(templateSetSimple.resolve(templateSetResourcesPath)
.resolve(ConfigurationConstants.TEMPLATE_SET_FREEMARKER_FUNCTIONS_FILE_NAME)).exists();
assertThat(templateSetComplex.resolve(templateSetResourcesPathComplex)
.resolve(ConfigurationConstants.TEMPLATE_SET_FREEMARKER_FUNCTIONS_FILE_NAME)).exists();

// check if template set utility resource folder exists
assertThat(templateSetSimple.resolve(ConfigurationConstants.UTIL_RESOURCE_FOLDER)).exists();
assertThat(templateSetComplex.resolve(ConfigurationConstants.UTIL_RESOURCE_FOLDER)).exists();

// validate maven specific contents
assertThat(templateSetSimple.resolve("pom.xml")).exists();
assertThat(templateSetComplex.resolve("pom.xml")).exists();

// check if META-INF was deleted
assertThat(templateSetResourcesPath.resolve("META-INF")).doesNotExist();
assertThat(templateSetResourcesPathComplex.resolve("META-INF")).doesNotExist();

}

/**
* Checks if adapt-templates command successfully created cobigen templates folder and its sub folders
*
* @throws Exception test fails
*/

@Test
public void adaptTemplatesTest() throws Exception {

Path cliSystemTestPath = new File(
AdaptTemplatesCommandIT.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile()
.getParentFile().toPath();
Path templatesPath = this.currentHome.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
Path CobigenTemplatesPath = templatesPath.resolve(ConfigurationConstants.COBIGEN_TEMPLATES);
if (!Files.exists(templatesPath)) {
Files.createDirectories(templatesPath);
}

TemplatesJarUtil.downloadJar("com.devonfw.cobigen", "templates-devon4j", "3.0.0", false, templatesPath.toFile());
TemplatesJarUtil.downloadJar("com.devonfw.cobigen", "templates-devon4j", "3.0.0", true, templatesPath.toFile());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.devonfw.test</groupId>
<artifactId>crud-java-server-app-complex</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>../../downloaded</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<skipSource>${skip.deployment}</skipSource>
<outputDirectory>../../downloaded</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- Inject Maven Properties in java-templates source folder -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>generate-maven-properties-class</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Integrate POM manually</echo>
<copy file="pom.xml" tofile="${project.build.outputDirectory}/pom.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<tns:templateSetConfiguration version="6.0" xmlns:tns="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration" xmlns:cc="http://capgemini.com/devonfw/cobigen/ContextConfiguration" xmlns:tc="http://capgemini.com/devonfw/cobigen/TemplatesConfiguration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration templateSetConfiguration.xsd ">
<cc:contextConfiguration version="3.0">
<cc:trigger id="crud_java_server_app_complex" type="java">
<cc:containerMatcher type="package" value="((.+\.)?([^\.]+))\.([^\.]+)\.dataaccess\.api" retrieveObjectsRecursively="false" />
<cc:matcher type="fqn" value="((.+\.)?([^\.]+))\.([^\.]+)\.dataaccess\.api\.([^\.]+)Entity">
<cc:variableAssignment type="regex" key="rootPackage" value="1" />
<cc:variableAssignment type="regex" key="domain" value="3" />
<cc:variableAssignment type="regex" key="component" value="4" />
<cc:variableAssignment type="regex" key="entityName" value="5" />
</cc:matcher>
</cc:trigger>
<cc:tags>
<cc:tag name="Java"></cc:tag>
<cc:tag name="CRUD"></cc:tag>
<cc:tag name="Server"></cc:tag>
<cc:tag name="App"></cc:tag>
</cc:tags>
<cc:links>
<cc:link url="https://docs.spring.io/spring-data/data-commons/docs/1.6.1.RELEASE/reference/html/repositories.html"></cc:link>
</cc:links>
</cc:contextConfiguration>

<tc:templatesConfiguration version="5.0">

<tc:templates>
<tc:templateExtension ref="${variables.entityName}Eto.java" mergeStrategy="javamerge"/>
</tc:templates>

<tc:templateScans>
<tc:templateScan name="ts_scan" templatePath="templates" destinationPath="" />
</tc:templateScans>

<tc:increments>
<tc:increment name="tos" description="TO's">
<tc:templateRef ref="${variables.entityName}Eto.java"/>
</tc:increment>
</tc:increments>
</tc:templatesConfiguration>
</tns:templateSetConfiguration>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package test;
Loading

0 comments on commit af182c4

Please sign in to comment.