Skip to content

Commit

Permalink
Revert "create the test structure (unit and devmode test) when using …
Browse files Browse the repository at this point in the history
…create-extension Maven Mojo"
  • Loading branch information
gastaldi authored Oct 13, 2020
1 parent d9721ea commit 3495f91
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,22 +513,6 @@ public class CreateExtensionMojo extends AbstractMojo {
@Parameter(defaultValue = COMPILER_PLUGIN_DEFAULT_VERSION, required = true, property = "quarkus.mavenCompilerPluginVersion")
String compilerPluginVersion;

/**
* Indicates whether to generate a unit test class for the extension
*
* @since 1.3.0
*/
@Parameter(property = "quarkus.generateUnitTest", defaultValue = "true")
boolean generateUnitTest;

/**
* Indicates whether to generate a dev mode unit test class for the extension
*
* @since 1.3.0
*/
@Parameter(property = "quarkus.generateDevModeTest", defaultValue = "true")
boolean generateDevModeTest;

boolean currentProjectIsBaseDir;

Charset charset;
Expand Down Expand Up @@ -841,14 +825,6 @@ private void generateExtensionProjects(Configuration cfg, TemplateParams templat
.resolve("deployment")
.resolve(templateParams.artifactIdBaseCamelCase + "Processor.java");
evalTemplate(cfg, "Processor.java", processorPath, templateParams);

if (generateUnitTest) {
generateUnitTestClass(cfg, templateParams);
}

if (generateDevModeTest) {
generateDevModeTestClass(cfg, templateParams);
}
}

private PomTransformer pomTransformer(Path basePomXml) {
Expand Down Expand Up @@ -929,24 +905,6 @@ private Configuration getTemplateConfig() throws IOException {
return templateCfg;
}

private void generateUnitTestClass(Configuration cfg, TemplateParams model) throws IOException, TemplateException {
final Path unitTest = basedir.toPath()
.resolve(model.artifactIdBase + "/deployment/src/test/java/" + model.javaPackageBase.replace('.', '/')
+ "/test/" + model.artifactIdBaseCamelCase + "Test.java");

evalTemplate(cfg, "UnitTest.java", unitTest, model);
}

private void generateDevModeTestClass(Configuration cfg, TemplateParams model) throws IOException, TemplateException {
final Path devModeTest = basedir
.toPath()
.resolve(model.artifactIdBase + "/deployment/src/test/java/" + model.javaPackageBase.replace('.', '/')
+ "/test/" + model.artifactIdBaseCamelCase + "DevModeTest.java");

evalTemplate(cfg, "DevModeTest.java", devModeTest, model);

}

void generateItest(Configuration cfg, TemplateParams model)
throws MojoFailureException, MojoExecutionException, TemplateException, IOException {
final Path itestParentAbsPath = basedir.toPath().resolve(itestParentPath);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
[#if !assumeManaged ] <version>[=r"$"]{project.version}</version>
[/#if]
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ private static CreateExtensionMojo initMojo(final Path projectDir) throws IOExce
final CreateExtensionMojo mojo = new CreateExtensionMojo();
mojo.project = new MavenProject();
mojo.basedir = projectDir.toFile();
mojo.generateDevModeTest = true;
mojo.generateUnitTest = true;

final File pom = new File(projectDir.toFile(), "pom.xml");
if (pom.exists()) {
Expand Down Expand Up @@ -127,7 +125,7 @@ private static Path newProjectDir(String testProjectName) throws IOException {

@Test
void createExtensionUnderExistingPomMinimal() throws MojoExecutionException, MojoFailureException,
IllegalArgumentException, SecurityException, IOException {
IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, IOException {
final CreateExtensionMojo mojo = initMojo(createProjectFromTemplate("create-extension-pom"));
mojo.artifactId = "my-project-(minimal-extension)";
mojo.assumeManaged = false;
Expand All @@ -139,7 +137,7 @@ void createExtensionUnderExistingPomMinimal() throws MojoExecutionException, Moj

@Test
void createExtensionUnderExistingPomWithAdditionalRuntimeDependencies() throws MojoExecutionException, MojoFailureException,
IllegalArgumentException, SecurityException, IOException {
IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, IOException {
final CreateExtensionMojo mojo = initMojo(createProjectFromTemplate("create-extension-pom"));
mojo.artifactId = "my-project-(add-to-bom)";
mojo.assumeManaged = false;
Expand All @@ -154,7 +152,7 @@ void createExtensionUnderExistingPomWithAdditionalRuntimeDependencies() throws M

@Test
void createExtensionUnderExistingPomWithItest() throws MojoExecutionException, MojoFailureException,
IllegalArgumentException, SecurityException, IOException {
IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, IOException {
final CreateExtensionMojo mojo = initMojo(createProjectFromTemplate("create-extension-pom"));
mojo.artifactId = "my-project-(itest)";
mojo.assumeManaged = false;
Expand All @@ -167,7 +165,7 @@ void createExtensionUnderExistingPomWithItest() throws MojoExecutionException, M

@Test
void createExtensionUnderExistingPomCustomGrandParent() throws MojoExecutionException, MojoFailureException,
IllegalArgumentException, SecurityException, IOException {
IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, IOException {
final CreateExtensionMojo mojo = initMojo(createProjectFromTemplate("create-extension-pom"));
mojo.artifactId = "myproject-(with-grand-parent)";
mojo.parentArtifactId = "grand-parent";
Expand Down Expand Up @@ -243,15 +241,15 @@ static void assertTreesMatch(Path expected, Path actual) throws IOException {
}

@Test
void getPackage() {
void getPackage() throws IOException {
assertEquals("org.apache.camel.quarkus.aws.sns.deployment", CreateExtensionMojo
.getJavaPackage("org.apache.camel.quarkus", null, "camel-quarkus-aws-sns-deployment"));
assertEquals("org.apache.camel.quarkus.component.aws.sns.deployment", CreateExtensionMojo
.getJavaPackage("org.apache.camel.quarkus", "component", "camel-quarkus-aws-sns-deployment"));
}

@Test
void toCapCamelCase() {
void toCapCamelCase() throws IOException {
assertEquals("FooBarBaz", CreateExtensionMojo.toCapCamelCase("foo-bar-baz"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<artifactId>my-project-add-to-bom</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<artifactId>my-project-itest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<artifactId>my-project-minimal-extension</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
<groupId>org.acme</groupId>
<artifactId>myproject-with-grand-parent</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

Loading

0 comments on commit 3495f91

Please sign in to comment.