Skip to content

Commit c42dcd7

Browse files
committed
Add sonatype post.
1 parent a1ad406 commit c42dcd7

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Maven Plugin Test Frameworks
3+
author: emeraldjava
4+
date: 2024-09-21T07:44:00Z
5+
slug: 2024-09-21-Maven-Plugin-Test-Frameworks.md
6+
tags:
7+
- astro
8+
summary: 'Maven Plugin Test Frameworks'
9+
---
10+
11+
## 2024-09-21
12+
13+
Via
14+
15+
package org.openapitools.codegen.plugin;
16+
17+
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
18+
19+
import java.nio.file.Path;
20+
import java.nio.file.Paths;
21+
22+
/**
23+
* A base test class where we can add helper methods and whatnot
24+
*/
25+
public abstract class BaseTestCase extends AbstractMojoTestCase {
26+
protected Path getUnitTestDir() {
27+
return Paths.get(getBasedir(), "src", "test", "resources", "unit");
28+
}
29+
}
30+
31+
see https://github.com/OpenAPITools/openapi-generator/blob/ee1cbf6f4bacd28aa8c1615e16c25bf29ad6e4e8/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/BaseTestCase.java
32+
33+
34+
then
35+
36+
- get the test pom, use the lookupMojo and then execute.
37+
38+
public class CodeGenMojoTest extends BaseTestCase {
39+
@Override
40+
protected void setUp() throws Exception {
41+
super.setUp();
42+
}
43+
44+
@SuppressWarnings("unchecked")
45+
public void testCommonConfiguration() throws Exception {
46+
File testPom = StubUtility.basedPath(getUnitTestDir().toFile(), "common-maven", "common-maven.xml").toFile();
47+
final CodeGenMojo mojo = (CodeGenMojo) lookupMojo("generate", testPom);
48+
49+
https://github.com/OpenAPITools/openapi-generator/blob/ee1cbf6f4bacd28aa8c1615e16c25bf29ad6e4e8/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
50+
51+
the pom
52+
53+
<dependency>
54+
<groupId>org.apache.maven.shared</groupId>
55+
<artifactId>maven-verifier</artifactId>
56+
<version>1.7.2</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.apache.maven.plugin-testing</groupId>
61+
<artifactId>maven-plugin-testing-harness</artifactId>
62+
<version>3.3.0</version>
63+
<scope>test</scope>
64+
</dependency>
65+
66+
via https://github.com/OpenAPITools/openapi-generator/blob/ee1cbf6f4bacd28aa8c1615e16c25bf29ad6e4e8/modules/openapi-generator-maven-plugin/pom.xml
67+
68+
## Frameworks
69+
70+
### maven-plugin-testing-harness
71+
72+
<dependency>
73+
<groupId>org.apache.maven.plugin-testing</groupId>
74+
<artifactId>maven-plugin-testing-harness</artifactId>
75+
<version>3.3.0</version>
76+
<scope>test</scope>
77+
</dependency>
78+
79+
Reference
80+
- https://maven.apache.org/plugin-developers/plugin-testing.html
81+
82+
### takari-plugin-testing-project
83+
84+
https://github.com/takari/takari-plugin-testing-project
85+
86+
### maven-it-extension
87+
88+
https://github.com/khmarbaise/maven-it-extension
89+
https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html
90+
91+
References
92+
- https://dzone.com/articles/maven-plugin-testing-in-a-modern-way-part-i
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Sonatype Setup for emeraldjava
3+
author: emeraldjava
4+
date: 2024-09-22T07:44:00Z
5+
slug: 2024-09-22-sonatype-setup-for-emeraldjava.md
6+
tags:
7+
- astro
8+
summary: 'Sonatype Setup for emeraldjava'
9+
---
10+
11+
## 2024-09-22
12+
13+
https://central.sonatype.com/namespace/io.github.emeraldjava
117 KB
Loading

0 commit comments

Comments
 (0)