Skip to content

Commit

Permalink
devonfw#1509 implemented testAdaptMonolithicTemplatesAndGenerate and …
Browse files Browse the repository at this point in the history
…testBasicOpenAPIGenerationWithAdaptMonolithicTemplates
  • Loading branch information
cedricarnauld123 committed Mar 27, 2023
1 parent 4c5cfab commit 7ef6a4f
Show file tree
Hide file tree
Showing 10 changed files with 248 additions and 0 deletions.
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;
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</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" 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;

0 comments on commit 7ef6a4f

Please sign in to comment.