This is an automated email from the ASF dual-hosted git repository.
sparsick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new f6f00459 chore: Migrate Junit3/4 to Junit5 (#1197)
f6f00459 is described below
commit f6f004590277bf789243de57eea577e1f08a1bea
Author: Sandra Parsick <[email protected]>
AuthorDate: Tue Jan 6 16:38:00 2026 +0000
chore: Migrate Junit3/4 to Junit5 (#1197)
* chore: migrate to junit 5
Signed-off-by: Sandra Parsick <[email protected]>
* refactor: inline classes
Signed-off-by: Sandra Parsick <[email protected]>
* chore: migration to MojoTest
* chore: migrate junit3/4 to junit 5 (ITs)
* refactor(review): remove non-needed code, add comments
* fix(ci): spotless apply
---------
Signed-off-by: Sandra Parsick <[email protected]>
---
pom.xml | 25 ++-
.../parent-usage-test/src/test/java/AppTest.java | 36 +--
src/it/projects/MSITE-497/apps/app/pom.xml | 6 +-
.../src/test/java/org/apache/maven/AppTest.java | 36 +--
.../parent-usage-test/src/test/java/AppTest.java | 36 +--
src/it/projects/MSITE-665/pom.xml | 6 +-
.../src/test/java/my/group/id/AppTest.java | 7 +-
src/it/projects/failure/pom.xml | 6 +-
src/it/projects/full-reporting/pom.xml | 6 +-
.../org/apache/maven/plugins/site/its/AppTest.java | 31 +--
src/it/projects/full-reporting/verify.groovy | 2 +-
src/it/projects/it-plugin-test/pom.xml | 6 +-
src/it/projects/new-configuration/pom.xml | 6 +-
src/it/projects/no-version/pom.xml | 6 +-
.../org/apache/maven/plugins/site/its/AppTest.java | 41 +---
src/it/projects/surefire-report/pom.xml | 6 +-
.../org/apache/maven/plugins/site/its/AppTest.java | 41 +---
.../site/deploy/AbstractSiteDeployWebDavTest.java | 249 ---------------------
.../plugins/site/deploy/SiteDeployMojoTest.java | 132 -----------
.../plugins/site/deploy/SiteDeployWebDavTest.java | 41 ----
...teDeployWebDavThruProxyWitAuthzInProxyTest.java | 177 +++++++++++++++
.../deploy/SiteDeployWebDavWithoutAuthTest.java | 212 ++++++++++++++++++
.../apache/maven/plugins/site/run/WebXmlTest.java | 8 +-
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
.../java/org/apache/maven/plugin/site/AppTest.java | 35 +--
src/test/projects/site-plugin-multiproject/pom.xml | 6 +-
.../apache/maven/plugin/site/test1/AppTest.java | 35 +--
.../apache/maven/plugin/site/test11/AppTest.java | 35 +--
.../apache/maven/plugin/site/test11/AppTest.java | 35 +--
.../apache/maven/plugin/site/test11/AppTest.java | 35 +--
.../apache/maven/plugin/site/test2/AppTest.java | 35 +--
.../apache/maven/plugin/site/test3/AppTest.java | 35 +--
.../apache/maven/plugin/site/test4/AppTest.java | 35 +--
.../apache/maven/plugin/site/test5/AppTest.java | 35 +--
.../apache/maven/plugin/site/test6/AppTest.java | 35 +--
.../apache/maven/plugin/site/test7/AppTest.java | 35 +--
.../apache/maven/plugin/site/test8/AppTest.java | 35 +--
.../apache/maven/plugin/site/test8/AppTest.java | 35 +--
.../apache/maven/plugin/site/test8/AppTest.java | 35 +--
50 files changed, 666 insertions(+), 1372 deletions(-)
diff --git a/pom.xml b/pom.xml
index 96163556..ec614c0f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -478,7 +478,24 @@ under the License.
<version>${jettyVersion}</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- Is needed for MojoExtension-->
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.11.0</version>
+ <!-- last mockito version with java 8 support -->
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -507,12 +524,6 @@ under the License.
<version>3.4.0</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
diff --git
a/src/it/projects/MSITE-484/parent-usage-test/src/test/java/AppTest.java
b/src/it/projects/MSITE-484/parent-usage-test/src/test/java/AppTest.java
index 481d5f59..c382e9a0 100644
--- a/src/it/projects/MSITE-484/parent-usage-test/src/test/java/AppTest.java
+++ b/src/it/projects/MSITE-484/parent-usage-test/src/test/java/AppTest.java
@@ -17,39 +17,19 @@
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
+
diff --git a/src/it/projects/MSITE-497/apps/app/pom.xml
b/src/it/projects/MSITE-497/apps/app/pom.xml
index cd79c431..af403b37 100644
--- a/src/it/projects/MSITE-497/apps/app/pom.xml
+++ b/src/it/projects/MSITE-497/apps/app/pom.xml
@@ -42,9 +42,9 @@ under the License.
<version>2.25.3</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/src/it/projects/MSITE-497/apps/app/src/test/java/org/apache/maven/AppTest.java
b/src/it/projects/MSITE-497/apps/app/src/test/java/org/apache/maven/AppTest.java
index d3449168..4f9aa8b3 100644
---
a/src/it/projects/MSITE-497/apps/app/src/test/java/org/apache/maven/AppTest.java
+++
b/src/it/projects/MSITE-497/apps/app/src/test/java/org/apache/maven/AppTest.java
@@ -19,39 +19,19 @@ package org.apache.maven;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
+
diff --git
a/src/it/projects/MSITE-512/parent-usage-test/src/test/java/AppTest.java
b/src/it/projects/MSITE-512/parent-usage-test/src/test/java/AppTest.java
index 481d5f59..c382e9a0 100644
--- a/src/it/projects/MSITE-512/parent-usage-test/src/test/java/AppTest.java
+++ b/src/it/projects/MSITE-512/parent-usage-test/src/test/java/AppTest.java
@@ -17,39 +17,19 @@
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
+
diff --git a/src/it/projects/MSITE-665/pom.xml
b/src/it/projects/MSITE-665/pom.xml
index 23fefa54..e5fc8a86 100644
--- a/src/it/projects/MSITE-665/pom.xml
+++ b/src/it/projects/MSITE-665/pom.xml
@@ -58,9 +58,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/it/projects/MSITE-665/src/test/java/my/group/id/AppTest.java
b/src/it/projects/MSITE-665/src/test/java/my/group/id/AppTest.java
index 13ddce96..1ca23660 100644
--- a/src/it/projects/MSITE-665/src/test/java/my/group/id/AppTest.java
+++ b/src/it/projects/MSITE-665/src/test/java/my/group/id/AppTest.java
@@ -19,11 +19,8 @@ package my.group.id;
* under the License.
*/
-import org.junit.*;
-
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.matchers.JUnitMatchers.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
diff --git a/src/it/projects/failure/pom.xml b/src/it/projects/failure/pom.xml
index a75d4cb4..5af914cd 100644
--- a/src/it/projects/failure/pom.xml
+++ b/src/it/projects/failure/pom.xml
@@ -40,9 +40,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/it/projects/full-reporting/pom.xml
b/src/it/projects/full-reporting/pom.xml
index 2b645888..022c8ae4 100644
--- a/src/it/projects/full-reporting/pom.xml
+++ b/src/it/projects/full-reporting/pom.xml
@@ -42,9 +42,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/src/it/projects/full-reporting/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
b/src/it/projects/full-reporting/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
index cddd1aac..9e51650f 100644
---
a/src/it/projects/full-reporting/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
+++
b/src/it/projects/full-reporting/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
@@ -18,40 +18,19 @@
*/
package org.apache.maven.plugins.site.its;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest extends TestCase {
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest(String testName) {
- super(testName);
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite() {
- return new TestSuite(AppTest.class);
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
+ @Test
public void testApp() {
assertTrue(true);
}
-
- /*
- public void testFailed()
- {
- assertTrue( false );
- } */
}
diff --git a/src/it/projects/full-reporting/verify.groovy
b/src/it/projects/full-reporting/verify.groovy
index 023b4c8d..ba6dda49 100644
--- a/src/it/projects/full-reporting/verify.groovy
+++ b/src/it/projects/full-reporting/verify.groovy
@@ -42,7 +42,7 @@ assert new File( sitedir, 'team.html' ).exists();
assert new File( sitedir, 'dependencies.html' ).exists();
content = new File( sitedir, 'dependencies.html' ).text;
-assert content.contains( 'junit:junit:jar:4.13.2' );
+assert content.contains( 'org.junit.jupiter:junit-jupiter-api:jar:' );
// check reports order
String[] reports = [ 'index', // <report>index</report>
diff --git a/src/it/projects/it-plugin-test/pom.xml
b/src/it/projects/it-plugin-test/pom.xml
index d141345e..6745856e 100644
--- a/src/it/projects/it-plugin-test/pom.xml
+++ b/src/it/projects/it-plugin-test/pom.xml
@@ -38,9 +38,9 @@ under the License.
<version>@mavenVersion@</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/it/projects/new-configuration/pom.xml
b/src/it/projects/new-configuration/pom.xml
index 2c49f477..736cf5db 100644
--- a/src/it/projects/new-configuration/pom.xml
+++ b/src/it/projects/new-configuration/pom.xml
@@ -38,9 +38,9 @@ under the License.
<version>@mavenVersion@</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/it/projects/no-version/pom.xml
b/src/it/projects/no-version/pom.xml
index 26f1e209..36904251 100644
--- a/src/it/projects/no-version/pom.xml
+++ b/src/it/projects/no-version/pom.xml
@@ -34,9 +34,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/src/it/projects/no-version/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
b/src/it/projects/no-version/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
index b5d2d84c..322331ec 100644
---
a/src/it/projects/no-version/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
+++
b/src/it/projects/no-version/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
@@ -19,45 +19,18 @@ package org.apache.maven.plugins.site.its;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
-
- /*
- public void testFailed()
- {
- assertTrue( false );
- } */
+
}
diff --git a/src/it/projects/surefire-report/pom.xml
b/src/it/projects/surefire-report/pom.xml
index 9818efc0..e8c26596 100644
--- a/src/it/projects/surefire-report/pom.xml
+++ b/src/it/projects/surefire-report/pom.xml
@@ -33,9 +33,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/src/it/projects/surefire-report/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
b/src/it/projects/surefire-report/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
index b5d2d84c..322331ec 100644
---
a/src/it/projects/surefire-report/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
+++
b/src/it/projects/surefire-report/src/test/java/org/apache/maven/plugins/site/its/AppTest.java
@@ -19,45 +19,18 @@ package org.apache.maven.plugins.site.its;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
-
- /*
- public void testFailed()
- {
- assertTrue( false );
- } */
+
}
diff --git
a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java
b/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java
deleted file mode 100644
index 4d2d3a66..00000000
---
a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.site.deploy;
-
-import java.io.File;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.bridge.MavenRepositorySystem;
-import org.apache.maven.doxia.tools.SiteTool;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.site.stubs.SiteMavenProjectStub;
-import org.apache.maven.settings.Proxy;
-import org.apache.maven.settings.Settings;
-import org.codehaus.plexus.util.ReflectionUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * @author Olivier Lamy
- *
- */
-@RunWith(JUnit4.class)
-public abstract class AbstractSiteDeployWebDavTest extends
AbstractMojoTestCase {
-
- // Can use @TempDir with JUnit 5
- @Rule
- public TemporaryFolder directory = new TemporaryFolder();
-
- private File siteTargetPath;
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- siteTargetPath = new File(directory.newFolder(), "target");
- if (!siteTargetPath.exists()) {
- siteTargetPath.mkdirs();
- }
- }
-
- abstract String getMojoName();
-
- abstract AbstractMojo getMojo(File pomFile) throws Exception;
-
- @Test
- public void noAuthzDavDeploy() throws Exception {
- SimpleDavServerHandler simpleDavServerHandler = new
SimpleDavServerHandler(siteTargetPath);
-
- try {
- File pomFile =
getTestFile("src/test/resources/unit/deploy-dav/pom.xml");
- AbstractMojo mojo = getMojo(pomFile);
- assertNotNull(mojo);
- SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
-
- assertTrue(
- "dav server port not available: " +
simpleDavServerHandler.getPort(),
- simpleDavServerHandler.getPort() > 0);
-
- siteMavenProjectStub
- .getDistributionManagement()
- .getSite()
- .setUrl("dav:http://localhost:" +
simpleDavServerHandler.getPort() + "/site/");
-
- setVariableValueToObject(mojo, "project", siteMavenProjectStub);
- Settings settings = new Settings();
- setVariableValueToObject(mojo, "settings", settings);
- File inputDirectory = new
File("src/test/resources/unit/deploy-dav/target/site");
-
- setVariableValueToObject(mojo, "inputDirectory", inputDirectory);
- mojo.execute();
-
- assertContentInFiles();
-
assertFalse(requestsContainsProxyUse(simpleDavServerHandler.httpRequests));
- } finally {
- simpleDavServerHandler.stop();
- }
- }
-
- @Test
- public void davDeployThruProxyWithoutAuthzInProxy() throws Exception {
- SimpleDavServerHandler simpleDavServerHandler = new
SimpleDavServerHandler(siteTargetPath);
- try {
- File pluginXmlFile =
getTestFile("src/test/resources/unit/deploy-dav/pom.xml");
- AbstractMojo mojo = getMojo(pluginXmlFile);
- assertNotNull(mojo);
- SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
- // olamy, Note : toto is something like foo or bar for french
folks :-)
- String siteUrl = "dav:http://toto.com/site/";
-
siteMavenProjectStub.getDistributionManagement().getSite().setUrl(siteUrl);
-
- setVariableValueToObject(mojo, "project", siteMavenProjectStub);
- Settings settings = new Settings();
- Proxy proxy = new Proxy();
-
- // dummy proxy
- proxy.setActive(true);
- proxy.setHost("localhost");
- proxy.setPort(simpleDavServerHandler.getPort());
- proxy.setProtocol("http");
- proxy.setNonProxyHosts("www.google.com|*.somewhere.com");
- settings.addProxy(proxy);
-
- setVariableValueToObject(mojo, "settings", settings);
-
- MavenExecutionRequest request = new DefaultMavenExecutionRequest();
- request.setProxies(Arrays.asList(proxy));
- MavenSession mavenSession = new MavenSession(getContainer(), null,
request, null);
-
- setVariableValueToObject(mojo, "mavenSession", mavenSession);
-
- File inputDirectory = new
File("src/test/resources/unit/deploy-dav/target/site");
-
- setVariableValueToObject(mojo, "inputDirectory", inputDirectory);
- mojo.execute();
-
- assertContentInFiles();
-
-
assertTrue(requestsContainsProxyUse(simpleDavServerHandler.httpRequests));
- } finally {
- simpleDavServerHandler.stop();
- }
- }
-
- @Test
- public void davDeployThruProxyWitAuthzInProxy() throws Exception {
- Map<String, String> authentications = new HashMap<>();
- authentications.put("foo", "titi");
-
- AuthAsyncProxyServlet servlet = new
AuthAsyncProxyServlet(authentications, siteTargetPath);
-
- SimpleDavServerHandler simpleDavServerHandler = new
SimpleDavServerHandler(servlet);
- try {
- File pluginXmlFile =
getTestFile("src/test/resources/unit/deploy-dav/pom.xml");
- AbstractMojo mojo = getMojo(pluginXmlFile);
- assertNotNull(mojo);
- SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
-
-
siteMavenProjectStub.getDistributionManagement().getSite().setUrl("dav:http://toto.com/site/");
-
- setVariableValueToObject(mojo, "project", siteMavenProjectStub);
- Settings settings = new Settings();
- Proxy proxy = new Proxy();
-
- // dummy proxy
- proxy.setActive(true);
- proxy.setHost("localhost");
- proxy.setPort(simpleDavServerHandler.getPort());
- proxy.setProtocol("dav");
- proxy.setUsername("foo");
- proxy.setPassword("titi");
- proxy.setNonProxyHosts("www.google.com|*.somewhere.com");
- settings.addProxy(proxy);
-
- setVariableValueToObject(mojo, "settings", settings);
-
- MavenExecutionRequest request = new DefaultMavenExecutionRequest();
- request.setProxies(Arrays.asList(proxy));
- MavenSession mavenSession = new MavenSession(getContainer(), null,
request, null);
-
- setVariableValueToObject(mojo, "mavenSession", mavenSession);
-
- File inputDirectory = new
File("src/test/resources/unit/deploy-dav/target/site");
-
- // test which mojo we are using
- if
(ReflectionUtils.getFieldByNameIncludingSuperclasses("inputDirectory",
mojo.getClass()) != null) {
- setVariableValueToObject(mojo, "inputDirectory",
inputDirectory);
- } else {
- setVariableValueToObject(mojo, "stagingDirectory",
inputDirectory);
- setVariableValueToObject(mojo, "reactorProjects",
Collections.emptyList());
- setVariableValueToObject(
- mojo,
- "localRepository",
- MavenRepositorySystem.createArtifactRepository(
- "local", "foo", new DefaultRepositoryLayout(),
null, null));
- setVariableValueToObject(mojo, "siteTool",
getContainer().lookup(SiteTool.class));
- setVariableValueToObject(mojo, "siteDirectory", new
File("foo"));
- setVariableValueToObject(mojo, "remoteProjectRepositories",
Collections.emptyList());
- }
- mojo.execute();
-
- assertContentInFiles();
- assertTrue(requestsContainsProxyUse(servlet.httpRequests));
- assertAtLeastOneRequestContainsHeader(servlet.httpRequests,
"Proxy-Authorization");
- } finally {
- simpleDavServerHandler.stop();
- }
- }
-
- private void assertContentInFiles() throws Exception {
- File htmlFile = new File(siteTargetPath, "site" + File.separator +
"index.html");
- assertTrue(htmlFile.exists());
- String htmlContent = new String(Files.readAllBytes(htmlFile.toPath()),
StandardCharsets.UTF_8);
- assertTrue(htmlContent.contains("Welcome to Apache Maven"));
-
- File cssFile = new File(siteTargetPath, "site" + File.separator +
"css" + File.separator + "maven-base.css");
- assertTrue(cssFile.exists());
- String cssContent = new String(Files.readAllBytes(cssFile.toPath()),
StandardCharsets.UTF_8);
- assertTrue(cssContent.contains("background-image:
url(../images/collapsed.gif);"));
- }
-
- /**
- * @param requests
- * @return true if at least on request use proxy http header
Proxy-Connection : Keep-Alive
- */
- private boolean requestsContainsProxyUse(List<HttpRequest> requests) {
- return assertAtLeastOneRequestContainsHeader(requests,
"Proxy-Connection");
- }
-
- private boolean assertAtLeastOneRequestContainsHeader(List<HttpRequest>
requests, String headerName) {
- for (HttpRequest rq : requests) {
- boolean containsProxyHeader = rq.headers.containsKey(headerName);
- if (containsProxyHeader) {
- return true;
- }
- }
- return false;
- }
-}
diff --git
a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployMojoTest.java
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployMojoTest.java
deleted file mode 100644
index 5569df36..00000000
--- a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployMojoTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.site.deploy;
-
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.wagon.Wagon;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * @author <a href="mailto:[email protected]">Cyrille Le Clerc</a>
- */
-@RunWith(JUnit4.class)
-public class SiteDeployMojoTest extends AbstractMojoTestCase {
- private Wagon wagon;
-
- // private Repository repository;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- // wagon = getContainer().lookup( Wagon.class, "scp" );
- // repository = new Repository( "my-repository",
"scp://repository-host/var/maven2" );
- }
-
- @Test
- public void testFoo() {
- // should not fail ;-)
- assertTrue(true);
- }
-
- /**
- * FIXME find a way to restore those tests as wagonManager.addProxy is not
anymore available in maven 3.
- * public void testGetProxyInfoNoProxyForRepositoryProtocol()
- * {
- * wagonManager.addProxy( "http", "proxy-host", 8080, "my-user",
"my-password", null );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNull( "ProxyInfo must be null because http != scp", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostExactlyMatchesNonProxyHosts()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password",
- * "a-host,repository-host;another-host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNull( "ProxyInfo must be null because 'repository-host' in
nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts1()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "a-host|repository*|another-host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNull( "ProxyInfo must be null because 'repository-host' in
nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts2()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "*host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNull( "ProxyInfo must be null because 'repository-host' in
nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardMatchNonProxyHosts3()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "repository*host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNull( "ProxyInfo must be null because 'repository-host' in
nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts1()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "mycompany*" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts2()
- * {
- * wagonManager.
- *
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "*mycompany" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts3()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "repository*mycompany" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts4()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "mycompany*host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- *
- * public void
testGetProxyInfoForRepositoryHostWildcardNoMatchNonProxyHosts5()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "mycompany*mycompany" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- *
- * public void testGetProxyInfoFound()
- * {
- * wagonManager.addProxy( "scp", "localhost", 8080, "my-user",
"my-password", "an-host|another-host" );
- * ProxyInfo proxyInfo = SiteDeployMojo.getProxyInfo( repository,
wagonManager );
- * assertNotNull( "ProxyInfo must be found because 'repository-host' not
in nonProxyHosts list", proxyInfo );
- * }
- **/
-}
diff --git
a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavTest.java
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavTest.java
deleted file mode 100644
index 5ccaec5e..00000000
---
a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.site.deploy;
-
-import java.io.File;
-
-import org.apache.maven.plugin.AbstractMojo;
-
-/**
- * @author Olivier Lamy
- * @since 3.0-beta-2
- *
- */
-public class SiteDeployWebDavTest extends AbstractSiteDeployWebDavTest {
-
- @Override
- String getMojoName() {
- return "deploy";
- }
-
- @Override
- AbstractMojo getMojo(File pomXmlFile) throws Exception {
- return (SiteDeployMojo) lookupMojo(getMojoName(), pomXmlFile);
- }
-}
diff --git
a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavThruProxyWitAuthzInProxyTest.java
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavThruProxyWitAuthzInProxyTest.java
new file mode 100644
index 00000000..06a0350c
--- /dev/null
+++
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavThruProxyWitAuthzInProxyTest.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.site.deploy;
+
+import javax.inject.Inject;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.api.di.Provides;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugins.site.stubs.SiteMavenProjectStub;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Settings;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.when;
+
+@MojoTest
+class SiteDeployWebDavThruProxyWitAuthzInProxyTest {
+ @TempDir
+ private static File directory;
+
+ @Inject
+ private MavenProject project;
+
+ @Inject
+ private Settings settings;
+
+ @Inject
+ private MavenSession mavenSession;
+
+ private static SimpleDavServerHandler simpleDavServerHandler;
+ private static File siteTargetPath;
+ private static AuthAsyncProxyServlet servlet;
+
+ @BeforeAll
+ public static void setup() throws Exception {
+ siteTargetPath = new File(newFolder(directory, "junit"), "target");
+ if (!siteTargetPath.exists()) {
+ siteTargetPath.mkdirs();
+ }
+
+ Map<String, String> authentications = new HashMap<>();
+ authentications.put("foo", "titi");
+
+ servlet = new AuthAsyncProxyServlet(authentications, siteTargetPath);
+ simpleDavServerHandler = new SimpleDavServerHandler(servlet);
+ }
+
+ @AfterAll
+ public static void cleanup() throws Exception {
+ simpleDavServerHandler.stop();
+ }
+
+ @InjectMojo(goal = "deploy", pom =
"src/test/resources/unit/deploy-dav/pom.xml")
+ @MojoParameter(name = "inputDirectory", value = "target/site")
+ @Test
+ public void davDeployThruProxyWitAuthzInProxy(SiteDeployMojo mojo) throws
Exception {
+ when(mavenSession.getRequest()).thenReturn(request());
+
+ mojo.execute();
+
+ assertContentInFiles();
+ assertTrue(requestsContainsProxyUse(servlet.httpRequests));
+ assertAtLeastOneRequestContainsHeader(servlet.httpRequests,
"Proxy-Authorization");
+ }
+
+ @Provides
+ private MavenProject project() {
+ SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
+ // olamy, Note : toto is something like foo or bar for french folks :-)
+ String siteUrl = "dav:http://toto.com/site/";
+
siteMavenProjectStub.getDistributionManagement().getSite().setUrl(siteUrl);
+
+ return siteMavenProjectStub;
+ }
+
+ @Provides
+ private Settings settings() {
+ Settings settings = new Settings();
+
+ settings.addProxy(proxy());
+ return settings;
+ }
+
+ private MavenExecutionRequest request() {
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest();
+ request.setProxies(Arrays.asList(proxy()));
+ return request;
+ }
+
+ private Proxy proxy() {
+ Proxy proxy = new Proxy();
+
+ // dummy proxy
+ proxy.setActive(true);
+ proxy.setHost("localhost");
+ proxy.setPort(simpleDavServerHandler.getPort());
+ proxy.setProtocol("dav");
+ proxy.setUsername("foo");
+ proxy.setPassword("titi");
+ proxy.setNonProxyHosts("www.google.com|*.somewhere.com");
+ return proxy;
+ }
+
+ private static File newFolder(File root, String... subDirs) throws
IOException {
+ String subFolder = String.join("/", subDirs);
+ File result = new File(root, subFolder);
+ if (!result.mkdirs()) {
+ throw new IOException("Couldn't create folders " + root);
+ }
+ return result;
+ }
+
+ private void assertContentInFiles() throws Exception {
+ File htmlFile = new File(siteTargetPath, "site" + File.separator +
"index.html");
+ assertTrue(htmlFile.exists());
+ String htmlContent = new String(Files.readAllBytes(htmlFile.toPath()),
StandardCharsets.UTF_8);
+ assertTrue(htmlContent.contains("Welcome to Apache Maven"));
+
+ File cssFile = new File(siteTargetPath, "site" + File.separator +
"css" + File.separator + "maven-base.css");
+ assertTrue(cssFile.exists());
+ String cssContent = new String(Files.readAllBytes(cssFile.toPath()),
StandardCharsets.UTF_8);
+ assertTrue(cssContent.contains("background-image:
url(../images/collapsed.gif);"));
+ }
+
+ /**
+ * @param requests
+ * @return true if at least on request use proxy http header
Proxy-Connection : Keep-Alive
+ */
+ private boolean requestsContainsProxyUse(List<HttpRequest> requests) {
+ return assertAtLeastOneRequestContainsHeader(requests,
"Proxy-Connection");
+ }
+
+ private boolean assertAtLeastOneRequestContainsHeader(List<HttpRequest>
requests, String headerName) {
+ for (HttpRequest rq : requests) {
+ boolean containsProxyHeader = rq.headers.containsKey(headerName);
+ if (containsProxyHeader) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git
a/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavWithoutAuthTest.java
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavWithoutAuthTest.java
new file mode 100644
index 00000000..e72691bb
--- /dev/null
+++
b/src/test/java/org/apache/maven/plugins/site/deploy/SiteDeployWebDavWithoutAuthTest.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.site.deploy;
+
+import javax.inject.Inject;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.api.di.Provides;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugins.site.stubs.SiteMavenProjectStub;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Settings;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.when;
+
+public class SiteDeployWebDavWithoutAuthTest {
+ @TempDir
+ private static File directory;
+
+ private static File siteTargetPath;
+ private static SimpleDavServerHandler simpleDavServerHandler;
+
+ private static File newFolder(File root, String... subDirs) throws
IOException {
+ String subFolder = String.join("/", subDirs);
+ File result = new File(root, subFolder);
+ if (!result.mkdirs()) {
+ throw new IOException("Couldn't create folders " + root);
+ }
+ return result;
+ }
+
+ @BeforeAll
+ public static void prepare() throws Exception {
+ siteTargetPath = new File(newFolder(directory, "junit"), "target");
+ if (!siteTargetPath.exists()) {
+ siteTargetPath.mkdirs();
+ }
+ simpleDavServerHandler = new SimpleDavServerHandler(siteTargetPath);
+ }
+
+ @AfterEach
+ public void cleanup() throws Exception {
+ simpleDavServerHandler.httpRequests.clear();
+ FileUtils.cleanDirectory(siteTargetPath);
+ }
+
+ @AfterAll
+ public static void tearDown() throws Exception {
+ simpleDavServerHandler.stop();
+ }
+
+ @Nested
+ @MojoTest
+ class NoAutzDavDeploy {
+
+ @Inject
+ private Settings settings;
+
+ @Inject
+ private MavenProject project;
+
+ @InjectMojo(goal = "deploy", pom =
"src/test/resources/unit/deploy-dav/pom.xml")
+ @MojoParameter(name = "inputDirectory", value = "target/site")
+ @Test
+ public void noAuthzDavDeploy(SiteDeployMojo mojo) throws Exception {
+ assertTrue(
+ simpleDavServerHandler.getPort() > 0,
+ "dav server port not available: " +
simpleDavServerHandler.getPort());
+
+ mojo.execute();
+ assertContentInFiles();
+
assertFalse(assertAtLeastOneRequestContainsHeader(simpleDavServerHandler.httpRequests,
"Proxy-Connection"));
+ }
+
+ @Provides
+ private Settings settings() {
+ return new Settings();
+ }
+
+ @Provides
+ private MavenProject project() {
+ SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
+ siteMavenProjectStub
+ .getDistributionManagement()
+ .getSite()
+ .setUrl("dav:http://localhost:" +
simpleDavServerHandler.getPort() + "/site/");
+ return siteMavenProjectStub;
+ }
+ }
+
+ @Nested
+ @MojoTest
+ class DavDeployThruProxyWithoutAuthzInProxy {
+
+ @Inject
+ private MavenProject project;
+
+ @Inject
+ private Settings settings;
+
+ @Inject
+ private MavenSession mavenSession;
+
+ @InjectMojo(goal = "deploy", pom =
"src/test/resources/unit/deploy-dav/pom.xml")
+ @MojoParameter(name = "inputDirectory", value = "target/site")
+ @Test
+ public void davDeployThruProxyWithoutAuthzInProxy(SiteDeployMojo mojo)
throws Exception {
+ when(mavenSession.getRequest()).thenReturn(request());
+
+ mojo.execute();
+
+ assertContentInFiles();
+
+
assertTrue(assertAtLeastOneRequestContainsHeader(simpleDavServerHandler.httpRequests,
"Proxy-Connection"));
+ }
+
+ @Provides
+ private MavenProject project() {
+ SiteMavenProjectStub siteMavenProjectStub = new
SiteMavenProjectStub("deploy-dav");
+ // olamy, Note : toto is something like foo or bar for french
folks :-)
+ String siteUrl = "dav:http://toto.com/site/";
+
siteMavenProjectStub.getDistributionManagement().getSite().setUrl(siteUrl);
+
+ return siteMavenProjectStub;
+ }
+
+ @Provides
+ private Settings settings() {
+ Settings settings = new Settings();
+
+ settings.addProxy(proxy());
+ return settings;
+ }
+
+ private MavenExecutionRequest request() {
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest();
+ request.setProxies(Arrays.asList(proxy()));
+ return request;
+ }
+
+ private Proxy proxy() {
+ Proxy proxy = new Proxy();
+
+ // dummy proxy
+ proxy.setActive(true);
+ proxy.setHost("localhost");
+ proxy.setPort(simpleDavServerHandler.getPort());
+ proxy.setProtocol("http");
+ proxy.setNonProxyHosts("www.google.com|*.somewhere.com");
+ return proxy;
+ }
+ }
+
+ private void assertContentInFiles() throws Exception {
+ File htmlFile = new File(siteTargetPath, "site" + File.separator +
"index.html");
+ assertTrue(htmlFile.exists());
+ String htmlContent = new String(Files.readAllBytes(htmlFile.toPath()),
StandardCharsets.UTF_8);
+ assertTrue(htmlContent.contains("Welcome to Apache Maven"));
+
+ File cssFile = new File(siteTargetPath, "site" + File.separator +
"css" + File.separator + "maven-base.css");
+ assertTrue(cssFile.exists());
+ String cssContent = new String(Files.readAllBytes(cssFile.toPath()),
StandardCharsets.UTF_8);
+ assertTrue(cssContent.contains("background-image:
url(../images/collapsed.gif);"));
+ }
+
+ private boolean assertAtLeastOneRequestContainsHeader(List<HttpRequest>
requests, String headerName) {
+ for (HttpRequest rq : requests) {
+ boolean containsProxyHeader = rq.headers.containsKey(headerName);
+ if (containsProxyHeader) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/test/java/org/apache/maven/plugins/site/run/WebXmlTest.java
b/src/test/java/org/apache/maven/plugins/site/run/WebXmlTest.java
index 342c2838..fbbe3553 100644
--- a/src/test/java/org/apache/maven/plugins/site/run/WebXmlTest.java
+++ b/src/test/java/org/apache/maven/plugins/site/run/WebXmlTest.java
@@ -24,13 +24,13 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class WebXmlTest {
@@ -43,7 +43,7 @@ public class WebXmlTest {
NodeList filterClasses =
(NodeList)
xPath.compile("/web-app/filter/filter-class").evaluate(doc,
XPathConstants.NODESET);
- assertTrue("Expected at least one filter", filterClasses.getLength() >
0);
+ assertTrue(filterClasses.getLength() > 0, "Expected at least one
filter");
for (int index = 0; index < filterClasses.getLength(); index++) {
Node filterClass = filterClasses.item(index).getFirstChild();
try {
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework11/framework111/framework1111/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework11/framework111/framework1111/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework11/framework111/framework1111/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework11/framework111/framework1111/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework11/framework112/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework11/framework112/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework11/framework112/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework11/framework112/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework12/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework12/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework12/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework12/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework13/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework13/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework13/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework13/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14111/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14111/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14111/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14111/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14112/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14112/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14112/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1411/framework14112/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1412/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1412/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1412/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework1/framework14/framework141/framework1412/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework21/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework21/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework21/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework21/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2211/framework22111/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2211/framework22111/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2211/framework22111/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2211/framework22111/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2212/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2212/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2212/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework221/framework2212/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2221/framework22211/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2221/framework22211/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2221/framework22211/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2221/framework22211/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2222/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2222/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2222/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework22/framework222/framework2222/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-multiproject/framework2/framework23/src/test/java/org/apache/maven/plugin/site/AppTest.java
b/src/test/projects/site-plugin-multiproject/framework2/framework23/src/test/java/org/apache/maven/plugin/site/AppTest.java
index 81f7551c..2c5baa9e 100644
---
a/src/test/projects/site-plugin-multiproject/framework2/framework23/src/test/java/org/apache/maven/plugin/site/AppTest.java
+++
b/src/test/projects/site-plugin-multiproject/framework2/framework23/src/test/java/org/apache/maven/plugin/site/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git a/src/test/projects/site-plugin-multiproject/pom.xml
b/src/test/projects/site-plugin-multiproject/pom.xml
index 9a86b893..3789b9d0 100644
--- a/src/test/projects/site-plugin-multiproject/pom.xml
+++ b/src/test/projects/site-plugin-multiproject/pom.xml
@@ -33,9 +33,9 @@ under the License.
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>@versions.junit5@</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/src/test/projects/site-plugin-test1/src/test/java/org/apache/maven/plugin/site/test1/AppTest.java
b/src/test/projects/site-plugin-test1/src/test/java/org/apache/maven/plugin/site/test1/AppTest.java
index 7d07a2c0..b8147bcc 100644
---
a/src/test/projects/site-plugin-test1/src/test/java/org/apache/maven/plugin/site/test1/AppTest.java
+++
b/src/test/projects/site-plugin-test1/src/test/java/org/apache/maven/plugin/site/test1/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test1;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test11/framework/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
b/src/test/projects/site-plugin-test11/framework/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
index 20f25a77..2b498e1d 100644
---
a/src/test/projects/site-plugin-test11/framework/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
+++
b/src/test/projects/site-plugin-test11/framework/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test11;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test11/framework2/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
b/src/test/projects/site-plugin-test11/framework2/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
index 20f25a77..2b498e1d 100644
---
a/src/test/projects/site-plugin-test11/framework2/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
+++
b/src/test/projects/site-plugin-test11/framework2/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test11;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test11/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
b/src/test/projects/site-plugin-test11/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
index 20f25a77..2b498e1d 100644
---
a/src/test/projects/site-plugin-test11/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
+++
b/src/test/projects/site-plugin-test11/src/test/java/org/apache/maven/plugin/site/test11/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test11;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test2/src/test/java/org/apache/maven/plugin/site/test2/AppTest.java
b/src/test/projects/site-plugin-test2/src/test/java/org/apache/maven/plugin/site/test2/AppTest.java
index dc97f13e..b7e84a04 100644
---
a/src/test/projects/site-plugin-test2/src/test/java/org/apache/maven/plugin/site/test2/AppTest.java
+++
b/src/test/projects/site-plugin-test2/src/test/java/org/apache/maven/plugin/site/test2/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test2;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test3/src/test/java/org/apache/maven/plugin/site/test3/AppTest.java
b/src/test/projects/site-plugin-test3/src/test/java/org/apache/maven/plugin/site/test3/AppTest.java
index 24b0c83b..af28d5ae 100644
---
a/src/test/projects/site-plugin-test3/src/test/java/org/apache/maven/plugin/site/test3/AppTest.java
+++
b/src/test/projects/site-plugin-test3/src/test/java/org/apache/maven/plugin/site/test3/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test3;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test4/src/test/java/org/apache/maven/plugin/site/test4/AppTest.java
b/src/test/projects/site-plugin-test4/src/test/java/org/apache/maven/plugin/site/test4/AppTest.java
index cb5a9069..e7b6bbdf 100644
---
a/src/test/projects/site-plugin-test4/src/test/java/org/apache/maven/plugin/site/test4/AppTest.java
+++
b/src/test/projects/site-plugin-test4/src/test/java/org/apache/maven/plugin/site/test4/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test4;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test5/src/test/java/org/apache/maven/plugin/site/test5/AppTest.java
b/src/test/projects/site-plugin-test5/src/test/java/org/apache/maven/plugin/site/test5/AppTest.java
index cc158bbb..f2bf533c 100644
---
a/src/test/projects/site-plugin-test5/src/test/java/org/apache/maven/plugin/site/test5/AppTest.java
+++
b/src/test/projects/site-plugin-test5/src/test/java/org/apache/maven/plugin/site/test5/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test5;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test6/src/test/java/org/apache/maven/plugin/site/test6/AppTest.java
b/src/test/projects/site-plugin-test6/src/test/java/org/apache/maven/plugin/site/test6/AppTest.java
index cde7569f..adc01786 100644
---
a/src/test/projects/site-plugin-test6/src/test/java/org/apache/maven/plugin/site/test6/AppTest.java
+++
b/src/test/projects/site-plugin-test6/src/test/java/org/apache/maven/plugin/site/test6/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test6;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test7/src/test/java/org/apache/maven/plugin/site/test7/AppTest.java
b/src/test/projects/site-plugin-test7/src/test/java/org/apache/maven/plugin/site/test7/AppTest.java
index 6de6b62c..4d5b2566 100644
---
a/src/test/projects/site-plugin-test7/src/test/java/org/apache/maven/plugin/site/test7/AppTest.java
+++
b/src/test/projects/site-plugin-test7/src/test/java/org/apache/maven/plugin/site/test7/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test7;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test8/framework/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
b/src/test/projects/site-plugin-test8/framework/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
index 1cf058a4..df654dfd 100644
---
a/src/test/projects/site-plugin-test8/framework/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
+++
b/src/test/projects/site-plugin-test8/framework/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test8;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test8/framework2/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
b/src/test/projects/site-plugin-test8/framework2/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
index 1cf058a4..df654dfd 100644
---
a/src/test/projects/site-plugin-test8/framework2/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
+++
b/src/test/projects/site-plugin-test8/framework2/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test8;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}
diff --git
a/src/test/projects/site-plugin-test8/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
b/src/test/projects/site-plugin-test8/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
index 1cf058a4..df654dfd 100644
---
a/src/test/projects/site-plugin-test8/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
+++
b/src/test/projects/site-plugin-test8/src/test/java/org/apache/maven/plugin/site/test8/AppTest.java
@@ -19,39 +19,18 @@ package org.apache.maven.plugin.site.test8;
* under the License.
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
+public class AppTest {
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ @Test
+ public void testApp() {
+ assertTrue(true);
}
+
}