Skip to content

Commit dc61a9e

Browse files
chore: [DevOps] bump the production-minor-patch group with 10 updates (#997)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Roshin Rajan Panackal <[email protected]>
1 parent 050d05d commit dc61a9e

File tree

8 files changed

+68
-185
lines changed

8 files changed

+68
-185
lines changed

datamodel/odata-v4/odata-v4-generator-maven-plugin/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@
6868
<artifactId>junit-jupiter-api</artifactId>
6969
<scope>test</scope>
7070
</dependency>
71-
<dependency>
72-
<groupId>junit</groupId>
73-
<artifactId>junit</artifactId>
74-
<version>4.13.2</version>
75-
<scope>test</scope>
76-
</dependency>
7771
<dependency>
7872
<groupId>org.assertj</groupId>
7973
<artifactId>assertj-core</artifactId>
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
package com.sap.cloud.sdk.datamodel.odatav4.generator;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
43
import static org.assertj.core.api.SoftAssertions.assertSoftly;
54

6-
import java.io.File;
7-
import java.net.URL;
8-
9-
import org.apache.maven.plugin.testing.MojoRule;
5+
import org.apache.maven.api.plugin.testing.InjectMojo;
6+
import org.apache.maven.api.plugin.testing.MojoTest;
107
import org.junit.jupiter.api.Test;
11-
import org.junit.runner.Description;
12-
import org.junit.runners.model.Statement;
138

149
import com.sap.cloud.sdk.datamodel.odata.utility.NameSource;
1510
import com.sap.cloud.sdk.datamodel.odata.utility.S4HanaNamingStrategy;
1611
import com.sap.cloud.sdk.datamodel.odatav4.generator.annotation.DefaultAnnotationStrategy;
1712

13+
@MojoTest
1814
class DataModelGeneratorMojoTest
1915
{
16+
private static final String TEST_POM = "src/test/resources/DataModelGeneratorMojoTest/pom.xml";
17+
2018
@Test
21-
void test()
19+
@InjectMojo( goal = "generate", pom = TEST_POM )
20+
void test( DataModelGeneratorMojo mojo )
2221
throws Throwable
2322
{
24-
final DataModelGeneratorMojo mojo = loadTestProject();
2523
final DataModelGenerator generator = mojo.getDataModelGenerator();
2624

2725
assertSoftly(softly -> {
@@ -51,28 +49,4 @@ void test()
5149
softly.assertThat(generator.isServiceMethodsPerEntitySet()).isTrue();
5250
});
5351
}
54-
55-
private DataModelGeneratorMojo loadTestProject()
56-
throws Throwable
57-
{
58-
final URL resource = getClass().getClassLoader().getResource(getClass().getSimpleName());
59-
assertThat(resource).isNotNull();
60-
61-
final File pomFile = new File(resource.getFile());
62-
63-
final MojoRule rule = new MojoRule();
64-
// hacky workaround to invoke the internal call to "testCase.setUp()" inside MojoRule
65-
// exploiting the fact that the setup is not teared down after "evaluate" returns
66-
// this workaround is applied because "lookupConfiguredMojo" is not available on AbstractMojoTestCase
67-
// and this way we can skip the effort to re-implement what is already available in MojoRule
68-
rule.apply(new Statement()
69-
{
70-
@Override
71-
public void evaluate()
72-
{
73-
74-
}
75-
}, Description.createSuiteDescription("dummy")).evaluate();
76-
return (DataModelGeneratorMojo) rule.lookupConfiguredMojo(pomFile, "generate");
77-
}
7852
}

datamodel/odata/odata-generator-maven-plugin/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@
6969
<scope>test</scope>
7070
</dependency>
7171
<!-- JUnit 4 must not be used for test execution -->
72-
<dependency>
73-
<groupId>junit</groupId>
74-
<artifactId>junit</artifactId>
75-
<version>4.13.2</version>
76-
<scope>test</scope>
77-
</dependency>
7872
<dependency>
7973
<groupId>org.assertj</groupId>
8074
<artifactId>assertj-core</artifactId>
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
package com.sap.cloud.sdk.datamodel.odata.generator;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
43
import static org.assertj.core.api.SoftAssertions.assertSoftly;
54

6-
import java.io.File;
7-
import java.net.URL;
8-
9-
import org.apache.maven.plugin.testing.MojoRule;
5+
import org.apache.maven.api.plugin.testing.InjectMojo;
6+
import org.apache.maven.api.plugin.testing.MojoTest;
107
import org.junit.jupiter.api.Test;
11-
import org.junit.runner.Description;
12-
import org.junit.runners.model.Statement;
138

149
import com.sap.cloud.sdk.datamodel.odata.generator.annotation.DefaultAnnotationStrategy;
1510
import com.sap.cloud.sdk.datamodel.odata.utility.NameSource;
1611
import com.sap.cloud.sdk.datamodel.odata.utility.S4HanaNamingStrategy;
1712

13+
@MojoTest
1814
class DataModelGeneratorMojoTest
1915
{
16+
private static final String TEST_POM = "src/test/resources/DataModelGeneratorMojoTest/pom.xml";
17+
2018
@Test
21-
void test()
22-
throws Throwable
19+
@InjectMojo( goal = "generate", pom = TEST_POM )
20+
void test( DataModelGeneratorMojo mojo )
2321
{
24-
final DataModelGeneratorMojo mojo = loadTestProject();
2522
final DataModelGenerator generator = mojo.getDataModelGenerator();
2623

2724
assertSoftly(softly -> {
@@ -51,28 +48,4 @@ void test()
5148
softly.assertThat(generator.isServiceMethodsPerEntitySet()).isTrue();
5249
});
5350
}
54-
55-
private DataModelGeneratorMojo loadTestProject()
56-
throws Throwable
57-
{
58-
final URL resource = getClass().getClassLoader().getResource(getClass().getSimpleName());
59-
assertThat(resource).isNotNull();
60-
61-
final File pomFile = new File(resource.getFile());
62-
63-
final MojoRule rule = new MojoRule();
64-
// hacky workaround to invoke the internal call to "testCase.setUp()" inside MojoRule
65-
// exploiting the fact that the setup is not teared down after "evaluate" returns
66-
// this workaround is applied because "lookupConfiguredMojo" is not available on AbstractMojoTestCase
67-
// and this way we can skip the effort to re-implement what is already available in MojoRule
68-
rule.apply(new Statement()
69-
{
70-
@Override
71-
public void evaluate()
72-
{
73-
74-
}
75-
}, Description.createSuiteDescription("dummy")).evaluate();
76-
return (DataModelGeneratorMojo) rule.lookupConfiguredMojo(pomFile, "generate");
77-
}
7851
}

datamodel/openapi/openapi-generator-maven-plugin/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@
6868
<artifactId>junit-jupiter-api</artifactId>
6969
<scope>test</scope>
7070
</dependency>
71-
<!-- JUnit 4 must not be used for test execution -->
72-
<dependency>
73-
<groupId>junit</groupId>
74-
<artifactId>junit</artifactId>
75-
<version>4.13.2</version>
76-
<scope>test</scope>
77-
</dependency>
7871
<dependency>
7972
<groupId>org.assertj</groupId>
8073
<artifactId>assertj-core</artifactId>

datamodel/openapi/openapi-generator-maven-plugin/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorMojoIntegrationTest.java

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
import static org.assertj.core.api.Assertions.assertThat;
44

55
import java.io.File;
6-
import java.net.URL;
76
import java.nio.file.Files;
87
import java.nio.file.Path;
98
import java.nio.file.Paths;
109
import java.util.function.Predicate;
1110

12-
import org.apache.maven.plugin.testing.MojoRule;
11+
import org.apache.maven.api.plugin.testing.InjectMojo;
12+
import org.apache.maven.api.plugin.testing.MojoTest;
1313
import org.junit.jupiter.api.Test;
1414
import org.junit.jupiter.api.io.TempDir;
15-
import org.junit.runner.Description;
16-
import org.junit.runners.model.Statement;
1715

1816
import com.sap.cloud.sdk.datamodel.openapi.generator.model.ApiMaturity;
1917
import com.sap.cloud.sdk.datamodel.openapi.generator.model.GenerationConfiguration;
@@ -25,22 +23,26 @@
2523
* module. However, it was found that the OpenAPI generator behaves strange when it comes to accessing the templates as
2624
* resources on the classpath. This issue was not caught in the {@code DataModelGeneratorIntegrationTest}.
2725
*/
26+
@MojoTest
2827
class DataModelGeneratorMojoIntegrationTest
2928
{
30-
@TempDir
31-
File outputDirectory;
32-
29+
private static final String TEST_POM =
30+
"src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/input/pom.xml";
3331
private static final String FOLDER_WITH_EXPECTED_CONTENT =
3432
"src/test/resources/" + DataModelGeneratorMojoIntegrationTest.class.getSimpleName() + "/sodastore/output";
3533

34+
@TempDir
35+
File outputDirectory;
36+
3637
@Test
37-
void generateAndCompareSodastoreLibrary()
38+
@InjectMojo( goal = "generate", pom = TEST_POM )
39+
void generateAndCompareSodastoreLibrary( DataModelGeneratorMojo mojo )
3840
throws Throwable
3941
{
4042
final String outputFolderWithActualContent =
4143
Paths.get(outputDirectory.getAbsolutePath()).resolve("output").toString();
4244

43-
generateSodastoreLibrary(outputFolderWithActualContent);
45+
generateSodastoreLibrary(mojo, outputFolderWithActualContent);
4446

4547
assertThatDirectoriesHaveSameContent(
4648
Paths.get(FOLDER_WITH_EXPECTED_CONTENT),
@@ -49,17 +51,16 @@ void generateAndCompareSodastoreLibrary()
4951

5052
// Run this test method manually to overwrite the folder containing the expected content with the latest generator state
5153
// @Test
52-
void regenerateExpectedSodastoreLibrary()
54+
@InjectMojo( goal = "generate", pom = TEST_POM )
55+
void regenerateExpectedSodastoreLibrary( DataModelGeneratorMojo mojo )
5356
throws Throwable
5457
{
55-
generateSodastoreLibrary(FOLDER_WITH_EXPECTED_CONTENT);
58+
generateSodastoreLibrary(mojo, FOLDER_WITH_EXPECTED_CONTENT);
5659
}
5760

58-
private void generateSodastoreLibrary( final String outputDirectory )
61+
private void generateSodastoreLibrary( DataModelGeneratorMojo mojo, final String outputDirectory )
5962
throws Throwable
6063
{
61-
final DataModelGeneratorMojo mojo = loadTestProject();
62-
6364
final GenerationConfiguration configuration = mojo.retrieveGenerationConfiguration().get();
6465

6566
assertThat(configuration.getApiMaturity()).isEqualTo(ApiMaturity.RELEASED);
@@ -84,28 +85,4 @@ private static void assertThatDirectoriesHaveSameContent( final Path a, final Pa
8485
Files.walk(a).filter(isFile).forEach(p -> assertThat(p).hasSameTextualContentAs(b.resolve(a.relativize(p))));
8586
Files.walk(b).filter(isFile).forEach(p -> assertThat(p).hasSameTextualContentAs(a.resolve(b.relativize(p))));
8687
}
87-
88-
private DataModelGeneratorMojo loadTestProject()
89-
throws Throwable
90-
{
91-
final URL resource = getClass().getClassLoader().getResource(getClass().getSimpleName() + "/sodastore/input");
92-
assertThat(resource).isNotNull();
93-
94-
final File pomFile = new File(resource.getFile());
95-
96-
final MojoRule rule = new MojoRule();
97-
// hacky workaround to invoke the internal call to "testCase.setUp()" inside MojoRule
98-
// exploiting the fact that the setup is not teared down after "evaluate" returns
99-
// this workaround is applied because "lookupConfiguredMojo" is not available on AbstractMojoTestCase
100-
// and this way we can skip the effort to re-implement what is already available in MojoRule
101-
rule.apply(new Statement()
102-
{
103-
@Override
104-
public void evaluate()
105-
{
106-
107-
}
108-
}, Description.createSuiteDescription("dummy")).evaluate();
109-
return (DataModelGeneratorMojo) rule.lookupConfiguredMojo(pomFile, "generate");
110-
}
11188
}

0 commit comments

Comments
 (0)