Skip to content

Commit 86d9613

Browse files
committed
Maven test harness running
1 parent 0b71f39 commit 86d9613

File tree

5 files changed

+291
-1
lines changed

5 files changed

+291
-1
lines changed

components/sbm-openrewrite/pom.xml

+116-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
~ limitations under the License.
1616
-->
1717

18-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1920
<modelVersion>4.0.0</modelVersion>
2021

2122
<parent>
@@ -104,6 +105,104 @@
104105
<artifactId>spring-boot-starter-test</artifactId>
105106
<scope>test</scope>
106107
</dependency>
108+
109+
<!-- Maven test harness -->
110+
111+
<!-- <dependency>-->
112+
<!-- <groupId>com.github.codeteapot.maven.plugin-testing</groupId>-->
113+
<!-- <artifactId>maven-plugin-testing-harness-junit-jupiter</artifactId>-->
114+
<!-- <version>1.1.3</version>-->
115+
<!-- </dependency>-->
116+
117+
<!-- <dependency>-->
118+
<!-- <groupId>org.junit.jupiter</groupId>-->
119+
<!-- <artifactId>junit-jupiter-api</artifactId>-->
120+
<!-- <version>5.7.0</version>-->
121+
<!-- <scope>provided</scope>-->
122+
<!-- </dependency>-->
123+
124+
<!-- <dependency>-->
125+
<!-- <groupId>org.junit.jupiter</groupId>-->
126+
<!-- <artifactId>junit-jupiter-engine</artifactId>-->
127+
<!-- <version>5.7.0</version>-->
128+
<!-- <scope>test</scope>-->
129+
<!-- </dependency>-->
130+
131+
<!-- <dependency>-->
132+
<!-- <groupId>org.mockito</groupId>-->
133+
<!-- <artifactId>mockito-junit-jupiter</artifactId>-->
134+
<!-- <version>3.5.13</version>-->
135+
<!-- <scope>test</scope>-->
136+
<!-- </dependency>-->
137+
138+
<dependency>
139+
<groupId>org.eclipse.sisu</groupId>
140+
<artifactId>org.eclipse.sisu.plexus</artifactId>
141+
<version>0.3.5</version>
142+
<scope>test</scope>
143+
</dependency>
144+
<dependency>
145+
<groupId>org.openrewrite.maven</groupId>
146+
<artifactId>rewrite-maven-plugin</artifactId>
147+
<version>4.42.0</version>
148+
<scope>test</scope>
149+
</dependency>
150+
151+
<dependency>
152+
<groupId>org.apache.maven</groupId>
153+
<artifactId>maven-compat</artifactId>
154+
<version>3.9.1</version>
155+
<scope>test</scope>
156+
</dependency>
157+
<dependency>
158+
<groupId>org.apache.maven</groupId>
159+
<artifactId>maven-core</artifactId>
160+
<version>3.9.1</version>
161+
</dependency>
162+
<!-- <dependency>-->
163+
<!-- <groupId>org.apache.maven</groupId>-->
164+
<!-- <artifactId>maven-resolver-provider</artifactId>-->
165+
<!-- <version>3.9.1</version>-->
166+
<!-- <scope>test</scope>-->
167+
<!-- </dependency>-->
168+
<!-- <dependency>-->
169+
<!-- <groupId>org.apache.maven.resolver</groupId>-->
170+
<!-- <artifactId>maven-resolver-api</artifactId>-->
171+
<!-- <version>1.3.1</version>-->
172+
<!-- <scope>test</scope>-->
173+
<!-- </dependency>-->
174+
<dependency>
175+
<groupId>org.apache.maven</groupId>
176+
<artifactId>maven-plugin-api</artifactId>
177+
<version>3.9.1</version>
178+
</dependency>
179+
<dependency>
180+
<groupId>org.apache.maven.plugin-testing</groupId>
181+
<artifactId>maven-plugin-testing-harness</artifactId>
182+
<version>3.3.0</version>
183+
<scope>test</scope>
184+
</dependency>
185+
186+
<!-- Maven Plugin Test -->
187+
<dependency>
188+
<groupId>com.soebes.itf.jupiter.extension</groupId>
189+
<artifactId>itf-extension-maven</artifactId>
190+
<version>0.9.0</version>
191+
<scope>test</scope>
192+
</dependency>
193+
<dependency>
194+
<groupId>com.soebes.itf.jupiter.extension</groupId>
195+
<artifactId>itf-assertj</artifactId>
196+
<version>0.9.0</version>
197+
<scope>test</scope>
198+
</dependency>
199+
<dependency>
200+
<groupId>com.soebes.itf.jupiter.extension</groupId>
201+
<artifactId>itf-jupiter-extension</artifactId>
202+
<version>0.9.0</version>
203+
<scope>test</scope>
204+
</dependency>
205+
<!-- END Maven Plugin Test -->
107206
</dependencies>
108207
<build>
109208
<plugins>
@@ -120,6 +219,22 @@
120219
</execution>
121220
</executions>
122221
</plugin>
222+
<!-- Maven Plugin Test -->
223+
<plugin>
224+
<groupId>com.soebes.itf.jupiter.extension</groupId>
225+
<artifactId>itf-maven-plugin</artifactId>
226+
<version>0.12.0</version>
227+
<executions>
228+
<execution>
229+
<id>installing</id>
230+
<phase>pre-integration-test</phase>
231+
<goals>
232+
<goal>install</goal>
233+
<goal>resources-its</goal>
234+
</goals>
235+
</execution>
236+
</executions>
237+
</plugin>
123238
</plugins>
124239
</build>
125240
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openrewrite.maven;
17+
18+
import com.soebes.itf.jupiter.extension.MavenGoal;
19+
import com.soebes.itf.jupiter.extension.MavenJupiterExtension;
20+
import com.soebes.itf.jupiter.extension.MavenTest;
21+
import com.soebes.itf.jupiter.maven.MavenExecutionResult;
22+
import org.assertj.core.api.Assertions;
23+
import org.junit.jupiter.api.Test;
24+
25+
/**
26+
* Testing the OpenRewrite Maven Plugin to verify expectations about Markers.
27+
*
28+
* Using Maven Integration Testing Framework
29+
* https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html
30+
*
31+
* @author Fabian Krüger
32+
*/
33+
@MavenJupiterExtension
34+
public class RewriteMavenPluginIT {
35+
@MavenTest
36+
@MavenGoal("rewrite:discover") //${project.groupId}:${project.artifactId}:${project.version}:compare-dependencies")
37+
void test_plugin(MavenExecutionResult result) {
38+
Assertions.assertThat(true).isFalse();
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openrewrite.maven;
17+
18+
19+
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
20+
21+
import java.io.File;
22+
23+
/**
24+
* Testing the OpenRewrite Maven Plugin to verify expectations about Markers.
25+
* https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/getting-started/index.html
26+
*
27+
* @author Fabian Krüger
28+
*/
29+
public class RewriteMavenPluginTest extends AbstractMojoTestCase
30+
{
31+
/** {@inheritDoc} */
32+
protected void setUp()
33+
throws Exception
34+
{
35+
// required
36+
super.setUp();
37+
38+
}
39+
40+
/** {@inheritDoc} */
41+
protected void tearDown()
42+
throws Exception
43+
{
44+
// required
45+
super.tearDown();
46+
47+
}
48+
49+
/**
50+
* @throws Exception if any
51+
*/
52+
public void testSomething()
53+
throws Exception
54+
{
55+
File pom = getTestFile( "src/test/resources/rewrite-maven-plugin/pom.xml" );
56+
assertNotNull( pom );
57+
assertTrue( pom.exists() );
58+
59+
//
60+
// MyMojo myMojo = (MyMojo) lookupMojo( "touch", pom );
61+
// assertNotNull( myMojo );
62+
// myMojo.execute();
63+
//
64+
// ...
65+
}
66+
}
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
4+
<groupId>com.soebes.itf.maven.plugin.its</groupId>
5+
<artifactId>install_should_not_fail</artifactId>
6+
<version>1.0</version>
7+
<packaging>jar</packaging>
8+
9+
<name>ITF Maven Plugin - BasicIT#install_should_not_fail</name>
10+
<description>Should not fail based on execution definition.</description>
11+
12+
<build>
13+
<plugins>
14+
<!-- <plugin>-->
15+
<!-- <groupId>com.soebes.itf.jupiter.extension</groupId>-->
16+
<!-- <artifactId>itf-maven-plugin</artifactId>-->
17+
<!-- <version>@project.version@</version>-->
18+
<!-- <executions>-->
19+
<!-- <execution>-->
20+
<!-- <id>installing</id>-->
21+
<!-- <goals>-->
22+
<!-- <goal>install</goal>-->
23+
<!-- </goals>-->
24+
<!-- </execution>-->
25+
<!-- </executions>-->
26+
<!-- </plugin>-->
27+
<plugin>
28+
<groupId>org.openrewrite.maven</groupId>
29+
<artifactId>rewrite-maven-plugin</artifactId>
30+
<version>4.44.0</version>
31+
</plugin>
32+
</plugins>
33+
</build>
34+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
4+
<groupId>com.soebes.itf.maven.plugin.its</groupId>
5+
<artifactId>install_should_not_fail</artifactId>
6+
<version>1.0</version>
7+
<packaging>jar</packaging>
8+
9+
<name>ITF Maven Plugin - BasicIT#install_should_not_fail</name>
10+
<description>Should not fail based on execution definition.</description>
11+
12+
<build>
13+
<plugins>
14+
<!-- <plugin>-->
15+
<!-- <groupId>com.soebes.itf.jupiter.extension</groupId>-->
16+
<!-- <artifactId>itf-maven-plugin</artifactId>-->
17+
<!-- <version>@project.version@</version>-->
18+
<!-- <executions>-->
19+
<!-- <execution>-->
20+
<!-- <id>installing</id>-->
21+
<!-- <goals>-->
22+
<!-- <goal>install</goal>-->
23+
<!-- </goals>-->
24+
<!-- </execution>-->
25+
<!-- </executions>-->
26+
<!-- </plugin>-->
27+
<plugin>
28+
<groupId>org.openrewrite.maven</groupId>
29+
<artifactId>rewrite-maven-plugin</artifactId>
30+
<version>4.44.0</version>
31+
</plugin>
32+
</plugins>
33+
</build>
34+
</project>

0 commit comments

Comments
 (0)