Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3755c34

Browse files
committedJan 27, 2025
feat(#1156): generate Java models alongside citrus classes
1 parent 3f52978 commit 3755c34

File tree

49 files changed

+2203
-611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2203
-611
lines changed
 

‎test-api-generator/citrus-test-api-generator-core/pom.xml

+62
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
<name>Citrus :: Test API Generator :: Core</name>
1818
<description>Generates a Citrus Test-API for OpenAPI and WSDL specifications.</description>
1919

20+
<properties>
21+
<openapi-java-folder>${project.build.directory}/openapi-java-resources</openapi-java-folder>
22+
</properties>
23+
2024
<dependencies>
2125
<dependency>
2226
<groupId>org.citrusframework</groupId>
@@ -118,6 +122,64 @@
118122
</executions>
119123
</plugin>
120124

125+
<plugin>
126+
<groupId>org.apache.maven.plugins</groupId>
127+
<artifactId>maven-dependency-plugin</artifactId>
128+
<version>3.7.1</version>
129+
<configuration>
130+
<artifactItems>
131+
<artifactItem>
132+
<groupId>org.openapitools</groupId>
133+
<artifactId>openapi-generator</artifactId>
134+
<version>${org.openapitools.version}</version>
135+
<includes>Java/*Annotation*.mustache,Java/*Model*.mustache,Java/model*.mustache,Java/pojo*.mustache</includes>
136+
</artifactItem>
137+
</artifactItems>
138+
<outputDirectory>
139+
${openapi-java-folder}
140+
</outputDirectory>
141+
</configuration>
142+
<executions>
143+
<execution>
144+
<id>unpack-java-templates</id>
145+
<phase>generate-resources</phase>
146+
<goals>
147+
<goal>unpack</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
</plugin>
152+
153+
<plugin>
154+
<groupId>org.apache.maven.plugins</groupId>
155+
<artifactId>maven-resources-plugin</artifactId>
156+
<version>3.3.1</version>
157+
<executions>
158+
<execution>
159+
<id>prepare-java-templates</id>
160+
<phase>process-resources</phase>
161+
<goals>
162+
<goal>copy-resources</goal>
163+
</goals>
164+
<configuration>
165+
<outputDirectory>${project.build.outputDirectory}/java-citrus</outputDirectory>
166+
<resources>
167+
<resource>
168+
<directory>
169+
${openapi-java-folder}/Java
170+
</directory>
171+
<includes>
172+
<include>
173+
*.mustache
174+
</include>
175+
</includes>
176+
</resource>
177+
</resources>
178+
</configuration>
179+
</execution>
180+
</executions>
181+
</plugin>
182+
121183
<plugin>
122184
<groupId>org.openapitools</groupId>
123185
<artifactId>openapi-generator-maven-plugin</artifactId>

‎test-api-generator/citrus-test-api-generator-core/src/main/java/org/citrusframework/openapi/generator/JavaCitrusCodegen.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public JavaCitrusCodegen() {
8585

8686
// set default
8787
additionalProperties.put(API_TYPE, API_TYPE_REST);
88+
additionalProperties.put("useJakartaEe", true);
8889

8990
// add additional reserved words used in CitrusAbstractTestRequest and its base class to prevent name collisions
9091
Set<String> reservedWordsTemp = reservedWords();
@@ -119,8 +120,7 @@ public JavaCitrusCodegen() {
119120
newString(API_ENDPOINT,
120121
"Which http client should be used (default " + httpClient + ")."));
121122
cliOptions.add(
122-
newString(
123-
API_TYPE,
123+
newString(API_TYPE,
124124
"Specifies the type of API to be generated specify SOAP to generate a SOAP API. By default a REST API will be generated"
125125
)
126126
);
@@ -135,10 +135,8 @@ public JavaCitrusCodegen() {
135135
newString(OPENAPI_SCHEMA,
136136
"Which OpenAPI schema should be used (default " + openapiSchema + ")."));
137137
cliOptions.add(
138-
newString(
139-
PREFIX,
140-
"Add a prefix before the name of the files. First character should be upper case (default "
141-
+ apiPrefix + ")."
138+
newString(PREFIX,
139+
"Add a prefix before the name of the files. First character should be upper case (default " + apiPrefix + ")."
142140
)
143141
);
144142
cliOptions.add(newString(PREFIX, "The api prefix (default " + apiPrefix + ")."));

0 commit comments

Comments
 (0)